Decomposing and counting Multiset.powerset #
Structural decompositions of Multiset.powerset (mathlib has only the zero/cons
forms), and the multiplicity of s in t.powerset as a product of binomial
coefficients: a sub-multiset picks s.count x of the t.count x copies of each
distinct x. (This product of binomials is not Nat.multinomial, which is the
quotient (∑ᵢ kᵢ)! / ∏ᵢ kᵢ!.)
Main results #
Multiset.powerset_add:(F + G).powersetas a bind/map product of the summands' powersets — the+analogue ofMultiset.powerset_cons.Multiset.powerset_powerset_pair_swap: the two iteration orders over nested sub-multiset pairs enumerate the same multiset of pairs.Multiset.count_powerset_of_le: fors ≤ t,t.powerset.count s = ∏ x ∈ t.toFinset, (t.count x).choose (s.count x).Multiset.count_powerset: the hypothesis-free form, indexed by(s + t).toFinsetso thatNat.choosevanishing makes both sides0whens ≰ t.
Implementation notes #
The induction runs over a fixed ambient Finset containing both supports
(count_powerset_subset): the index set stays constant through the recursion and the
unconditional induction hypothesis absorbs the s ≰ t boundary cases by
Nat.choose vanishing. [UPSTREAM] candidate; eventual mathlib home
Mathlib.Data.Multiset.Powerset.
powerset of a sum, as a bind/map product over the summands' powersets: each
sub-multiset of F + G splits (with multiplicity) into a sub-multiset of F plus a
sub-multiset of G. The + analogue of powerset_cons.
Nested-powerset reparameterization: iterating F₁ ⊆ F then A ⊆ F₁ enumerates the
same multiset of pairs as iterating A ⊆ F then B ⊆ F - A, via the bijection
(F₁, A) ↦ (A, F₁ - A).
Count of a sub-multiset s ≤ t among the sub-multisets of t: for each distinct
x, choose s.count x of the t.count x copies.
Hypothesis-free form of count_powerset_of_le: over (s + t).toFinset, some factor
(t.count x).choose (s.count x) vanishes whenever s ≰ t, so both sides are 0.
A multiset that is not below t does not occur in t.powerset.