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 * y
wherex ∈ s
andy ∈ t
.s + t
: Addition, set of allx + y
wherex ∈ s
andy ∈ t
.s⁻¹
: Inversion, set of allx⁻¹
wherex ∈ s
.-s
: Negation, set of all-x
wherex ∈ s
.s / t
: Division, set of allx / y
wherex ∈ s
andy ∈ t
.s - t
: Subtraction, set of allx - y
wherex ∈ s
andy ∈ t
.s • t
: Scalar multiplication, set of allx • y
wherex ∈ s
andy ∈ t
.s +ᵥ t
: Scalar addition, set of allx +ᵥ y
wherex ∈ s
andy ∈ t
.s -ᵥ t
: Scalar subtraction, set of allx -ᵥ y
wherex ∈ s
andy ∈ t
.a • s
: Scaling, set of alla • x
wherex ∈ s
.a +ᵥ s
: Translation, set of alla +ᵥ x
wherex ∈ 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}
.
We define set_semiring α
, an alias of set α
, which we endow with ∪
as addition and *
as
multiplication. If α
is a (commutative) monoid, set_semiring α
is a (commutative) semiring.
Appropriate definitions and results are also transported to the additive theory via to_additive
.
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
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}}
Set addition/multiplication #
The set (s * t : set α)
is defined as {x * y | x ∈ s, y ∈ t}
in locale pointwise
.
Equations
The set (s + t : set α)
is defined as {x + y | x ∈ s, y ∈ t}
in locale pointwise
.
Equations
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 := _}
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 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' := _}
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 := _}
Equations
- set.decidable_mem_mul = λ (_x : α), decidable_of_iff (∃ (x y : α), x ∈ s ∧ y ∈ t ∧ x * y = _x) _
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
singleton
is a monoid hom.
Equations
- set.singleton_hom = {to_fun := singleton set.has_singleton, map_one' := _, map_mul' := _}
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 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.
The n-ary version of set.mul_mem_mul
.
The n-ary version of set.add_mem_add
.
The n-ary version of set.mul_subset_mul
.
The n-ary version of set.add_subset_add
.
TODO: define decidable_mem_finset_prod
and decidable_mem_finset_sum
.
Set negation/inversion #
The set (-s : set α)
is defined as {x | -x ∈ s}
in locale pointwise
.
It is equal to {-x | x ∈ s}
, see set.image_neg
.
Equations
The set (s⁻¹ : set α)
is defined as {x | x⁻¹ ∈ s}
in locale pointwise
.
It is 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 multiplication/division #
The set (s / t : set α)
is defined as {x / y | x ∈ s, y ∈ t}
in locale pointwise
.
Equations
The set (s - t : set α)
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
.
Equations
Repeated pointwise addition/subtraction (not the same as pointwise repeated
addition/subtraction!) of a set
.
Equations
Repeated pointwise multiplication/division (not the same as pointwise repeated
multiplication/division!) of a set
.
s / t = s * t⁻¹
for all s t : set α
if a / b = a * b⁻¹
for all a b : α
.
Equations
- set.div_inv_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_inv.inv set.has_inv, div := has_div.div set.has_div, div_eq_mul_inv := _, zpow := zpow_rec {inv := has_inv.inv set.has_inv}, zpow_zero' := _, zpow_succ' := _, zpow_neg' := _}
s - t = s + -t
for all s t : set α
if a - b = a + -b
for all a b : α
.
Equations
- set.sub_neg_add_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_neg.neg set.has_neg, sub := has_sub.sub set.has_sub, sub_eq_add_neg := _, zsmul := zsmul_rec {neg := has_neg.neg set.has_neg}, zsmul_zero' := _, zsmul_succ' := _, zsmul_neg' := _}
s / t = s * t⁻¹
for all s t : set α
if a / b = a * b⁻¹
for all a b : α
.
Equations
- set.div_inv_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_inv.inv set.has_inv, div := has_div.div set.has_div, div_eq_mul_inv := _, zpow := zpow_rec {inv := has_inv.inv set.has_inv}, zpow_zero' := _, zpow_succ' := _, zpow_neg' := _}
Translation/scaling of sets #
The translation of a set (x +ᵥ s : set β)
by a scalar x ∶ α
is
defined as {x +ᵥ y | y ∈ s}
in locale pointwise
.
Equations
- set.has_vadd_set = {vadd := λ (a : α), set.image (has_vadd.vadd a)}
The scaling of a set (x • s : set β)
by a scalar x ∶ α
is defined as {x • y | y ∈ s}
in locale pointwise
.
Equations
- set.has_scalar_set = {smul := λ (a : α), set.image (has_scalar.smul a)}
A multiplicative action of a monoid α
on a type β
gives a multiplicative action of set α
on set β
.
Equations
- set.mul_action = {to_has_scalar := set.has_scalar mul_action.to_has_scalar, 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
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
An alias for set α
, which has a semiring structure given by ∪
as "addition" and pointwise
multiplication *
as "multiplication".
Equations
- set.set_semiring α = set α
The identity function set_semiring α → set α
.
Equations
- set.set_semiring.add_comm_monoid = {add := λ (s t : set.set_semiring α), s ∪ t, add_assoc := _, zero := ∅, zero_add := _, add_zero := _, nsmul := add_monoid.nsmul._default ∅ (λ (s t : set.set_semiring α), s ∪ t) set.empty_union set.union_empty, nsmul_zero' := _, nsmul_succ' := _, add_comm := _}
Equations
- set.set_semiring.non_unital_non_assoc_semiring = {add := add_comm_monoid.add set.set_semiring.add_comm_monoid, add_assoc := _, zero := add_comm_monoid.zero set.set_semiring.add_comm_monoid, zero_add := _, add_zero := _, nsmul := add_comm_monoid.nsmul set.set_semiring.add_comm_monoid, nsmul_zero' := _, nsmul_succ' := _, add_comm := _, mul := has_mul.mul set.has_mul, left_distrib := _, right_distrib := _, zero_mul := _, mul_zero := _}
Equations
- set.set_semiring.non_assoc_semiring = {add := non_unital_non_assoc_semiring.add set.set_semiring.non_unital_non_assoc_semiring, add_assoc := _, zero := non_unital_non_assoc_semiring.zero set.set_semiring.non_unital_non_assoc_semiring, zero_add := _, add_zero := _, nsmul := non_unital_non_assoc_semiring.nsmul set.set_semiring.non_unital_non_assoc_semiring, nsmul_zero' := _, nsmul_succ' := _, add_comm := _, mul := non_unital_non_assoc_semiring.mul set.set_semiring.non_unital_non_assoc_semiring, left_distrib := _, right_distrib := _, zero_mul := _, mul_zero := _, one := mul_one_class.one set.mul_one_class, one_mul := _, mul_one := _}
Equations
- set.set_semiring.non_unital_semiring = {add := non_unital_non_assoc_semiring.add set.set_semiring.non_unital_non_assoc_semiring, add_assoc := _, zero := non_unital_non_assoc_semiring.zero set.set_semiring.non_unital_non_assoc_semiring, zero_add := _, add_zero := _, nsmul := non_unital_non_assoc_semiring.nsmul set.set_semiring.non_unital_non_assoc_semiring, nsmul_zero' := _, nsmul_succ' := _, add_comm := _, mul := non_unital_non_assoc_semiring.mul set.set_semiring.non_unital_non_assoc_semiring, left_distrib := _, right_distrib := _, zero_mul := _, mul_zero := _, mul_assoc := _}
Equations
- set.set_semiring.semiring = {add := non_assoc_semiring.add set.set_semiring.non_assoc_semiring, add_assoc := _, zero := non_assoc_semiring.zero set.set_semiring.non_assoc_semiring, zero_add := _, add_zero := _, nsmul := non_assoc_semiring.nsmul set.set_semiring.non_assoc_semiring, nsmul_zero' := _, nsmul_succ' := _, add_comm := _, mul := non_assoc_semiring.mul set.set_semiring.non_assoc_semiring, left_distrib := _, right_distrib := _, zero_mul := _, mul_zero := _, mul_assoc := _, one := non_assoc_semiring.one set.set_semiring.non_assoc_semiring, one_mul := _, mul_one := _, npow := monoid_with_zero.npow._default non_assoc_semiring.one non_assoc_semiring.mul set.set_semiring.semiring._proof_14 set.set_semiring.semiring._proof_15, npow_zero' := _, npow_succ' := _}
Equations
- set.set_semiring.comm_semiring = {add := semiring.add set.set_semiring.semiring, add_assoc := _, zero := semiring.zero set.set_semiring.semiring, zero_add := _, add_zero := _, nsmul := semiring.nsmul set.set_semiring.semiring, nsmul_zero' := _, nsmul_succ' := _, add_comm := _, mul := comm_monoid.mul set.comm_monoid, left_distrib := _, right_distrib := _, zero_mul := _, mul_zero := _, mul_assoc := _, one := comm_monoid.one set.comm_monoid, one_mul := _, mul_one := _, npow := comm_monoid.npow set.comm_monoid, npow_zero' := _, npow_succ' := _, mul_comm := _}
The image of a set under a multiplicative homomorphism is a ring homomorphism with respect to the pointwise operations on sets.
Equations
- set.set_semiring.canonically_ordered_comm_semiring = {add := comm_semiring.add infer_instance, add_assoc := _, zero := comm_semiring.zero infer_instance, zero_add := _, add_zero := _, nsmul := comm_semiring.nsmul infer_instance, nsmul_zero' := _, nsmul_succ' := _, add_comm := _, le := partial_order.le infer_instance, lt := partial_order.lt infer_instance, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, add_le_add_left := _, bot := order_bot.bot infer_instance, bot_le := _, le_iff_exists_add := _, mul := comm_semiring.mul infer_instance, left_distrib := _, right_distrib := _, zero_mul := _, mul_zero := _, mul_assoc := _, one := comm_semiring.one infer_instance, one_mul := _, mul_one := _, npow := comm_semiring.npow infer_instance, npow_zero' := _, npow_succ' := _, mul_comm := _, eq_zero_or_eq_zero_of_mul_eq_zero := _}
A nonempty set is scaled by zero to the singleton set containing 0.
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.