Berry–Esseen theorem:
OpenBerryEsseenFeller.berry_esseenThis is the Berry–Esseen theorem, the classical quantitative form of the central limit theorem, in the version with the explicit constant proved in Feller's and Durrett's textbooks.
Let be independent and identically distributed real random variables on a probability space such that
For let be the distribution function of the normalized sum,
and let be the standard normal distribution function. Then for every and every real ,
The central limit theorem only asserts that . The Berry–Esseen theorem turns this into an explicit error bound of order that is uniform in and depends on the common distribution only through the ratio ; the order cannot be improved in general (for instance for symmetric steps). It is the standard tool for quantifying normal approximations of sums of independent variables. Smaller admissible values of the absolute constant are known; the constant is the one in the cited textbook statements.
Formalization Note The sequence is X : ℕ → Ω → ℝ indexed from , so of the text is X (k - 1) and is ∑ i ∈ Finset.range n, X i ω. The i.i.d. assumption is iIndepFun X P together with IdentDistrib (X i) (X 0) P P for every i, exactly as in Mathlib's central limit theorem ProbabilityTheory.tendstoInDistribution_inv_sqrt_mul_sum_sub. Finiteness of the third absolute moment is the hypothesis that is integrable; on a probability space this also makes and integrable, so the Bochner integrals in the hypotheses and are genuine expectations, and is named by the hypothesis . is ProbabilityTheory.cdf of the law P.map of the normalized sum, and is cdf (gaussianReal 0 1). The hypotheses and are part of the source statement and are needed: for Lean's convention would make the right-hand side .
import Mathlib open MeasureTheory ProbabilityTheory
namespace BerryEsseenFeller
/-- **Berry–Esseen theorem** with Feller's constant `3` (Feller, Vol. II, Ch. XVI, §5, Theorem 1;
Durrett, *Probability: Theory and Examples*, 5th ed., Theorem 3.4.17).
`X 0, X 1, …` are i.i.d. real random variables (`iIndepFun` plus `IdentDistrib (X i) (X 0)`) with
`E X = 0`, `E X² = σ²`, `σ > 0`, and `E|X|³ = ρ < ∞`. For every `n ≥ 1` and every real `x`, the
distribution function of `(X 0 + ⋯ + X (n - 1)) / (σ √n)` (the `cdf` of its law `P.map _`) differs
from the standard normal distribution function `cdf (gaussianReal 0 1)` at `x` by at most
`3 ρ / (σ³ √n)`. -/
theorem berry_esseen {Ω : Type*} [MeasurableSpace Ω] {P : Measure Ω} [IsProbabilityMeasure P]
{X : ℕ → Ω → ℝ} (hindep : iIndepFun X P) (hident : ∀ i, IdentDistrib (X i) (X 0) P P)
{σ ρ : ℝ} (hσ : 0 < σ) (h3 : Integrable (fun ω => |X 0 ω| ^ 3) P)
(hmean : ∫ ω, X 0 ω ∂P = 0) (hvar : ∫ ω, X 0 ω ^ 2 ∂P = σ ^ 2)
(hρ : ∫ ω, |X 0 ω| ^ 3 ∂P = ρ) (n : ℕ) (hn : 0 < n) (x : ℝ) :
|cdf (P.map (fun ω => (∑ i ∈ Finset.range n, X i ω) / (σ * √(n : ℝ)))) x
- cdf (gaussianReal 0 1) x| ≤ 3 * ρ / (σ ^ 3 * √(n : ℝ)) := by sorry
end BerryEsseenFeller