Poisson binomial distribution
DefinitionBernoulli random variable#✓fully proved
Let \(\mu\) be a measure on a measurable space \(\Omega\), let \(X : \Omega \to \mathbb{N}\) and let \(p\) be a real number. Then \(X\) is a Bernoulli random variable with parameter \(p\) under \(\mu\) when \(0 \le p \le 1\), \(X\) is \(\mu\)-almost everywhere measurable, and the pushforward of \(\mu\) along \(X\) is the Bernoulli distribution \(p\,\delta_1 + (1 - p)\,\delta_0\) on \(\mathbb{N}\), which gives mass \(p\) to \(1\), mass \(1 - p\) to \(0\) and no mass elsewhere.
def IsBernoulliRV {Ω : Type*} [MeasurableSpace Ω]
(X : Ω → ℕ) (μ : Measure Ω) (p : ℝ) : Prop :=
∃ hp : p ∈ Set.Icc (0 : ℝ) 1, HasLaw X (bernoulliMeasure 1 0 ⟨p, hp⟩) μ
Used by 8
LemmaBernoulli parameters are nonnegative#✓fully proved
If \(X\) is a Bernoulli random variable with parameter \(p\) under a measure \(\mu\), then \(0 \le p\).
lemma IsBernoulliRV.nonneg (hX : IsBernoulliRV X μ p) : 0 ≤ p
def IsBernoulliRV {Ω : Type*} [MeasurableSpace Ω]
(X : Ω → ℕ) (μ : Measure Ω) (p : ℝ) : Prop :=
∃ hp : p ∈ Set.Icc (0 : ℝ) 1, HasLaw X (bernoulliMeasure 1 0 ⟨p, hp⟩) μ
MathlibExt/Probability/BernoulliSumPmf.lean:65
LemmaBernoulli parameters are at most one#✓fully proved
If \(X\) is a Bernoulli random variable with parameter \(p\) under a measure \(\mu\), then \(p \le 1\).
lemma IsBernoulliRV.le_one (hX : IsBernoulliRV X μ p) : p ≤ 1
def IsBernoulliRV {Ω : Type*} [MeasurableSpace Ω]
(X : Ω → ℕ) (μ : Measure Ω) (p : ℝ) : Prop :=
∃ hp : p ∈ Set.Icc (0 : ℝ) 1, HasLaw X (bernoulliMeasure 1 0 ⟨p, hp⟩) μ
MathlibExt/Probability/BernoulliSumPmf.lean:65
LemmaLaw of a Bernoulli random variable#✓fully proved
If \(X : \Omega \to \mathbb{N}\) is a Bernoulli random variable with parameter \(p\) under a measure \(\mu\), then \(X\) is \(\mu\)-almost everywhere measurable and its law under \(\mu\), the pushforward of \(\mu\) along \(X\), is the Bernoulli distribution \(p\,\delta_1 + (1 - p)\,\delta_0\) on \(\mathbb{N}\).
lemma IsBernoulliRV.hasLaw (hX : IsBernoulliRV X μ p) :
HasLaw X (bernoulliMeasure 1 0 ⟨p, hX.nonneg, hX.le_one⟩) μ
def IsBernoulliRV {Ω : Type*} [MeasurableSpace Ω]
(X : Ω → ℕ) (μ : Measure Ω) (p : ℝ) : Prop :=
∃ hp : p ∈ Set.Icc (0 : ℝ) 1, HasLaw X (bernoulliMeasure 1 0 ⟨p, hp⟩) μ
MathlibExt/Probability/BernoulliSumPmf.lean:65
Uses 3 · Used by 2
LemmaProbability that a Bernoulli variable equals zero#✓fully proved
If \(X : \Omega \to \mathbb{N}\) is a Bernoulli random variable with parameter \(p\) under a measure \(\mu\), then \(\mu(\{\omega : X(\omega) = 0\}) = 1 - p\), as an extended nonnegative real.
lemma IsBernoulliRV.measure_zero (hX : IsBernoulliRV X μ p) :
μ (X ⁻¹' {0}) = ENNReal.ofReal (1 - p)
def IsBernoulliRV {Ω : Type*} [MeasurableSpace Ω]
(X : Ω → ℕ) (μ : Measure Ω) (p : ℝ) : Prop :=
∃ hp : p ∈ Set.Icc (0 : ℝ) 1, HasLaw X (bernoulliMeasure 1 0 ⟨p, hp⟩) μ
MathlibExt/Probability/BernoulliSumPmf.lean:65
Uses 4 · Used by 1
LemmaProbability that a Bernoulli variable equals one#✓fully proved
If \(X : \Omega \to \mathbb{N}\) is a Bernoulli random variable with parameter \(p\) under a measure \(\mu\), then \(\mu(\{\omega : X(\omega) = 1\}) = p\), as an extended nonnegative real.
lemma IsBernoulliRV.measure_one (hX : IsBernoulliRV X μ p) :
μ (X ⁻¹' {1}) = ENNReal.ofReal p
def IsBernoulliRV {Ω : Type*} [MeasurableSpace Ω]
(X : Ω → ℕ) (μ : Measure Ω) (p : ℝ) : Prop :=
∃ hp : p ∈ Set.Icc (0 : ℝ) 1, HasLaw X (bernoulliMeasure 1 0 ⟨p, hp⟩) μ
MathlibExt/Probability/BernoulliSumPmf.lean:65
Uses 4 · Used by 1
TheoremDistribution of a sum of independent Bernoulli variables#✓fully proved
Let \(\mu\) be a probability measure on a measurable space \(\Omega\), let \(m \in \mathbb{N}\), and let \(X_1, \dots, X_m : \Omega \to \mathbb{N}\) be measurable, mutually independent random variables such that each \(X_i\) is a Bernoulli random variable with real parameter \(p_i\) under \(\mu\). Then for every \(j \in \mathbb{N}\) the probability that \(X_1 + \dots + X_m = j\) equals
This is the Poisson binomial distribution.
theorem bernoulli_sum_pmf
{Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ]
{m : ℕ} {X : Fin m → Ω → ℕ} {p : Fin m → ℝ}
(hBernoulli : ∀ i, IsBernoulliRV (X i) μ (p i))
(hIndep : iIndepFun X μ)
(hMeas : ∀ i, Measurable (X i))
(j : ℕ) :
(μ ((fun ω => ∑ i : Fin m, X i ω) ⁻¹' {↑j})).toReal =
∑ A ∈ Finset.univ.powersetCard j,
(∏ i ∈ A, p i) * (∏ i ∈ Finset.univ \ A, (1 - p i))
def IsBernoulliRV {Ω : Type*} [MeasurableSpace Ω]
(X : Ω → ℕ) (μ : Measure Ω) (p : ℝ) : Prop :=
∃ hp : p ∈ Set.Icc (0 : ℝ) 1, HasLaw X (bernoulliMeasure 1 0 ⟨p, hp⟩) μ
MathlibExt/Probability/BernoulliSumPmf.lean:65
Uses 5 · Used by 2
TheoremBinomial distribution of a sum of i.i.d. Bernoulli variables#✓fully proved
Let \(\mu\) be a probability measure on a measurable space \(\Omega\), let \(m \in \mathbb{N}\), let \(p\) be a real number, and let \(X_1, \dots, X_m : \Omega \to \mathbb{N}\) be measurable, mutually independent random variables, each a Bernoulli random variable with parameter \(p\) under \(\mu\). Then for every \(j \in \mathbb{N}\) the probability that \(X_1 + \dots + X_m = j\) is \(\binom{m}{j} p^j (1 - p)^{m - j}\), where the exponent \(m - j\) is taken to be \(0\) when \(j > m\).
theorem bernoulli_sum_pmf_iid
{Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ]
{m : ℕ} {X : Fin m → Ω → ℕ} {p : ℝ}
(hBernoulli : ∀ i, IsBernoulliRV (X i) μ p)
(hIndep : iIndepFun X μ)
(hMeas : ∀ i, Measurable (X i))
(j : ℕ) :
(μ ((fun ω => ∑ i : Fin m, X i ω) ⁻¹' {↑j})).toReal =
(m.choose j : ℝ) * p ^ j * (1 - p) ^ (m - j)
def IsBernoulliRV {Ω : Type*} [MeasurableSpace Ω]
(X : Ω → ℕ) (μ : Measure Ω) (p : ℝ) : Prop :=
∃ hp : p ∈ Set.Icc (0 : ℝ) 1, HasLaw X (bernoulliMeasure 1 0 ⟨p, hp⟩) μ
MathlibExt/Probability/BernoulliSumPmf.lean:65
Uses 2
DefinitionPoisson-binomial mass function#✓fully proved
Poisson-binomial mass function of the number of successes among independent trials with
success probabilities p : Fin m → ℝ:
∑_{A ⊆ [m], |A| = j} ∏_{i ∈ A} p i ∏_{i ∉ A} (1 - p i). A probability mass function when
every p i ∈ [0, 1]; the algebraic identities below hold for all real p.
noncomputable def poissonBinomialPMF {m : ℕ} (p : Fin m → ℝ) (j : ℕ) : ℝ :=
∑ A ∈ (univ : Finset (Fin m)).powersetCard j, (∏ i ∈ A, p i) * ∏ i ∈ univ \ A, (1 - p i)
Used by 14
DefinitionUpper tail of the Poisson-binomial law#✓fully proved
Upper tail P(S ≥ k) = ∑_{k ≤ j ≤ m} P(S = j) of the Poisson-binomial law (the mass
function vanishes above m).
noncomputable def poissonBinomialTail {m : ℕ} (p : Fin m → ℝ) (k : ℕ) : ℝ :=
∑ j ∈ Icc k m, poissonBinomialPMF p j
noncomputable def poissonBinomialPMF {m : ℕ} (p : Fin m → ℝ) (j : ℕ) : ℝ :=
∑ A ∈ (univ : Finset (Fin m)).powersetCard j, (∏ i ∈ A, p i) * ∏ i ∈ univ \ A, (1 - p i)
MathlibExt/Probability/Distributions/PoissonBinomial.lean:71
Uses 1 · Used by 5
TheoremNonnegativity of the Poisson-binomial mass function#✓fully proved
The Poisson-binomial mass function is nonnegative for probabilities in [0, 1].
theorem poissonBinomialPMF_nonneg {m : ℕ} {p : Fin m → ℝ} (hp : ∀ i, p i ∈ Set.Icc (0 : ℝ) 1)
(j : ℕ) :
0 ≤ poissonBinomialPMF p j
noncomputable def poissonBinomialPMF {m : ℕ} (p : Fin m → ℝ) (j : ℕ) : ℝ :=
∑ A ∈ (univ : Finset (Fin m)).powersetCard j, (∏ i ∈ A, p i) * ∏ i ∈ univ \ A, (1 - p i)
MathlibExt/Probability/Distributions/PoissonBinomial.lean:71
Uses 1 · Used by 1
TheoremPoisson-binomial mass vanishes above the number of trials#✓fully proved
The Poisson-binomial mass function vanishes above the number of trials.
theorem poissonBinomialPMF_eq_zero_of_lt {m : ℕ} (p : Fin m → ℝ) {j : ℕ} (hj : m < j) :
poissonBinomialPMF p j = 0
noncomputable def poissonBinomialPMF {m : ℕ} (p : Fin m → ℝ) (j : ℕ) : ℝ :=
∑ A ∈ (univ : Finset (Fin m)).powersetCard j, (∏ i ∈ A, p i) * ∏ i ∈ univ \ A, (1 - p i)
MathlibExt/Probability/Distributions/PoissonBinomial.lean:71
TheoremPoisson-binomial mass at zero after adding a trial#✓fully proved
Adding a trial with probability a: no successes requires a failure of the new trial.
theorem poissonBinomialPMF_cons_zero {m : ℕ} (a : ℝ) (q : Fin m → ℝ) :
poissonBinomialPMF (Fin.cons a q : Fin (m + 1) → ℝ) 0 = (1 - a) * poissonBinomialPMF q 0
noncomputable def poissonBinomialPMF {m : ℕ} (p : Fin m → ℝ) (j : ℕ) : ℝ :=
∑ A ∈ (univ : Finset (Fin m)).powersetCard j, (∏ i ∈ A, p i) * ∏ i ∈ univ \ A, (1 - p i)
MathlibExt/Probability/Distributions/PoissonBinomial.lean:71
Uses 1 · Used by 2
TheoremFirst-step recurrence for the Poisson-binomial mass function#✓fully proved
Adding a trial with probability a: first-step decomposition of the mass function,
P(S' = j + 1) = a P(S = j) + (1 - a) P(S = j + 1).
theorem poissonBinomialPMF_cons_succ {m : ℕ} (a : ℝ) (q : Fin m → ℝ) (j : ℕ) :
poissonBinomialPMF (Fin.cons a q : Fin (m + 1) → ℝ) (j + 1) =
a * poissonBinomialPMF q j + (1 - a) * poissonBinomialPMF q (j + 1)
noncomputable def poissonBinomialPMF {m : ℕ} (p : Fin m → ℝ) (j : ℕ) : ℝ :=
∑ A ∈ (univ : Finset (Fin m)).powersetCard j, (∏ i ∈ A, p i) * ∏ i ∈ univ \ A, (1 - p i)
MathlibExt/Probability/Distributions/PoissonBinomial.lean:71
Uses 1 · Used by 3
TheoremPoisson-binomial masses sum to one#✓fully proved
The Poisson-binomial masses sum to one (an identity for all real p; it is the expansion
of ∏ ((1 - p i) + p i) = 1).
theorem sum_poissonBinomialPMF {m : ℕ} (p : Fin m → ℝ) :
∑ j ∈ range (m + 1), poissonBinomialPMF p j = 1
noncomputable def poissonBinomialPMF {m : ℕ} (p : Fin m → ℝ) (j : ℕ) : ℝ :=
∑ A ∈ (univ : Finset (Fin m)).powersetCard j, (∏ i ∈ A, p i) * ∏ i ∈ univ \ A, (1 - p i)
MathlibExt/Probability/Distributions/PoissonBinomial.lean:71
Uses 4 · Used by 2
TheoremPeeling off the lowest term of the Poisson-binomial tail#✓fully proved
Peeling off the lowest term of the tail: P(S ≥ k) = P(S = k) + P(S ≥ k + 1).
theorem poissonBinomialTail_eq_add {m : ℕ} (q : Fin m → ℝ) (k : ℕ) :
poissonBinomialTail q k = poissonBinomialPMF q k + poissonBinomialTail q (k + 1)
noncomputable def poissonBinomialTail {m : ℕ} (p : Fin m → ℝ) (k : ℕ) : ℝ :=
∑ j ∈ Icc k m, poissonBinomialPMF p j
MathlibExt/Probability/Distributions/PoissonBinomial.lean:76
noncomputable def poissonBinomialPMF {m : ℕ} (p : Fin m → ℝ) (j : ℕ) : ℝ :=
∑ A ∈ (univ : Finset (Fin m)).powersetCard j, (∏ i ∈ A, p i) * ∏ i ∈ univ \ A, (1 - p i)
MathlibExt/Probability/Distributions/PoissonBinomial.lean:71
Uses 3 · Used by 2
TheoremPoisson-binomial tail after adding a trial#✓fully proved
Adding a trial with probability a raises the upper tail by exactly a P(S = k):
P(S' ≥ k + 1) = P(S ≥ k + 1) + a P(S = k). So the tail is affine in each trial's probability,
with nonnegative slope a point mass of the remaining trials.
theorem poissonBinomialTail_cons_succ {m : ℕ} (a : ℝ) (q : Fin m → ℝ) (k : ℕ) :
poissonBinomialTail (Fin.cons a q : Fin (m + 1) → ℝ) (k + 1) =
poissonBinomialTail q (k + 1) + a * poissonBinomialPMF q k
noncomputable def poissonBinomialTail {m : ℕ} (p : Fin m → ℝ) (k : ℕ) : ℝ :=
∑ j ∈ Icc k m, poissonBinomialPMF p j
MathlibExt/Probability/Distributions/PoissonBinomial.lean:76
noncomputable def poissonBinomialPMF {m : ℕ} (p : Fin m → ℝ) (j : ℕ) : ℝ :=
∑ A ∈ (univ : Finset (Fin m)).powersetCard j, (∏ i ∈ A, p i) * ∏ i ∈ univ \ A, (1 - p i)
MathlibExt/Probability/Distributions/PoissonBinomial.lean:71
TheoremThe burden-test p-value is monotone in every background rate#✓fully proved
If p i ≤ q i for all
i, with all probabilities in [0, 1], then P_p(S ≥ k) ≤ P_q(S ≥ k).
theorem poissonBinomialTail_mono {m : ℕ} {p q : Fin m → ℝ} (hp : ∀ i, p i ∈ Set.Icc (0 : ℝ) 1)
(hq : ∀ i, q i ∈ Set.Icc (0 : ℝ) 1) (hpq : ∀ i, p i ≤ q i) (k : ℕ) :
poissonBinomialTail p k ≤ poissonBinomialTail q k
noncomputable def poissonBinomialTail {m : ℕ} (p : Fin m → ℝ) (k : ℕ) : ℝ :=
∑ j ∈ Icc k m, poissonBinomialPMF p j
MathlibExt/Probability/Distributions/PoissonBinomial.lean:76
Uses 6 · Used by 1
TheoremPoisson-binomial law with equal probabilities is binomial#✓fully proved
With equal probabilities the Poisson-binomial law is the binomial law.
theorem poissonBinomialPMF_const {m : ℕ} (a : ℝ) (j : ℕ) :
poissonBinomialPMF (fun _ : Fin m => a) j = (m.choose j : ℝ) * a ^ j * (1 - a) ^ (m - j)
noncomputable def poissonBinomialPMF {m : ℕ} (p : Fin m → ℝ) (j : ℕ) : ℝ :=
∑ A ∈ (univ : Finset (Fin m)).powersetCard j, (∏ i ∈ A, p i) * ∏ i ∈ univ \ A, (1 - p i)
MathlibExt/Probability/Distributions/PoissonBinomial.lean:71
Uses 1 · Used by 1
TheoremBinomial tail monotonicity#✓fully proved
For 0 ≤ p ≤ q ≤ 1,
∑_{k ≤ j ≤ n} C(n, j) p^j (1 - p)^{n - j} ≤ ∑_{k ≤ j ≤ n} C(n, j) q^j (1 - q)^{n - j}.
TheoremBinomial upper tail is monotone in the success probability#✓fully proved
The upper tail Bin(n, p)([k, ∞)) of Mathlib's binomial law is monotone in p.
theorem binomial_real_Ici_mono (n k : ℕ) :
Monotone fun p : unitInterval => (binomial n p).real (Set.Ici k)
Uses 1
TheoremTail of a sum of independent Bernoulli variables is Poisson-binomial#✓fully proved
For independent Bernoulli variables X i with parameters p i, the one-sided burden
p-value P(∑ X i ≥ k) is the Poisson-binomial tail.
theorem measure_le_sum_eq_poissonBinomialTail {m : ℕ}
{Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ]
{X : Fin m → Ω → ℕ} {p : Fin m → ℝ}
(hBernoulli : ∀ i, IsBernoulliRV (X i) μ (p i)) (hIndep : iIndepFun X μ)
(hMeas : ∀ i, Measurable (X i)) (k : ℕ) :
(μ {ω | k ≤ ∑ i, X i ω}).toReal = poissonBinomialTail p k
def IsBernoulliRV {Ω : Type*} [MeasurableSpace Ω]
(X : Ω → ℕ) (μ : Measure Ω) (p : ℝ) : Prop :=
∃ hp : p ∈ Set.Icc (0 : ℝ) 1, HasLaw X (bernoulliMeasure 1 0 ⟨p, hp⟩) μ
MathlibExt/Probability/BernoulliSumPmf.lean:65
noncomputable def poissonBinomialTail {m : ℕ} (p : Fin m → ℝ) (k : ℕ) : ℝ :=
∑ j ∈ Icc k m, poissonBinomialPMF p j
MathlibExt/Probability/Distributions/PoissonBinomial.lean:76
TheoremLe Cam's inequality, finite truncations#✓fully proved
For probabilities p i ∈ [0, 1] and
λ = ∑ p i, every partial sum of ∑_j |P(S = j) - e^{-λ} λ^j / j!| is at most 2 ∑ (p i)².
theorem sum_range_abs_poissonBinomialPMF_sub_poisson_le {m : ℕ} {p : Fin m → ℝ}
(hp : ∀ i, p i ∈ Set.Icc (0 : ℝ) 1) (N : ℕ) :
∑ j ∈ range N, |poissonBinomialPMF p j - exp (-∑ i, p i) * (∑ i, p i) ^ j / (j ! : ℝ)| ≤
2 * ∑ i, p i ^ 2
noncomputable def poissonBinomialPMF {m : ℕ} (p : Fin m → ℝ) (j : ℕ) : ℝ :=
∑ A ∈ (univ : Finset (Fin m)).powersetCard j, (∏ i ∈ A, p i) * ∏ i ∈ univ \ A, (1 - p i)
MathlibExt/Probability/Distributions/PoissonBinomial.lean:71
Uses 4 · Used by 1
TheoremLe Cam's inequality#✓fully proved
Le Cam's inequality (Le Cam 1960): the series ∑_j |P(S = j) - e^{-λ} λ^j / j!| is
summable and its sum is at most 2 ∑ (p i)², where λ = ∑ p i.
theorem tsum_abs_poissonBinomialPMF_sub_poisson_le {m : ℕ} {p : Fin m → ℝ}
(hp : ∀ i, p i ∈ Set.Icc (0 : ℝ) 1) :
Summable (fun j : ℕ =>
|poissonBinomialPMF p j - exp (-∑ i, p i) * (∑ i, p i) ^ j / (j ! : ℝ)|) ∧
∑' j : ℕ, |poissonBinomialPMF p j - exp (-∑ i, p i) * (∑ i, p i) ^ j / (j ! : ℝ)| ≤
2 * ∑ i, p i ^ 2
noncomputable def poissonBinomialPMF {m : ℕ} (p : Fin m → ℝ) (j : ℕ) : ℝ :=
∑ A ∈ (univ : Finset (Fin m)).powersetCard j, (∏ i ∈ A, p i) * ∏ i ∈ univ \ A, (1 - p i)
MathlibExt/Probability/Distributions/PoissonBinomial.lean:71
Uses 2
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.