Pointwise operations of sets #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
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
.
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
.
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 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
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' := _}
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
.