Multisets of exponent vectors #
Mathlib's Finsupp.toMultiset sends an exponent vector e : α →₀ ℕ to the multiset in which
each a occurs e a times. Its cardinality is the total degree of e. This file also computes it
on exponent vectors built from unit steps Finsupp.single a 1: adding one unit step conses its
index, and a sum of unit steps along a finite family is the multiset of values of the family.
The coefficients of such a sum are the letter counts of the family: the number of indices at
which it takes each value.
Main results #
Finsupp.card_toMultiset_eq_degree:card (toMultiset e) = e.degree.Finsupp.toMultiset_add_single_one:toMultiset (e + single a 1) = a ::ₘ toMultiset e.Finsupp.toMultiset_sum_single_one:toMultiset (∑ i ∈ s, single (p i) 1) = s.val.map p.Finsupp.sum_single_one_apply: along a familyfindexed by a finite type, the coefficient ofain∑ t, single (f t) 1is the number of indicestwithf t = a;Finsupp.sum_sum_single_one_applyandFinsupp.sum_single_one_apply_ne_zero_iffrecord that these letter counts sum to the number of indices and are nonzero exactly at the values off.Finsupp.exists_sum_single_eq_iff: the letter counts of orderedn-tuples are exactly the exponent vectors of total degreen.
The same unit steps summed along a list, with coefficients in any additive commutative monoid with one, count the occurrences of each letter; in characteristic zero these counts determine a constant list.
List.sum_map_single_one_apply:(l.map fun k ↦ single k 1).sum a = l.count a.List.eq_replicate_of_sum_map_single_one_eq: a list whose letter counts are those ofmcopies ofiismcopies ofi.
The number of letters of the monomial with exponent vector d is its total degree. This is
not a simp lemma: Finsupp.card_toMultiset already rewrites the left-hand side to
d.sum fun _ => id, so tagging it would leave it out of simp-normal form.
Adding one unit step at a to an exponent vector conses a onto its multiset.
The multiset of a sum of unit steps along a family p indexed by a finset s is the
multiset of the values of p on s.
The letter counts of a family: the coefficient of a in ∑ₜ single (f t) 1 is the
number of indices t with f t = a.
Summing the unit steps single k 1 along a list counts the occurrences of each letter.
In characteristic zero, a list whose sum of unit steps is m times the unit step at i is
the list of m copies of i.