mathlib3 documentation

data.nat.choose.multinomial

Multinomial #

THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.

This file defines the multinomial coefficient and several small lemma's for manipulating it.

Main declarations #

Main results #

def nat.multinomial {α : Type u_1} (s : finset α) (f : α ) :

The multinomial coefficient. Gives the number of strings consisting of symbols from s, where c ∈ s appears with multiplicity f c.

Defined as (∑ i in s, f i)! / ∏ i in s, (f i)!.

Equations
theorem nat.multinomial_pos {α : Type u_1} (s : finset α) (f : α ) :
theorem nat.multinomial_spec {α : Type u_1} (s : finset α) (f : α ) :
s.prod (λ (i : α), (f i).factorial) * nat.multinomial s f = (s.sum (λ (i : α), f i)).factorial
@[simp]
theorem nat.multinomial_nil {α : Type u_1} (f : α ) :
@[simp]
theorem nat.multinomial_singleton {α : Type u_1} (f : α ) {a : α} :
@[simp]
theorem nat.multinomial_insert_one {α : Type u_1} (s : finset α) (f : α ) {a : α} [decidable_eq α] (h : a s) (h₁ : f a = 1) :
theorem nat.multinomial_insert {α : Type u_1} (s : finset α) (f : α ) {a : α} [decidable_eq α] (h : a s) :
theorem nat.multinomial_congr {α : Type u_1} (s : finset α) {f g : α } (h : (a : α), a s f a = g a) :

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 : α} [decidable_eq α] (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 : α} [decidable_eq α] (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 : α} [decidable_eq α] (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 : α} [decidable_eq α] (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 : α} [decidable_eq α] (h : a b) :
theorem nat.succ_mul_binomial {α : Type u_1} (f : α ) {a b : α} [decidable_eq α] (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 #

Alternative definitions #

def finsupp.multinomial {α : Type u_1} (f : α →₀ ) :

Alternative multinomial definition based on a finsupp, using the support for the big operations

Equations
theorem finsupp.multinomial_update {α : Type u_1} (a : α) (f : α →₀ ) :
f.multinomial = (f.sum (λ (_x : α), id)).choose (f a) * (f.update a 0).multinomial
noncomputable def multiset.multinomial {α : Type u_1} (m : multiset α) :

Alternative definition of multinomial based on multiset delegating to the finsupp definition

Equations

Multinomial theorem #

theorem finset.sum_pow_of_commute {α : Type u_1} [decidable_eq α] (s : finset α) {R : Type u_2} [semiring R] (x : α R) (hc : s.pairwise (λ (i j : α), commute (x i) (x j))) (n : ) :

The multinomial theorem

Proof is by induction on the number of summands.

theorem finset.sum_pow {α : Type u_1} [decidable_eq α] (s : finset α) {R : Type u_2} [comm_semiring R] (x : α R) (n : ) :
s.sum x ^ n = (s.sym n).sum (λ (k : sym α n), (k.val.multinomial) * (multiset.map x k.val).prod)