Symmetric difference on finsets and finite types #
This module gathers algebraic and combinatorial properties of symmetric difference on finite sets:
- In a generalized Boolean algebra
b ↦ a ∆ bis an involution, so over a finite generalized Boolean algebra the product off (a ∆ b)over allbis the product off bover allb(Fintype.prod_symmDiff,Fintype.sum_symmDiff). - Symmetric difference of a finset with a singleton:
s ∆ {t}removestif present and inserts it otherwise (Finset.symmDiff_singleton_eq), bounding the cardinality bys.card + 1(Finset.card_symmDiff_singleton_le). - Summing over
s ∆ {t}addsval twhen elements have order at most 2, in particular in the Boolean ringBool(Finset.sum_symmDiff_singleton).
Main results #
Fintype.prod_symmDiff,Fintype.sum_symmDiff: reindexing a product or a sum by a symmetric difference.Finset.symmDiff_singleton_eq: symmetric difference with a singleton as conditional erase/insert.Finset.mem_symmDiff_singleton: membership ins ∆ {t}.Finset.card_symmDiff_singleton_le: cardinality bound fors ∆ {t}.Finset.sum_symmDiff_singleton: summing overs ∆ {t}addsval tinBool.
theorem Fintype.prod_symmDiff {α : Type u_1} {M : Type u_2} [Fintype α] [GeneralizedBooleanAlgebra α] [CommMonoid M] (a : α) (f : α → M) :
Reindexing a product over a finite generalized Boolean algebra by the involution
b ↦ a ∆ b.
theorem Fintype.sum_symmDiff {α : Type u_1} {M : Type u_2} [Fintype α] [GeneralizedBooleanAlgebra α] [AddCommMonoid M] (a : α) (f : α → M) :
Reindexing a sum over a finite generalized Boolean algebra by the involution
b ↦ a ∆ b.
theorem Finset.sum_symmDiff_singleton_of_add_self {α : Type u_1} [DecidableEq α] {M : Type u_2} [AddCommMonoid M] (h_self : ∀ (x : M), x + x = 0) (s : Finset α) (t : α) (val : α → M) :
In an additive commutative monoid where every element has order at most 2, summing over
s ∆ {t} adds val t.