File: Mathlib/Data/Finsupp/Multiset.lean

full_name: Finsupp.toMultiset
code: /-- 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. -/
def toMultiset : (α →₀ ℕ) →+ Multiset α 
goal: (α →₀ ℕ) →+ Multiset α

full_name: Finsupp.toMultiset_zero
code: theorem toMultiset_zero : toMultiset (0 : α →₀ ℕ) = 0 
goal: Finsupp.toMultiset 0 = 0

full_name: Finsupp.toMultiset_add
code: theorem toMultiset_add (m n : α →₀ ℕ) : toMultiset (m + n) = toMultiset m + toMultiset n 
goal: Finsupp.toMultiset (m + n) = Finsupp.toMultiset m + Finsupp.toMultiset n

full_name: Finsupp.toMultiset_apply
code: theorem toMultiset_apply (f : α →₀ ℕ) : toMultiset f = f.sum fun a n => n • {a} 
goal: Finsupp.toMultiset f = f.sum fun a n => n • {a}

full_name: Finsupp.toMultiset_single
code: @[simp]
theorem toMultiset_single (a : α) (n : ℕ) : toMultiset (single a n) = n • {a} 
goal: Finsupp.toMultiset (Finsupp.single a n) = n • {a}

full_name: Finsupp.toMultiset_sum
code: theorem toMultiset_sum {f : ι → α →₀ ℕ} (s : Finset ι) :
    Finsupp.toMultiset (∑ i ∈ s, f i) = ∑ i ∈ s, Finsupp.toMultiset (f i) 
goal: Finsupp.toMultiset (∑ i ∈ s, f i) = ∑ i ∈ s, Finsupp.toMultiset (f i)

full_name: Finsupp.toMultiset_sum_single
code: theorem toMultiset_sum_single (s : Finset ι) (n : ℕ) :
    Finsupp.toMultiset (∑ i ∈ s, single i n) = n • s.val 
goal: Finsupp.toMultiset (∑ i ∈ s, Finsupp.single i n) = n • s.val

full_name: Finsupp.card_toMultiset
code: @[simp]
theorem card_toMultiset (f : α →₀ ℕ) : Multiset.card (toMultiset f) = f.sum fun _ => id 
goal: Multiset.card (Finsupp.toMultiset f) = f.sum fun x => id

full_name: Finsupp.toMultiset_map
code: theorem toMultiset_map (f : α →₀ ℕ) (g : α → β) :
    f.toMultiset.map g = toMultiset (f.mapDomain g) 
goal: Multiset.map g (Finsupp.toMultiset f) = Finsupp.toMultiset (Finsupp.mapDomain g f)

full_name: Finsupp.sum_toMultiset
code: @[to_additive (attr := simp)]
theorem prod_toMultiset [CommMonoid α] (f : α →₀ ℕ) :
    f.toMultiset.prod = f.prod fun a n => a ^ n 
goal: (Finsupp.toMultiset f).sum = f.sum fun a n => n • a

full_name: Finsupp.prod_toMultiset
code: @[to_additive (attr := simp)]
theorem prod_toMultiset [CommMonoid α] (f : α →₀ ℕ) :
    f.toMultiset.prod = f.prod fun a n => a ^ n 
goal: (Finsupp.toMultiset f).prod = f.prod fun a n => a ^ n

full_name: Finsupp.toFinset_toMultiset
code: @[simp]
theorem toFinset_toMultiset [DecidableEq α] (f : α →₀ ℕ) : f.toMultiset.toFinset = f.support 
goal: (Finsupp.toMultiset f).toFinset = f.support

full_name: Finsupp.count_toMultiset
code: @[simp]
theorem count_toMultiset [DecidableEq α] (f : α →₀ ℕ) (a : α) : (toMultiset f).count a = f a 
goal: Multiset.count a (Finsupp.toMultiset f) = f a

full_name: Finsupp.toMultiset_sup
code: theorem toMultiset_sup [DecidableEq α] (f g : α →₀ ℕ) :
    toMultiset (f ⊔ g) = toMultiset f ∪ toMultiset g 
goal: Finsupp.toMultiset (f ⊔ g) = Finsupp.toMultiset f ∪ Finsupp.toMultiset g

full_name: Finsupp.toMultiset_inf
code: theorem toMultiset_inf [DecidableEq α] (f g : α →₀ ℕ) :
    toMultiset (f ⊓ g) = toMultiset f ∩ toMultiset g 
goal: Finsupp.toMultiset (f ⊓ g) = Finsupp.toMultiset f ∩ Finsupp.toMultiset g

full_name: Finsupp.mem_toMultiset
code: @[simp]
theorem mem_toMultiset (f : α →₀ ℕ) (i : α) : i ∈ toMultiset f ↔ i ∈ f.support 
goal: i ∈ Finsupp.toMultiset f ↔ i ∈ f.support

full_name: Multiset.toFinsupp_symm_apply
code: /-- Given a multiset `s`, `s.toFinsupp` returns the finitely supported function on `ℕ` given by
the multiplicities of the elements of `s`. -/
@[simps symm_apply]
def toFinsupp : Multiset α ≃+ (α →₀ ℕ) 
goal: Multiset.toFinsupp.symm f = Finsupp.toMultiset f

full_name: Multiset.toFinsupp
code: /-- Given a multiset `s`, `s.toFinsupp` returns the finitely supported function on `ℕ` given by
the multiplicities of the elements of `s`. -/
@[simps symm_apply]
def toFinsupp : Multiset α ≃+ (α →₀ ℕ) 
goal: Multiset α ≃+ (α →₀ ℕ)

full_name: Multiset.toFinsupp_support
code: @[simp]
theorem toFinsupp_support (s : Multiset α) : s.toFinsupp.support = s.toFinset 
goal: (Multiset.toFinsupp s).support = s.toFinset

full_name: Multiset.toFinsupp_apply
code: @[simp]
theorem toFinsupp_apply (s : Multiset α) (a : α) : toFinsupp s a = s.count a 
goal: (Multiset.toFinsupp s) a = Multiset.count a s

full_name: Multiset.toFinsupp_zero
code: theorem toFinsupp_zero : toFinsupp (0 : Multiset α) = 0 
goal: Multiset.toFinsupp 0 = 0

full_name: Multiset.toFinsupp_add
code: theorem toFinsupp_add (s t : Multiset α) : toFinsupp (s + t) = toFinsupp s + toFinsupp t 
goal: Multiset.toFinsupp (s + t) = Multiset.toFinsupp s + Multiset.toFinsupp t

full_name: Multiset.toFinsupp_singleton
code: @[simp]
theorem toFinsupp_singleton (a : α) : toFinsupp ({a} : Multiset α) = Finsupp.single a 1 
goal: Multiset.toFinsupp {a} = Finsupp.single a 1

full_name: Multiset.toFinsupp_toMultiset
code: @[simp]
theorem toFinsupp_toMultiset (s : Multiset α) : Finsupp.toMultiset (toFinsupp s) = s 
goal: Finsupp.toMultiset (Multiset.toFinsupp s) = s

full_name: Multiset.toFinsupp_eq_iff
code: theorem toFinsupp_eq_iff {s : Multiset α} {f : α →₀ ℕ} :
    toFinsupp s = f ↔ s = Finsupp.toMultiset f 
goal: Multiset.toFinsupp s = f ↔ s = Finsupp.toMultiset f

full_name: Multiset.toFinsupp_union
code: theorem toFinsupp_union (s t : Multiset α) : toFinsupp (s ∪ t) = toFinsupp s ⊔ toFinsupp t 
goal: Multiset.toFinsupp (s ∪ t) = Multiset.toFinsupp s ⊔ Multiset.toFinsupp t

full_name: Multiset.toFinsupp_inter
code: theorem toFinsupp_inter (s t : Multiset α) : toFinsupp (s ∩ t) = toFinsupp s ⊓ toFinsupp t 
goal: Multiset.toFinsupp (s ∩ t) = Multiset.toFinsupp s ⊓ Multiset.toFinsupp t

full_name: Multiset.toFinsupp_sum_eq
code: @[simp]
theorem toFinsupp_sum_eq (s : Multiset α) : s.toFinsupp.sum (fun _ ↦ id) = Multiset.card s 
goal: ((Multiset.toFinsupp s).sum fun x => id) = Multiset.card s

full_name: Finsupp.toMultiset_toFinsupp
code: @[simp]
theorem Finsupp.toMultiset_toFinsupp [DecidableEq α] (f : α →₀ ℕ) :
    Multiset.toFinsupp (Finsupp.toMultiset f) = f 
goal: Multiset.toFinsupp (Finsupp.toMultiset f) = f

full_name: Finsupp.toMultiset_eq_iff
code: theorem Finsupp.toMultiset_eq_iff [DecidableEq α] {f : α →₀ ℕ} {s : Multiset α} :
    Finsupp.toMultiset f = s ↔ f = Multiset.toFinsupp s 
goal: Finsupp.toMultiset f = s ↔ f = Multiset.toFinsupp s

full_name: Finsupp.orderIsoMultiset
code: /-- `Finsupp.toMultiset` as an order isomorphism. -/
def orderIsoMultiset [DecidableEq ι] : (ι →₀ ℕ) ≃o Multiset ι 
goal: (ι →₀ ℕ) ≃o Multiset ι

full_name: Finsupp.coe_orderIsoMultiset
code: @[simp]
theorem coe_orderIsoMultiset [DecidableEq ι] : ⇑(@orderIsoMultiset ι _) = toMultiset 
goal: ⇑Finsupp.orderIsoMultiset = ⇑Finsupp.toMultiset

full_name: Finsupp.coe_orderIsoMultiset_symm
code: @[simp]
theorem coe_orderIsoMultiset_symm [DecidableEq ι] :
    ⇑(@orderIsoMultiset ι).symm = Multiset.toFinsupp 
goal: ⇑Finsupp.orderIsoMultiset.symm = ⇑Multiset.toFinsupp

full_name: Finsupp.toMultiset_strictMono
code: theorem toMultiset_strictMono : StrictMono (@toMultiset ι) 
goal: StrictMono ⇑Finsupp.toMultiset

full_name: Finsupp.sum_id_lt_of_lt
code: theorem sum_id_lt_of_lt (m n : ι →₀ ℕ) (h : m < n) : (m.sum fun _ => id) < n.sum fun _ => id 
goal: (m.sum fun x => id) < n.sum fun x => id

full_name: Finsupp.lt_wf
code: /-- The order on `ι →₀ ℕ` is well-founded. -/
theorem lt_wf : WellFounded (@LT.lt (ι →₀ ℕ) _) 
goal: WellFounded LT.lt

full_name: Finsupp.instWellFoundedRelationNat
code: instance : WellFoundedRelation (ι →₀ ℕ) 
goal: WellFoundedRelation (ι →₀ ℕ)

full_name: Multiset.toFinsupp_strictMono
code: theorem Multiset.toFinsupp_strictMono [DecidableEq ι] : StrictMono (@Multiset.toFinsupp ι _) 
goal: StrictMono ⇑Multiset.toFinsupp

full_name: Sym.equivNatSum
code: /-- 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. -/
def equivNatSum :
    Sym α n ≃ {P : α →₀ ℕ // P.sum (fun _ ↦ id) = n} 
goal: Sym α n ≃ { P // (P.sum fun x => id) = n }

full_name: Sym.coe_equivNatSum_apply_apply
code: @[simp] lemma coe_equivNatSum_apply_apply (s : Sym α n) (a : α) :
    (equivNatSum α n s : α →₀ ℕ) a = (s : Multiset α).count a 
goal: ↑((Sym.equivNatSum α n) s) a = Multiset.count a ↑s

full_name: Sym.coe_equivNatSum_symm_apply
code: @[simp] lemma coe_equivNatSum_symm_apply (P : {P : α →₀ ℕ // P.sum (fun _ ↦ id) = n}) :
    ((equivNatSum α n).symm P : Multiset α) = Finsupp.toMultiset P 
goal: ↑((Sym.equivNatSum α n).symm P) = Finsupp.toMultiset ↑P

full_name: Sym.equivNatSumOfFintype
code: /-- 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. -/
noncomputable def equivNatSumOfFintype [Fintype α] :
    Sym α n ≃ {P : α → ℕ // ∑ i, P i = n} 
goal: Sym α n ≃ { P // ∑ i : α, P i = n }

full_name: Sym.coe_equivNatSumOfFintype_apply_apply
code: @[simp] lemma coe_equivNatSumOfFintype_apply_apply [Fintype α] (s : Sym α n) (a : α) :
    (equivNatSumOfFintype α n s : α → ℕ) a = (s : Multiset α).count a 
goal: ↑((Sym.equivNatSumOfFintype α n) s) a = Multiset.count a ↑s

full_name: Sym.coe_equivNatSumOfFintype_symm_apply
code: @[simp] lemma coe_equivNatSumOfFintype_symm_apply [Fintype α] (P : {P : α → ℕ // ∑ i, P i = n}) :
    ((equivNatSumOfFintype α n).symm P : Multiset α) = ∑ a, ((P : α → ℕ) a) • {a} 
goal: ↑((Sym.equivNatSumOfFintype α n).symm P) = ∑ a : α, ↑P a • {a}