Documentation

CslibFrontier.Foundations.Combinatorics.BinomialTail

Hoeffding's inequality for the biased binomial distribution #

For a Bernoulli trial with parameter p ∈ [0, 1], the centered moment generating function (1 - p) exp (-s p) + p exp (s (1 - p)) is bounded above by exp (s² / 8) for every s : ℝ (Cslib.one_sub_mul_exp_add_mul_exp_le), by Mathlib’s bounded-variable sub-Gaussian estimate. The binomial theorem gives the centered MGF identity (Cslib.sum_choose_mul_pow_mul_exp). Specializing finite-PMF concentration to independent coins and using the replicated Poisson-binomial law gives one-sided (Cslib.sum_filter_le_sub_choose_mul_pow_le, Cslib.sum_filter_le_mul_sub_choose_mul_pow_le) and two-sided (Cslib.sum_filter_le_abs_sub_choose_mul_pow_le) Hoeffding tail bounds for Bin(Q, p), together with the interval-complement form (Cslib.sum_filter_notMem_choose_mul_pow_le) used in Lemma 4.8 of [OpenAI2026ETH] at p = (r - 1) / (2 r). All tail inequalities hold for every Q : ℕ, including Q = 0.

For the unbiased case p = 1 / 2 in counting form on ι → Bool, see Cslib.BitString.card_filter_le_abs_card_filter_sub_half_le.

Main results #

References #

theorem Cslib.one_sub_mul_exp_add_mul_exp_le {p : ℝ} (hp₀ : 0 ≤ p) (hp₁ : p ≤ 1) (s : ℝ) :
(1 - p) * Real.exp (-s * p) + p * Real.exp (s * (1 - p)) ≤ Real.exp (s ^ 2 / 8)

Hoeffding's lemma for a biased Bernoulli trial [Hoeffding1963]: for p ∈ [0, 1] and s : ℝ, the centered moment generating function (1 - p) exp (-s p) + p exp (s (1 - p)) is at most exp (s² / 8). This specializes Cslib.Probability.PMF.sum_mul_exp_sub_mean_le to PMF.coin.

theorem Cslib.one_sub_add_mul_exp_le {p : ℝ} (hp₀ : 0 ≤ p) (hp₁ : p ≤ 1) (s : ℝ) :
1 - p + p * Real.exp s ≤ Real.exp (p * s + s ^ 2 / 8)

Uncentered Bernoulli moment generating function bound [Hoeffding1963]: for p ∈ [0, 1] and every s : ℝ, 1 - p + p * exp s ≤ exp (p * s + s² / 8). Obtained from one_sub_mul_exp_add_mul_exp_le by multiplying by exp (p * s).

theorem Cslib.sum_choose_mul_pow_eq_one (Q : ℕ) (p : ℝ) :
∑ k ∈ Finset.range (Q + 1), ↑(Q.choose k) * p ^ k * (1 - p) ^ (Q - k) = 1

The binomial weights C(Q, k) p^k (1 - p)^(Q - k) sum to 1.

theorem Cslib.sum_choose_mul_pow_mul_exp (Q : ℕ) (p s : ℝ) :
∑ k ∈ Finset.range (Q + 1), ↑(Q.choose k) * p ^ k * (1 - p) ^ (Q - k) * Real.exp (s * (↑k - ↑Q * p)) = ((1 - p) * Real.exp (-s * p) + p * Real.exp (s * (1 - p))) ^ Q

The centered binomial moment generating function: summing C(Q, k) p^k (1 - p)^(Q - k) exp (s (k - Q p)) over 0 ≤ k ≤ Q factors as the Q-th power of the single-trial moment generating function.

theorem Cslib.sum_filter_le_sub_choose_mul_pow_le (Q : ℕ) {p t : ℝ} (hp₀ : 0 ≤ p) (hp₁ : p ≤ 1) (ht : 0 ≤ t) :
∑ k ∈ Finset.range (Q + 1) with t ≤ ↑k - ↑Q * p, ↑(Q.choose k) * p ^ k * (1 - p) ^ (Q - k) ≤ Real.exp (-2 * t ^ 2 / ↑Q)

Upper-tail Hoeffding inequality for Bin(Q, p): for p ∈ [0, 1] and 0 ≤ t, the binomial probability mass on k - Q p ≥ t is at most exp (-2 t² / Q). At Q = 0 the right-hand side is exp 0 = 1.

theorem Cslib.sum_filter_le_mul_sub_choose_mul_pow_le (Q : ℕ) {p t : ℝ} (hp₀ : 0 ≤ p) (hp₁ : p ≤ 1) (ht : 0 ≤ t) :
∑ k ∈ Finset.range (Q + 1) with t ≤ ↑Q * p - ↑k, ↑(Q.choose k) * p ^ k * (1 - p) ^ (Q - k) ≤ Real.exp (-2 * t ^ 2 / ↑Q)

Lower-tail Hoeffding inequality for Bin(Q, p): for p ∈ [0, 1] and 0 ≤ t, the binomial probability mass on Q p - k ≥ t is at most exp (-2 t² / Q). Derived directly from Cslib.Probability.PMF.pi_sum_le_mean_sub.

theorem Cslib.sum_filter_le_abs_sub_choose_mul_pow_le (Q : ℕ) {p t : ℝ} (hp₀ : 0 ≤ p) (hp₁ : p ≤ 1) (ht : 0 ≤ t) :
∑ k ∈ Finset.range (Q + 1) with t ≤ |↑k - ↑Q * p|, ↑(Q.choose k) * p ^ k * (1 - p) ^ (Q - k) ≤ 2 * Real.exp (-2 * t ^ 2 / ↑Q)

Two-sided Hoeffding inequality for Bin(Q, p) [Hoeffding1963]: for p ∈ [0, 1] and 0 ≤ t, the binomial probability mass on |k - Q p| ≥ t is at most 2 exp (-2 t² / Q). Derived directly from Cslib.Probability.PMF.pi_sum_abs_sub_mean_ge.

theorem Cslib.sum_filter_notMem_choose_mul_pow_le (Q : ℕ) (I : Finset ℕ) {p t : ℝ} (hp₀ : 0 ≤ p) (hp₁ : p ≤ 1) (ht : 0 ≤ t) (hI : ∀ k ∈ Finset.range (Q + 1), |↑k - ↑Q * p| ≤ t → k ∈ I) :
∑ k ∈ Finset.range (Q + 1) with k ∉ I, ↑(Q.choose k) * p ^ k * (1 - p) ^ (Q - k) ≤ 2 * Real.exp (-2 * t ^ 2 / ↑Q)

Interval-complement Hoeffding bound for Bin(Q, p): if I contains every integer 0 ≤ k ≤ Q within t of the mean Q p, then the binomial mass outside I is at most 2 exp (-2 t² / Q).

theorem Cslib.choose_mul_pow_le_mode {n w : ℕ} {p : ℝ} (hw : w ≤ n) (hnp : ↑n * p = ↑w) (hp0 : 0 ≤ p) (hp1 : p ≤ 1) {k : ℕ} (hk : k ≤ n) :
↑(n.choose k) * p ^ k * (1 - p) ^ (n - k) ≤ ↑(n.choose w) * p ^ w * (1 - p) ^ (n - w)

The mode of the binomial distribution: when n p = w is an integer, the weight C(n, k) p ^ k (1 - p) ^ (n - k) of Bin(n, p) is largest at k = w. Consecutive weights satisfy t (k + 1) (k + 1) (1 - p) = t k (n - k) p, so they increase up to w and decrease after it.