Pointwise operations of finsets #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
This file defines pointwise algebraic operations on finsets.
Main declarations #
For finsets s
and t
:
0
(finset.has_zero
): The singleton{0}
.1
(finset.has_one
): The singleton{1}
.-s
(finset.has_neg
): Negation, finset of all-x
wherex ∈ s
.s⁻¹
(finset.has_inv
): Inversion, finset of allx⁻¹
wherex ∈ s
.s + t
(finset.has_add
): Addition, finset of allx + y
wherex ∈ s
andy ∈ t
.s * t
(finset.has_mul
): Multiplication, finset of allx * y
wherex ∈ s
andy ∈ t
.s - t
(finset.has_sub
): Subtraction, finset of allx - y
wherex ∈ s
andy ∈ t
.s / t
(finset.has_div
): Division, finset of allx / y
wherex ∈ s
andy ∈ t
.s +ᵥ t
(finset.has_vadd
): Scalar addition, finset of allx +ᵥ y
wherex ∈ s
andy ∈ t
.s • t
(finset.has_smul
): Scalar multiplication, finset of allx • y
wherex ∈ s
andy ∈ t
.s -ᵥ t
(finset.has_vsub
): Scalar subtraction, finset of allx -ᵥ y
wherex ∈ s
andy ∈ t
.a • s
(finset.has_smul_finset
): Scaling, finset of alla • x
wherex ∈ s
.a +ᵥ s
(finset.has_vadd_finset
): Translation, finset of alla +ᵥ x
wherex ∈ s
.
For α
a semigroup/monoid, finset α
is a semigroup/monoid.
As an unfortunate side effect, this means that n • s
, where n : ℕ
, is ambiguous between
pointwise scaling and repeated pointwise addition; the former has (2 : ℕ) • {1, 2} = {2, 4}
, while
the latter has (2 : ℕ) • {1, 2} = {2, 3, 4}
. See note [pointwise nat action].
Implementation notes #
We put all instances in the locale pointwise
, so that these instances are not available by
default. Note that we do not mark them as reducible (as argued by note [reducible non-instances])
since we expect the locale to be open whenever the instances are actually used (and making the
instances reducible changes the behavior of simp
.
Tags #
finset multiplication, finset addition, pointwise addition, pointwise multiplication, pointwise subtraction
0
/1
as finsets #
The singleton operation as a zero_hom
.
Equations
The singleton operation as a one_hom
.
Equations
Lift a zero_hom
to finset
via image
Equations
- finset.image_zero_hom f = {to_fun := finset.image ⇑f, map_zero' := _}
Lift a one_hom
to finset
via image
.
Equations
- finset.image_one_hom f = {to_fun := finset.image ⇑f, map_one' := _}
Finset negation/inversion #
The pointwise inversion of finset s⁻¹
is defined as {x⁻¹ | x ∈ s}
in locale pointwise
.
Equations
The pointwise negation of finset -s
is defined as {-x | x ∈ s}
in locale
pointwise
.
Equations
Alias of the forward direction of finset.inv_nonempty_iff
.
Alias of the reverse direction of finset.inv_nonempty_iff
.
Alias of the reverse direction of finset.inv_nonempty_iff
.
Alias of the forward direction of finset.inv_nonempty_iff
.
Finset addition/multiplication #
The pointwise addition of finsets s + t
is defined as {x + y | x ∈ s, y ∈ t}
in
locale pointwise
.
Equations
The pointwise multiplication of finsets s * t
and t
is defined as {x * y | x ∈ s, y ∈ t}
in locale pointwise
.
Equations
If a finset u
is contained in the product of two sets s * t
, we can find two finsets s'
,
t'
such that s' ⊆ s
, t' ⊆ t
and u ⊆ s' * t'
.
If a finset u
is contained in the sum of two sets s + t
, we can find two finsets
s'
, t'
such that s' ⊆ s
, t' ⊆ t
and u ⊆ s' + t'
.
The singleton operation as an add_hom
.
Equations
The singleton operation as a mul_hom
.
Equations
Lift an add_hom
to finset
via image
Equations
- finset.image_add_hom f = {to_fun := finset.image ⇑f, map_add' := _}
Lift a mul_hom
to finset
via image
.
Equations
- finset.image_mul_hom f = {to_fun := finset.image ⇑f, map_mul' := _}
Finset subtraction/division #
The pointwise subtraction of finsets s - t
is defined as {x - y | x ∈ s, y ∈ t}
in locale pointwise
.
Equations
The pointwise division of sfinets s / t
is defined as {x / y | x ∈ s, y ∈ t}
in locale
pointwise
.
Equations
If a finset u
is contained in the sum of two sets s - t
, we can find two finsets
s'
, t'
such that s' ⊆ s
, t' ⊆ t
and u ⊆ s' - t'
.
If a finset u
is contained in the product of two sets s / t
, we can find two finsets s'
,
t'
such that s' ⊆ s
, t' ⊆ t
and u ⊆ s' / t'
.
Instances #
Repeated pointwise addition (not the same as pointwise repeated addition!) of a finset
. See
note [pointwise nat action].
Equations
Repeated pointwise multiplication (not the same as pointwise repeated multiplication!) of a
finset
. See note [pointwise nat action].
Repeated pointwise addition/subtraction (not the same as pointwise repeated
addition/subtraction!) of a finset
. See note [pointwise nat action].
Equations
Repeated pointwise multiplication/division (not the same as pointwise repeated
multiplication/division!) of a finset
. See note [pointwise nat action].
finset α
is a semigroup
under pointwise operations if α
is.
Equations
- finset.semigroup = function.injective.semigroup coe finset.coe_injective finset.semigroup._proof_1
finset α
is an add_semigroup
under pointwise operations if α
is.
Equations
- finset.add_semigroup = function.injective.add_semigroup coe finset.coe_injective finset.add_semigroup._proof_1
finset α
is an add_comm_semigroup
under pointwise operations if α
is.
Equations
- finset.add_comm_semigroup = function.injective.add_comm_semigroup coe finset.coe_injective finset.add_comm_semigroup._proof_1
finset α
is a comm_semigroup
under pointwise operations if α
is.
Equations
- finset.comm_semigroup = function.injective.comm_semigroup coe finset.coe_injective finset.comm_semigroup._proof_1
finset α
is an add_zero_class
under pointwise operations if α
is.
Equations
- finset.add_zero_class = function.injective.add_zero_class coe finset.coe_injective finset.add_zero_class._proof_1 finset.add_zero_class._proof_2
finset α
is a mul_one_class
under pointwise operations if α
is.
Equations
- finset.mul_one_class = function.injective.mul_one_class coe finset.coe_injective finset.mul_one_class._proof_1 finset.mul_one_class._proof_2
The singleton operation as an add_monoid_hom
.
Equations
- finset.singleton_add_monoid_hom = {to_fun := finset.singleton_add_hom.to_fun, map_zero' := _, map_add' := _}
The singleton operation as a monoid_hom
.
Equations
- finset.singleton_monoid_hom = {to_fun := finset.singleton_mul_hom.to_fun, map_one' := _, map_mul' := _}
The coercion from finset
to set
as a monoid_hom
.
Equations
- finset.coe_monoid_hom = {to_fun := coe coe_to_lift, map_one' := _, map_mul' := _}
The coercion from finset
to set
as an add_monoid_hom
.
Equations
- finset.coe_add_monoid_hom = {to_fun := coe coe_to_lift, map_zero' := _, map_add' := _}
Lift an add_monoid_hom
to finset
via image
Equations
- finset.image_add_monoid_hom f = {to_fun := (finset.image_add_hom f).to_fun, map_zero' := _, map_add' := _}
Lift a monoid_hom
to finset
via image
.
Equations
- finset.image_monoid_hom f = {to_fun := (finset.image_mul_hom f).to_fun, map_one' := _, map_mul' := _}
finset α
is a monoid
under pointwise operations if α
is.
Equations
- finset.monoid = function.injective.monoid coe finset.coe_injective finset.monoid._proof_1 finset.monoid._proof_2 finset.monoid._proof_3
finset α
is an add_monoid
under pointwise operations if α
is.
Equations
- finset.add_monoid = function.injective.add_monoid coe finset.coe_injective finset.add_monoid._proof_1 finset.add_monoid._proof_2 finset.add_monoid._proof_3
finset α
is a comm_monoid
under pointwise operations if α
is.
Equations
- finset.comm_monoid = function.injective.comm_monoid coe finset.coe_injective finset.comm_monoid._proof_1 finset.comm_monoid._proof_2 finset.comm_monoid._proof_3
finset α
is an add_comm_monoid
under pointwise operations if α
is.
Equations
- finset.add_comm_monoid = function.injective.add_comm_monoid coe finset.coe_injective finset.add_comm_monoid._proof_1 finset.add_comm_monoid._proof_2 finset.add_comm_monoid._proof_3
finset α
is a division monoid under pointwise operations if α
is.
Equations
- finset.division_monoid = function.injective.division_monoid coe finset.coe_injective finset.division_monoid._proof_1 finset.division_monoid._proof_2 finset.division_monoid._proof_3 finset.division_monoid._proof_4 finset.division_monoid._proof_5 finset.division_monoid._proof_6
finset α
is a subtraction monoid under pointwise operations if
α
is.
Equations
- finset.subtraction_monoid = function.injective.subtraction_monoid coe finset.coe_injective finset.subtraction_monoid._proof_1 finset.subtraction_monoid._proof_2 finset.subtraction_monoid._proof_3 finset.subtraction_monoid._proof_4 finset.subtraction_monoid._proof_5 finset.subtraction_monoid._proof_6
finset α
is a commutative subtraction monoid under
pointwise operations if α
is.
Equations
- finset.subtraction_comm_monoid = function.injective.subtraction_comm_monoid coe finset.coe_injective finset.subtraction_comm_monoid._proof_1 finset.subtraction_comm_monoid._proof_2 finset.subtraction_comm_monoid._proof_3 finset.subtraction_comm_monoid._proof_4 finset.subtraction_comm_monoid._proof_5 finset.subtraction_comm_monoid._proof_6
finset α
is a commutative division monoid under pointwise operations if α
is.
Equations
- finset.division_comm_monoid = function.injective.division_comm_monoid coe finset.coe_injective finset.division_comm_monoid._proof_1 finset.division_comm_monoid._proof_2 finset.division_comm_monoid._proof_3 finset.division_comm_monoid._proof_4 finset.division_comm_monoid._proof_5 finset.division_comm_monoid._proof_6
finset α
has distributive negation if α
has.
Equations
- finset.has_distrib_neg = function.injective.has_distrib_neg coe finset.coe_injective finset.has_distrib_neg._proof_1 finset.has_distrib_neg._proof_2
Note that finset
is not a mul_zero_class
because 0 * ∅ ≠ 0
.
Scalar addition/multiplication of finsets #
The pointwise product of two finsets s
and t
: s • t = {x • y | x ∈ s, y ∈ t}
.
Equations
The pointwise sum of two finsets s
and
t
: s +ᵥ t = {x +ᵥ y | x ∈ s, y ∈ t}
.
Equations
If a finset u
is contained in the scalar sum of two sets s +ᵥ t
, we can find two
finsets s'
, t'
such that s' ⊆ s
, t' ⊆ t
and u ⊆ s' +ᵥ t'
.
If a finset u
is contained in the scalar product of two sets s • t
, we can find two finsets
s'
, t'
such that s' ⊆ s
, t' ⊆ t
and u ⊆ s' • t'
.
Scalar subtraction of finsets #
The pointwise product of two finsets s
and t
: s -ᵥ t = {x -ᵥ y | x ∈ s, y ∈ t}
.
Equations
If a finset u
is contained in the pointwise subtraction of two sets s -ᵥ t
, we can find two
finsets s'
, t'
such that s' ⊆ s
, t' ⊆ t
and u ⊆ s' -ᵥ t'
.
Translation/scaling of finsets #
The translation of a finset s
by a vector a
:
a +ᵥ s = {a +ᵥ x | x ∈ s}
.
Equations
- finset.has_vadd_finset = {vadd := λ (a : α), finset.image (has_vadd.vadd a)}
The scaling of a finset s
by a scalar a
: a • s = {a • x | x ∈ s}
.
Equations
- finset.has_smul_finset = {smul := λ (a : α), finset.image (has_smul.smul a)}
A multiplicative action of a monoid α
on a type β
gives a multiplicative action of
finset α
on finset β
.
Equations
- finset.mul_action = {to_has_smul := finset.has_smul mul_action.to_has_smul, one_smul := _, mul_smul := _}
An additive action of an additive monoid α
on a type β
gives an additive action
of finset α
on finset β
Equations
- finset.add_action = {to_has_vadd := finset.has_vadd add_action.to_has_vadd, zero_vadd := _, add_vadd := _}
An additive action of an additive monoid on a type β
gives an additive action
on finset β
.
Equations
- finset.add_action_finset = function.injective.add_action coe finset.coe_injective finset.add_action_finset._proof_1
A multiplicative action of a monoid on a type β
gives a multiplicative action on finset β
.
Equations
- finset.mul_action_finset = function.injective.mul_action coe finset.coe_injective finset.mul_action_finset._proof_1
A distributive multiplicative action of a monoid on an additive monoid β
gives a distributive
multiplicative action on finset β
.
Equations
- finset.distrib_mul_action_finset = function.injective.distrib_mul_action {to_fun := coe coe_to_lift, map_zero' := _, map_add' := _} finset.coe_injective finset.distrib_mul_action_finset._proof_3
A multiplicative action of a monoid on a monoid β
gives a multiplicative action on set β
.
Equations
- finset.mul_distrib_mul_action_finset = function.injective.mul_distrib_mul_action {to_fun := coe coe_to_lift, map_one' := _, map_mul' := _} finset.coe_injective finset.mul_distrib_mul_action_finset._proof_3
If the left cosets of t
by elements of s
are disjoint (but not necessarily
distinct!), then the size of t
divides the size of s + t
.
If the left cosets of t
by elements of s
are disjoint (but not necessarily distinct!), then
the size of t
divides the size of s * t
.
If the right cosets of s
by elements of t
are disjoint (but not necessarily distinct!), then
the size of s
divides the size of s * t
.
If the right cosets of s
by elements of t
are disjoint (but not necessarily
distinct!), then the size of s
divides the size of s + t
.
Note that we have neither smul_with_zero α (finset β)
nor smul_with_zero (finset α) (finset β)
because 0 * ∅ ≠ 0
.
A nonempty set is scaled by zero to the singleton set containing 0.