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
- One or more equations did not get rendered due to their size.
Instances For
theorem
Finsupp.toMultiset_apply
{α : Type u_1}
(f : α →₀ ℕ)
:
Finsupp.toMultiset f = Finsupp.sum f fun (a : α) (n : ℕ) => n • {a}
@[simp]
theorem
Finsupp.toMultiset_single
{α : Type u_1}
(a : α)
(n : ℕ)
:
Finsupp.toMultiset (Finsupp.single a n) = n • {a}
theorem
Finsupp.toMultiset_sum
{α : Type u_1}
{ι : Type u_3}
{f : ι → α →₀ ℕ}
(s : Finset ι)
:
Finsupp.toMultiset (Finset.sum s fun (i : ι) => f i) = Finset.sum s fun (i : ι) => Finsupp.toMultiset (f i)
theorem
Finsupp.toMultiset_sum_single
{ι : Type u_3}
(s : Finset ι)
(n : ℕ)
:
Finsupp.toMultiset (Finset.sum s fun (i : ι) => Finsupp.single i n) = n • s.val
theorem
Finsupp.card_toMultiset
{α : Type u_1}
(f : α →₀ ℕ)
:
Multiset.card (Finsupp.toMultiset f) = Finsupp.sum f fun (x : α) => id
theorem
Finsupp.toMultiset_map
{α : Type u_1}
{β : Type u_2}
(f : α →₀ ℕ)
(g : α → β)
:
Multiset.map g (Finsupp.toMultiset f) = Finsupp.toMultiset (Finsupp.mapDomain g f)
@[simp]
theorem
Finsupp.sum_toMultiset
{α : Type u_1}
[AddCommMonoid α]
(f : α →₀ ℕ)
:
Multiset.sum (Finsupp.toMultiset f) = Finsupp.sum f fun (a : α) (n : ℕ) => n • a
@[simp]
theorem
Finsupp.prod_toMultiset
{α : Type u_1}
[CommMonoid α]
(f : α →₀ ℕ)
:
Multiset.prod (Finsupp.toMultiset f) = Finsupp.prod f fun (a : α) (n : ℕ) => a ^ n
@[simp]
theorem
Finsupp.toFinset_toMultiset
{α : Type u_1}
[DecidableEq α]
(f : α →₀ ℕ)
:
Multiset.toFinset (Finsupp.toMultiset f) = f.support
@[simp]
theorem
Finsupp.count_toMultiset
{α : Type u_1}
[DecidableEq α]
(f : α →₀ ℕ)
(a : α)
:
Multiset.count a (Finsupp.toMultiset f) = f a
@[simp]
theorem
Multiset.toFinsupp_symm_apply
{α : Type u_1}
[DecidableEq α]
(f : α →₀ ℕ)
:
(AddEquiv.symm Multiset.toFinsupp) f = Finsupp.toMultiset f
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
@[simp]
theorem
Multiset.toFinsupp_support
{α : Type u_1}
[DecidableEq α]
(s : Multiset α)
:
(Multiset.toFinsupp s).support = Multiset.toFinset s
@[simp]
theorem
Multiset.toFinsupp_apply
{α : Type u_1}
[DecidableEq α]
(s : Multiset α)
(a : α)
:
(Multiset.toFinsupp s) a = Multiset.count a s
@[simp]
theorem
Multiset.toFinsupp_singleton
{α : Type u_1}
[DecidableEq α]
(a : α)
:
Multiset.toFinsupp {a} = Finsupp.single a 1
@[simp]
theorem
Multiset.toFinsupp_toMultiset
{α : Type u_1}
[DecidableEq α]
(s : Multiset α)
:
Finsupp.toMultiset (Multiset.toFinsupp s) = s
@[simp]
theorem
Finsupp.toMultiset_toFinsupp
{α : Type u_1}
[DecidableEq α]
(f : α →₀ ℕ)
:
Multiset.toFinsupp (Finsupp.toMultiset f) = f
As an order isomorphism #
@[simp]
theorem
Finsupp.coe_orderIsoMultiset
{ι : Type u_3}
[DecidableEq ι]
:
⇑Finsupp.orderIsoMultiset = ⇑Finsupp.toMultiset
@[simp]
theorem
Finsupp.coe_orderIsoMultiset_symm
{ι : Type u_3}
[DecidableEq ι]
:
⇑(OrderIso.symm Finsupp.orderIsoMultiset) = ⇑Multiset.toFinsupp
theorem
Finsupp.sum_id_lt_of_lt
{ι : Type u_3}
(m : ι →₀ ℕ)
(n : ι →₀ ℕ)
(h : m < n)
:
(Finsupp.sum m fun (x : ι) => id) < Finsupp.sum n fun (x : ι) => id
instance
Finsupp.instWellFoundedRelationFinsuppNatToZeroLinearOrderedCommMonoidWithZero
(ι : Type u_3)
:
WellFoundedRelation (ι →₀ ℕ)
Equations
- Finsupp.instWellFoundedRelationFinsuppNatToZeroLinearOrderedCommMonoidWithZero ι = { rel := fun (x x_1 : ι →₀ ℕ) => x < x_1, wf := (_ : WellFounded LT.lt) }
theorem
Multiset.toFinsupp_strictMono
{ι : Type u_3}
[DecidableEq ι]
:
StrictMono ⇑Multiset.toFinsupp