Multinomial #
This file defines the multinomial coefficients and several small lemmas for manipulating them.
Nat.multinomial: the multinomial coefficient, Given a functionf : α → ℕands : Finset α, this is the number of strings consisting of symbols froms, wherec ∈ sappears with multiplicityf c.It is defined as
(∑ i ∈ s, f i)! / ∏ i ∈ s, (f i)!.Multiset.countPerms: multinomial coefficient associated with theMultiset.countfunction of a multiset. This is the number of lists that induce the given multiset.Finset.sum_pow: The expansion of(s.sum x) ^ nusing multinomial coefficientsMultiset.multinomial. Given a multisetmof natural numbers,m.multinomialis the multinomial coefficient defined by(m.sum) ! / ∏ i ∈ m, m i !.
This should not be confused with m.countPerms which
is defined as m.toFinsupp.multinomial.
As an example, one has Multiset.multinomial {1, 2, 2} = 30,
while Multiset.countPerms {1, 2, 2} = 3.
Multiset.multinomial_consproves that(x ::ₘ m).multinomial = Nat.choose (x + m.sum) x * m.multinomialMultiset.multinomial_addproves that(m + m').multinomial = Nat.choose (m + m').sum m.sum * m.multinomial * m'.multinomial
Implementation note for Multiset.multinomial. #
To avoid the definition of Multiset.multinomial as a quotient given above,
we define it in terms of Finsupp.multinomial, via lists:
If m : Multiset ℕ is the multiset associated with a list l : List ℕ,
then m.multinomial = l.toFinsupp.multinomial.
Then we prove its invariance under permutation.
The multinomial coefficient. Gives the number of strings consisting of symbols
from s, where c ∈ s appears with multiplicity f c.
Defined as (∑ i ∈ s, f i)! / ∏ i ∈ s, (f i)!.
Equations
- Nat.multinomial s f = (∑ i ∈ s, f i).factorial / ∏ i ∈ s, (f i).factorial
Instances For
Connection to binomial coefficients #
When Nat.multinomial is applied to a Finset of two elements {a, b}, the
result a binomial coefficient. We use binomial in the names of lemmas that
involves Nat.multinomial {a, b}.
Simple cases #
Alternative definitions #
The number of permutations of a given multiset.
Equations
Instances For
Multinomial theorem #
The multinomial theorem.
The multinomial theorem.
The multinomial coefficients given by a list of natural numbers.
See also Multiset.multinomial