Multinomial #
This file defines the multinomial coefficient and several small lemma's for manipulating it.
Main declarations #
Nat.multinomial
: the multinomial coefficient
Main results #
Finset.sum_pow
: The expansion of(s.sum x) ^ n
using multinomial coefficients
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
theorem
Nat.multinomial_spec
{α : Type u_1}
(s : Finset α)
(f : α → ℕ)
:
(∏ i ∈ s, (f i).factorial) * Nat.multinomial s f = (∑ i ∈ s, f i).factorial
@[deprecated Nat.multinomial_empty]
Alias of Nat.multinomial_empty
.
theorem
Nat.multinomial_cons
{α : Type u_1}
{s : Finset α}
{a : α}
(ha : a ∉ s)
(f : α → ℕ)
:
Nat.multinomial (Finset.cons a s ha) f = (f a + ∑ i ∈ s, f i).choose (f a) * Nat.multinomial s f
theorem
Nat.multinomial_insert
{α : Type u_1}
{s : Finset α}
{a : α}
[DecidableEq α]
(ha : a ∉ s)
(f : α → ℕ)
:
Nat.multinomial (insert a s) f = (f a + ∑ i ∈ s, f i).choose (f a) * Nat.multinomial s f
@[simp]
@[simp]
theorem
Nat.multinomial_insert_one
{α : Type u_1}
{s : Finset α}
{f : α → ℕ}
{a : α}
[DecidableEq α]
(h : a ∉ s)
(h₁ : f a = 1)
:
Nat.multinomial (insert a s) f = (s.sum f).succ * Nat.multinomial s f
theorem
Nat.multinomial_congr
{α : Type u_1}
{s : Finset α}
{f g : α → ℕ}
(h : ∀ a ∈ s, f a = g a)
:
Nat.multinomial s f = Nat.multinomial s g
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}
.
theorem
Nat.binomial_eq
{α : Type u_1}
{f : α → ℕ}
{a b : α}
[DecidableEq α]
(h : a ≠ b)
:
Nat.multinomial {a, b} f = (f a + f b).factorial / ((f a).factorial * (f b).factorial)
theorem
Nat.binomial_eq_choose
{α : Type u_1}
{f : α → ℕ}
{a b : α}
[DecidableEq α]
(h : a ≠ b)
:
Nat.multinomial {a, b} f = (f a + f b).choose (f a)
theorem
Nat.binomial_spec
{α : Type u_1}
{f : α → ℕ}
{a b : α}
[DecidableEq α]
(hab : a ≠ b)
:
(f a).factorial * (f b).factorial * Nat.multinomial {a, b} f = (f a + f b).factorial
@[simp]
theorem
Nat.binomial_one
{α : Type u_1}
{f : α → ℕ}
{a b : α}
[DecidableEq α]
(h : a ≠ b)
(h₁ : f a = 1)
:
Nat.multinomial {a, b} f = (f b).succ
theorem
Nat.binomial_succ_succ
{α : Type u_1}
{f : α → ℕ}
{a b : α}
[DecidableEq α]
(h : a ≠ b)
:
Nat.multinomial {a, b} (Function.update (Function.update f a (f a).succ) b (f b).succ) = Nat.multinomial {a, b} (Function.update f a (f a).succ) + Nat.multinomial {a, b} (Function.update f b (f b).succ)
theorem
Nat.succ_mul_binomial
{α : Type u_1}
{f : α → ℕ}
{a b : α}
[DecidableEq α]
(h : a ≠ b)
:
(f a + f b).succ * Nat.multinomial {a, b} f = (f a).succ * Nat.multinomial {a, b} (Function.update f a (f a).succ)
Simple cases #
theorem
Nat.multinomial_univ_two
(a b : ℕ)
:
Nat.multinomial Finset.univ ![a, b] = (a + b).factorial / (a.factorial * b.factorial)
Alternative definitions #
theorem
Finsupp.multinomial_eq
{α : Type u_1}
(f : α →₀ ℕ)
:
f.multinomial = Nat.multinomial f.support ⇑f
theorem
Multiset.multinomial_filter_ne
{α : Type u_1}
[DecidableEq α]
(a : α)
(m : Multiset α)
:
m.multinomial = m.card.choose (Multiset.count a m) * (Multiset.filter (fun (x : α) => a ≠ x) m).multinomial
@[simp]
Multinomial theorem #
theorem
Finset.sum_pow_eq_sum_piAntidiag_of_commute
{α : Type u_1}
{R : Type u_2}
[DecidableEq α]
[Semiring R]
(s : Finset α)
(f : α → R)
(hc : (↑s).Pairwise (Commute on f))
(n : ℕ)
:
(∑ i ∈ s, f i) ^ n = ∑ k ∈ s.piAntidiag n, ↑(Nat.multinomial s k) * s.noncommProd (fun (i : α) => f i ^ k i) ⋯
The multinomial theorem.
theorem
Finset.sum_pow_of_commute
{α : Type u_1}
{R : Type u_2}
[DecidableEq α]
[Semiring R]
(x : α → R)
(s : Finset α)
(hc : (↑s).Pairwise (Commute on x))
(n : ℕ)
:
The multinomial theorem.
theorem
Finset.sum_pow_eq_sum_piAntidiag
{α : Type u_1}
{R : Type u_2}
[DecidableEq α]
[CommSemiring R]
(s : Finset α)
(f : α → R)
(n : ℕ)
:
(∑ i ∈ s, f i) ^ n = ∑ k ∈ s.piAntidiag n, ↑(Nat.multinomial s k) * ∏ i ∈ s, f i ^ k i
theorem
Finset.sum_pow
{α : Type u_1}
{R : Type u_2}
[DecidableEq α]
[CommSemiring R]
{s : Finset α}
(x : α → R)
(n : ℕ)
:
s.sum x ^ n = ∑ k ∈ s.sym n, ↑(↑k).multinomial * (Multiset.map x ↑k).prod
theorem
Nat.multinomial_two_mul_le_mul_multinomial
{ι : Type u_1}
{s : Finset ι}
{f : ι → ℕ}
:
(Nat.multinomial s fun (i : ι) => 2 * f i) ≤ ((∑ i ∈ s, f i) ^ ∑ i ∈ s, f i) * Nat.multinomial s f