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.
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:
(fun h ↦ h * g) ⁻¹' s,(fun h ↦ g * h) ⁻¹' s,(fun h ↦ h * g⁻¹) ⁻¹' s,(fun 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 scope
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 scope 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
SMul α β → SMul α (Set β). When α is ℕ or ℤ, this action conflicts with the
nat or int action coming from Set β being a Monoid or DivInvMonoid. For example,
2 • {a, b} can both be {2 • a, 2 • b} (pointwise action, pointwise repeated addition,
Set.smulSet) and {a + a, a + b, b + a, b + b} (nat or int action, repeated pointwise
addition, Set.NSMul).
Because the pointwise action can easily be spelled out in such cases, we give higher priority to the nat and int actions.
Equations
Instances For
0/1 as sets #
Set negation/inversion #
The pointwise inversion of set s⁻¹ is defined as {x | x⁻¹ ∈ s} in scope Pointwise. It is
equal to {x⁻¹ | x ∈ s}, see Set.image_inv_eq_inv.
Equations
Instances For
The pointwise negation of set -s is defined as {x | -x ∈ s} in scope Pointwise.
It is equal to {-x | x ∈ s}, see Set.image_neg_eq_neg.
Equations
Instances For
Equations
Equations
Set addition/multiplication #
Set subtraction/division #
Set α is a commutative subtraction monoid under pointwise operations if α is.
Equations
Instances For
Alias of the reverse direction of Set.one_notMem_div_iff.