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 = Subtype.instDecidableEqSubtype
This is the List.Perm
setoid lifted to Vector
.
See note [reducible non-instances].
Equations
- 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 = { val := ↑↑x, property := (_ : ↑Multiset.card ↑↑x = n) }
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.instCoeVectorSym = { coe := fun x => Sym.ofVector x }
α ∈ s
means that a
appears as one of the factors in s
.
Equations
- Sym.decidableMem a s = Multiset.decidableMem a ↑s
erase s a h
is the sym that subtracts 1 from the
multiplicity of a
if a is present in the sym.
Equations
- Sym.erase s a h = { val := Multiset.erase (↑s) a, property := (_ : ↑Multiset.card (Multiset.erase (↑s) a) = n) }
Instances For
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
Equations
- Sym.instEmptyCollectionSymOfNatNatInstOfNatNat = { emptyCollection := 0 }
replicate n a
is the sym containing only a
with multiplicity n
.
Equations
- Sym.replicate n a = { val := Multiset.replicate n a, property := (_ : ↑Multiset.card (Multiset.replicate n a) = n) }
Instances For
Equations
- Sym.inhabitedSym n = { default := Sym.replicate n default }
Equations
- Sym.inhabitedSym' n = { default := Quotient.mk' (Vector.replicate n default) }
Equations
- Sym.instUniqueSym n = Unique.mk' (Sym α n)
A function α → β
induces a function Sym α n → Sym β n
by applying it to every element of
the underlying n
-tuple.
Equations
- Sym.map f x = { val := Multiset.map f ↑x, property := (_ : ↑Multiset.card (Multiset.map f ↑x) = n) }
Instances For
Note: Sym.map_id
is not simp-normal, as simp ends up unfolding id
with Sym.map_congr
"Attach" a proof that a ∈ s
to each element a
in s
to produce
an element of the symmetric power on {x // x ∈ s}
.
Equations
- Sym.attach s = { val := Multiset.attach ↑s, property := (_ : ↑Multiset.card (Multiset.attach ↑s) = n) }
Instances For
Combinatorial equivalences #
Function from the symmetric product over Option
splitting on whether or not
it contains a none
.
Equations
- SymOptionSuccEquiv.encode s = if h : none ∈ s then Sum.inl (Sym.erase s none h) else Sum.inr (Sym.map (fun o => Option.get ↑o (_ : Option.isSome ↑o = true)) (Sym.attach s))
Instances For
Inverse of Sym_option_succ_equiv.decode
.
Equations
Instances For
The symmetric product over Option
is a disjoint union over simpler symmetric products.
Equations
- One or more equations did not get rendered due to their size.