Pointwise operations of sets #
This file defines pointwise algebraic operations on sets.
Main declarations #
For sets s and t and scalar a:
s * t: Multiplication, set of allx * ywherex ∈ sandy ∈ t.s + t: Addition, set of allx + ywherex ∈ sandy ∈ t.s⁻¹: Inversion, set of allx⁻¹wherex ∈ s.-s: Negation, set of all-xwherex ∈ s.s / t: Division, set of allx / ywherex ∈ sandy ∈ t.s - t: Subtraction, set of allx - ywherex ∈ sandy ∈ t.s • t: Scalar multiplication, set of allx • ywherex ∈ sandy ∈ t.s +ᵥ t: Scalar addition, set of allx +ᵥ ywherex ∈ sandy ∈ t.s -ᵥ t: Scalar subtraction, set of allx -ᵥ ywherex ∈ sandy ∈ t.a • s: Scaling, set of alla • xwherex ∈ s.a +ᵥ s: Translation, set of alla +ᵥ xwherex ∈ s.
For α a semigroup/monoid, set α 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].
Appropriate definitions and results are also transported to the additive theory via to_additive.
Definitions for Hahn series #
set.add_antidiagonal s t a,set.mul_antidiagonal s t a: Sets of pairs of elements ofsandtthat add/multiply toa.finset.add_antidiagonal,finset.mul_antidiagonal: Finset versions of the above whensandtare well-founded.
Implementation notes #
- The following expressions are considered in simp-normal form in a group:
(λ h, h * g) ⁻¹' s,(λ h, g * h) ⁻¹' s,(λ h, h * g⁻¹) ⁻¹' s,(λ h, g⁻¹ * h) ⁻¹' s,s * t,s⁻¹,(1 : set _)(and similarly for additive variants). Expressions equal to one of these will be simplified. - 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 ofsimp.
Tags #
set multiplication, set addition, pointwise addition, pointwise multiplication, pointwise subtraction
Pointwise monoids (set, finset, filter) have derived pointwise actions of the form
has_smul α β → has_smul α (set β). When α is ℕ or ℤ, this action conflicts with the
nat or int action coming from set β being a monoid or div_inv_monoid. For example,
2 • {a, b} can both be {2 • a, 2 • b} (pointwise action, pointwise repeated addition,
set.has_smul_set) and {a + a, a + b, b + a, b + b} (nat or int action, repeated pointwise
addition, set.has_nsmul).
Because the pointwise action can easily be spelled out in such cases, we give higher priority to the nat and int actions.
0/1 as sets #
The set 1 : set α is defined as {1} in locale pointwise.
Equations
- set.has_one = {one := {1}}
The set 0 : set α is defined as {0} in locale pointwise.
Equations
- set.has_zero = {zero := {0}}
The singleton operation as a zero_hom.
Equations
The singleton operation as a one_hom.
Equations
Set negation/inversion #
The pointwise negation of set -s is defined as {x | -x ∈ s} in locale
pointwise. It is equal to {-x | x ∈ s}, see set.image_neg.
Equations
The pointwise inversion of set s⁻¹ is defined as {x | x⁻¹ ∈ s} in locale pointwise. It i
equal to {x⁻¹ | x ∈ s}, see set.image_inv.
Equations
Equations
- set.has_involutive_neg = {neg := has_neg.neg set.has_neg, neg_neg := _}
Equations
- set.has_involutive_inv = {inv := has_inv.inv set.has_inv, inv_inv := _}
Set addition/multiplication #
The pointwise multiplication of sets s * t and t is defined as {x * y | x ∈ s, y ∈ t} in
locale pointwise.
Equations
The pointwise addition of sets s + t is defined as {x + y | x ∈ s, y ∈ t} in
locale pointwise.
Equations
Addition preserves finiteness.
Equations
- s.fintype_add t = set.fintype_image2 (λ (a b : α), a + b) s t
Multiplication preserves finiteness.
Equations
- s.fintype_mul t = set.fintype_image2 (λ (a b : α), a * b) s t
The singleton operation as a mul_hom.
Equations
The singleton operation as an add_hom.
Equations
Set subtraction/division #
The pointwise division of sets s / t is defined as {x / y | x ∈ s, y ∈ t} in locale
pointwise.
Equations
The pointwise subtraction of sets s - t is defined as {x - y | x ∈ s, y ∈ t} in
locale pointwise.
Equations
Repeated pointwise addition (not the same as pointwise repeated addition!) of a finset. See
note [pointwise nat action].
Equations
Repeated pointwise addition/subtraction (not the same as pointwise repeated
addition/subtraction!) of a set. See note [pointwise nat action].
Equations
Repeated pointwise multiplication/division (not the same as pointwise repeated
multiplication/division!) of a set. See note [pointwise nat action].
set α is an add_semigroup under pointwise operations if α is.
Equations
- set.add_semigroup = {add := has_add.add set.has_add, add_assoc := _}
set α is a semigroup under pointwise operations if α is.
Equations
- set.semigroup = {mul := has_mul.mul set.has_mul, mul_assoc := _}
set α is an add_comm_semigroup under pointwise operations if α is.
Equations
- set.add_comm_semigroup = {add := add_semigroup.add set.add_semigroup, add_assoc := _, add_comm := _}
set α is a comm_semigroup under pointwise operations if α is.
Equations
- set.comm_semigroup = {mul := semigroup.mul set.semigroup, mul_assoc := _, mul_comm := _}
set α is an add_zero_class under pointwise operations if α is.
Equations
- set.add_zero_class = {zero := 0, add := has_add.add set.has_add, zero_add := _, add_zero := _}
set α is a mul_one_class under pointwise operations if α is.
Equations
- set.mul_one_class = {one := 1, mul := has_mul.mul set.has_mul, one_mul := _, mul_one := _}
The singleton operation as a monoid_hom.
Equations
- set.singleton_monoid_hom = {to_fun := set.singleton_mul_hom.to_fun, map_one' := _, map_mul' := _}
The singleton operation as an add_monoid_hom.
Equations
- set.singleton_add_monoid_hom = {to_fun := set.singleton_add_hom.to_fun, map_zero' := _, map_add' := _}
set α is a monoid under pointwise operations if α is.
Equations
- set.monoid = {mul := semigroup.mul set.semigroup, mul_assoc := _, one := mul_one_class.one set.mul_one_class, one_mul := _, mul_one := _, npow := npow_rec (mul_one_class.to_has_mul (set α)), npow_zero' := _, npow_succ' := _}
set α is an add_monoid under pointwise operations if α is.
Equations
- set.add_monoid = {add := add_semigroup.add set.add_semigroup, add_assoc := _, zero := add_zero_class.zero set.add_zero_class, zero_add := _, add_zero := _, nsmul := nsmul_rec (add_zero_class.to_has_add (set α)), nsmul_zero' := _, nsmul_succ' := _}
Equations
- set.decidable_mem_add = λ (_x : α), decidable_of_iff (∃ (x y : α), x ∈ s ∧ y ∈ t ∧ x + y = _x) _
Equations
- set.decidable_mem_mul = λ (_x : α), decidable_of_iff (∃ (x y : α), x ∈ s ∧ y ∈ t ∧ x * y = _x) _
Equations
- set.decidable_mem_nsmul n = nat.rec (set.decidable_mem_nsmul._proof_1.mpr (set.decidable_mem_nsmul._proof_2.mpr (λ (a : α), _inst_3 a 0))) (λ (n : ℕ) (ih : decidable_pred (λ (_x : α), _x ∈ n • s)), let _inst : decidable_pred (λ (_x : α), _x ∈ n • s) := ih in _.mpr (λ (a : α), set.decidable_mem_add a)) n
Equations
- set.decidable_mem_pow n = nat.rec (set.decidable_mem_pow._proof_1.mpr (set.decidable_mem_pow._proof_2.mpr (λ (a : α), _inst_3 a 1))) (λ (n : ℕ) (ih : decidable_pred (λ (_x : α), _x ∈ s ^ n)), let _inst : decidable_pred (λ (_x : α), _x ∈ s ^ n) := ih in _.mpr (λ (a : α), set.decidable_mem_mul a)) n
set α is a comm_monoid under pointwise operations if α is.
Equations
- set.comm_monoid = {mul := monoid.mul set.monoid, mul_assoc := _, one := monoid.one set.monoid, one_mul := _, mul_one := _, npow := monoid.npow set.monoid, npow_zero' := _, npow_succ' := _, mul_comm := _}
set α is an add_comm_monoid under pointwise operations if α is.
Equations
- set.add_comm_monoid = {add := add_monoid.add set.add_monoid, add_assoc := _, zero := add_monoid.zero set.add_monoid, zero_add := _, add_zero := _, nsmul := add_monoid.nsmul set.add_monoid, nsmul_zero' := _, nsmul_succ' := _, add_comm := _}
set α is a subtraction monoid under pointwise operations if α
is.
Equations
- set.subtraction_monoid = {add := add_monoid.add set.add_monoid, add_assoc := _, zero := add_monoid.zero set.add_monoid, zero_add := _, add_zero := _, nsmul := add_monoid.nsmul set.add_monoid, nsmul_zero' := _, nsmul_succ' := _, neg := has_involutive_neg.neg set.has_involutive_neg, sub := has_sub.sub set.has_sub, sub_eq_add_neg := _, zsmul := sub_neg_monoid.zsmul._default add_monoid.add set.subtraction_monoid._proof_7 add_monoid.zero set.subtraction_monoid._proof_8 set.subtraction_monoid._proof_9 add_monoid.nsmul set.subtraction_monoid._proof_10 set.subtraction_monoid._proof_11 has_involutive_neg.neg, zsmul_zero' := _, zsmul_succ' := _, zsmul_neg' := _, neg_neg := _, neg_add_rev := _, neg_eq_of_add := _}
set α is a division monoid under pointwise operations if α is.
Equations
- set.division_monoid = {mul := monoid.mul set.monoid, mul_assoc := _, one := monoid.one set.monoid, one_mul := _, mul_one := _, npow := monoid.npow set.monoid, npow_zero' := _, npow_succ' := _, inv := has_involutive_inv.inv set.has_involutive_inv, div := has_div.div set.has_div, div_eq_mul_inv := _, zpow := div_inv_monoid.zpow._default monoid.mul set.division_monoid._proof_7 monoid.one set.division_monoid._proof_8 set.division_monoid._proof_9 monoid.npow set.division_monoid._proof_10 set.division_monoid._proof_11 has_involutive_inv.inv, zpow_zero' := _, zpow_succ' := _, zpow_neg' := _, inv_inv := _, mul_inv_rev := _, inv_eq_of_mul := _}
set α is a commutative division monoid under pointwise operations if α is.
Equations
- set.division_comm_monoid = {mul := division_monoid.mul set.division_monoid, mul_assoc := _, one := division_monoid.one set.division_monoid, one_mul := _, mul_one := _, npow := division_monoid.npow set.division_monoid, npow_zero' := _, npow_succ' := _, inv := division_monoid.inv set.division_monoid, div := division_monoid.div set.division_monoid, div_eq_mul_inv := _, zpow := division_monoid.zpow set.division_monoid, zpow_zero' := _, zpow_succ' := _, zpow_neg' := _, inv_inv := _, mul_inv_rev := _, inv_eq_of_mul := _, mul_comm := _}
set α is a commutative subtraction monoid under pointwise
operations if α is.
Equations
- set.subtraction_comm_monoid = {add := subtraction_monoid.add set.subtraction_monoid, add_assoc := _, zero := subtraction_monoid.zero set.subtraction_monoid, zero_add := _, add_zero := _, nsmul := subtraction_monoid.nsmul set.subtraction_monoid, nsmul_zero' := _, nsmul_succ' := _, neg := subtraction_monoid.neg set.subtraction_monoid, sub := subtraction_monoid.sub set.subtraction_monoid, sub_eq_add_neg := _, zsmul := subtraction_monoid.zsmul set.subtraction_monoid, zsmul_zero' := _, zsmul_succ' := _, zsmul_neg' := _, neg_neg := _, neg_add_rev := _, neg_eq_of_add := _, add_comm := _}
set α has distributive negation if α has.
Equations
- set.has_distrib_neg = {neg := has_involutive_neg.neg set.has_involutive_neg, neg_neg := _, neg_mul := _, mul_neg := _}
Note that set is not a mul_zero_class because 0 * ∅ ≠ 0.
Alias of the reverse direction of set.not_one_mem_div_iff.
Alias of the reverse direction of set.not_one_mem_div_iff.
The n-ary version of set.mem_add.
The n-ary version of set.mem_mul.
A version of set.mem_finset_prod with a simpler RHS for products over a fintype.
A version of set.mem_finset_sum with a simpler RHS for sums over a fintype.
An n-ary version of set.add_mem_add.
An n-ary version of set.mul_mem_mul.
An n-ary version of set.add_subset_add.
An n-ary version of set.mul_subset_mul.
An n-ary version of set.add_mem_add.
An n-ary version of set.mul_mem_mul.
An n-ary version of set.mul_subset_mul.
An n-ary version of set.add_subset_add.
An n-ary version of set.mul_mem_mul.
An n-ary version of set.add_mem_add.
An n-ary version of set.mul_subset_mul.
An n-ary version of set.add_subset_add.
TODO: define decidable_mem_finset_prod and decidable_mem_finset_sum.
Translation/scaling of sets #
The dilation of set x • s is defined as {x • y | y ∈ s} in locale pointwise.
Equations
- set.has_smul_set = {smul := λ (a : α), set.image (has_smul.smul a)}
The translation of set x +ᵥ s is defined as {x +ᵥ y | y ∈ s} in
locale pointwise.
Equations
- set.has_vadd_set = {vadd := λ (a : α), set.image (has_vadd.vadd a)}
The pointwise scalar multiplication of sets s • t is defined as {x • y | x ∈ s, y ∈ t} in
locale pointwise.
Equations
The pointwise scalar addition of sets s +ᵥ t is defined as
{x +ᵥ y | x ∈ s, y ∈ t} in locale pointwise.
Equations
A multiplicative action of a monoid α on a type β gives a multiplicative action of set α
on set β.
Equations
- set.mul_action = {to_has_smul := set.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 set α on set β
Equations
- set.add_action = {to_has_vadd := set.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 set β.
Equations
- set.add_action_set = {to_has_vadd := set.has_vadd_set add_action.to_has_vadd, zero_vadd := _, add_vadd := _}
A multiplicative action of a monoid on a type β gives a multiplicative action on set β.
Equations
- set.mul_action_set = {to_has_smul := set.has_smul_set mul_action.to_has_smul, one_smul := _, mul_smul := _}
A distributive multiplicative action of a monoid on an additive monoid β gives a distributive
multiplicative action on set β.
Equations
A multiplicative action of a monoid on a monoid β gives a multiplicative action on set β.
Equations
Equations
Note that we have neither smul_with_zero α (set β) nor smul_with_zero (set α) (set β)
because 0 * ∅ ≠ 0.
A nonempty set is scaled by zero to the singleton set containing 0.
Miscellaneous #
Some lemmas about pointwise multiplication and submonoids. Ideally we put these in
group_theory.submonoid.basic, but currently we cannot because that file is imported by this.
Multiplication antidiagonal #
finset.mul_antidiagonal_of_is_wf hs ht a is the set of all pairs of an element in s and an
element in t that multiply to a, but its construction requires proofs that s and t are
well-ordered.
Equations
- finset.mul_antidiagonal hs ht a = _.to_finset
finset.add_antidiagonal_of_is_wf hs ht a is the set of all pairs of an element in
s and an element in t that add to a, but its construction requires proofs that s and t are
well-ordered.
Equations
- finset.add_antidiagonal hs ht a = _.to_finset