Stat.CLT.Finite­Iid­Triangular

Bounded finite iid triangular-row limit theory: Gaussian CDF convergence, empirical-moment consistency, and normalized fourth-moment control.

Basic 15 core · 7 supporting Finite iid triangular rows with bounded, centered, row-dependent scores. ★ mass_normalized

Finite iid triangular rows with bounded, centered, row-dependent scores. The module provides their literal product law, finite expectations, coordinate independence identities, and the row statistics used by the limit results.

structure RowModel reviewed
Causalean.Stat.CLT.FiniteIidTriangular

A bounded finite iid triangular experiment consists of row lengths tending to infinity, row-dependent probability masses and exactly centered scores, a common absolute score bound, and one-coordinate second moments tending to a positive variance.

Definition (Lean source)
Y :
Type*
N :
ℕ → ℕ
w :
ℕ → Y → ℝ
f :
ℕ → Y → ℝ
B :
ℝ
v₀ :
length_tendsto :
mass_nonneg :
∀ n y, 0 ≤ w n y
mass_one :
∀ n, ∑ y, w n y = 1
centered :
∀ n, ∑ y, w n y * f n y = 0
bound :
∀ n y, |f n y| ≤ B
variance_tendsto :
Tendsto (fun n => ∑ y, w n y * (f n y) ^ 2) atTop (𝓝 (v₀ : ℝ))
variance_pos :
0 < v₀
Causalean.Stat.CLT.FiniteIidTriangular.RowModel · Causalean/Stat/CLT/FiniteIidTriangular/Basic.lean:15
def mass reviewed
Causalean.Stat.CLT.FiniteIidTriangular.RowModel

A row and an outcome vector determine their finite iid product mass.

Definition (Lean source)
Y :
Type u_1
shared
M :
shared
n :
ℕ
ys :
Fin (M.N n) → Y
mass M n ys :
ℝ
∏ i, M.w n (ys i)
Causalean.Stat.CLT.FiniteIidTriangular.RowModel.mass · Causalean/Stat/CLT/FiniteIidTriangular/Basic.lean:37 · uses RowModel
def expect reviewed
Causalean.Stat.CLT.FiniteIidTriangular.RowModel

The finite-product expectation of a real statistic is its mass-weighted sum over all outcome vectors in the row.

Definition (Lean source)
Y :
Type u_1
shared
M :
shared
n :
ℕ
F :
(Fin (M.N n) → Y) → ℝ
expect M n F :
ℝ
∑ ys, M.mass n ys * F ys
Causalean.Stat.CLT.FiniteIidTriangular.RowModel.expect · Causalean/Stat/CLT/FiniteIidTriangular/Basic.lean:41 · uses RowModel
def oneMean reviewed
Causalean.Stat.CLT.FiniteIidTriangular.RowModel

The one-coordinate mean score in a row is the mass-weighted sum of the scores. The centering condition of the row model makes it zero.

Definition (Lean source)
Y :
Type u_1
shared
M :
shared
n :
ℕ
oneMean M n :
ℝ
∑ y, M.w n y * M.f n y
Causalean.Stat.CLT.FiniteIidTriangular.RowModel.oneMean · Causalean/Stat/CLT/FiniteIidTriangular/Basic.lean:46 · uses RowModel
def oneSecond reviewed
Causalean.Stat.CLT.FiniteIidTriangular.RowModel

The one-coordinate second raw moment in a row is the mass-weighted sum of the squared scores. Because the scores are centered, it is the one-coordinate variance.

Definition (Lean source)
Y :
Type u_1
shared
M :
shared
n :
ℕ
oneSecond M n :
ℝ
∑ y, M.w n y * (M.f n y) ^ 2
Causalean.Stat.CLT.FiniteIidTriangular.RowModel.oneSecond · Causalean/Stat/CLT/FiniteIidTriangular/Basic.lean:50 · uses RowModel
def oneFourth reviewed
Causalean.Stat.CLT.FiniteIidTriangular.RowModel

The one-coordinate fourth raw moment in a row is the mass-weighted fourth score power.

Definition (Lean source)
Y :
Type u_1
shared
M :
shared
n :
ℕ
oneFourth M n :
ℝ
∑ y, M.w n y * (M.f n y) ^ 4
Causalean.Stat.CLT.FiniteIidTriangular.RowModel.oneFourth · Causalean/Stat/CLT/FiniteIidTriangular/Basic.lean:54 · uses RowModel
def scoreSum reviewed
Causalean.Stat.CLT.FiniteIidTriangular.RowModel

The unscaled score sum is the sum of all coordinate scores in a row.

Definition (Lean source)
Y :
Type u_1
shared
M :
shared
n :
ℕ
ys :
Fin (M.N n) → Y
scoreSum M n ys :
ℝ
∑ i, M.f n (ys i)
Causalean.Stat.CLT.FiniteIidTriangular.RowModel.scoreSum · Causalean/Stat/CLT/FiniteIidTriangular/Basic.lean:57 · uses RowModel
def normalizedSum reviewed
Causalean.Stat.CLT.FiniteIidTriangular.RowModel

The normalized score sum divides the score sum by the square root of the row length.

Definition (Lean source)
Y :
Type u_1
shared
M :
shared
n :
ℕ
ys :
Fin (M.N n) → Y
normalizedSum M n ys :
ℝ
(sqrt (M.N n : ℝ))⁻¹ * M.scoreSum n ys
Causalean.Stat.CLT.FiniteIidTriangular.RowModel.normalizedSum · Causalean/Stat/CLT/FiniteIidTriangular/Basic.lean:61 · uses RowModel
def empiricalMean reviewed
Causalean.Stat.CLT.FiniteIidTriangular.RowModel

The empirical score mean divides the score sum by the row length, with zero at length zero.

Definition (Lean source)
Y :
Type u_1
shared
M :
shared
n :
ℕ
ys :
Fin (M.N n) → Y
empiricalMean M n ys :
ℝ
(M.N n : ℝ)⁻¹ * M.scoreSum n ys
Causalean.Stat.CLT.FiniteIidTriangular.RowModel.empiricalMean · Causalean/Stat/CLT/FiniteIidTriangular/Basic.lean:65 · uses RowModel
def empiricalSecond reviewed
Causalean.Stat.CLT.FiniteIidTriangular.RowModel

The empirical second moment is the average of the squared coordinate scores.

Definition (Lean source)
Y :
Type u_1
shared
M :
shared
n :
ℕ
ys :
Fin (M.N n) → Y
empiricalSecond M n ys :
ℝ
(M.N n : ℝ)⁻¹ * ∑ i, (M.f n (ys i)) ^ 2
Causalean.Stat.CLT.FiniteIidTriangular.RowModel.empiricalSecond · Causalean/Stat/CLT/FiniteIidTriangular/Basic.lean:69 · uses RowModel
def empiricalVariance reviewed
Causalean.Stat.CLT.FiniteIidTriangular.RowModel

The centered empirical variance is the empirical second moment minus the squared empirical score mean.

Definition (Lean source)
Y :
Type u_1
shared
M :
shared
n :
ℕ
ys :
Fin (M.N n) → Y
empiricalVariance M n ys :
ℝ
M.empiricalSecond n ys - (M.empiricalMean n ys) ^ 2
Causalean.Stat.CLT.FiniteIidTriangular.RowModel.empiricalVariance · Causalean/Stat/CLT/FiniteIidTriangular/Basic.lean:73 · uses RowModel
theorem mass_normalized reviewed
Causalean.Stat.CLT.FiniteIidTriangular.RowModel

At each row index, the total finite-product mass equals one.

Formal statement
Y :
Type u_1
shared
M :
shared
n :
ℕ
∑ ys : Fin (M.N n) → Y, M.mass n ys = 1
Proof (Lean source)
theorem mass_normalized (n : ℕ) : ∑ ys : Fin (M.N n) → Y, M.mass n ys = 1 := by classical calc ∑ ys : Fin (M.N n) → Y, M.mass n ys = ∏ _i : Fin (M.N n), ∑ y, M.w n y := by simpa [mass] using (Fintype.prod_sum (fun _i : Fin (M.N n) => M.w n)).symm _ = 1 := by simp [M.mass_one]
Causalean.Stat.CLT.FiniteIidTriangular.RowModel.mass_normalized · Causalean/Stat/CLT/FiniteIidTriangular/Basic.lean:83 · uses RowModel , mass
def coordinateDesign reviewed
Causalean.Stat.CLT.FiniteIidTriangular.RowModel

The single-coordinate design of a row has the row's probability mass function.

Definition (Lean source)
Y :
Type u_1
shared
M :
shared
n :
ℕ
coordinateDesign M n :
clause 1
p := M.w n
clause 2
p_nonneg := M.mass_nonneg n
clause 3
p_sum := M.mass_one n
Causalean.Stat.CLT.FiniteIidTriangular.RowModel.coordinateDesign · Causalean/Stat/CLT/FiniteIidTriangular/Basic.lean:171 · uses FiniteDesign , RowModel
def productDesign reviewed
Causalean.Stat.CLT.FiniteIidTriangular.RowModel

The product design of a row assigns each outcome vector its literal product mass.

Definition (Lean source)
Y :
Type u_1
shared
M :
shared
n :
ℕ
productDesign M n :
FiniteDesign (Fin (M.N n) → Y)
prodDesign (fun _ : Fin (M.N n) => M.coordinateDesign n)
Causalean.Stat.CLT.FiniteIidTriangular.RowModel.productDesign · Causalean/Stat/CLT/FiniteIidTriangular/Basic.lean:177 · uses FiniteDesign , RowModel
def rowMeasure reviewed
Causalean.Stat.CLT.FiniteIidTriangular.RowModel

The probability measure of a row is the finite product-design measure.

Definition (Lean source)
Y :
Type u_1
shared
M :
shared
n :
ℕ
rowMeasure M n :
Measure (Fin (M.N n) → Y)
(M.productDesign n).toMeasure
Causalean.Stat.CLT.FiniteIidTriangular.RowModel.rowMeasure · Causalean/Stat/CLT/FiniteIidTriangular/Basic.lean:197 · uses RowModel
7 supporting declarations (lemmas, instances)
  • mass_nonnegative theorem — The product mass is nonnegative at every outcome vector.
    Y :
    Type u_1
    shared
    M :
    shared
    n :
    ℕ
    ys :
    Fin (M.N n) → Y
    0 ≤ M.mass n ys
    Proof (Lean source)
    theorem mass_nonnegative (n : ℕ) (ys : Fin (M.N n) → Y) : 0 ≤ M.mass n ys := by unfold mass exact Finset.prod_nonneg (by intro i hi; exact M.mass_nonneg n (ys i))
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.mass_nonnegative · Causalean/Stat/CLT/FiniteIidTriangular/Basic.lean:78
  • expect_coordinate theorem — The finite-product expectation of one coordinate statistic is its one-coordinate mass-weighted expectation.
    Y :
    Type u_1
    shared
    M :
    shared
    n :
    ℕ
    i :
    Fin (M.N n)
    g :
    Y → ℝ
    M.expect n (fun ys => g (ys i)) = ∑ y, M.w n y * g y
    Proof (Lean source)
    theorem expect_coordinate (n : ℕ) (i : Fin (M.N n)) (g : Y → ℝ) : M.expect n (fun ys => g (ys i)) = ∑ y, M.w n y * g y := by classical let q : Fin (M.N n) → Y → ℝ := fun k y => M.w n y * (if k = i then g y else 1) have hfactor (ys : Fin (M.N n) → Y) : (∏ k, q k (ys k)) = M.mass n ys * g (ys i) := by change (∏ k, M.w n (ys k) * (if k = i then g (ys k) else 1)) = _ rw [Finset.prod_mul_distrib, Fintype.prod_ite_eq'] rfl have hsum (k : Fin (M.N n)) : (∑ y, q k y) = if k = i then ∑ y, M.w n y * g y else 1 := by by_cases hk : k = i <;> simp [q, hk, M.mass_one] calc M.expect n (fun ys => g (ys i)) = ∑ ys : Fin (M.N n) → Y, ∏ k, q k (ys k) := by unfold expect apply Finset.sum_congr rfl intro ys _ exact (hfactor ys).symm _ = ∏ k, ∑ y, q k y := (Fintype.prod_sum q).symm _ = ∑ y, M.w n y * g y := by simp_rw [hsum] simp
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.expect_coordinate · Causalean/Stat/CLT/FiniteIidTriangular/Basic.lean:93
  • expect_coordinate_mul theorem — Under the finite product law, two distinct coordinate statistics have expectation equal to the product of their one-coordinate expectations.
    Y :
    Type u_1
    shared
    M :
    shared
    n :
    ℕ
    i j :
    Fin (M.N n)
    hij :
    i ≠ j
    g h :
    Y → ℝ
    M.expect n (fun ys => g (ys i) * h (ys j)) = (∑ y, M.w n y * g y) * (∑ y, M.w n y * h y)
    Proof (Lean source)
    theorem expect_coordinate_mul (n : ℕ) (i j : Fin (M.N n)) (hij : i ≠ j) (g h : Y → ℝ) : M.expect n (fun ys => g (ys i) * h (ys j)) = (∑ y, M.w n y * g y) * (∑ y, M.w n y * h y) := by classical let q : Fin (M.N n) → Y → ℝ := fun k y => M.w n y * (if k = i then g y else 1) * (if k = j then h y else 1) have hfactor (ys : Fin (M.N n) → Y) : (∏ k, q k (ys k)) = M.mass n ys * (g (ys i) * h (ys j)) := by change (∏ k, (M.w n (ys k) * (if k = i then g (ys k) else 1)) * (if k = j then h (ys k) else 1)) = _ rw [Finset.prod_mul_distrib, Finset.prod_mul_distrib] rw [Fintype.prod_ite_eq', Fintype.prod_ite_eq'] simp only [mass] ring have hsum (k : Fin (M.N n)) : (∑ y, q k y) = (if k = i then ∑ y, M.w n y * g y else 1) * (if k = j then ∑ y, M.w n y * h y else 1) := by by_cases hik : k = i · by_cases hjk : k = j · exact (hij (hik.symm.trans hjk)).elim · have : i ≠ j := hij subst k simp [q, this] · by_cases hjk : k = j · have : j ≠ i := Ne.symm hij subst k simp [q, this] · simp [q, hik, hjk, M.mass_one] calc M.expect n (fun ys => g (ys i) * h (ys j)) = ∑ ys : Fin (M.N n) → Y, ∏ k, q k (ys k) := by unfold expect apply Finset.sum_congr rfl intro ys _ exact (hfactor ys).symm _ = ∏ k, ∑ y, q k y := (Fintype.prod_sum q).symm _ = (∑ y, M.w n y * g y) * (∑ y, M.w n y * h y) := by simp_rw [hsum] rw [Finset.prod_mul_distrib] simp
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.expect_coordinate_mul · Causalean/Stat/CLT/FiniteIidTriangular/Basic.lean:118
  • productDesign_expect theorem — Expectation under the product design is the literal finite-product expectation.
    Y :
    Type u_1
    shared
    M :
    shared
    n :
    ℕ
    F :
    (Fin (M.N n) → Y) → ℝ
    (M.productDesign n).E F = M.expect n F
    Proof (Lean source)
    theorem productDesign_expect (n : ℕ) (F : (Fin (M.N n) → Y) → ℝ) : (M.productDesign n).E F = M.expect n F := by rfl
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.productDesign_expect · Causalean/Stat/CLT/FiniteIidTriangular/Basic.lean:181
  • expect_prod_coordinate theorem — A product of coordinate statistics has expectation equal to the product of their one-coordinate expectations, even when the coordinate statistics differ.
    Y :
    Type u_1
    shared
    M :
    shared
    n :
    ℕ
    g :
    Fin (M.N n) → Y → ℝ
    M.expect n (fun ys => ∏ i, g i (ys i)) = ∏ i, ∑ y, M.w n y * g i y
    Proof (Lean source)
    theorem expect_prod_coordinate (n : ℕ) (g : Fin (M.N n) → Y → ℝ) : M.expect n (fun ys => ∏ i, g i (ys i)) = ∏ i, ∑ y, M.w n y * g i y := by simpa only [← M.productDesign_expect n, productDesign, coordinateDesign, FiniteDesign.E] using (FiniteDesign.E_prod_prod (fun _ : Fin (M.N n) => M.coordinateDesign n) g)
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.expect_prod_coordinate · Causalean/Stat/CLT/FiniteIidTriangular/Basic.lean:186
  • integral_rowMeasure_eq_expect theorem — Integration against the row measure is the literal finite-product expectation.
    Y :
    Type u_1
    shared
    M :
    shared
    n :
    ℕ
    F :
    (Fin (M.N n) → Y) → ℝ
    ∫ ys, F ys ∂M.rowMeasure n = M.expect n F
    Proof (Lean source)
    theorem integral_rowMeasure_eq_expect (n : ℕ) (F : (Fin (M.N n) → Y) → ℝ) : ∫ ys, F ys ∂M.rowMeasure n = M.expect n F := by exact (FiniteDesign.integral_toMeasure (M.productDesign n) F).trans (M.productDesign_expect n F)
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.integral_rowMeasure_eq_expect · Causalean/Stat/CLT/FiniteIidTriangular/Basic.lean:201
  • rowMeasure_independent theorem — All coordinate projections in a row are independent under its product measure.
    Y :
    Type u_1
    shared
    M :
    shared
    n :
    ℕ
    iIndepFun (fun (i : Fin (M.N n)) (ys : Fin (M.N n) → Y) => ys i) (M.rowMeasure n)
    Proof (Lean source)
    theorem rowMeasure_independent (n : ℕ) : iIndepFun (fun (i : Fin (M.N n)) (ys : Fin (M.N n) → Y) => ys i) (M.rowMeasure n) := by exact iIndepFun_prodDesign_eval (fun _ : Fin (M.N n) => M.coordinateDesign n)
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.rowMeasure_independent · Causalean/Stat/CLT/FiniteIidTriangular/Basic.lean:207
Consistency 2 core · 6 supporting Probability limits for empirical first, second, and centered second moments in bounded finite iid triangular rows. ★ empiricalVariance_tendstoInProbability

Probability limits for empirical first, second, and centered second moments in bounded finite iid triangular rows. Direct finite-design Chebyshev calculations yield consistency without importing an experimentation layer.

def eventProbability reviewed
Causalean.Stat.CLT.FiniteIidTriangular.RowModel

The finite-product probability of a predicate is the sum of the masses of the outcome vectors satisfying it.

Definition (Lean source)
Y :
Type u_1
shared
M :
shared
n :
ℕ
P :
(Fin (M.N n) → Y) → Prop
eventProbability M n P :
ℝ
M.expect n (fun ys => if P ys then 1 else 0)
Causalean.Stat.CLT.FiniteIidTriangular.RowModel.eventProbability · Causalean/Stat/CLT/FiniteIidTriangular/Consistency.lean:33 · uses RowModel
theorem empiricalVariance_tendstoInProbability reviewed
Causalean.Stat.CLT.FiniteIidTriangular.RowModel

At a positive error tolerance, the finite-product probability that the centered empirical variance differs from the limiting variance by at least that tolerance tends to zero.

Formal statement
Y :
Type u_1
shared
M :
shared
ε :
ℝ
hε :
0 < ε
Tendsto (fun n => M.eventProbability n (fun ys => ε ≤ |M.empiricalVariance n ys - (M.v₀ : ℝ)|)) atTop (𝓝 0)
Proof (Lean source)
theorem empiricalVariance_tendstoInProbability (ε : ℝ) (hε : 0 < ε) : Tendsto (fun n => M.eventProbability n (fun ys => ε ≤ |M.empiricalVariance n ys - (M.v₀ : ℝ)|)) atTop (𝓝 0) := by classical have hhalf : 0 < ε / 2 := by linarith have hsqrt : 0 < sqrt (ε / 2) := Real.sqrt_pos.2 hhalf have hsecond := M.empiricalSecond_tendstoInProbability (ε / 2) hhalf have hmean := M.empiricalMean_tendstoInProbability (sqrt (ε / 2)) hsqrt have hsum : Tendsto (fun n => M.eventProbability n (fun ys => ε / 2 ≤ |M.empiricalSecond n ys - (M.v₀ : ℝ)|) + M.eventProbability n (fun ys => sqrt (ε / 2) ≤ |M.empiricalMean n ys|)) atTop (𝓝 0) := by simpa using hsecond.add hmean refine squeeze_zero (fun n => ?_) (fun n => ?_) hsum · rw [M.eventProbability_eq_designPr] exact (M.productDesign n).Pr_nonneg _ · rw [M.eventProbability_eq_designPr, M.eventProbability_eq_designPr, M.eventProbability_eq_designPr] have hmono : (M.productDesign n).Pr (fun ys => ε ≤ |M.empiricalVariance n ys - (M.v₀ : ℝ)|) ≤ (M.productDesign n).Pr (fun ys => ε / 2 ≤ |M.empiricalSecond n ys - (M.v₀ : ℝ)| ∨ sqrt (ε / 2) ≤ |M.empiricalMean n ys|) := by apply (M.productDesign n).Pr_mono intro ys hy by_contra hc push Not at hc obtain ⟨h1, h2⟩ := hc have hsq : (M.empiricalMean n ys) ^ 2 < ε / 2 := by have hpow := (sq_lt_sq₀ (abs_nonneg (M.empiricalMean n ys)) hsqrt.le).2 h2 rw [sq_abs, Real.sq_sqrt hhalf.le] at hpow exact hpow have htri : |M.empiricalVariance n ys - (M.v₀ : ℝ)| ≤ |M.empiricalSecond n ys - (M.v₀ : ℝ)| + (M.empiricalMean n ys) ^ 2 := by rw [empiricalVariance] have heq : M.empiricalSecond n ys - (M.empiricalMean n ys) ^ 2 - (M.v₀ : ℝ) = (M.empiricalSecond n ys - (M.v₀ : ℝ)) - (M.empiricalMean n ys) ^ 2 := by ring rw [heq] calc _ ≤ |M.empiricalSecond n ys - (M.v₀ : ℝ)| + |(M.empiricalMean n ys) ^ 2| := abs_sub _ _ _ = _ := by rw [abs_of_nonneg (sq_nonneg (M.empiricalMean n ys))] linarith exact hmono.trans (finiteDesign_pr_or_le (M.productDesign n) _ _)
Causalean.Stat.CLT.FiniteIidTriangular.RowModel.empiricalVariance_tendstoInProbability · Causalean/Stat/CLT/FiniteIidTriangular/Consistency.lean:367 · uses RowModel , empiricalVariance , eventProbability
6 supporting declarations (lemmas, instances)
  • eventProbability_eq_designPr theorem — The literal finite-product event probability equals the probability assigned by the corresponding finite product design.
    Y :
    Type u_1
    shared
    M :
    shared
    n :
    ℕ
    P :
    (Fin (M.N n) → Y) → Prop
    M.eventProbability n P = (M.productDesign n).Pr P
    Proof (Lean source)
    theorem eventProbability_eq_designPr (n : ℕ) (P : (Fin (M.N n) → Y) → Prop) [DecidablePred P] : M.eventProbability n P = (M.productDesign n).Pr P := by rfl
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.eventProbability_eq_designPr · Causalean/Stat/CLT/FiniteIidTriangular/Consistency.lean:38
  • expect_empiricalSecond theorem — The empirical second moment has expectation equal to the one-coordinate second moment whenever the row length is positive.
    Y :
    Type u_1
    shared
    M :
    shared
    n :
    ℕ
    hn :
    0 < M.N n
    M.expect n (M.empiricalSecond n) = M.oneSecond n
    Proof (Lean source)
    theorem expect_empiricalSecond (n : ℕ) (hn : 0 < M.N n) : M.expect n (M.empiricalSecond n) = M.oneSecond n := by classical have hN : (M.N n : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt hn) calc M.expect n (M.empiricalSecond n) = (M.N n : ℝ)⁻¹ * ∑ i : Fin (M.N n), M.expect n (fun ys => (M.f n (ys i)) ^ 2) := by simp only [expect, empiricalSecond, Finset.mul_sum] rw [Finset.sum_comm] congr 1 ext i congr 1 ext ys ring _ = (M.N n : ℝ)⁻¹ * ∑ _i : Fin (M.N n), M.oneSecond n := by congr 1 apply Finset.sum_congr rfl intro i _ exact M.expect_coordinate n i (fun y => (M.f n y) ^ 2) _ = M.oneSecond n := by simp [hN]
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.expect_empiricalSecond · Causalean/Stat/CLT/FiniteIidTriangular/Consistency.lean:45
  • empiricalSecond_mse_le theorem — The mean-squared error of the empirical second moment is at most the fourth power of the common score bound divided by the positive row length.
    Y :
    Type u_1
    shared
    M :
    shared
    n :
    ℕ
    hn :
    0 < M.N n
    M.expect n (fun ys => (M.empiricalSecond n ys - M.oneSecond n) ^ 2)
    ≤ M.B ^ 4 / (M.N n : ℝ)
    Proof (Lean source)
    theorem empiricalSecond_mse_le (n : ℕ) (hn : 0 < M.N n) : M.expect n (fun ys => (M.empiricalSecond n ys - M.oneSecond n) ^ 2) ≤ M.B ^ 4 / (M.N n : ℝ) := by classical let μ := M.oneSecond n let z (i : Fin (M.N n)) (ys : Fin (M.N n) → Y) := (M.f n (ys i)) ^ 2 - μ have hN : (M.N n : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt hn) have hsum (g : Fin (M.N n) → (Fin (M.N n) → Y) → ℝ) : M.expect n (fun ys => ∑ i, g i ys) = ∑ i, M.expect n (g i) := by simp only [expect, Finset.mul_sum] rw [Finset.sum_comm] have hscale (c : ℝ) (g : (Fin (M.N n) → Y) → ℝ) : M.expect n (fun ys => c * g ys) = c * M.expect n g := by simp only [expect] rw [Finset.mul_sum] apply Finset.sum_congr rfl intro ys _ ring have hpair (i j : Fin (M.N n)) (hij : i ≠ j) : M.expect n (fun ys => z i ys * z j ys) = 0 := by rw [M.expect_coordinate_mul n i j hij (fun y => (M.f n y) ^ 2 - μ) (fun y => (M.f n y) ^ 2 - μ)] simp [μ, oneSecond, mul_sub, Finset.sum_sub_distrib, ← Finset.sum_mul, M.mass_one] have hdiag (i : Fin (M.N n)) : M.expect n (fun ys => (z i ys) ^ 2) ≤ M.B ^ 4 := by have hc := M.expect_coordinate n i (fun y => ((M.f n y) ^ 2 - μ) ^ 2) change M.expect n (fun ys => (z i ys) ^ 2) = _ at hc rw [hc] have hμsq : 0 ≤ μ ^ 2 := sq_nonneg μ have hfourth : (∑ y, M.w n y * (M.f n y) ^ 4) ≤ M.B ^ 4 := by calc _ ≤ ∑ y, M.w n y * M.B ^ 4 := by apply Finset.sum_le_sum intro y _ apply mul_le_mul_of_nonneg_left _ (M.mass_nonneg n y) have hb := M.bound n y have hb4 : (M.f n y) ^ 4 = |M.f n y| ^ 4 := by rw [← abs_pow] exact (abs_of_nonneg (by positivity)).symm rw [hb4] exact pow_le_pow_left₀ (abs_nonneg _) hb _ _ = M.B ^ 4 := by simp [← Finset.sum_mul, M.mass_one] have hv : (∑ y, M.w n y * ((M.f n y) ^ 2 - μ) ^ 2) = (∑ y, M.w n y * (M.f n y) ^ 4) - μ ^ 2 := by calc _ = (∑ y, M.w n y * (M.f n y) ^ 4) - 2 * μ * (∑ y, M.w n y * (M.f n y) ^ 2) + μ ^ 2 * (∑ y, M.w n y) := by simp only [Finset.mul_sum] rw [← Finset.sum_sub_distrib, ← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro y _ ring _ = _ := by rw [M.mass_one]; dsimp [μ, oneSecond]; ring rw [hv] linarith have hcenter (ys : Fin (M.N n) → Y) : M.empiricalSecond n ys - μ = (M.N n : ℝ)⁻¹ * ∑ i, z i ys := by simp only [empiricalSecond, z, Finset.sum_sub_distrib] simp only [Finset.sum_const, Finset.card_fin, nsmul_eq_mul] field_simp have hvar : M.expect n (fun ys => (∑ i, z i ys) ^ 2) = ∑ i : Fin (M.N n), M.expect n (fun ys => (z i ys) ^ 2) := by calc _ = ∑ i : Fin (M.N n), ∑ j : Fin (M.N n), M.expect n (fun ys => z i ys * z j ys) := by calc _ = M.expect n (fun ys => ∑ i : Fin (M.N n), ∑ j : Fin (M.N n), z i ys * z j ys) := by congr 1 funext ys rw [← Finset.sum_mul_sum] ring _ = _ := by rw [hsum] apply Finset.sum_congr rfl intro i _ rw [hsum] _ = ∑ i : Fin (M.N n), M.expect n (fun ys => (z i ys) ^ 2) := by apply Finset.sum_congr rfl intro i _ rw [Finset.sum_eq_single i] · simp only [pow_two] · intro j _ hji exact hpair i j (Ne.symm hji) · intro hi exact (hi (Finset.mem_univ i)).elim calc M.expect n (fun ys => (M.empiricalSecond n ys - M.oneSecond n) ^ 2) = ((M.N n : ℝ)⁻¹) ^ 2 * ∑ i : Fin (M.N n), M.expect n (fun ys => (z i ys) ^ 2) := by simp_rw [show M.oneSecond n = μ from rfl, hcenter] rw [← hvar, ← hscale] congr 1 funext ys ring _ ≤ ((M.N n : ℝ)⁻¹) ^ 2 * ((M.N n : ℝ) * M.B ^ 4) := by apply mul_le_mul_of_nonneg_left _ (sq_nonneg _) simpa only [Finset.sum_const_zero, Finset.sum_const, Finset.card_fin, nsmul_eq_mul] using Finset.sum_le_sum (s := univ) (fun i _ => hdiag i) _ = M.B ^ 4 / (M.N n : ℝ) := by field_simp
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.empiricalSecond_mse_le · Causalean/Stat/CLT/FiniteIidTriangular/Consistency.lean:69
  • empiricalMean_mse_le theorem — The mean squared empirical score mean is at most the squared common score bound divided by the positive row length.
    Y :
    Type u_1
    shared
    M :
    shared
    n :
    ℕ
    hn :
    0 < M.N n
    M.expect n (fun ys => (M.empiricalMean n ys) ^ 2) ≤ M.B ^ 2 / (M.N n : ℝ)
    Proof (Lean source)
    theorem empiricalMean_mse_le (n : ℕ) (hn : 0 < M.N n) : M.expect n (fun ys => (M.empiricalMean n ys) ^ 2) ≤ M.B ^ 2 / (M.N n : ℝ) := by classical let z (i : Fin (M.N n)) (ys : Fin (M.N n) → Y) := M.f n (ys i) have hN : (M.N n : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt hn) have hsum (g : Fin (M.N n) → (Fin (M.N n) → Y) → ℝ) : M.expect n (fun ys => ∑ i, g i ys) = ∑ i, M.expect n (g i) := by simp only [expect, Finset.mul_sum] rw [Finset.sum_comm] have hscale (c : ℝ) (g : (Fin (M.N n) → Y) → ℝ) : M.expect n (fun ys => c * g ys) = c * M.expect n g := by simp only [expect] rw [Finset.mul_sum] apply Finset.sum_congr rfl intro ys _ ring have hpair (i j : Fin (M.N n)) (hij : i ≠ j) : M.expect n (fun ys => z i ys * z j ys) = 0 := by rw [M.expect_coordinate_mul n i j hij (M.f n) (M.f n)] simp [M.centered n] have hdiag (i : Fin (M.N n)) : M.expect n (fun ys => (z i ys) ^ 2) ≤ M.B ^ 2 := by rw [M.expect_coordinate n i (fun y => (M.f n y) ^ 2)] calc (∑ y, M.w n y * (M.f n y) ^ 2) ≤ ∑ y, M.w n y * M.B ^ 2 := by apply Finset.sum_le_sum intro y _ apply mul_le_mul_of_nonneg_left _ (M.mass_nonneg n y) have hb := M.bound n y have hb2 : (M.f n y) ^ 2 = |M.f n y| ^ 2 := by rw [← abs_pow] exact (abs_of_nonneg (by positivity)).symm rw [hb2] exact pow_le_pow_left₀ (abs_nonneg _) hb _ _ = M.B ^ 2 := by simp [← Finset.sum_mul, M.mass_one] have hvar : M.expect n (fun ys => (∑ i, z i ys) ^ 2) = ∑ i : Fin (M.N n), M.expect n (fun ys => (z i ys) ^ 2) := by calc _ = ∑ i : Fin (M.N n), ∑ j : Fin (M.N n), M.expect n (fun ys => z i ys * z j ys) := by calc _ = M.expect n (fun ys => ∑ i : Fin (M.N n), ∑ j : Fin (M.N n), z i ys * z j ys) := by congr 1 funext ys rw [← Finset.sum_mul_sum] ring _ = _ := by rw [hsum] apply Finset.sum_congr rfl intro i _ rw [hsum] _ = ∑ i : Fin (M.N n), M.expect n (fun ys => (z i ys) ^ 2) := by apply Finset.sum_congr rfl intro i _ rw [Finset.sum_eq_single i] · simp only [pow_two] · intro j _ hji exact hpair i j (Ne.symm hji) · intro hi exact (hi (Finset.mem_univ i)).elim calc M.expect n (fun ys => (M.empiricalMean n ys) ^ 2) = ((M.N n : ℝ)⁻¹) ^ 2 * ∑ i : Fin (M.N n), M.expect n (fun ys => (z i ys) ^ 2) := by simp only [empiricalMean, scoreSum] rw [← hvar, ← hscale] congr 1 funext ys ring _ ≤ ((M.N n : ℝ)⁻¹) ^ 2 * ((M.N n : ℝ) * M.B ^ 2) := by apply mul_le_mul_of_nonneg_left _ (sq_nonneg _) simpa only [Finset.sum_const_zero, Finset.sum_const, Finset.card_fin, nsmul_eq_mul] using Finset.sum_le_sum (s := univ) (fun i _ => hdiag i) _ = M.B ^ 2 / (M.N n : ℝ) := by field_simp
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.empiricalMean_mse_le · Causalean/Stat/CLT/FiniteIidTriangular/Consistency.lean:174
  • empiricalSecond_tendstoInProbability theorem — At every positive error tolerance, the finite-product probability that the empirical second moment differs from the limiting variance by at least that tolerance tends to zero.
    Y :
    Type u_1
    shared
    M :
    shared
    ε :
    ℝ
    hε :
    0 < ε
    Tendsto (fun n => M.eventProbability n (fun ys => ε ≤ |M.empiricalSecond n ys - (M.v₀ : ℝ)|)) atTop (𝓝 0)
    Proof (Lean source)
    theorem empiricalSecond_tendstoInProbability (ε : ℝ) (hε : 0 < ε) : Tendsto (fun n => M.eventProbability n (fun ys => ε ≤ |M.empiricalSecond n ys - (M.v₀ : ℝ)|)) atTop (𝓝 0) := by classical have hhalf : 0 < ε / 2 := by linarith have hN : Tendsto (fun n => (M.N n : ℝ)) atTop atTop := tendsto_natCast_atTop_atTop.comp M.length_tendsto have hsmall : Tendsto (fun n => M.B ^ 4 / (M.N n : ℝ) / (ε / 2) ^ 2) atTop (𝓝 0) := by have h := (tendsto_const_div_atTop_nhds_zero_nat (M.B ^ 4)).comp M.length_tendsto simpa only [Function.comp_def, zero_div] using h.div_const ((ε / 2) ^ 2) have hcenter : ∀ᶠ n in atTop, |M.oneSecond n - (M.v₀ : ℝ)| < ε / 2 := by simpa only [oneSecond, Real.dist_eq] using (Metric.tendsto_nhds.1 M.variance_tendsto (ε / 2) hhalf) have hpositive : ∀ᶠ n in atTop, 0 < M.N n := M.length_tendsto.eventually (eventually_gt_atTop 0) have hnonneg : ∀ᶠ n in atTop, 0 ≤ M.eventProbability n (fun ys => ε ≤ |M.empiricalSecond n ys - (M.v₀ : ℝ)|) := by filter_upwards [] with n rw [M.eventProbability_eq_designPr] exact (M.productDesign n).Pr_nonneg _ have hupper : ∀ᶠ n in atTop, M.eventProbability n (fun ys => ε ≤ |M.empiricalSecond n ys - (M.v₀ : ℝ)|) ≤ M.B ^ 4 / (M.N n : ℝ) / (ε / 2) ^ 2 := by filter_upwards [hcenter, hpositive] with n hn hnN rw [M.eventProbability_eq_designPr] have hE : (M.productDesign n).E (M.empiricalSecond n) = M.oneSecond n := M.expect_empiricalSecond n hnN have htail : (M.productDesign n).Pr (fun ys => ε ≤ |M.empiricalSecond n ys - (M.v₀ : ℝ)|) ≤ (M.productDesign n).Pr (fun ys => ε / 2 ≤ |M.empiricalSecond n ys - M.oneSecond n|) := by apply (M.productDesign n).Pr_mono intro ys hys have ht := abs_sub_le (M.empiricalSecond n ys) (M.oneSecond n) (M.v₀ : ℝ) by_contra hc have hc' : |M.empiricalSecond n ys - M.oneSecond n| < ε / 2 := lt_of_not_ge hc linarith have hcheb := (M.productDesign n).chebyshev (M.empiricalSecond n) hhalf rw [hE] at hcheb have hvar : (M.productDesign n).Var (M.empiricalSecond n) = M.expect n (fun ys => (M.empiricalSecond n ys - M.oneSecond n) ^ 2) := by rw [show (M.productDesign n).Var (M.empiricalSecond n) = M.expect n (fun ys => (M.empiricalSecond n ys - (M.productDesign n).E (M.empiricalSecond n)) ^ 2) from rfl, hE] rw [hvar] at hcheb exact htail.trans (hcheb.trans (div_le_div_of_nonneg_right (M.empiricalSecond_mse_le n hnN) (sq_nonneg _))) exact squeeze_zero' hnonneg hupper hsmall
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.empiricalSecond_tendstoInProbability · Causalean/Stat/CLT/FiniteIidTriangular/Consistency.lean:254
  • empiricalMean_tendstoInProbability theorem — At every positive error tolerance, the finite-product probability that the empirical score mean differs from zero by at least that tolerance tends to zero.
    Y :
    Type u_1
    shared
    M :
    shared
    ε :
    ℝ
    hε :
    0 < ε
    Tendsto (fun n => M.eventProbability n (fun ys => ε ≤ |M.empiricalMean n ys|)) atTop (𝓝 0)
    Proof (Lean source)
    theorem empiricalMean_tendstoInProbability (ε : ℝ) (hε : 0 < ε) : Tendsto (fun n => M.eventProbability n (fun ys => ε ≤ |M.empiricalMean n ys|)) atTop (𝓝 0) := by classical have hN : Tendsto (fun n => (M.N n : ℝ)) atTop atTop := tendsto_natCast_atTop_atTop.comp M.length_tendsto have hsmall : Tendsto (fun n => M.B ^ 2 / (M.N n : ℝ) / ε ^ 2) atTop (𝓝 0) := by have h := (tendsto_const_div_atTop_nhds_zero_nat (M.B ^ 2)).comp M.length_tendsto simpa only [Function.comp_def, zero_div] using h.div_const (ε ^ 2) have hpositive : ∀ᶠ n in atTop, 0 < M.N n := M.length_tendsto.eventually (eventually_gt_atTop 0) have hnonneg : ∀ᶠ n in atTop, 0 ≤ M.eventProbability n (fun ys => ε ≤ |M.empiricalMean n ys|) := by filter_upwards [] with n rw [M.eventProbability_eq_designPr] exact (M.productDesign n).Pr_nonneg _ have hupper : ∀ᶠ n in atTop, M.eventProbability n (fun ys => ε ≤ |M.empiricalMean n ys|) ≤ M.B ^ 2 / (M.N n : ℝ) / ε ^ 2 := by filter_upwards [hpositive] with n hn rw [M.eventProbability_eq_designPr] have hE : (M.productDesign n).E (M.empiricalMean n) = 0 := by have hNne : (M.N n : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt hn) change M.expect n (M.empiricalMean n) = 0 simp only [expect, empiricalMean, scoreSum, Finset.mul_sum] rw [Finset.sum_comm] have hcoord (i : Fin (M.N n)) : ∑ ys : Fin (M.N n) → Y, M.mass n ys * M.f n (ys i) = 0 := by change M.expect n (fun ys => M.f n (ys i)) = 0 rw [M.expect_coordinate] exact M.centered n calc (∑ i : Fin (M.N n), ∑ ys : Fin (M.N n) → Y, M.mass n ys * ((M.N n : ℝ)⁻¹ * M.f n (ys i))) = ∑ i : Fin (M.N n), (M.N n : ℝ)⁻¹ * (∑ ys : Fin (M.N n) → Y, M.mass n ys * M.f n (ys i)) := by apply Finset.sum_congr rfl intro i _ rw [Finset.mul_sum] apply Finset.sum_congr rfl intro ys _ ring _ = 0 := by simp [hcoord] have hcheb := (M.productDesign n).chebyshev (M.empiricalMean n) hε rw [hE] at hcheb simp only [sub_zero] at hcheb have hvar : (M.productDesign n).Var (M.empiricalMean n) = M.expect n (fun ys => (M.empiricalMean n ys) ^ 2) := by rw [show (M.productDesign n).Var (M.empiricalMean n) = M.expect n (fun ys => (M.empiricalMean n ys - (M.productDesign n).E (M.empiricalMean n)) ^ 2) from rfl, hE] simp rw [hvar] at hcheb exact hcheb.trans (div_le_div_of_nonneg_right (M.empiricalMean_mse_le n hn) (sq_nonneg _)) exact squeeze_zero' hnonneg hupper hsmall
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.empiricalMean_tendstoInProbability · Causalean/Stat/CLT/FiniteIidTriangular/Consistency.lean:307
Fourth­Moment 3 core · 5 supporting Fourth-moment bounds for bounded finite iid triangular rows. ★ normalizedSum_fourth_le

Fourth-moment bounds for bounded finite iid triangular rows. The module expands the fourth power of a score sum by index pattern and derives a uniform fourth-moment bound for its square-root normalization.

def fourthHasSingleton reviewed
Causalean.Stat.CLT.FiniteIidTriangular

An ordered quadruple has a singleton coordinate when some index appears exactly once.

Definition (Lean source)
k :
ℕ
p :
Fin 4 → Fin k
fourthHasSingleton p :
Prop
∃ i : Fin k, (Finset.univ.filter (fun a : Fin 4 => p a = i)).card = 1
Causalean.Stat.CLT.FiniteIidTriangular.fourthHasSingleton · Causalean/Stat/CLT/FiniteIidTriangular/FourthMoment.lean:12
def fourthConstant reviewed
Causalean.Stat.CLT.FiniteIidTriangular

An ordered quadruple is constant when all four of its indices coincide.

Definition (Lean source)
k :
ℕ
p :
Fin 4 → Fin k
a :
fourthConstant p :
Prop
p a = p 0
Causalean.Stat.CLT.FiniteIidTriangular.fourthConstant · Causalean/Stat/CLT/FiniteIidTriangular/FourthMoment.lean:16
theorem normalizedSum_fourth_le reviewed
Causalean.Stat.CLT.FiniteIidTriangular.RowModel

At each row index, the fourth moment of the square-root-normalized score sum is bounded by four times the fourth power of the common absolute score bound.

Formal statement
Y :
Type u_1
shared
M :
shared
n :
ℕ
M.expect n (fun ys => (M.normalizedSum n ys) ^ 4) ≤ 4 * M.B ^ 4
Proof (Lean source)
theorem normalizedSum_fourth_le (n : ℕ) : M.expect n (fun ys => (M.normalizedSum n ys) ^ 4) ≤ 4 * M.B ^ 4 := by classical have hY : (Finset.univ : Finset Y).Nonempty := by by_contra h have hm := M.mass_one n simp [Finset.not_nonempty_iff_eq_empty.mp h] at hm obtain ⟨y₀, _⟩ := hY have hB : 0 ≤ M.B := (abs_nonneg _).trans (M.bound n y₀) have hfour : M.oneFourth n ≤ M.B ^ 4 := by unfold oneFourth calc (∑ y, M.w n y * (M.f n y) ^ 4) ≤ ∑ y, M.w n y * M.B ^ 4 := by apply Finset.sum_le_sum intro y _ apply mul_le_mul_of_nonneg_left _ (M.mass_nonneg n y) have hf2 : (M.f n y) ^ 2 ≤ M.B ^ 2 := by have hp : 0 ≤ (M.B - |M.f n y|) * (M.B + |M.f n y|) := mul_nonneg (sub_nonneg.mpr (M.bound n y)) (add_nonneg hB (abs_nonneg _)) nlinarith [sq_abs (M.f n y)] calc (M.f n y) ^ 4 = ((M.f n y) ^ 2) ^ 2 := by ring _ ≤ (M.B ^ 2) ^ 2 := pow_le_pow_left₀ (sq_nonneg _) hf2 2 _ = M.B ^ 4 := by ring _ = M.B ^ 4 := by rw [← Finset.sum_mul, M.mass_one n]; ring have hsecond_nonneg : 0 ≤ M.oneSecond n := by unfold oneSecond apply Finset.sum_nonneg intro y _ exact mul_nonneg (M.mass_nonneg n y) (sq_nonneg _) have hsecond : M.oneSecond n ≤ M.B ^ 2 := by unfold oneSecond calc (∑ y, M.w n y * (M.f n y) ^ 2) ≤ ∑ y, M.w n y * M.B ^ 2 := by apply Finset.sum_le_sum intro y _ apply mul_le_mul_of_nonneg_left _ (M.mass_nonneg n y) have hp : 0 ≤ (M.B - |M.f n y|) * (M.B + |M.f n y|) := mul_nonneg (sub_nonneg.mpr (M.bound n y)) (add_nonneg hB (abs_nonneg _)) nlinarith [sq_abs (M.f n y)] _ = M.B ^ 2 := by rw [← Finset.sum_mul, M.mass_one n]; ring by_cases hz : M.N n = 0 · have hzero : M.expect n (fun ys => (M.normalizedSum n ys) ^ 4) = 0 := by simp [normalizedSum, scoreSum, hz, expect] rw [hzero] positivity · have hk : 1 ≤ (M.N n : ℝ) := by exact_mod_cast Nat.one_le_iff_ne_zero.mpr hz have hk0 : 0 < (M.N n : ℝ) := by linarith have hsqrt : (sqrt (M.N n : ℝ)) ^ 2 = (M.N n : ℝ) := Real.sq_sqrt (by positivity) have hscale : ((sqrt (M.N n : ℝ))⁻¹) ^ 4 = ((M.N n : ℝ)⁻¹) ^ 2 := by calc ((sqrt (M.N n : ℝ))⁻¹) ^ 4 = (((sqrt (M.N n : ℝ)) ^ 2)⁻¹) ^ 2 := by ring _ = _ := by rw [hsqrt] have hsecond_sq : (M.oneSecond n) ^ 2 ≤ M.B ^ 4 := by have hb2 : 0 ≤ M.B ^ 2 := sq_nonneg _ nlinarith [mul_nonneg hsecond_nonneg (sub_nonneg.mpr hsecond), mul_nonneg hb2 (sub_nonneg.mpr hsecond)] have hexp : (M.N n : ℝ) * M.oneFourth n + 3 * (M.N n : ℝ) * ((M.N n : ℝ) - 1) * (M.oneSecond n) ^ 2 ≤ 4 * (M.N n : ℝ) ^ 2 * M.B ^ 4 := by have hk1 : 0 ≤ (M.N n : ℝ) - 1 := by linarith have hfour0 : 0 ≤ M.B ^ 4 := by positivity have hfirst := mul_le_mul_of_nonneg_left hfour (le_of_lt hk0) have hpair := mul_le_mul_of_nonneg_left hsecond_sq (show 0 ≤ 3 * (M.N n : ℝ) * ((M.N n : ℝ) - 1) by positivity) have hkk : (M.N n : ℝ) ≤ (M.N n : ℝ) ^ 2 := by nlinarith [mul_nonneg hk0.le hk1] have hlast := mul_le_mul_of_nonneg_right hkk hfour0 have hgap : 0 ≤ (M.N n : ℝ) * M.B ^ 4 := mul_nonneg hk0.le hfour0 nlinarith [mul_nonneg hk0.le hfour0, mul_nonneg hk1 hfour0] calc M.expect n (fun ys => (M.normalizedSum n ys) ^ 4) = ((M.N n : ℝ)⁻¹) ^ 2 * ((M.N n : ℝ) * M.oneFourth n + 3 * (M.N n : ℝ) * ((M.N n : ℝ) - 1) * (M.oneSecond n) ^ 2) := by calc M.expect n (fun ys => (M.normalizedSum n ys) ^ 4) = ((M.N n : ℝ)⁻¹) ^ 2 * M.expect n (fun ys => (M.scoreSum n ys) ^ 4) := by simp only [normalizedSum, mul_pow, hscale, expect, Finset.mul_sum] apply Finset.sum_congr rfl intro ys _ ring _ = _ := by rw [M.scoreSum_fourth_expansion] _ ≤ ((M.N n : ℝ)⁻¹) ^ 2 * (4 * (M.N n : ℝ) ^ 2 * M.B ^ 4) := by exact mul_le_mul_of_nonneg_left hexp (sq_nonneg _) _ = 4 * M.B ^ 4 := by field_simp
Causalean.Stat.CLT.FiniteIidTriangular.RowModel.normalizedSum_fourth_le · Causalean/Stat/CLT/FiniteIidTriangular/FourthMoment.lean:302 · uses RowModel , expect , normalizedSum
5 supporting declarations (lemmas, instances)
  • fourth_index_sum theorem — Quadruples without a singleton contribute either a one-index fourth moment or one of the three pairings of two distinct indices.
    k :
    ℕ
    m₂ m₄ :
    ℝ
    (∑ p : Fin 4 → Fin k, if fourthHasSingleton p then (0 : ℝ) else if fourthConstant p then m₄ else m₂ ^ 2)
    = (k : ℝ) * m₄ + 3 * (k : ℝ) * ((k : ℝ) - 1) * m₂ ^ 2
    Proof (Lean source)
    theorem fourth_index_sum (k : ℕ) (m₂ m₄ : ℝ) : (∑ p : Fin 4 → Fin k, if fourthHasSingleton p then (0 : ℝ) else if fourthConstant p then m₄ else m₂ ^ 2) = (k : ℝ) * m₄ + 3 * (k : ℝ) * ((k : ℝ) - 1) * m₂ ^ 2 := by classical have hpoint (a b c d : Fin k) : (if fourthHasSingleton (![a,b,c,d] : Fin 4 → Fin k) then 0 else if fourthConstant ![a,b,c,d] then m₄ else m₂^2) = (if a=b ∧ a=c ∧ a=d then m₄ else 0) + (if a=b ∧ c=d ∧ a≠c then m₂^2 else 0) + (if a=c ∧ b=d ∧ a≠b then m₂^2 else 0) + (if a=d ∧ b=c ∧ a≠b then m₂^2 else 0) := by have hc : fourthConstant (![a,b,c,d] : Fin 4 → Fin k) ↔ a=b ∧ a=c ∧ a=d := by simp [fourthConstant, Fin.forall_fin_succ, eq_comm] have hs : fourthHasSingleton (![a,b,c,d] : Fin 4 → Fin k) ↔ (a ≠ b ∧ a ≠ c ∧ a ≠ d) ∨ (b ≠ a ∧ b ≠ c ∧ b ≠ d) ∨ (c ≠ a ∧ c ≠ b ∧ c ≠ d) ∨ (d ≠ a ∧ d ≠ b ∧ d ≠ c) := by have hcard : fourthHasSingleton (![a,b,c,d] : Fin 4 → Fin k) ↔ ∃ i : Fin k, (if a=i then 1 else 0) + (if b=i then 1 else 0) + (if c=i then 1 else 0) + (if d=i then 1 else 0) = (1 : ℕ) := by simp only [fourthHasSingleton, Finset.card_filter, Fin.sum_univ_four] rfl rw [hcard] constructor · rintro ⟨i, hi⟩ by_cases ha : a = i <;> by_cases hb : b = i <;> by_cases hc : c = i <;> by_cases hd : d = i <;> simp_all [eq_comm] · rintro (h | h | h | h) · refine ⟨a, ?_⟩; simp_all [eq_comm] · refine ⟨b, ?_⟩; simp_all [eq_comm] · refine ⟨c, ?_⟩; simp_all [eq_comm] · refine ⟨d, ?_⟩; simp_all [eq_comm] rw [hc, hs] by_cases h₁ : a = b <;> by_cases h₂ : a = c <;> by_cases h₃ : a = d <;> by_cases h₄ : b = c <;> by_cases h₅ : b = d <;> by_cases h₆ : c = d <;> simp_all [eq_comm] have hquad (f : (Fin 4 → Fin k) → ℝ) : (∑ p, f p) = ∑ a, ∑ b, ∑ c, ∑ d, f ![a,b,c,d] := by let e : (Fin 4 → Fin k) ≃ Fin k × Fin k × Fin k × Fin k := { toFun := fun p => (p 0, p 1, p 2, p 3) invFun := fun x => ![x.1, x.2.1, x.2.2.1, x.2.2.2] left_inv := by intro p; funext i; fin_cases i <;> rfl right_inv := by intro ⟨a,b,c,d⟩; rfl } rw [Fintype.sum_equiv e f (fun x => f ![x.1,x.2.1,x.2.2.1,x.2.2.2]) (by intro p have hp : p = ![p 0,p 1,p 2,p 3] := by funext i; fin_cases i <;> rfl simpa [e] using congrArg f hp)] simp only [Fintype.sum_prod_type] have hconst : (∑ a : Fin k, ∑ b : Fin k, ∑ c : Fin k, ∑ d : Fin k, if a=b ∧ a=c ∧ a=d then m₄ else 0) = (k : ℝ) * m₄ := by simp_rw [ite_and] simp have hneq (t : ℝ) : (∑ a : Fin k, ∑ b : Fin k, if a=b then 0 else t) = (k : ℝ) * ((k : ℝ) - 1) * t := by have h (a b : Fin k) : (if a=b then (0:ℝ) else t) = t - (if a=b then t else 0) := by split_ifs <;> ring simp_rw [h, Finset.sum_sub_distrib] simp ring have hpair₁ : (∑ a : Fin k, ∑ b : Fin k, ∑ c : Fin k, ∑ d : Fin k, if a=b ∧ c=d ∧ a≠c then m₂^2 else 0) = (k : ℝ) * ((k : ℝ) - 1) * m₂^2 := by simp_rw [ite_and] simp only [ne_eq, ite_not, Finset.sum_ite_irrel, Finset.sum_ite_eq, Finset.mem_univ, ↓reduceIte, Finset.sum_const_zero] exact hneq (m₂^2) have hpair₂ : (∑ a : Fin k, ∑ b : Fin k, ∑ c : Fin k, ∑ d : Fin k, if a=c ∧ b=d ∧ a≠b then m₂^2 else 0) = (k : ℝ) * ((k : ℝ) - 1) * m₂^2 := by simp_rw [ite_and] simp only [ne_eq, ite_not, Finset.sum_ite_irrel, Finset.sum_ite_eq, Finset.mem_univ, ↓reduceIte, Finset.sum_const_zero] exact hneq (m₂^2) have hpair₃ : (∑ a : Fin k, ∑ b : Fin k, ∑ c : Fin k, ∑ d : Fin k, if a=d ∧ b=c ∧ a≠b then m₂^2 else 0) = (k : ℝ) * ((k : ℝ) - 1) * m₂^2 := by simp_rw [ite_and] simp only [ne_eq, ite_not, Finset.sum_ite_eq, Finset.mem_univ, ↓reduceIte] exact hneq (m₂^2) rw [hquad] simp_rw [hpoint] simp_rw [Finset.sum_add_distrib] rw [hconst, hpair₁, hpair₂, hpair₃] ring
    Causalean.Stat.CLT.FiniteIidTriangular.fourth_index_sum · Causalean/Stat/CLT/FiniteIidTriangular/FourthMoment.lean:21
  • expect_four_product_singleton_zero theorem — A four-score coordinate product has zero expectation when one of its indices occurs exactly once, because that coordinate has mean zero.
    Y :
    Type u_1
    shared
    M :
    shared
    n :
    ℕ
    p :
    Fin 4 → Fin (M.N n)
    M.expect n (fun ys => ∏ a : Fin 4, M.f n (ys (p a))) = 0
    Proof (Lean source)
    theorem expect_four_product_singleton_zero (n : ℕ) (p : Fin 4 → Fin (M.N n)) (hp : fourthHasSingleton p) : M.expect n (fun ys => ∏ a : Fin 4, M.f n (ys (p a))) = 0 := by -- Factor the product by distinct coordinates using `expect_prod_coordinate`. -- The factor at the singleton index is `M.centered n`. classical obtain ⟨i, hi⟩ := hp let g : Fin (M.N n) → Y → ℝ := fun j y => ∏ a ∈ Finset.univ.filter (fun a : Fin 4 => p a = j), M.f n y have hfactor (ys : Fin (M.N n) → Y) : (∏ j, g j (ys j)) = ∏ a : Fin 4, M.f n (ys (p a)) := by simp only [g] calc (∏ j, ∏ a ∈ Finset.univ.filter (fun a : Fin 4 => p a = j), M.f n (ys j)) = ∏ j, ∏ a ∈ Finset.univ.filter (fun a : Fin 4 => p a = j), M.f n (ys (p a)) := by apply Finset.prod_congr rfl intro j _ apply Finset.prod_congr rfl intro a ha rw [(Finset.mem_filter.mp ha).2] _ = ∏ a : Fin 4, M.f n (ys (p a)) := by simpa using (Finset.prod_fiberwise univ p (fun a : Fin 4 => M.f n (ys (p a)))) have hsingle : ∑ y, M.w n y * g i y = 0 := by obtain ⟨a, ha⟩ := Finset.card_eq_one.mp hi simp [g, ha, M.centered n] calc M.expect n (fun ys => ∏ a : Fin 4, M.f n (ys (p a))) = M.expect n (fun ys => ∏ j, g j (ys j)) := by congr 1; funext ys; exact (hfactor ys).symm _ = ∏ j, ∑ y, M.w n y * g j y := M.expect_prod_coordinate n g _ = 0 := Finset.prod_eq_zero (Finset.mem_univ i) hsingle
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.expect_four_product_singleton_zero · Causalean/Stat/CLT/FiniteIidTriangular/FourthMoment.lean:121
  • expect_four_product_constant theorem — A four-score product with all four indices equal has expectation equal to the one-coordinate fourth moment.
    Y :
    Type u_1
    shared
    M :
    shared
    n :
    ℕ
    p :
    Fin 4 → Fin (M.N n)
    M.expect n (fun ys => ∏ a : Fin 4, M.f n (ys (p a))) = M.oneFourth n
    Proof (Lean source)
    theorem expect_four_product_constant (n : ℕ) (p : Fin 4 → Fin (M.N n)) (hp : fourthConstant p) : M.expect n (fun ys => ∏ a : Fin 4, M.f n (ys (p a))) = M.oneFourth n := by -- Rewrite the product as `(f n (ys (p 0))) ^ 4` and use `expect_coordinate`. have hprod (ys : Fin (M.N n) → Y) : (∏ a : Fin 4, M.f n (ys (p a))) = (M.f n (ys (p 0))) ^ 4 := by rw [Fin.prod_univ_four] simp only [hp 1, hp 2, hp 3] ring calc M.expect n (fun ys => ∏ a : Fin 4, M.f n (ys (p a))) = M.expect n (fun ys => (M.f n (ys (p 0))) ^ 4) := by congr 1; funext ys; exact hprod ys _ = M.oneFourth n := by rw [M.expect_coordinate n (p 0) (fun y => (M.f n y) ^ 4)] rfl
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.expect_four_product_constant · Causalean/Stat/CLT/FiniteIidTriangular/FourthMoment.lean:157
  • expect_four_product_two_pairs theorem — A four-score product with no singleton and at least two distinct indices has expectation equal to the square of the one-coordinate second moment.
    Y :
    Type u_1
    shared
    M :
    shared
    n :
    ℕ
    p :
    Fin 4 → Fin (M.N n)
    hs :
    hc :
    M.expect n (fun ys => ∏ a : Fin 4, M.f n (ys (p a))) = (M.oneSecond n) ^ 2
    Proof (Lean source)
    theorem expect_four_product_two_pairs (n : ℕ) (p : Fin 4 → Fin (M.N n)) (hs : ¬ fourthHasSingleton p) (hc : ¬ fourthConstant p) : M.expect n (fun ys => ∏ a : Fin 4, M.f n (ys (p a))) = (M.oneSecond n) ^ 2 := by -- Four occurrences with no singleton and at least two indices are two pairs. -- Rewrite as `f i ^ 2 * f j ^ 2` and use `expect_coordinate_mul`. classical have hcases : (p 0 = p 1 ∧ p 2 = p 3 ∧ p 0 ≠ p 2) ∨ (p 0 = p 2 ∧ p 1 = p 3 ∧ p 0 ≠ p 1) ∨ (p 0 = p 3 ∧ p 1 = p 2 ∧ p 0 ≠ p 1) := by have hseq : fourthHasSingleton p ↔ (p 0 ≠ p 1 ∧ p 0 ≠ p 2 ∧ p 0 ≠ p 3) ∨ (p 1 ≠ p 0 ∧ p 1 ≠ p 2 ∧ p 1 ≠ p 3) ∨ (p 2 ≠ p 0 ∧ p 2 ≠ p 1 ∧ p 2 ≠ p 3) ∨ (p 3 ≠ p 0 ∧ p 3 ≠ p 1 ∧ p 3 ≠ p 2) := by simp only [fourthHasSingleton, Finset.card_filter, Fin.sum_univ_four] constructor · rintro ⟨i, hi⟩ by_cases h0 : p 0 = i <;> by_cases h1 : p 1 = i <;> by_cases h2 : p 2 = i <;> by_cases h3 : p 3 = i <;> simp_all [eq_comm] · rintro (h | h | h | h) · refine ⟨p 0, ?_⟩; simp_all [eq_comm] · refine ⟨p 1, ?_⟩; simp_all [eq_comm] · refine ⟨p 2, ?_⟩; simp_all [eq_comm] · refine ⟨p 3, ?_⟩; simp_all [eq_comm] have hceq : fourthConstant p ↔ p 0 = p 1 ∧ p 0 = p 2 ∧ p 0 = p 3 := by simp [fourthConstant, Fin.forall_fin_succ] constructor <;> rintro ⟨h1, h2, h3⟩ <;> exact ⟨h1.symm, h2.symm, h3.symm⟩ rw [hseq] at hs rw [hceq] at hc by_cases h01 : p 0 = p 1 <;> by_cases h02 : p 0 = p 2 <;> by_cases h03 : p 0 = p 3 <;> by_cases h12 : p 1 = p 2 <;> by_cases h13 : p 1 = p 3 <;> by_cases h23 : p 2 = p 3 <;> simp_all [eq_comm] rcases hcases with ⟨h01, h23, h02⟩ | ⟨h02, h13, h01⟩ | ⟨h03, h12, h01⟩ · have hprod (ys : Fin (M.N n) → Y) : (∏ a : Fin 4, M.f n (ys (p a))) = (M.f n (ys (p 0))) ^ 2 * (M.f n (ys (p 2))) ^ 2 := by rw [Fin.prod_univ_four, h01, h23] ring calc M.expect n (fun ys => ∏ a : Fin 4, M.f n (ys (p a))) = M.expect n (fun ys => (M.f n (ys (p 0))) ^ 2 * (M.f n (ys (p 2))) ^ 2) := by congr 1; funext ys; exact hprod ys _ = (M.oneSecond n) ^ 2 := by rw [M.expect_coordinate_mul n (p 0) (p 2) h02 (fun y => (M.f n y) ^ 2) (fun y => (M.f n y) ^ 2)] simp only [oneSecond] ring · have hprod (ys : Fin (M.N n) → Y) : (∏ a : Fin 4, M.f n (ys (p a))) = (M.f n (ys (p 0))) ^ 2 * (M.f n (ys (p 1))) ^ 2 := by rw [Fin.prod_univ_four, h02, h13] ring calc M.expect n (fun ys => ∏ a : Fin 4, M.f n (ys (p a))) = M.expect n (fun ys => (M.f n (ys (p 0))) ^ 2 * (M.f n (ys (p 1))) ^ 2) := by congr 1; funext ys; exact hprod ys _ = (M.oneSecond n) ^ 2 := by rw [M.expect_coordinate_mul n (p 0) (p 1) h01 (fun y => (M.f n y) ^ 2) (fun y => (M.f n y) ^ 2)] simp only [oneSecond] ring · have hprod (ys : Fin (M.N n) → Y) : (∏ a : Fin 4, M.f n (ys (p a))) = (M.f n (ys (p 0))) ^ 2 * (M.f n (ys (p 1))) ^ 2 := by rw [Fin.prod_univ_four, h03, h12] ring calc M.expect n (fun ys => ∏ a : Fin 4, M.f n (ys (p a))) = M.expect n (fun ys => (M.f n (ys (p 0))) ^ 2 * (M.f n (ys (p 1))) ^ 2) := by congr 1; funext ys; exact hprod ys _ = (M.oneSecond n) ^ 2 := by rw [M.expect_coordinate_mul n (p 0) (p 1) h01 (fun y => (M.f n y) ^ 2) (fun y => (M.f n y) ^ 2)] simp only [oneSecond] ring
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.expect_four_product_two_pairs · Causalean/Stat/CLT/FiniteIidTriangular/FourthMoment.lean:176
  • scoreSum_fourth_expansion theorem — For a centered finite iid row, the fourth moment of the unnormalized score sum is the number of coordinates times the one-coordinate fourth moment, plus three times the number of ordered distinct pairs times the square of the one-coordinate second moment.
    Y :
    Type u_1
    shared
    M :
    shared
    n :
    ℕ
    M.expect n (fun ys => (M.scoreSum n ys) ^ 4)
    = (M.N n : ℝ) * M.oneFourth n + 3 * (M.N n : ℝ) * ((M.N n : ℝ) - 1) * (M.oneSecond n) ^ 2
    Proof (Lean source)
    theorem scoreSum_fourth_expansion (n : ℕ) : M.expect n (fun ys => (M.scoreSum n ys) ^ 4) = (M.N n : ℝ) * M.oneFourth n + 3 * (M.N n : ℝ) * ((M.N n : ℝ) - 1) * (M.oneSecond n) ^ 2 := by classical have hpoint (p : Fin 4 → Fin (M.N n)) : M.expect n (fun ys => ∏ a : Fin 4, M.f n (ys (p a))) = if fourthHasSingleton p then 0 else if fourthConstant p then M.oneFourth n else (M.oneSecond n) ^ 2 := by by_cases hs : fourthHasSingleton p · simp [hs, M.expect_four_product_singleton_zero n p hs] · by_cases hc : fourthConstant p · simp [hs, hc, M.expect_four_product_constant n p hc] · simp [hs, hc, M.expect_four_product_two_pairs n p hs hc] calc M.expect n (fun ys => (M.scoreSum n ys) ^ 4) = M.expect n (fun ys => ∑ p : Fin 4 → Fin (M.N n), ∏ a : Fin 4, M.f n (ys (p a))) := by congr 1 funext ys exact Fintype.sum_pow (fun i : Fin (M.N n) => M.f n (ys i)) 4 _ = ∑ p : Fin 4 → Fin (M.N n), M.expect n (fun ys => ∏ a : Fin 4, M.f n (ys (p a))) := by simp only [expect, Finset.mul_sum] rw [Finset.sum_comm] _ = _ := by simp_rw [hpoint] exact fourth_index_sum (M.N n) (M.oneSecond n) (M.oneFourth n)
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.scoreSum_fourth_expansion · Causalean/Stat/CLT/FiniteIidTriangular/FourthMoment.lean:270
Gaussian 5 core · 11 supporting Gaussian limits for bounded finite iid triangular rows. ★ normalizedCDF_tendsto_gaussian

Gaussian limits for bounded finite iid triangular rows. It pads finite rows into independent triangular arrays, verifies the Lyapunov hypotheses from the uniform bound, and transfers the resulting law convergence to CDF convergence.

def standardizedIncrement reviewed
Causalean.Stat.CLT.FiniteIidTriangular.RowModel

The standardized increment at natural index k is the corresponding coordinate score divided by the row-length and limiting-variance square roots when k is active, and zero otherwise.

Definition (Lean source)
Y :
Type u_1
shared
M :
shared
n k :
ℕ
ys :
Fin (M.N n) → Y
standardizedIncrement M n k ys :
ℝ
if h : k < M.N n then (sqrt (M.N n : ℝ) * sqrt (M.v₀ : ℝ))⁻¹ * M.f n (ys ⟨k, h⟩) else 0
Causalean.Stat.CLT.FiniteIidTriangular.RowModel.standardizedIncrement · Causalean/Stat/CLT/FiniteIidTriangular/Gaussian.lean:116 · uses RowModel
def standardizedArray reviewed
Causalean.Stat.CLT.FiniteIidTriangular.RowModel

The standardized finite iid row is an independent triangular array whose active increments are the coordinate scores divided by both square-root scales.

Definition (Lean source)
Y :
Type u_1
shared
M :
shared
standardizedArray M :
IndependentTriangularArray (fun n => Fin (M.N n) → Y) (fun n => M.rowMeasure n)
by exact { rowLength := M.N increment := M.standardizedIncrement measurable := M.standardizedIncrement_stronglyMeasurable squareIntegrable := fun n k _ => M.standardizedIncrement_memLp n k mean_zero := M.standardizedIncrement_mean_zero independent := M.standardizedIncrement_independent }
Causalean.Stat.CLT.FiniteIidTriangular.RowModel.standardizedArray · Causalean/Stat/CLT/FiniteIidTriangular/Gaussian.lean:258 · uses RowModel , rowMeasure , IndependentTriangularArray
def normalizedCDF reviewed
Causalean.Stat.CLT.FiniteIidTriangular.RowModel

The finite-product CDF at a threshold is the mass of row outcomes whose normalized score sum is at most that threshold.

Definition (Lean source)
Y :
Type u_1
shared
M :
shared
n :
ℕ
t :
ℝ
normalizedCDF M n t :
ℝ
M.expect n (fun ys => if M.normalizedSum n ys ≤ t then 1 else 0)
Causalean.Stat.CLT.FiniteIidTriangular.RowModel.normalizedCDF · Causalean/Stat/CLT/FiniteIidTriangular/Gaussian.lean:354 · uses RowModel
def normalizedSumLaw reviewed
Causalean.Stat.CLT.FiniteIidTriangular.RowModel

The law of the normalized score sum is the pushforward of the finite product row measure.

Definition (Lean source)
Y :
Type u_1
shared
M :
shared
n :
ℕ
normalizedSumLaw M n :
(M.rowMeasure n).map (M.normalizedSum n)
Causalean.Stat.CLT.FiniteIidTriangular.RowModel.normalizedSumLaw · Causalean/Stat/CLT/FiniteIidTriangular/Gaussian.lean:359 · uses RowModel
theorem normalizedCDF_tendsto_gaussian reviewed
Causalean.Stat.CLT.FiniteIidTriangular.RowModel

At each real threshold, the normalized finite iid score CDF converges to the centered Gaussian CDF with the positive limiting one-coordinate variance.

Formal statement
Y :
Type u_1
shared
M :
shared
t :
ℝ
Tendsto (fun n => M.normalizedCDF n t) atTop (𝓝 (cdf (gaussianReal 0 M.v₀) t))
Proof (Lean source)
theorem normalizedCDF_tendsto_gaussian (t : ℝ) : Tendsto (fun n => M.normalizedCDF n t) atTop (𝓝 (cdf (gaussianReal 0 M.v₀) t)) := by /- Give the finite alphabet its discrete measurable space locally; the statement itself needs no measurable-space assumption. Then obtain `∀ n, IsProbabilityMeasure (M.rowMeasure n)` from `productDesign.toMeasure`. For Lyapunov integrability, every active increment is integrable to fourth power on the finite probability space. Apply `lyapunov_clt` with `δ = 2` using the two limits from `GaussianArray`. The martingale row sum is pointwise `normalizedSum / sqrt (v₀ : ℝ)`: rewrite the range sum as a `Fin` sum, expand `standardizedIncrement`, and factor the constant. Obtain convergence of the standard-normal CDF at `t / sqrt (v₀ : ℝ)` from the CLT's `TendstoInLaw.tendsto` field and `tendsto_cdf_at_of_tendsto`. Positive `sqrt v₀` makes the event for this threshold exactly `normalizedSum ≤ t`; finish with `normalizedCDF_eq_cdf` and `cdf_gaussianReal_zero`. Directly comparing the two preimage events avoids a separate pushforward scaling lemma. -/ classical letI : MeasurableSpace Y := ⊤ haveI : MeasurableSingletonClass Y := ⟨fun _ => trivial⟩ haveI hprob (n : ℕ) : IsProbabilityMeasure (M.rowMeasure n) := by change IsProbabilityMeasure (M.productDesign n).toMeasure infer_instance let A := M.standardizedArray have hclt := lyapunov_clt (A := A) (δ := 2) (by norm_num) (by intro n k hk exact Integrable.of_finite) M.standardizedArray_varianceSum_tendsto M.standardizedArray_lyapunovSum_two_tendsto have hspos : 0 < sqrt (M.v₀ : ℝ) := Real.sqrt_pos.2 (by exact_mod_cast M.variance_pos) have hsum (n : ℕ) (ys : Fin (M.N n) → Y) : A.toMartingale.rowSum n ys = M.normalizedSum n ys / sqrt (M.v₀ : ℝ) := by simp only [rowSum, toMartingale, A, standardizedArray] rw [← Fin.sum_univ_eq_sum_range] simp only [Finset.sum_apply] rw [show (∑ i : Fin (M.N n), M.standardizedIncrement n (i : ℕ) ys) = ∑ i : Fin (M.N n), (sqrt (M.N n : ℝ) * sqrt (M.v₀ : ℝ))⁻¹ * M.f n (ys i) by apply Finset.sum_congr rfl intro i hi simp [standardizedIncrement, i.isLt]] rw [← Finset.mul_sum] unfold normalizedSum scoreSum rw [mul_comm (sqrt (M.N n : ℝ))⁻¹] ring have hcont : ContinuousAt (cdf (gaussianReal 0 (1 : NNReal))) (t / sqrt (M.v₀ : ℝ)) := (continuous_cdf_gaussianReal_zero (by norm_num : (0 : NNReal) < 1)).continuousAt have hcdf := tendsto_cdf_at_of_tendsto (νs := fun n => ⟨(M.rowMeasure n).map (A.toMartingale.rowSum n), Measure.isProbabilityMeasure_map (hclt.forall_aemeasurable n)⟩) (ν := ⟨gaussianReal 0 1, inferInstance⟩) (by simpa only [ProbabilityMeasure.coe_mk, Measure.map_id] using hclt.tendsto) hcont have hevent (n : ℕ) : (M.rowMeasure n).map (A.toMartingale.rowSum n) = (M.normalizedSumLaw n).map (fun x => x / sqrt (M.v₀ : ℝ)) := by rw [normalizedSumLaw, Measure.map_map] · congr 1 funext ys exact hsum n ys · exact (continuous_id.div_const _).measurable · exact measurable_of_finite _ have hcdf_eq (n : ℕ) : cdf ((M.rowMeasure n).map (A.toMartingale.rowSum n)) (t / sqrt (M.v₀ : ℝ)) = M.normalizedCDF n t := by haveI : IsProbabilityMeasure (M.normalizedSumLaw n) := Measure.isProbabilityMeasure_map (measurable_of_finite (M.normalizedSum n)).aemeasurable haveI : IsProbabilityMeasure ((M.normalizedSumLaw n).map (fun x => x / sqrt (M.v₀ : ℝ))) := Measure.isProbabilityMeasure_map (continuous_id.div_const _).measurable.aemeasurable rw [hevent, cdf_eq_real, MeasureTheory.map_measureReal_apply (f := fun x : ℝ => x / sqrt (M.v₀ : ℝ)) (continuous_id.div_const _).measurable measurableSet_Iic] have hset : (fun x : ℝ => x / sqrt (M.v₀ : ℝ)) ⁻¹' Iic (t / sqrt (M.v₀ : ℝ)) = Iic t := by ext x simp only [Set.mem_preimage, Set.mem_Iic] exact div_le_div_iff_of_pos_right hspos rw [hset, ← cdf_eq_real, ← M.normalizedCDF_eq_cdf] simpa only [ProbabilityMeasure.coe_mk, hcdf_eq, cdf_gaussianReal_zero (by norm_num : (0 : NNReal) < 1), cdf_gaussianReal_zero M.variance_pos, NNReal.coe_one, Real.sqrt_one, div_one] using hcdf
Causalean.Stat.CLT.FiniteIidTriangular.RowModel.normalizedCDF_tendsto_gaussian · Causalean/Stat/CLT/FiniteIidTriangular/Gaussian.lean:410 · uses RowModel , normalizedCDF
11 supporting declarations (lemmas, instances)
  • iIndepFun_nat_pad theorem — An independent family indexed by Fin d remains independent as a family indexed by all natural numbers when every index at least d is assigned the constant zero variable.
    Ω :
    d :
    ℕ
    X :
    Fin d → Ω → ℝ
    hX :
    iIndepFun X μ
    iIndepFun (fun k ω => if h : k < d then X ⟨k, h⟩ ω else 0) μ
    Proof (Lean source)
    theorem iIndepFun_nat_pad {Ω : Type*} [MeasurableSpace Ω] (μ : Measure Ω) [IsProbabilityMeasure μ] (d : ℕ) (X : Fin d → Ω → ℝ) (hX : iIndepFun X μ) : iIndepFun (fun k ω => if h : k < d then X ⟨k, h⟩ ω else 0) μ := by have hfun : (fun k ω => if h : k < d then X ⟨k, h⟩ ω else (0 : ℝ)) = (fun k : ℕ => if hk : k < d then X ⟨k, hk⟩ else fun _ => 0) := by funext k ω split_ifs <;> rfl rw [hfun] classical rw [iIndepFun_iff_measure_inter_preimage_eq_mul] intro S sets hsets let T : Finset (Fin d) := Finset.univ.filter (fun j => (j : ℕ) ∈ S) let U : Finset ℕ := S.filter (fun k => k < d) have hTU : T.image val = U := by ext k rw [mem_image] simp only [U, mem_filter] constructor · rintro ⟨j, hj, rfl⟩ exact ⟨(Finset.mem_filter.mp hj).2, j.isLt⟩ · rintro ⟨hkS, hkD⟩ exact ⟨⟨k, hkD⟩, Finset.mem_filter.mpr ⟨Finset.mem_univ _, hkS⟩, rfl⟩ have hprob : μ univ = 1 := by have h := hX.measure_inter_preimage_eq_mul (∅ : Finset (Fin d)) (sets := fun _ => univ) (by simp) simpa using h have hT := hX.measure_inter_preimage_eq_mul T (sets := fun j : Fin d => sets j.val) (by intro j hj; exact hsets j.val ((Finset.mem_filter.mp hj).2)) have hbelow : μ (⋂ k ∈ U, (if hk : k < d then X ⟨k, hk⟩ else fun _ => 0) ⁻¹' sets k) = ∏ k ∈ U, μ ((if hk : k < d then X ⟨k, hk⟩ else fun _ => 0) ⁻¹' sets k) := by have hI : (⋂ k ∈ U, (if hk : k < d then X ⟨k, hk⟩ else fun _ => 0) ⁻¹' sets k) = ⋂ j ∈ T, X j ⁻¹' sets j.val := by ext ω simp only [Set.mem_iInter] constructor · intro h j hj have hjS : j.val ∈ S := (Finset.mem_filter.mp hj).2 have hjU : j.val ∈ U := Finset.mem_filter.mpr ⟨hjS, j.isLt⟩ simpa [j.isLt] using h j.val hjU · intro h k hk have hkD : k < d := (Finset.mem_filter.mp hk).2 have hkS : k ∈ S := (Finset.mem_filter.mp hk).1 simpa [hkD] using h ⟨k, hkD⟩ (Finset.mem_filter.mpr ⟨Finset.mem_univ _, hkS⟩) rw [hI] convert hT using 1 rw [← hTU, Finset.prod_image] · apply Finset.prod_congr rfl intro j hj simp [j.isLt] · exact Fin.val_injective.injOn by_cases hbad : ∃ k ∈ S, ¬ k < d ∧ (0 : ℝ) ∉ sets k · obtain ⟨k, hkS, hkD, hk0⟩ := hbad have hzero : ((if hk : k < d then X ⟨k, hk⟩ else fun _ => 0) ⁻¹' sets k) = ∅ := by simp [hkD, hk0] have hmem : (⋂ i ∈ S, (if hi : i < d then X ⟨i, hi⟩ else fun _ => 0) ⁻¹' sets i) = ∅ := by ext ω simp only [Set.mem_empty_iff_false, iff_false] intro hω have := Set.mem_iInter.mp (Set.mem_iInter.mp hω k) hkS simp [hzero] at this rw [hmem, measure_empty, Finset.prod_eq_zero hkS] simp [hzero] · have hout : ∀ k ∈ S, ¬ k < d → (0 : ℝ) ∈ sets k := by intro k hkS hkD by_contra hk0 exact hbad ⟨k, hkS, hkD, hk0⟩ have hI : (⋂ k ∈ S, (if hk : k < d then X ⟨k, hk⟩ else fun _ => 0) ⁻¹' sets k) = ⋂ k ∈ U, (if hk : k < d then X ⟨k, hk⟩ else fun _ => 0) ⁻¹' sets k := by ext ω simp only [Set.mem_iInter] constructor · intro h k hk exact h k (Finset.mem_filter.mp hk).1 · intro h k hkS by_cases hkD : k < d · exact h k (Finset.mem_filter.mpr ⟨hkS, hkD⟩) · simp [hkD, hout k hkS hkD] rw [hI, hbelow] have hprod : (∏ k ∈ S, μ ((if hk : k < d then X ⟨k, hk⟩ else fun _ => 0) ⁻¹' sets k)) = ∏ k ∈ U, μ ((if hk : k < d then X ⟨k, hk⟩ else fun _ => 0) ⁻¹' sets k) := by rw [Finset.prod_filter] apply Finset.prod_congr rfl intro k hkS by_cases hkD : k < d · simp [hkD] · simp [hkD, hout k hkS hkD, hprob] exact hprod.symm
    Causalean.Stat.CLT.FiniteIidTriangular.iIndepFun_nat_pad · Causalean/Stat/CLT/FiniteIidTriangular/Gaussian.lean:16
  • standardizedIncrement_stronglyMeasurable theorem — Every standardized row increment is strongly measurable under the finite row sample space.
    Y :
    Type u_1
    shared
    M :
    shared
    n k :
    ℕ
    StronglyMeasurable (M.standardizedIncrement n k)
    Proof (Lean source)
    theorem standardizedIncrement_stronglyMeasurable (n k : ℕ) : StronglyMeasurable (M.standardizedIncrement n k) := by exact (measurable_of_finite _).stronglyMeasurable
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.standardizedIncrement_stronglyMeasurable · Causalean/Stat/CLT/FiniteIidTriangular/Gaussian.lean:124
  • standardizedIncrement_memLp theorem — Every standardized coordinate score has a finite second moment under its row's product probability measure.
    Y :
    Type u_1
    shared
    M :
    shared
    n k :
    ℕ
    MemLp (M.standardizedIncrement n k) 2 (M.rowMeasure n)
    Proof (Lean source)
    theorem standardizedIncrement_memLp (n k : ℕ) : MemLp (M.standardizedIncrement n k) 2 (M.rowMeasure n) := by have : IsProbabilityMeasure (M.rowMeasure n) := by change IsProbabilityMeasure (M.productDesign n).toMeasure infer_instance exact MemLp.of_discrete
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.standardizedIncrement_memLp · Causalean/Stat/CLT/FiniteIidTriangular/Gaussian.lean:130
  • standardizedIncrement_mean_zero theorem — Every active standardized coordinate score has mean zero under its row's product probability measure.
    Y :
    Type u_1
    shared
    M :
    shared
    n k :
    ℕ
    hk :
    k < M.N n
    ∫ ys, M.standardizedIncrement n k ys ∂M.rowMeasure n = 0
    Proof (Lean source)
    theorem standardizedIncrement_mean_zero (n k : ℕ) (hk : k < M.N n) : ∫ ys, M.standardizedIncrement n k ys ∂M.rowMeasure n = 0 := by rw [M.integral_rowMeasure_eq_expect] have hcoord := M.expect_coordinate n ⟨k, hk⟩ (M.f n) have hcenter := M.centered n calc M.expect n (M.standardizedIncrement n k) = (sqrt (M.N n : ℝ) * sqrt (M.v₀ : ℝ))⁻¹ * M.expect n (fun ys => M.f n (ys ⟨k, hk⟩)) := by simp only [expect, standardizedIncrement, dif_pos hk, Finset.mul_sum] apply Finset.sum_congr rfl intro ys _ ring _ = 0 := by rw [hcoord, hcenter, mul_zero]
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.standardizedIncrement_mean_zero · Causalean/Stat/CLT/FiniteIidTriangular/Gaussian.lean:139
  • standardizedIncrement_independent theorem — The natural-index family of standardized increments is independent under each row's finite product law, including the zero increments beyond the row length.
    Y :
    Type u_1
    shared
    M :
    shared
    n :
    ℕ
    iIndepFun (M.standardizedIncrement n) (M.rowMeasure n)
    Proof (Lean source)
    theorem standardizedIncrement_independent (n : ℕ) : iIndepFun (M.standardizedIncrement n) (M.rowMeasure n) := by let X : Fin (M.N n) → (Fin (M.N n) → Y) → ℝ := fun i ys => (sqrt (M.N n : ℝ) * sqrt (M.v₀ : ℝ))⁻¹ * M.f n (ys i) have hX : iIndepFun X (M.rowMeasure n) := by apply (M.rowMeasure_independent n).comp (fun _ y => (sqrt (M.N n : ℝ) * sqrt (M.v₀ : ℝ))⁻¹ * M.f n y) intro i exact measurable_of_finite _ have : IsProbabilityMeasure (M.rowMeasure n) := by change IsProbabilityMeasure (M.productDesign n).toMeasure infer_instance have hpad := iIndepFun_nat_pad (M.rowMeasure n) (M.N n) X hX convert hpad using 1 funext k ys simp only [standardizedIncrement, X]
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.standardizedIncrement_independent · Causalean/Stat/CLT/FiniteIidTriangular/Gaussian.lean:156
  • standardizedIncrement_integral_sq theorem — An active standardized coordinate has second moment equal to the row's one-coordinate variance divided by row length and limiting variance.
    Y :
    Type u_1
    shared
    M :
    shared
    n k :
    ℕ
    hk :
    k < M.N n
    (∫ ys, (M.standardizedIncrement n k ys) ^ 2 ∂M.rowMeasure n)
    = M.oneSecond n / ((M.N n : ℝ) * (M.v₀ : ℝ))
    Proof (Lean source)
    theorem standardizedIncrement_integral_sq (n k : ℕ) (hk : k < M.N n) : (∫ ys, (M.standardizedIncrement n k ys) ^ 2 ∂M.rowMeasure n) = M.oneSecond n / ((M.N n : ℝ) * (M.v₀ : ℝ)) := by -- Rewrite the integral as `expect`, extract the constant square, and use -- `expect_coordinate` for the score square. `hk` and `variance_pos` make -- both denominator factors nonzero. have hscale : ((sqrt (M.N n : ℝ) * sqrt (M.v₀ : ℝ))⁻¹) ^ 2 = ((M.N n : ℝ) * (M.v₀ : ℝ))⁻¹ := by rw [inv_pow, mul_pow, Real.sq_sqrt (Nat.cast_nonneg _), Real.sq_sqrt (show 0 ≤ (M.v₀ : ℝ) by positivity)] rw [M.integral_rowMeasure_eq_expect] calc M.expect n (fun ys => (M.standardizedIncrement n k ys) ^ 2) = ((sqrt (M.N n : ℝ) * sqrt (M.v₀ : ℝ))⁻¹) ^ 2 * M.expect n (fun ys => (M.f n (ys ⟨k, hk⟩)) ^ 2) := by simp only [expect, standardizedIncrement, dif_pos hk, Finset.mul_sum] apply Finset.sum_congr rfl intro ys _ ring _ = M.oneSecond n / ((M.N n : ℝ) * (M.v₀ : ℝ)) := by rw [M.expect_coordinate n ⟨k, hk⟩ (fun y => (M.f n y) ^ 2), ← oneSecond, hscale] ring
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.standardizedIncrement_integral_sq · Causalean/Stat/CLT/FiniteIidTriangular/Gaussian.lean:175
  • standardizedIncrement_integral_fourth_le theorem — An active standardized coordinate has fourth moment at most the fourth power of the common score bound divided by the squared row length and squared limiting variance.
    Y :
    Type u_1
    shared
    M :
    shared
    n k :
    ℕ
    hk :
    k < M.N n
    (∫ ys, (M.standardizedIncrement n k ys) ^ 4 ∂M.rowMeasure n)
    ≤ M.B ^ 4 / ((M.N n : ℝ) ^ 2 * (M.v₀ : ℝ) ^ 2)
    Proof (Lean source)
    theorem standardizedIncrement_integral_fourth_le (n k : ℕ) (hk : k < M.N n) : (∫ ys, (M.standardizedIncrement n k ys) ^ 4 ∂M.rowMeasure n) ≤ M.B ^ 4 / ((M.N n : ℝ) ^ 2 * (M.v₀ : ℝ) ^ 2) := by -- Use `expect_coordinate` after extracting the scale. The mass-weighted -- fourth score moment is at most `B ^ 4` by `bound`, `mass_nonneg`, and -- `mass_one`. Both denominator factors are positive. have hscale : ((sqrt (M.N n : ℝ) * sqrt (M.v₀ : ℝ))⁻¹) ^ 4 = (((M.N n : ℝ) ^ 2) * ((M.v₀ : ℝ) ^ 2))⁻¹ := by rw [show (4 : ℕ) = 2 * 2 by norm_num, pow_mul, inv_pow, mul_pow, Real.sq_sqrt (Nat.cast_nonneg _), Real.sq_sqrt (show 0 ≤ (M.v₀ : ℝ) by positivity)] rw [inv_pow, mul_pow] have hfour : (∑ y, M.w n y * (M.f n y) ^ 4) ≤ M.B ^ 4 := by calc (∑ y, M.w n y * (M.f n y) ^ 4) ≤ ∑ y, M.w n y * M.B ^ 4 := by apply Finset.sum_le_sum intro y _ apply mul_le_mul_of_nonneg_left _ (M.mass_nonneg n y) have hB : 0 ≤ M.B := (abs_nonneg _).trans (M.bound n y) have hf2 : (M.f n y) ^ 2 ≤ M.B ^ 2 := by have hp : 0 ≤ (M.B - |M.f n y|) * (M.B + |M.f n y|) := mul_nonneg (sub_nonneg.mpr (M.bound n y)) (add_nonneg hB (abs_nonneg _)) nlinarith [sq_abs (M.f n y)] calc (M.f n y) ^ 4 = ((M.f n y) ^ 2) ^ 2 := by ring _ ≤ (M.B ^ 2) ^ 2 := pow_le_pow_left₀ (sq_nonneg _) hf2 2 _ = M.B ^ 4 := by ring _ = M.B ^ 4 := by rw [← Finset.sum_mul, M.mass_one n]; ring rw [M.integral_rowMeasure_eq_expect] calc M.expect n (fun ys => (M.standardizedIncrement n k ys) ^ 4) = ((sqrt (M.N n : ℝ) * sqrt (M.v₀ : ℝ))⁻¹) ^ 4 * M.expect n (fun ys => (M.f n (ys ⟨k, hk⟩)) ^ 4) := by simp only [expect, standardizedIncrement, dif_pos hk, Finset.mul_sum] apply Finset.sum_congr rfl intro ys _ ring _ = (∑ y, M.w n y * (M.f n y) ^ 4) / ((M.N n : ℝ) ^ 2 * (M.v₀ : ℝ) ^ 2) := by rw [M.expect_coordinate n ⟨k, hk⟩ (fun y => (M.f n y) ^ 4), hscale] ring _ ≤ M.B ^ 4 / ((M.N n : ℝ) ^ 2 * (M.v₀ : ℝ) ^ 2) := by exact div_le_div_of_nonneg_right hfour (by positivity)
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.standardizedIncrement_integral_fourth_le · Causalean/Stat/CLT/FiniteIidTriangular/Gaussian.lean:200
  • standardizedArray_varianceSum_tendsto theorem — The total increment variance of the standardized array tends to one.
    Y :
    Type u_1
    shared
    M :
    shared
    Tendsto M.standardizedArray.varianceSum atTop (𝓝 1)
    Proof (Lean source)
    theorem standardizedArray_varianceSum_tendsto : Tendsto M.standardizedArray.varianceSum atTop (𝓝 1) := by have hlim : Tendsto (fun n => M.oneSecond n / (M.v₀ : ℝ)) atTop (𝓝 1) := by have hv : (M.v₀ : ℝ) ≠ 0 := ne_of_gt (by exact_mod_cast M.variance_pos) simpa only [oneSecond, div_self hv] using M.variance_tendsto.div_const (M.v₀ : ℝ) have hpositive : ∀ᶠ n in atTop, 0 < M.N n := M.length_tendsto.eventually (eventually_gt_atTop 0) apply hlim.congr' filter_upwards [hpositive] with n hn symm change (∑ k ∈ range (M.N n), ∫ ys, (M.standardizedIncrement n k ys) ^ 2 ∂M.rowMeasure n) = M.oneSecond n / (M.v₀ : ℝ) rw [Finset.sum_congr rfl (fun k hk => M.standardizedIncrement_integral_sq n k (Finset.mem_range.mp hk))] simp only [Finset.sum_const, Finset.card_range, nsmul_eq_mul] have hN : (M.N n : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt hn) have hv : (M.v₀ : ℝ) ≠ 0 := ne_of_gt (by exact_mod_cast M.variance_pos) field_simp
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.standardizedArray_varianceSum_tendsto · Causalean/Stat/CLT/FiniteIidTriangular/Gaussian.lean:272
  • standardizedArray_lyapunovSum_two_tendsto theorem — The sum of fourth absolute moments of the standardized increments tends to zero, as required by Lyapunov with moment surplus two.
    Y :
    Type u_1
    shared
    M :
    shared
    Tendsto (M.standardizedArray.lyapunovSum 2) atTop (𝓝 0)
    Proof (Lean source)
    theorem standardizedArray_lyapunovSum_two_tendsto : Tendsto (M.standardizedArray.lyapunovSum 2) atTop (𝓝 0) := by have hsmall : Tendsto (fun n => (M.B ^ 4 / (M.v₀ : ℝ) ^ 2) / (M.N n : ℝ)) atTop (𝓝 0) := by simpa only [Function.comp_def] using (tendsto_const_div_atTop_nhds_zero_nat (M.B ^ 4 / (M.v₀ : ℝ) ^ 2)).comp M.length_tendsto have hnonneg : ∀ n, 0 ≤ M.standardizedArray.lyapunovSum 2 n := by intro n change 0 ≤ ∑ k ∈ range (M.N n), ∫ ys, |M.standardizedIncrement n k ys| ^ (2 + (2 : ℝ)) ∂M.rowMeasure n apply Finset.sum_nonneg intro k hk apply integral_nonneg intro ys exact Real.rpow_nonneg (abs_nonneg _) _ have hpositive : ∀ᶠ n in atTop, 0 < M.N n := M.length_tendsto.eventually (eventually_gt_atTop 0) have hbound : ∀ᶠ n in atTop, M.standardizedArray.lyapunovSum 2 n ≤ (M.B ^ 4 / (M.v₀ : ℝ) ^ 2) / (M.N n : ℝ) := by filter_upwards [hpositive] with n hn change (∑ k ∈ range (M.N n), ∫ ys, |M.standardizedIncrement n k ys| ^ (2 + (2 : ℝ)) ∂M.rowMeasure n) ≤ _ calc (∑ k ∈ range (M.N n), ∫ ys, |M.standardizedIncrement n k ys| ^ (2 + (2 : ℝ)) ∂M.rowMeasure n) ≤ ∑ k ∈ range (M.N n), M.B ^ 4 / ((M.N n : ℝ) ^ 2 * (M.v₀ : ℝ) ^ 2) := by apply Finset.sum_le_sum intro k hk calc (∫ ys, |M.standardizedIncrement n k ys| ^ (2 + (2 : ℝ)) ∂M.rowMeasure n) = ∫ ys, (M.standardizedIncrement n k ys) ^ 4 ∂M.rowMeasure n := by congr 1 funext ys rw [show (2 : ℝ) + 2 = (4 : ℕ) by norm_num, Real.rpow_natCast] have hpow : 0 ≤ (M.standardizedIncrement n k ys) ^ 4 := by positivity rw [← abs_pow, abs_of_nonneg hpow] _ ≤ _ := M.standardizedIncrement_integral_fourth_le n k (Finset.mem_range.mp hk) _ = (M.B ^ 4 / (M.v₀ : ℝ) ^ 2) / (M.N n : ℝ) := by simp only [Finset.sum_const, Finset.card_range, nsmul_eq_mul] have hN : (M.N n : ℝ) ≠ 0 := by exact_mod_cast (Nat.ne_of_gt hn) have hv : (M.v₀ : ℝ) ≠ 0 := ne_of_gt (by exact_mod_cast M.variance_pos) field_simp exact squeeze_zero' (Filter.Eventually.of_forall hnonneg) hbound hsmall
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.standardizedArray_lyapunovSum_two_tendsto · Causalean/Stat/CLT/FiniteIidTriangular/Gaussian.lean:294
  • normalizedCDF_eq_cdf theorem — The literal finite-product CDF equals the CDF of the normalized-sum pushforward law.
    Y :
    Type u_1
    shared
    M :
    shared
    n :
    ℕ
    t :
    ℝ
    M.normalizedCDF n t = cdf (M.normalizedSumLaw n) t
    Proof (Lean source)
    theorem normalizedCDF_eq_cdf [MeasurableSpace Y] [MeasurableSingletonClass Y] (n : ℕ) (t : ℝ) : M.normalizedCDF n t = cdf (M.normalizedSumLaw n) t := by classical have : IsProbabilityMeasure (M.rowMeasure n) := by change IsProbabilityMeasure (M.productDesign n).toMeasure infer_instance have : IsProbabilityMeasure (M.normalizedSumLaw n) := Measure.isProbabilityMeasure_map (measurable_of_finite (M.normalizedSum n)).aemeasurable rw [cdf_eq_real, normalizedSumLaw, measureReal_def, Measure.map_apply (measurable_of_finite (M.normalizedSum n)) measurableSet_Iic] change M.normalizedCDF n t = (M.rowMeasure n).real (M.normalizedSum n ⁻¹' Iic t) rw [← integral_indicator_one ((measurable_of_finite (M.normalizedSum n)) measurableSet_Iic)] rw [normalizedCDF, ← M.integral_rowMeasure_eq_expect] congr 1
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.normalizedCDF_eq_cdf · Causalean/Stat/CLT/FiniteIidTriangular/Gaussian.lean:364
  • eventually_small_normalized_coordinate theorem — Every positive threshold eventually exceeds all individual score increments after normalization by the square root of the growing row length.
    Y :
    Type u_1
    shared
    M :
    shared
    ε :
    ℝ
    hε :
    0 < ε
    ∀ᶠ n in atTop, ∀ y, |(sqrt (M.N n : ℝ))⁻¹ * M.f n y| < ε
    Proof (Lean source)
    theorem eventually_small_normalized_coordinate (ε : ℝ) (hε : 0 < ε) : ∀ᶠ n in atTop, ∀ y, |(sqrt (M.N n : ℝ))⁻¹ * M.f n y| < ε := by have hsqrt : Tendsto (fun n : ℕ => sqrt (M.N n : ℝ)) atTop atTop := Real.tendsto_sqrt_atTop.comp (tendsto_natCast_atTop_atTop.comp M.length_tendsto) have hinv : Tendsto (fun n : ℕ => (sqrt (M.N n : ℝ))⁻¹) atTop (𝓝 0) := tendsto_inv_atTop_zero.comp hsqrt have hlim : Tendsto (fun n : ℕ => (sqrt (M.N n : ℝ))⁻¹ * max M.B 0) atTop (𝓝 0) := by simpa using hinv.mul_const (max M.B 0) have hsmall : ∀ᶠ n in atTop, (sqrt (M.N n : ℝ))⁻¹ * max M.B 0 < ε := by exact hlim.eventually_lt_const hε filter_upwards [hsmall] with n hn y calc |(sqrt (M.N n : ℝ))⁻¹ * M.f n y| = (sqrt (M.N n : ℝ))⁻¹ * |M.f n y| := by rw [abs_mul, abs_of_nonneg (inv_nonneg.mpr (Real.sqrt_nonneg _))] _ ≤ (sqrt (M.N n : ℝ))⁻¹ * max M.B 0 := by exact mul_le_mul_of_nonneg_left ((M.bound n y).trans (le_max_left _ _)) (inv_nonneg.mpr (Real.sqrt_nonneg _)) _ < ε := hn
    Causalean.Stat.CLT.FiniteIidTriangular.RowModel.eventually_small_normalized_coordinate · Causalean/Stat/CLT/FiniteIidTriangular/Gaussian.lean:383