The binomial law #
Distribution.binomial n p is the law of the number of successes in n independent trials of
success probability p: a distribution on {0, …, n} (Fin (n + 1)) with weight
C(n, k) p^k (1 - p)^(n - k) at k. Its weights are those of Mathlib's binomial distribution
ProbabilityTheory.binomial (Distribution.binomial_weight_eq), and it is the law of the number
of heads of independent Bernoulli(p) coins indexed by any finite type with n elements
(Distribution.independent_bernoulli_map_countFin, Distribution.independent_bernoulli_map_card),
so its mean is n p (Distribution.binomial_expect_val). The number of elements with a property
is countFin, an element of {0, …, n}.
Two facts used on the way are stated in general: the indicator of an event is a Bernoulli coin
with the probability of the event (Distribution.map_decide_eq_bernoulli), and an independent
product transported coordinatewise is the independent product of the transported coordinates
(Distribution.independent_map_pi).
The number of elements of a finite type ι with the property P, as an element of
{0, …, |ι|}.
Equations
- Dynamics.countFin P = ⟨(Finset.filter P Finset.univ).card, ⋯⟩
Instances For
The binomial law Bin(n, p) on {0, …, n}: weight C(n, k) p^k (1 - p)^(n - k) at
k, the law of the number of successes in n independent trials of success probability
p.
Equations
Instances For
The weights of binomial n p are those of Mathlib's binomial distribution Bin(n, p) on
ℕ (ProbabilityTheory.binomial, with p in the unit interval).
The indicator of an event P is a Bernoulli coin with the probability of P.
An independent product transported coordinatewise, by f i on coordinate i, is the
independent product of the transported coordinates.
Exactly C(|ι|, k) maps ι → Bool take the value true k times.
The number of heads is binomial. The number of heads of independent Bernoulli(p) coins
indexed by a finite type ι has the binomial law Bin(|ι|, p).
independent_bernoulli_map_countFin for a finite type with m elements, the number of heads
counted in {0, …, m}.