Equivalence between Multiset
and ℕ
-valued finitely supported functions #
This defines Finsupp.toMultiset
the equivalence between α →₀ ℕ
and Multiset α
, along
with Multiset.toFinsupp
the reverse equivalence and Finsupp.orderIsoMultiset
(the equivalence
promoted to an order isomorphism).
Given f : α →₀ ℕ
, f.toMultiset
is the multiset with multiplicities given by the values of
f
on the elements of α
. We define this function as an AddMonoidHom
.
Under the additional assumption of [DecidableEq α]
, this is available as
Multiset.toFinsupp : Multiset α ≃+ (α →₀ ℕ)
; the two declarations are separate as this assumption
is only needed for one direction.
Equations
Instances For
Given a multiset s
, s.toFinsupp
returns the finitely supported function on ℕ
given by
the multiplicities of the elements of s
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
As an order isomorphism #
Finsupp.toMultiset
as an order isomorphism.
Equations
- Finsupp.orderIsoMultiset = { toEquiv := Multiset.toFinsupp.symm.toEquiv, map_rel_iff' := ⋯ }
Instances For
Equations
- Finsupp.instWellFoundedRelationNat ι = { rel := fun (x x_1 : ι →₀ ℕ) => x < x_1, wf := ⋯ }
The n
th symmetric power of a type α
is naturally equivalent to the subtype of
finitely-supported maps α →₀ ℕ
with total mass n
.
See also Sym.equivNatSumOfFintype
when α
is finite.
Equations
- Sym.equivNatSum α n = Multiset.toFinsupp.subtypeEquiv ⋯
Instances For
The n
th symmetric power of a finite type α
is naturally equivalent to the subtype of maps
α → ℕ
with total mass n
.
See also Sym.equivNatSum
when α
is not necessarily finite.
Equations
- Sym.equivNatSumOfFintype α n = (Sym.equivNatSum α n).trans (Finsupp.equivFunOnFinite.subtypeEquiv ⋯)