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][etemadi_strong_law], 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.truncation_zero {α : Type u_1} (f : α → ā„) :
    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) :
    truncation f A x = f x
    theorem ProbabilityTheory.truncation_eq_of_nonneg {α : Type u_1} {f : α → ā„} {A : ā„} (h : āˆ€ (x : α), 0 ≤ f x) :
    theorem ProbabilityTheory.truncation_nonneg {α : Type u_1} {f : α → ā„} (A : ā„) {x : α} (h : 0 ≤ f x) :
    theorem MeasureTheory.AEStronglyMeasurable.memLp_truncation {α : Type u_1} {m : MeasurableSpace α} {μ : Measure α} {f : α → ā„} [IsFiniteMeasure μ] (hf : AEStronglyMeasurable f μ) {A : ā„} {p : ENNReal} :
    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 : α), truncation f A x ^ n āˆ‚Ī¼ = ∫ (y : ā„) in -A..A, y ^ n āˆ‚MeasureTheory.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 : α), truncation f A x ^ n āˆ‚Ī¼ = ∫ (y : ā„) in 0 ..A, y ^ n āˆ‚MeasureTheory.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 : α), 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 : α), 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.IdentDistrib.truncation {α : Type u_1} {m : MeasurableSpace α} {μ : MeasureTheory.Measure α} {β : Type u_2} [MeasurableSpace β] {ν : MeasureTheory.Measure β} {f : α → ā„} {g : β → ā„} (h : IdentDistrib f g μ ν) {A : ā„} :
    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) :
    āˆ‘ j ∈ Finset.range K, MeasureTheory.volume {ω : Ī© | X ω ∈ Set.Ioc ↑j ↑N} ≤ ENNReal.ofReal ((∫ (a : Ī©), X a) + 1)
    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 : ā„•) :
    āˆ‘ j ∈ Finset.range K, (↑j ^ 2)⁻¹ * ∫ (a : Ī©), (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 (Function.onFun (fun (f g : Ī© → ā„) => IndepFun f g MeasureTheory.volume) X)) (hident : āˆ€ (i : ā„•), 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, |āˆ‘ i ∈ Finset.range ⌊c ^ nāŒ‹ā‚Š, truncation (X i) (↑i) ω - ∫ (a : Ī©), (āˆ‘ i ∈ Finset.range ⌊c ^ nāŒ‹ā‚Š, 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 (Function.onFun (fun (f g : Ī© → ā„) => IndepFun f g MeasureTheory.volume) X)) (hident : āˆ€ (i : ā„•), IdentDistrib (X i) (X 0) MeasureTheory.volume MeasureTheory.volume) (hnonneg : āˆ€ (i : ā„•) (ω : Ī©), 0 ≤ X i ω) {c : ā„} (c_one : 1 < c) :
    āˆ€įµ (ω : Ī©), (fun (n : ā„•) => āˆ‘ i ∈ Finset.range ⌊c ^ nāŒ‹ā‚Š, truncation (X i) (↑i) ω - ∫ (a : Ī©), (āˆ‘ i ∈ Finset.range ⌊c ^ nāŒ‹ā‚Š, 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 : ā„•), IdentDistrib (X i) (X 0) MeasureTheory.volume MeasureTheory.volume) :
    (fun (n : ā„•) => (∫ (a : Ī©), (āˆ‘ i ∈ Finset.range n, 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 (Function.onFun (fun (f g : Ī© → ā„) => IndepFun f g MeasureTheory.volume) X)) (hident : āˆ€ (i : ā„•), IdentDistrib (X i) (X 0) MeasureTheory.volume MeasureTheory.volume) (hnonneg : āˆ€ (i : ā„•) (ω : Ī©), 0 ≤ X i ω) {c : ā„} (c_one : 1 < c) :
    āˆ€įµ (ω : Ī©), (fun (n : ā„•) => āˆ‘ i ∈ Finset.range ⌊c ^ nāŒ‹ā‚Š, 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 : ā„•), IdentDistrib (X i) (X 0) MeasureTheory.volume MeasureTheory.volume) (hnonneg : āˆ€ (i : ā„•) (ω : Ī©), 0 ≤ X i ω) :
    āˆ€įµ (ω : Ī©), (fun (n : ā„•) => āˆ‘ i ∈ Finset.range n, truncation (X i) (↑i) ω - āˆ‘ i ∈ Finset.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 (Function.onFun (fun (f g : Ī© → ā„) => IndepFun f g MeasureTheory.volume) X)) (hident : āˆ€ (i : ā„•), IdentDistrib (X i) (X 0) MeasureTheory.volume MeasureTheory.volume) (hnonneg : āˆ€ (i : ā„•) (ω : Ī©), 0 ≤ X i ω) {c : ā„} (c_one : 1 < c) :
    āˆ€įµ (ω : Ī©), Filter.Tendsto (fun (n : ā„•) => (āˆ‘ i ∈ Finset.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 (Function.onFun (fun (f g : Ī© → ā„) => IndepFun f g MeasureTheory.volume) X)) (hident : āˆ€ (i : ā„•), IdentDistrib (X i) (X 0) MeasureTheory.volume MeasureTheory.volume) (hnonneg : āˆ€ (i : ā„•) (ω : Ī©), 0 ≤ X i ω) :
    āˆ€įµ (ω : Ī©), Filter.Tendsto (fun (n : ā„•) => (āˆ‘ i ∈ Finset.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} {m : MeasurableSpace Ī©} {μ : MeasureTheory.Measure Ī©} (X : ā„• → Ī© → ā„) (hint : MeasureTheory.Integrable (X 0) μ) (hindep : Pairwise (Function.onFun (fun (x1 x2 : Ī© → ā„) => IndepFun x1 x2 μ) X)) (hident : āˆ€ (i : ā„•), IdentDistrib (X i) (X 0) μ μ) :
    āˆ€įµ (ω : Ī©) āˆ‚Ī¼, Filter.Tendsto (fun (n : ā„•) => (āˆ‘ i ∈ Finset.range n, X i ω) / ↑n) Filter.atTop (nhds (∫ (x : Ī©), X 0 x āˆ‚Ī¼))

    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} {mĪ© : MeasurableSpace Ī©} {μ : MeasureTheory.Measure Ī©} [MeasureTheory.IsProbabilityMeasure μ] {E : Type u_2} [NormedAddCommGroup E] [NormedSpace ā„ E] [CompleteSpace E] [MeasurableSpace E] (X : ā„• → Ī© → E) (h' : Measurable (X 0)) (hindep : Pairwise (Function.onFun (fun (x1 x2 : Ī© → E) => IndepFun x1 x2 μ) X)) (hident : āˆ€ (i : ā„•), IdentDistrib (X i) (X 0) μ μ) (φ : MeasureTheory.SimpleFunc E E) :
    āˆ€įµ (ω : Ī©) āˆ‚Ī¼, Filter.Tendsto (fun (n : ā„•) => (↑n)⁻¹ • āˆ‘ i ∈ Finset.range n, φ (X i ω)) Filter.atTop (nhds (∫ (x : Ī©), (⇑φ ∘ X 0) x āˆ‚Ī¼))

    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} {mĪ© : MeasurableSpace Ī©} {μ : MeasureTheory.Measure Ī©} [MeasureTheory.IsProbabilityMeasure μ] {E : Type u_2} [NormedAddCommGroup E] [NormedSpace ā„ E] [CompleteSpace E] [MeasurableSpace E] [BorelSpace E] (X : ā„• → Ī© → E) (hint : MeasureTheory.Integrable (X 0) μ) (h' : MeasureTheory.StronglyMeasurable (X 0)) (hindep : Pairwise (Function.onFun (fun (x1 x2 : Ī© → E) => IndepFun x1 x2 μ) X)) (hident : āˆ€ (i : ā„•), IdentDistrib (X i) (X 0) μ μ) :
    āˆ€įµ (ω : Ī©) āˆ‚Ī¼, Filter.Tendsto (fun (n : ā„•) => (↑n)⁻¹ • āˆ‘ i ∈ Finset.range n, X i ω) Filter.atTop (nhds (∫ (x : Ī©), X 0 x āˆ‚Ī¼))

    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 {Ī© : Type u_1} {mĪ© : MeasurableSpace Ī©} {μ : MeasureTheory.Measure Ī©} {E : Type u_2} [NormedAddCommGroup E] [NormedSpace ā„ E] [CompleteSpace E] [MeasurableSpace E] [BorelSpace E] (X : ā„• → Ī© → E) (hint : MeasureTheory.Integrable (X 0) μ) (hindep : Pairwise (Function.onFun (fun (x1 x2 : Ī© → E) => IndepFun x1 x2 μ) X)) (hident : āˆ€ (i : ā„•), IdentDistrib (X i) (X 0) μ μ) :
    āˆ€įµ (ω : Ī©) āˆ‚Ī¼, Filter.Tendsto (fun (n : ā„•) => (↑n)⁻¹ • āˆ‘ i ∈ Finset.range n, X i ω) Filter.atTop (nhds (∫ (x : Ī©), X 0 x āˆ‚Ī¼))

    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} {mĪ© : MeasurableSpace Ī©} {μ : MeasureTheory.Measure Ī©} {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.MemLp (X 0) p μ) (hindep : Pairwise (Function.onFun (fun (x1 x2 : Ī© → E) => IndepFun x1 x2 μ) X)) (hident : āˆ€ (i : ā„•), IdentDistrib (X i) (X 0) μ μ) :
    Filter.Tendsto (fun (n : ā„•) => MeasureTheory.eLpNorm (fun (ω : Ī©) => (↑n)⁻¹ • āˆ‘ i ∈ Finset.range n, X i ω - ∫ (x : Ī©), X 0 x āˆ‚Ī¼) p μ) 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].