Symmetric powers #
This file defines symmetric powers of a type. The nth symmetric power consists of homogeneous n-tuples modulo permutations by the symmetric group.
The special case of 2-tuples is called the symmetric square, which is
addressed in more detail in Data.Sym.Sym2
.
TODO: This was created as supporting material for Sym2
; it
needs a fleshed-out interface.
Tags #
symmetric powers
The nth symmetric power is n-tuples up to permutation. We define it
as a subtype of Multiset
since these are well developed in the
library. We also give a definition Sym.sym'
in terms of vectors, and we
show these are equivalent in Sym.symEquivSym'
.
Instances For
Equations
- Sym.hasCoe α n = { coe := Sym.toMultiset }
Equations
- instDecidableEqSym = inferInstanceAs (DecidableEq { s : Multiset α // Multiset.card s = n })
This is the List.Perm
setoid lifted to Vector
.
See note [reducible non-instances].
Equations
- Mathlib.Vector.Perm.isSetoid α n = Setoid.comap Subtype.val (List.isSetoid α)
Instances For
Inserts an element into the term of Sym α n
, increasing the length by one.
Equations
- Sym.«term_::ₛ_» = Lean.ParserDescr.trailingNode `Sym.«term_::ₛ_» 67 68 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ::ₛ ") (Lean.ParserDescr.cat `term 67))
Instances For
This is the quotient map that takes a list of n elements as an n-tuple and produces an nth symmetric power.
Equations
- Sym.ofVector x = ⟨↑↑x, ⋯⟩
Instances For
This is the quotient map that takes a list of n elements as an n-tuple and produces an nth symmetric power.
Equations
- Sym.instCoeVector = { coe := fun (x : Mathlib.Vector α n) => Sym.ofVector x }
α ∈ s
means that a
appears as one of the factors in s
.
Equations
- Sym.decidableMem a s = Multiset.decidableMem a ↑s
This is cons
but for the alternative Sym'
definition.
Equations
- Sym.«term_::_» = Lean.ParserDescr.trailingNode `Sym.«term_::_» 1022 0 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " :: ") (Lean.ParserDescr.cat `term 0))
Instances For
Multisets of cardinality n are equivalent to length-n vectors up to permutations.
Equations
Instances For
Equations
- Sym.instEmptyCollectionOfNatNat = { emptyCollection := 0 }
replicate n a
is the sym containing only a
with multiplicity n
.
Equations
- Sym.replicate n a = ⟨Multiset.replicate n a, ⋯⟩
Instances For
Equations
- Sym.inhabitedSym n = { default := Sym.replicate n default }
Equations
- Sym.inhabitedSym' n = { default := Quotient.mk' (Mathlib.Vector.replicate n default) }
Equations
- Sym.instUnique n = Unique.mk' (Sym α n)
Note: Sym.map_id
is not simp-normal, as simp ends up unfolding id
with Sym.map_congr
Remove every a
from a given Sym α n
.
Yields the number of copies i
and a term of Sym α (n - i)
.
Equations
- Sym.filterNe a m = ⟨⟨Multiset.count a ↑m, ⋯⟩, ⟨Multiset.filter (fun (x : α) => a ≠ x) ↑m, ⋯⟩⟩
Instances For
Combinatorial equivalences #
Function from the symmetric product over Option
splitting on whether or not
it contains a none
.
Equations
Instances For
Inverse of Sym_option_succ_equiv.decode
.
Equations
- SymOptionSuccEquiv.decode (Sum.inl s) = none ::ₛ s
- SymOptionSuccEquiv.decode (Sum.inr s) = Sym.map (⇑Function.Embedding.some) s
Instances For
The symmetric product over Option
is a disjoint union over simpler symmetric products.
Equations
- symOptionSuccEquiv = { toFun := SymOptionSuccEquiv.encode, invFun := SymOptionSuccEquiv.decode, left_inv := ⋯, right_inv := ⋯ }