Documentation

Mathlib.Probability.StrongLaw

The strong law of large numbers #

We prove the strong law of large numbers, in ProbabilityTheory.strong_law_ae: If X n is a sequence of independent identically distributed integrable random variables, then ∑ i ∈ range n, X i / n converges almost surely to 𝔼[X 0]. We give here the strong version, due to Etemadi, that only requires pairwise independence.

This file also contains the Lᵖ version of the strong law of large numbers provided by ProbabilityTheory.strong_law_Lp which shows ∑ i ∈ range n, X i / n converges in Lᵖ to 𝔼[X 0] provided X n is independent identically distributed and is Lᵖ.

Implementation #

The main point is to prove the result for real-valued random variables, as the general case of Banach-space valued random variables follows from this case and approximation by simple functions. The real version is given in ProbabilityTheory.strong_law_ae_real.

We follow the proof by Etemadi Etemadi, An elementary proof of the strong law of large numbers, which goes as follows.

It suffices to prove the result for nonnegative X, as one can prove the general result by splitting a general X into its positive part and negative part. Consider Xₙ a sequence of nonnegative integrable identically distributed pairwise independent random variables. Let Yₙ be the truncation of Xₙ up to n. We claim that

  ∑_k ℙ (|∑_{i=0}^{c^k - 1} Yᵢ - 𝔼[Yᵢ]| > c^k ε)
    ≤ ∑_k (c^k ε)^{-2} ∑_{i=0}^{c^k - 1} Var[Yᵢ]    (by Markov inequality)
    ≤ ∑_i (C/i^2) Var[Yᵢ]                           (as ∑_{c^k > i} 1/(c^k)^2 ≤ C/i^2)
    ≤ ∑_i (C/i^2) 𝔼[Yᵢ^2]
    ≤ 2C 𝔼[X^2]                                     (see `sum_variance_truncation_le`)

Prerequisites on truncations #

def ProbabilityTheory.truncation {α : Type u_1} (f : α) (A : ) :
α

Truncating a real-valued function to the interval (-A, A].

Equations
Instances For
    theorem ProbabilityTheory.abs_truncation_le_bound {α : Type u_1} (f : α) (A : ) (x : α) :
    @[simp]
    theorem ProbabilityTheory.abs_truncation_le_abs_self {α : Type u_1} (f : α) (A : ) (x : α) :
    theorem ProbabilityTheory.truncation_eq_self {α : Type u_1} {f : α} {A : } {x : α} (h : |f x| < A) :
    theorem ProbabilityTheory.truncation_eq_of_nonneg {α : Type u_1} {f : α} {A : } (h : ∀ (x : α), 0 f x) :
    ProbabilityTheory.truncation f A = (Set.Ioc 0 A).indicator id f
    theorem ProbabilityTheory.truncation_nonneg {α : Type u_1} {f : α} (A : ) {x : α} (h : 0 f x) :
    theorem ProbabilityTheory.moment_truncation_eq_intervalIntegral {α : Type u_1} {m : MeasurableSpace α} {μ : MeasureTheory.Measure α} {f : α} (hf : MeasureTheory.AEStronglyMeasurable f μ) {A : } (hA : 0 A) {n : } (hn : n 0) :
    ∫ (x : α), ProbabilityTheory.truncation f A x ^ nμ = ∫ (y : ) in -A..A, y ^ nMeasureTheory.Measure.map f μ
    theorem ProbabilityTheory.moment_truncation_eq_intervalIntegral_of_nonneg {α : Type u_1} {m : MeasurableSpace α} {μ : MeasureTheory.Measure α} {f : α} (hf : MeasureTheory.AEStronglyMeasurable f μ) {A : } {n : } (hn : n 0) (h'f : 0 f) :
    ∫ (x : α), ProbabilityTheory.truncation f A x ^ nμ = ∫ (y : ) in 0 ..A, y ^ nMeasureTheory.Measure.map f μ
    theorem ProbabilityTheory.integral_truncation_eq_intervalIntegral {α : Type u_1} {m : MeasurableSpace α} {μ : MeasureTheory.Measure α} {f : α} (hf : MeasureTheory.AEStronglyMeasurable f μ) {A : } (hA : 0 A) :
    ∫ (x : α), ProbabilityTheory.truncation f A xμ = ∫ (y : ) in -A..A, yMeasureTheory.Measure.map f μ
    theorem ProbabilityTheory.integral_truncation_eq_intervalIntegral_of_nonneg {α : Type u_1} {m : MeasurableSpace α} {μ : MeasureTheory.Measure α} {f : α} (hf : MeasureTheory.AEStronglyMeasurable f μ) {A : } (h'f : 0 f) :
    ∫ (x : α), ProbabilityTheory.truncation f A xμ = ∫ (y : ) in 0 ..A, yMeasureTheory.Measure.map f μ
    theorem ProbabilityTheory.integral_truncation_le_integral_of_nonneg {α : Type u_1} {m : MeasurableSpace α} {μ : MeasureTheory.Measure α} {f : α} (hf : MeasureTheory.Integrable f μ) (h'f : 0 f) {A : } :
    ∫ (x : α), ProbabilityTheory.truncation f A xμ ∫ (x : α), f xμ
    theorem ProbabilityTheory.tendsto_integral_truncation {α : Type u_1} {m : MeasurableSpace α} {μ : MeasureTheory.Measure α} {f : α} (hf : MeasureTheory.Integrable f μ) :
    Filter.Tendsto (fun (A : ) => ∫ (x : α), ProbabilityTheory.truncation f A xμ) Filter.atTop (nhds (∫ (x : α), f xμ))

    If a function is integrable, then the integral of its truncated versions converges to the integral of the whole function.

    theorem ProbabilityTheory.sum_prob_mem_Ioc_le {Ω : Type u_1} [MeasureTheory.MeasureSpace Ω] [MeasureTheory.IsProbabilityMeasure MeasureTheory.volume] {X : Ω} (hint : MeasureTheory.Integrable X MeasureTheory.volume) (hnonneg : 0 X) {K : } {N : } (hKN : K N) :
    jFinset.range K, MeasureTheory.volume {ω : Ω | X ω Set.Ioc j N} ENNReal.ofReal ((∫ (a : Ω), X a) + 1)
    theorem ProbabilityTheory.tsum_prob_mem_Ioi_lt_top {Ω : Type u_1} [MeasureTheory.MeasureSpace Ω] [MeasureTheory.IsProbabilityMeasure MeasureTheory.volume] {X : Ω} (hint : MeasureTheory.Integrable X MeasureTheory.volume) (hnonneg : 0 X) :
    ∑' (j : ), MeasureTheory.volume {ω : Ω | X ω Set.Ioi j} <
    theorem ProbabilityTheory.sum_variance_truncation_le {Ω : Type u_1} [MeasureTheory.MeasureSpace Ω] [MeasureTheory.IsProbabilityMeasure MeasureTheory.volume] {X : Ω} (hint : MeasureTheory.Integrable X MeasureTheory.volume) (hnonneg : 0 X) (K : ) :
    jFinset.range K, (j ^ 2)⁻¹ * ∫ (a : Ω), (ProbabilityTheory.truncation X j ^ 2) a 2 * ∫ (a : Ω), X a

    Proof of the strong law of large numbers (almost sure version, assuming only pairwise independence) for nonnegative random variables, following Etemadi's proof.

    theorem ProbabilityTheory.strong_law_aux1 {Ω : Type u_1} [MeasureTheory.MeasureSpace Ω] [MeasureTheory.IsProbabilityMeasure MeasureTheory.volume] (X : Ω) (hint : MeasureTheory.Integrable (X 0) MeasureTheory.volume) (hindep : Pairwise fun (i j : ) => ProbabilityTheory.IndepFun (X i) (X j) MeasureTheory.volume) (hident : ∀ (i : ), ProbabilityTheory.IdentDistrib (X i) (X 0) MeasureTheory.volume MeasureTheory.volume) (hnonneg : ∀ (i : ) (ω : Ω), 0 X i ω) {c : } (c_one : 1 < c) {ε : } (εpos : 0 < ε) :
    ∀ᵐ (ω : Ω), ∀ᶠ (n : ) in Filter.atTop, |iFinset.range c ^ n⌋₊, ProbabilityTheory.truncation (X i) (↑i) ω - ∫ (a : Ω), (∑ iFinset.range c ^ n⌋₊, ProbabilityTheory.truncation (X i) i) a| < ε * c ^ n⌋₊

    The truncation of Xᵢ up to i satisfies the strong law of large numbers (with respect to the truncated expectation) along the sequence c^n, for any c > 1, up to a given ε > 0. This follows from a variance control.

    theorem ProbabilityTheory.strong_law_aux2 {Ω : Type u_1} [MeasureTheory.MeasureSpace Ω] [MeasureTheory.IsProbabilityMeasure MeasureTheory.volume] (X : Ω) (hint : MeasureTheory.Integrable (X 0) MeasureTheory.volume) (hindep : Pairwise fun (i j : ) => ProbabilityTheory.IndepFun (X i) (X j) MeasureTheory.volume) (hident : ∀ (i : ), ProbabilityTheory.IdentDistrib (X i) (X 0) MeasureTheory.volume MeasureTheory.volume) (hnonneg : ∀ (i : ) (ω : Ω), 0 X i ω) {c : } (c_one : 1 < c) :
    ∀ᵐ (ω : Ω), (fun (n : ) => iFinset.range c ^ n⌋₊, ProbabilityTheory.truncation (X i) (↑i) ω - ∫ (a : Ω), (∑ iFinset.range c ^ n⌋₊, ProbabilityTheory.truncation (X i) i) a) =o[Filter.atTop] fun (n : ) => c ^ n⌋₊
    theorem ProbabilityTheory.strong_law_aux3 {Ω : Type u_1} [MeasureTheory.MeasureSpace Ω] [MeasureTheory.IsProbabilityMeasure MeasureTheory.volume] (X : Ω) (hint : MeasureTheory.Integrable (X 0) MeasureTheory.volume) (hident : ∀ (i : ), ProbabilityTheory.IdentDistrib (X i) (X 0) MeasureTheory.volume MeasureTheory.volume) :
    (fun (n : ) => (∫ (a : Ω), (∑ iFinset.range n, ProbabilityTheory.truncation (X i) i) a) - n * ∫ (a : Ω), X 0 a) =o[Filter.atTop] Nat.cast

    The expectation of the truncated version of Xᵢ behaves asymptotically like the whole expectation. This follows from convergence and Cesàro averaging.

    theorem ProbabilityTheory.strong_law_aux4 {Ω : Type u_1} [MeasureTheory.MeasureSpace Ω] [MeasureTheory.IsProbabilityMeasure MeasureTheory.volume] (X : Ω) (hint : MeasureTheory.Integrable (X 0) MeasureTheory.volume) (hindep : Pairwise fun (i j : ) => ProbabilityTheory.IndepFun (X i) (X j) MeasureTheory.volume) (hident : ∀ (i : ), ProbabilityTheory.IdentDistrib (X i) (X 0) MeasureTheory.volume MeasureTheory.volume) (hnonneg : ∀ (i : ) (ω : Ω), 0 X i ω) {c : } (c_one : 1 < c) :
    ∀ᵐ (ω : Ω), (fun (n : ) => iFinset.range c ^ n⌋₊, ProbabilityTheory.truncation (X i) (↑i) ω - c ^ n⌋₊ * ∫ (a : Ω), X 0 a) =o[Filter.atTop] fun (n : ) => c ^ n⌋₊
    theorem ProbabilityTheory.strong_law_aux5 {Ω : Type u_1} [MeasureTheory.MeasureSpace Ω] [MeasureTheory.IsProbabilityMeasure MeasureTheory.volume] (X : Ω) (hint : MeasureTheory.Integrable (X 0) MeasureTheory.volume) (hident : ∀ (i : ), ProbabilityTheory.IdentDistrib (X i) (X 0) MeasureTheory.volume MeasureTheory.volume) (hnonneg : ∀ (i : ) (ω : Ω), 0 X i ω) :
    ∀ᵐ (ω : Ω), (fun (n : ) => iFinset.range n, ProbabilityTheory.truncation (X i) (↑i) ω - iFinset.range n, X i ω) =o[Filter.atTop] fun (n : ) => n

    The truncated and non-truncated versions of Xᵢ have the same asymptotic behavior, as they almost surely coincide at all but finitely many steps. This follows from a probability computation and Borel-Cantelli.

    theorem ProbabilityTheory.strong_law_aux6 {Ω : Type u_1} [MeasureTheory.MeasureSpace Ω] [MeasureTheory.IsProbabilityMeasure MeasureTheory.volume] (X : Ω) (hint : MeasureTheory.Integrable (X 0) MeasureTheory.volume) (hindep : Pairwise fun (i j : ) => ProbabilityTheory.IndepFun (X i) (X j) MeasureTheory.volume) (hident : ∀ (i : ), ProbabilityTheory.IdentDistrib (X i) (X 0) MeasureTheory.volume MeasureTheory.volume) (hnonneg : ∀ (i : ) (ω : Ω), 0 X i ω) {c : } (c_one : 1 < c) :
    ∀ᵐ (ω : Ω), Filter.Tendsto (fun (n : ) => (∑ iFinset.range c ^ n⌋₊, X i ω) / c ^ n⌋₊) Filter.atTop (nhds (∫ (a : Ω), X 0 a))
    theorem ProbabilityTheory.strong_law_aux7 {Ω : Type u_1} [MeasureTheory.MeasureSpace Ω] [MeasureTheory.IsProbabilityMeasure MeasureTheory.volume] (X : Ω) (hint : MeasureTheory.Integrable (X 0) MeasureTheory.volume) (hindep : Pairwise fun (i j : ) => ProbabilityTheory.IndepFun (X i) (X j) MeasureTheory.volume) (hident : ∀ (i : ), ProbabilityTheory.IdentDistrib (X i) (X 0) MeasureTheory.volume MeasureTheory.volume) (hnonneg : ∀ (i : ) (ω : Ω), 0 X i ω) :
    ∀ᵐ (ω : Ω), Filter.Tendsto (fun (n : ) => (∑ iFinset.range n, X i ω) / n) Filter.atTop (nhds (∫ (a : Ω), X 0 a))

    Xᵢ satisfies the strong law of large numbers along all integers. This follows from the corresponding fact along the sequences c^n, and the fact that any integer can be sandwiched between c^n and c^(n+1) with comparably small error if c is close enough to 1 (which is formalized in tendsto_div_of_monotone_of_tendsto_div_floor_pow).

    theorem ProbabilityTheory.strong_law_ae_real {Ω : Type u_2} [MeasureTheory.MeasureSpace Ω] (X : Ω) (hint : MeasureTheory.Integrable (X 0) MeasureTheory.volume) (hindep : Pairwise fun (i j : ) => ProbabilityTheory.IndepFun (X i) (X j) MeasureTheory.volume) (hident : ∀ (i : ), ProbabilityTheory.IdentDistrib (X i) (X 0) MeasureTheory.volume MeasureTheory.volume) :
    ∀ᵐ (ω : Ω), Filter.Tendsto (fun (n : ) => (∑ iFinset.range n, X i ω) / n) Filter.atTop (nhds (∫ (a : Ω), X 0 a))

    Strong law of large numbers, almost sure version: if X n is a sequence of independent identically distributed integrable real-valued random variables, then ∑ i ∈ range n, X i / n converges almost surely to 𝔼[X 0]. We give here the strong version, due to Etemadi, that only requires pairwise independence. Superseded by strong_law_ae, which works for random variables taking values in any Banach space.

    theorem ProbabilityTheory.strong_law_ae_simpleFunc_comp {Ω : Type u_1} [MeasureTheory.MeasureSpace Ω] [MeasureTheory.IsProbabilityMeasure MeasureTheory.volume] {E : Type u_2} [NormedAddCommGroup E] [NormedSpace E] [CompleteSpace E] [MeasurableSpace E] (X : ΩE) (h' : Measurable (X 0)) (hindep : Pairwise fun (i j : ) => ProbabilityTheory.IndepFun (X i) (X j) MeasureTheory.volume) (hident : ∀ (i : ), ProbabilityTheory.IdentDistrib (X i) (X 0) MeasureTheory.volume MeasureTheory.volume) (φ : MeasureTheory.SimpleFunc E E) :
    ∀ᵐ (ω : Ω), Filter.Tendsto (fun (n : ) => (↑n)⁻¹ iFinset.range n, φ (X i ω)) Filter.atTop (nhds (∫ (a : Ω), (φ X 0) a))

    Preliminary lemma for the strong law of large numbers for vector-valued random variables: the composition of the random variables with a simple function satisfies the strong law of large numbers.

    theorem ProbabilityTheory.strong_law_ae_of_measurable {Ω : Type u_1} [MeasureTheory.MeasureSpace Ω] [MeasureTheory.IsProbabilityMeasure MeasureTheory.volume] {E : Type u_2} [NormedAddCommGroup E] [NormedSpace E] [CompleteSpace E] [MeasurableSpace E] [BorelSpace E] (X : ΩE) (hint : MeasureTheory.Integrable (X 0) MeasureTheory.volume) (h' : MeasureTheory.StronglyMeasurable (X 0)) (hindep : Pairwise fun (i j : ) => ProbabilityTheory.IndepFun (X i) (X j) MeasureTheory.volume) (hident : ∀ (i : ), ProbabilityTheory.IdentDistrib (X i) (X 0) MeasureTheory.volume MeasureTheory.volume) :
    ∀ᵐ (ω : Ω), Filter.Tendsto (fun (n : ) => (↑n)⁻¹ iFinset.range n, X i ω) Filter.atTop (nhds (∫ (a : Ω), X 0 a))

    Preliminary lemma for the strong law of large numbers for vector-valued random variables, assuming measurability in addition to integrability. This is weakened to ae measurability in the full version ProbabilityTheory.strong_law_ae.

    theorem ProbabilityTheory.strong_law_ae {E : Type u_2} [NormedAddCommGroup E] [NormedSpace E] [CompleteSpace E] [MeasurableSpace E] [BorelSpace E] {Ω : Type u_3} [MeasureTheory.MeasureSpace Ω] (X : ΩE) (hint : MeasureTheory.Integrable (X 0) MeasureTheory.volume) (hindep : Pairwise fun (i j : ) => ProbabilityTheory.IndepFun (X i) (X j) MeasureTheory.volume) (hident : ∀ (i : ), ProbabilityTheory.IdentDistrib (X i) (X 0) MeasureTheory.volume MeasureTheory.volume) :
    ∀ᵐ (ω : Ω), Filter.Tendsto (fun (n : ) => (↑n)⁻¹ iFinset.range n, X i ω) Filter.atTop (nhds (∫ (a : Ω), X 0 a))

    Strong law of large numbers, almost sure version: if X n is a sequence of independent identically distributed integrable random variables taking values in a Banach space, then n⁻¹ • ∑ i ∈ range n, X i converges almost surely to 𝔼[X 0]. We give here the strong version, due to Etemadi, that only requires pairwise independence.

    theorem ProbabilityTheory.strong_law_Lp {Ω : Type u_1} [MeasureTheory.MeasureSpace Ω] {E : Type u_2} [NormedAddCommGroup E] [NormedSpace E] [CompleteSpace E] [MeasurableSpace E] [BorelSpace E] {p : ENNReal} (hp : 1 p) (hp' : p ) (X : ΩE) (hℒp : MeasureTheory.Memℒp (X 0) p MeasureTheory.volume) (hindep : Pairwise fun (i j : ) => ProbabilityTheory.IndepFun (X i) (X j) MeasureTheory.volume) (hident : ∀ (i : ), ProbabilityTheory.IdentDistrib (X i) (X 0) MeasureTheory.volume MeasureTheory.volume) :
    Filter.Tendsto (fun (n : ) => MeasureTheory.eLpNorm (fun (ω : Ω) => (↑n)⁻¹ iFinset.range n, X i ω - ∫ (a : Ω), X 0 a) p MeasureTheory.volume) Filter.atTop (nhds 0)

    Strong law of large numbers, Lᵖ version: if X n is a sequence of independent identically distributed random variables in Lᵖ, then n⁻¹ • ∑ i ∈ range n, X i converges in Lᵖ to 𝔼[X 0].