Mathlib.Probability.Stein­Method

Stein-method normal-approximation helpers: Stein equation solutions, uniform bounds, local-dependence estimates, and dependency-graph CLTs.

Solution 3 core · 2 supporting This file defines gExpect, the bounded solution steinSol of the standard-normal Stein equation, and the two public identities steinSol_hasDerivAt and steinSol_stein_eq. ★ steinSol_hasDerivAt

Stein equation for the standard normal distribution

This file defines gExpect, the bounded solution steinSol of the standard-normal Stein equation, and the two public identities steinSol_hasDerivAt and steinSol_stein_eq. The supporting lemmas establish the Gaussian expectation and integrability facts needed by the Stein-method bounds.

def gExpect reviewed
Causalean.SteinMethod

Expectation of h under the standard normal law, E[h(Z)].

Definition (Lean source)
noncomputable def gExpect (h : ℝ → ℝ) : ℝ := ∫ x, h x ∂(gaussianReal 0 1)
def steinSol reviewed
Causalean.SteinMethod

The bounded solution of the Stein equation f' − w·f = h − E[h(Z)].

Definition (Lean source)
noncomputable def steinSol (h : ℝ → ℝ) (w : ℝ) : ℝ := exp (w ^ 2 / 2) * ∫ x in Iic w, (h x - gExpect h) * exp (-x ^ 2 / 2)
theorem steinSol_hasDerivAt reviewed
Causalean.SteinMethod

The Stein equation. For a continuous test function h that is bounded in absolute value by a constant C, the Stein solution steinSol h is differentiable at every point w, with derivative w·steinSol h w + (h w − E[h(Z)]) for a standard normal Z, i.e. it solves the Stein equation f'(w) − w·f(w) = h(w) − E[h(Z)].

Formal statement
h :
ℝ → ℝ
hh :
C :
hb :
∀ x, |h x| ≤ C
w :
HasDerivAt (steinSol h) (w * steinSol h w + (h w - gExpect h)) w
Proof (Lean source)
theorem steinSol_hasDerivAt (h : ℝ → ℝ) (hh : Continuous h) {C : ℝ} (hb : ∀ x, |h x| ≤ C) (w : ℝ) : HasDerivAt (steinSol h) (w * steinSol h w + (h w - gExpect h)) w := by set g := steinIntegrand h with hg_def have hg_cont : Continuous g := steinIntegrand_continuous h hh have hg_int : Integrable g := steinIntegrand_integrable hh hb -- The cumulative integral `G w = ∫ x in Iic w, g x` has derivative `g w`. set G : ℝ → ℝ := fun u => ∫ x in Iic u, g x with hG_def have hG_deriv : HasDerivAt G (g w) w := by -- Base point `a := w - 1`. set a : ℝ := w - 1 with ha_def have hIIc_int : ∀ u : ℝ, IntegrableOn g (Iic u) := fun u => hg_int.integrableOn -- `G u = (∫ x in Iic a, g) + ∫ x in a..u, g`. have hGeq : ∀ u : ℝ, G u = (∫ x in Iic a, g x) + ∫ x in a..u, g x := by intro u have := intervalIntegral.integral_Iic_sub_Iic (hIIc_int a) (hIIc_int u) rw [hG_def]; linarith [this] have hivint : IntervalIntegrable g MeasureTheory.volume a w := hg_int.intervalIntegrable have hd : HasDerivAt (fun u => ∫ x in a..u, g x) (g w) w := intervalIntegral.integral_hasDerivAt_right hivint hg_cont.aestronglyMeasurable.stronglyMeasurableAtFilter hg_cont.continuousAt have hd' : HasDerivAt (fun u => (∫ x in Iic a, g x) + ∫ x in a..u, g x) (g w) w := by simpa using hd.const_add (∫ x in Iic a, g x) exact hd'.congr_of_eventuallyEq (Filter.Eventually.of_forall (fun u => hGeq u)) -- Derivative of `e^{w²/2}`. have hexp_deriv : HasDerivAt (fun u : ℝ => exp (u ^ 2 / 2)) (w * exp (w ^ 2 / 2)) w := by have hpow : HasDerivAt (fun u : ℝ => u ^ 2 / 2) w w := by have := (hasDerivAt_pow 2 w).div_const 2 simpa using this have := hpow.exp simpa [mul_comm] using this -- Product rule. have hprod := hexp_deriv.mul hG_deriv -- Rewrite `steinSol h = fun u => e^{u²/2} * G u`. have hsol_eq : steinSol h = fun u => exp (u ^ 2 / 2) * G u := by funext u; rfl -- Match derivatives: `w * steinSol h w + (h w - gExpect h)`. have hgcancel : exp (w ^ 2 / 2) * g w = h w - gExpect h := by rw [hg_def, steinIntegrand, ← mul_assoc, mul_comm (exp _) (h w - gExpect h), mul_assoc, ← Real.exp_add] rw [show w ^ 2 / 2 + -w ^ 2 / 2 = 0 by ring, Real.exp_zero, mul_one] rw [hsol_eq] refine hprod.congr_deriv ?_ rw [hgcancel]; ring
Causalean.SteinMethod.steinSol_hasDerivAt · Causalean/Mathlib/Probability/SteinMethod/Solution.lean:86 · uses gExpect , steinSol
2 supporting declarations (lemmas, instances)
Dependency­CLT 3 core · 3 supporting This file defines the standardized sum depSum, the neighborhood sum nbhdSum, and proves the Chen-Goldstein-Shao/Ross style stein_local_dependence_bound for a finite family of mean-zero random variables with dependency ne ★ stein_local_dependence_bound

Local-dependence Stein bound

This file defines the standardized sum depSum, the neighborhood sum nbhdSum, and proves the Chen-Goldstein-Shao/Ross style stein_local_dependence_bound for a finite family of mean-zero random variables with dependency neighborhoods. The bound controls the difference between expectations under the standardized sum and the standard normal by two local-dependence error terms.

def depSum reviewed
Causalean.SteinMethod

The standardized sum W = ∑ᵢ Xᵢ.

Definition (Lean source)
noncomputable def depSum (X : ι → Ω → ℝ) : Ω → ℝ := fun ω => ∑ i, X i ω
def nbhdSum reviewed
Causalean.SteinMethod

The neighborhood sum Tᵢ = ∑_{j∈Nᵢ} Xⱼ.

Definition (Lean source)
noncomputable def nbhdSum (X : ι → Ω → ℝ) (N : ι → Finset ι) (i : ι) : Ω → ℝ := fun ω => ∑ j ∈ N i, X j ω
theorem stein_local_dependence_bound reviewed
Causalean.SteinMethod

The local-dependence Stein bound. For jointly measurable summands X i uniformly bounded in absolute value by a nonnegative constant B, each mean zero and independent of the sum of the summands outside its neighborhood set N i, with the standardized sum having unit variance, and for a test function h that is bounded in absolute value by C, has derivative bounded in absolute value by L, and is differentiable, the deviation of the expected test-function value of the local-dependence sum from its standard-normal expectation is at most 2L·√(Var(∑ᵢ Xᵢ·nbhdSumᵢ)) + L·∑ᵢ E[|Xᵢ|·nbhdSumᵢ²].

Formal statement
X :
ι → Ω → ℝ
N :
ι → Finset ι
hmeas :
∀ i, Measurable (X i)
B :
hB :
0 ≤ B
hbound :
∀ i ω, |X i ω| ≤ B
hmean :
∀ i, ∫ ω, X i ω ∂μ = 0
hindep :
∀ i, IndepFun (X i) (fun ω => ∑ j ∈ univ \ N i, X j ω) μ
hvar :
∫ ω, (depSum X ω) ^ 2 ∂μ = 1
h :
ℝ → ℝ
C L :
hb :
∀ x, |h x| ≤ C
hd :
∀ x, |deriv h x| ≤ L
hdiff :
|(∫ ω, h (depSum X ω) ∂μ) - gExpect h|
≤ 2 * L * sqrt (variance (fun ω => ∑ i, X i ω * nbhdSum X N i ω) μ)
+ L * ∑ i, ∫ ω, |X i ω| * (nbhdSum X N i ω) ^ 2 ∂μ
Proof (Lean source)
theorem stein_local_dependence_bound (X : ι → Ω → ℝ) (N : ι → Finset ι) (hmeas : ∀ i, Measurable (X i)) {B : ℝ} (hB : 0 ≤ B) (hbound : ∀ i ω, |X i ω| ≤ B) (hmean : ∀ i, ∫ ω, X i ω ∂μ = 0) (hindep : ∀ i, IndepFun (X i) (fun ω => ∑ j ∈ univ \ N i, X j ω) μ) (hvar : ∫ ω, (depSum X ω) ^ 2 ∂μ = 1) (h : ℝ → ℝ) {C L : ℝ} (hb : ∀ x, |h x| ≤ C) (hd : ∀ x, |deriv h x| ≤ L) (hdiff : Differentiable ℝ h) : |(∫ ω, h (depSum X ω) ∂μ) - gExpect h| ≤ 2 * L * sqrt (variance (fun ω => ∑ i, X i ω * nbhdSum X N i ω) μ) + L * ∑ i, ∫ ω, |X i ω| * (nbhdSum X N i ω) ^ 2 ∂μ := by classical have hh : Continuous h := hdiff.continuous -- Abbreviations. set W : Ω → ℝ := depSum X with hW set T : ι → Ω → ℝ := fun i => nbhdSum X N i with hT set S : ι → Ω → ℝ := fun i ω => ∑ j ∈ univ \ N i, X j ω with hS set f : ℝ → ℝ := steinSol h with hf set f' : ℝ → ℝ := deriv (steinSol h) with hf' set Y : Ω → ℝ := fun ω => ∑ i, X i ω * T i ω with hY have hL : 0 ≤ L := le_trans (abs_nonneg (deriv h 0)) (hd 0) -- Continuity / measurability of the Stein solution and its derivative. have hfdiff : Differentiable ℝ f := fun w => (steinSol_hasDerivAt h hh hb w).differentiableAt have hfcont : Continuous f := hfdiff.continuous have hf'cont : Continuous f' := steinSol_deriv_continuous h hh hL hb hd hdiff have hfbd : ∀ w, |f w| ≤ 2 * L := fun w => (steinSol_abs_le h hb hd hdiff w).trans (by linarith) have hf'bd : ∀ w, |f' w| ≤ 2 * L := fun w => steinSol_deriv_abs_le h hb hd hdiff w -- Measurability of the random variables. have hWmeas : Measurable W := by simp only [hW]; exact measurable_sum _ (fun i _ => hmeas i) have hTmeas : ∀ i, Measurable (T i) := by intro i; simp only [hT]; exact measurable_sum _ (fun j _ => hmeas j) have hSmeas : ∀ i, Measurable (S i) := by intro i; rw [hS]; exact measurable_sum _ (fun j _ => hmeas j) have hYmeas : Measurable Y := by rw [hY]; exact measurable_sum _ (fun i _ => (hmeas i).mul (hTmeas i)) -- Boundedness of the sums (by `card · B`). have hWbd : ∀ ω, |W ω| ≤ (Fintype.card ι : ℝ) * B := by intro ω; simp only [hW, depSum] calc |∑ i, X i ω| ≤ ∑ _i : ι, B := by refine (Finset.abs_sum_le_sum_abs _ _).trans ?_ exact Finset.sum_le_sum (fun i _ => hbound i ω) _ = (Fintype.card ι : ℝ) * B := by rw [Finset.sum_const]; simp [mul_comm] have hTbd : ∀ i ω, |T i ω| ≤ (Fintype.card ι : ℝ) * B := by intro i ω; simp only [hT, nbhdSum] calc |∑ j ∈ N i, X j ω| ≤ ∑ _j ∈ N i, B := by refine (Finset.abs_sum_le_sum_abs _ _).trans ?_ exact Finset.sum_le_sum (fun j _ => hbound j ω) _ = ((N i).card : ℝ) * B := by rw [Finset.sum_const]; simp [mul_comm] _ ≤ (Fintype.card ι : ℝ) * B := by apply mul_le_mul_of_nonneg_right _ hB exact_mod_cast Finset.card_le_univ (N i) have hSbd : ∀ i ω, |S i ω| ≤ (Fintype.card ι : ℝ) * B := by intro i ω; rw [hS] calc |∑ j ∈ univ \ N i, X j ω| ≤ ∑ _j ∈ univ \ N i, B := by refine (Finset.abs_sum_le_sum_abs _ _).trans ?_ exact Finset.sum_le_sum (fun j _ => hbound j ω) _ = ((univ \ N i).card : ℝ) * B := by rw [Finset.sum_const]; simp [mul_comm] _ ≤ (Fintype.card ι : ℝ) * B := by apply mul_le_mul_of_nonneg_right _ hB exact_mod_cast Finset.card_le_univ (univ \ N i) -- A helper: a bounded measurable real function is integrable on the probability measure. have hInt_of_bd : ∀ (g : Ω → ℝ) (_ : Measurable g) (c : ℝ) (_ : ∀ ω, |g ω| ≤ c), Integrable g μ := by intro g hg c hgc have hmemlp : MemLp g 1 μ := MemLp.of_bound hg.aestronglyMeasurable c (Filter.Eventually.of_forall (fun ω => by rw [Real.norm_eq_abs]; exact hgc ω)) exact hmemlp.integrable le_rfl -- Integrability facts used throughout. have hXint : ∀ i, Integrable (X i) μ := fun i => hInt_of_bd _ (hmeas i) B (fun ω => hbound i ω) have hfWmeas : Measurable (fun ω => f (W ω)) := hfcont.measurable.comp hWmeas have hf'Wmeas : Measurable (fun ω => f' (W ω)) := hf'cont.measurable.comp hWmeas have hf'Wint : Integrable (fun ω => f' (W ω)) μ := hInt_of_bd _ hf'Wmeas (2 * L) (fun ω => hf'bd (W ω)) have hWfWint : Integrable (fun ω => W ω * f (W ω)) μ := hInt_of_bd _ (hWmeas.mul hfWmeas) ((Fintype.card ι : ℝ) * B * (2 * L)) (fun ω => by rw [abs_mul]; exact mul_le_mul (hWbd ω) (hfbd (W ω)) (abs_nonneg _) (by positivity)) have hhWint : Integrable (fun ω => h (W ω)) μ := hInt_of_bd _ (hh.measurable.comp hWmeas) C (fun ω => hb (W ω)) -- **Step 1.** Stein equation, integrated. have hstein_pt : ∀ ω, f' (W ω) - W ω * f (W ω) = h (W ω) - gExpect h := by intro ω; rw [hf', hf]; exact steinSol_stein_eq h hh hb (W ω) have hStep1 : (∫ ω, h (W ω) ∂μ) - gExpect h = (∫ ω, f' (W ω) ∂μ) - ∫ ω, W ω * f (W ω) ∂μ := by have hpt : (fun ω => h (W ω) - gExpect h) = (fun ω => f' (W ω) - W ω * f (W ω)) := by funext ω; rw [hstein_pt ω] have hlhs : (∫ ω, (h (W ω) - gExpect h) ∂μ) = (∫ ω, h (W ω) ∂μ) - gExpect h := by rw [integral_sub hhWint (integrable_const _), integral_const] simp rw [← hlhs, hpt, integral_sub hf'Wint hWfWint] -- **Step 2.** `W = T i + S i` (split `univ = N i ⊔ (univ \ N i)`). have hWsplit : ∀ i ω, W ω = T i ω + S i ω := by intro i ω simp only [hW, depSum, hT, nbhdSum, hS] rw [← Finset.sum_union (Finset.disjoint_sdiff)] rw [Finset.union_sdiff_of_subset (Finset.subset_univ (N i))] -- Measurability / boundedness / integrability of `f ∘ S i` and the products. have hfSmeas : ∀ i, Measurable (fun ω => f (S i ω)) := fun i => hfcont.measurable.comp (hSmeas i) have hfSint : ∀ i, Integrable (fun ω => f (S i ω)) μ := fun i => hInt_of_bd _ (hfSmeas i) (2 * L) (fun ω => hfbd (S i ω)) have hcardB_nonneg : (0:ℝ) ≤ (Fintype.card ι : ℝ) * B := by positivity have hXfWint : ∀ i, Integrable (fun ω => X i ω * f (W ω)) μ := fun i => hInt_of_bd _ ((hmeas i).mul hfWmeas) (B * (2 * L)) (fun ω => by rw [abs_mul]; exact mul_le_mul (hbound i ω) (hfbd (W ω)) (abs_nonneg _) hB) have hXfSint : ∀ i, Integrable (fun ω => X i ω * f (S i ω)) μ := fun i => hInt_of_bd _ ((hmeas i).mul (hfSmeas i)) (B * (2 * L)) (fun ω => by rw [abs_mul]; exact mul_le_mul (hbound i ω) (hfbd (S i ω)) (abs_nonneg _) hB) -- **Step 3.** Independence kills `∫ Xᵢ·f(Sᵢ) = 0`. have hXfS_zero : ∀ i, ∫ ω, X i ω * f (S i ω) ∂μ = 0 := by intro i have hindep_comp : IndepFun (X i) (fun ω => f (S i ω)) μ := (hindep i).comp (φ := id) (ψ := f) measurable_id hfcont.measurable rw [hindep_comp.integral_fun_mul_eq_mul_integral (hmeas i).aestronglyMeasurable (hfSmeas i).aestronglyMeasurable] rw [hmean i, zero_mul] -- **Step 4 (a).** `∫ W·f(W) = ∑ᵢ ∫ Xᵢ·f(W)`. have hIWf_sum : (∫ ω, W ω * f (W ω) ∂μ) = ∑ i, ∫ ω, X i ω * f (W ω) ∂μ := by have hpt : (fun ω => W ω * f (W ω)) = (fun ω => ∑ i, X i ω * f (W ω)) := by funext ω; rw [← Finset.sum_mul] simp only [hW, depSum] rw [hpt, integral_finset_sum _ (fun i _ => hXfWint i)] -- Each `∫ Xᵢ·f(W) = ∫ Xᵢ·(f(W) − f(Sᵢ))`. have hXfW_sub : ∀ i, (∫ ω, X i ω * f (W ω) ∂μ) = ∫ ω, X i ω * (f (W ω) - f (S i ω)) ∂μ := by intro i have hsplit : (fun ω => X i ω * (f (W ω) - f (S i ω))) = (fun ω => X i ω * f (W ω) - X i ω * f (S i ω)) := by funext ω; ring rw [hsplit, integral_sub (hXfWint i) (hXfSint i), hXfS_zero i, sub_zero] -- The Taylor remainder `R i ω = Tᵢ·f'(W) − (f(W) − f(Sᵢ))`. set R : ι → Ω → ℝ := fun i ω => T i ω * f' (W ω) - (f (W ω) - f (S i ω)) with hR -- Taylor bound: `|R i ω| ≤ L·(Tᵢ ω)²`. have hRbound : ∀ i ω, |R i ω| ≤ L * (T i ω) ^ 2 := by intro i ω have htaylor := steinSol_taylor_right h hb hd hdiff (S i ω) (T i ω) have hWeq : S i ω + T i ω = W ω := by rw [hWsplit i ω]; ring rw [hWeq] at htaylor change |T i ω * f' (W ω) - (f (W ω) - f (S i ω))| ≤ L * (T i ω) ^ 2 have heq : T i ω * f' (W ω) - (f (W ω) - f (S i ω)) = -(f (W ω) - f (S i ω) - T i ω * deriv (steinSol h) (W ω)) := by rw [hf']; ring rw [heq, abs_neg]; exact htaylor -- Measurability / integrability of `R i`, `Xᵢ·Tᵢ·f'(W)`, `Xᵢ·Rᵢ`. have hf'Wcont_meas : Measurable (fun ω => f' (W ω)) := hf'Wmeas have hRmeas : ∀ i, Measurable (R i) := by intro i; rw [hR] exact ((hTmeas i).mul hf'Wmeas).sub (hfWmeas.sub (hfSmeas i)) have hXTf'int : ∀ i, Integrable (fun ω => X i ω * T i ω * f' (W ω)) μ := by intro i refine hInt_of_bd _ (((hmeas i).mul (hTmeas i)).mul hf'Wmeas) (B * ((Fintype.card ι : ℝ) * B) * (2 * L)) (fun ω => ?_) rw [abs_mul, abs_mul] refine mul_le_mul (mul_le_mul (hbound i ω) (hTbd i ω) (abs_nonneg _) hB) (hf'bd (W ω)) (abs_nonneg _) (by positivity) have hXRint : ∀ i, Integrable (fun ω => X i ω * R i ω) μ := by intro i refine hInt_of_bd _ ((hmeas i).mul (hRmeas i)) (B * (L * ((Fintype.card ι : ℝ) * B) ^ 2)) (fun ω => ?_) rw [abs_mul] refine mul_le_mul (hbound i ω) ((hRbound i ω).trans ?_) (abs_nonneg _) hB apply mul_le_mul_of_nonneg_left _ hL calc (T i ω) ^ 2 = |T i ω| ^ 2 := (sq_abs _).symm _ ≤ ((Fintype.card ι : ℝ) * B) ^ 2 := by apply pow_le_pow_left₀ (abs_nonneg _) (hTbd i ω) -- Decomposition of each summand. have hXfW_decomp : ∀ i, (∫ ω, X i ω * f (W ω) ∂μ) = (∫ ω, X i ω * T i ω * f' (W ω) ∂μ) - ∫ ω, X i ω * R i ω ∂μ := by intro i rw [hXfW_sub i] have hpt : (fun ω => X i ω * (f (W ω) - f (S i ω))) = (fun ω => X i ω * T i ω * f' (W ω) - X i ω * R i ω) := by funext ω; rw [hR]; ring rw [hpt, integral_sub (hXTf'int i) (hXRint i)] -- **Step 4 (c).** `∑ᵢ ∫ Xᵢ·Tᵢ·f'(W) = ∫ f'(W)·Y`. have hf'WYint : Integrable (fun ω => f' (W ω) * Y ω) μ := by refine hInt_of_bd _ (hf'Wmeas.mul hYmeas) (2 * L * ((Fintype.card ι : ℝ) * ((Fintype.card ι : ℝ) * B * B))) (fun ω => ?_) rw [abs_mul] refine mul_le_mul (hf'bd (W ω)) ?_ (abs_nonneg _) (by positivity) rw [hY] calc |∑ i, X i ω * T i ω| ≤ ∑ _i : ι, (Fintype.card ι : ℝ) * B * B := by refine (Finset.abs_sum_le_sum_abs _ _).trans (Finset.sum_le_sum (fun i _ => ?_)) rw [abs_mul, mul_comm ((Fintype.card ι : ℝ) * B) B] exact mul_le_mul (hbound i ω) (hTbd i ω) (abs_nonneg _) hB _ = (Fintype.card ι : ℝ) * ((Fintype.card ι : ℝ) * B * B) := by rw [Finset.sum_const]; simp [mul_comm] have hsum_XTf' : (∑ i, ∫ ω, X i ω * T i ω * f' (W ω) ∂μ) = ∫ ω, f' (W ω) * Y ω ∂μ := by rw [← integral_finset_sum _ (fun i _ => hXTf'int i)] congr 1; funext ω rw [hY, Finset.mul_sum] congr 1; funext i; ring -- **Master identity.** `(∫h(W)) − gExpect h = ∫ f'(W)·(1 − Y) + ∑ᵢ ∫ Xᵢ·Rᵢ`. have hYint : Integrable Y μ := by refine hInt_of_bd _ hYmeas ((Fintype.card ι : ℝ) * ((Fintype.card ι : ℝ) * B * B)) (fun ω => ?_) rw [hY] calc |∑ i, X i ω * T i ω| ≤ ∑ _i : ι, (Fintype.card ι : ℝ) * B * B := by refine (Finset.abs_sum_le_sum_abs _ _).trans (Finset.sum_le_sum (fun i _ => ?_)) rw [abs_mul, mul_comm ((Fintype.card ι : ℝ) * B) B] exact mul_le_mul (hbound i ω) (hTbd i ω) (abs_nonneg _) hB _ = (Fintype.card ι : ℝ) * ((Fintype.card ι : ℝ) * B * B) := by rw [Finset.sum_const]; simp [mul_comm] have hmaster : (∫ ω, h (W ω) ∂μ) - gExpect h = (∫ ω, f' (W ω) * (1 - Y ω) ∂μ) + ∑ i, ∫ ω, X i ω * R i ω ∂μ := by rw [hStep1, hIWf_sum] have hsumdecomp : (∑ i, ∫ ω, X i ω * f (W ω) ∂μ) = (∑ i, ∫ ω, X i ω * T i ω * f' (W ω) ∂μ) - ∑ i, ∫ ω, X i ω * R i ω ∂μ := by rw [← Finset.sum_sub_distrib] exact Finset.sum_congr rfl (fun i _ => hXfW_decomp i) rw [hsumdecomp, hsum_XTf'] have h1mY : (∫ ω, f' (W ω) * (1 - Y ω) ∂μ) = (∫ ω, f' (W ω) ∂μ) - ∫ ω, f' (W ω) * Y ω ∂μ := by have hpt : (fun ω => f' (W ω) * (1 - Y ω)) = (fun ω => f' (W ω) - f' (W ω) * Y ω) := by funext ω; ring rw [hpt, integral_sub hf'Wint hf'WYint] rw [h1mY]; ring -- **Step 5 (a).** `∫ Y = ∫ W² = 1`. have hXSint : ∀ i, Integrable (fun ω => X i ω * S i ω) μ := fun i => hInt_of_bd _ ((hmeas i).mul (hSmeas i)) (B * ((Fintype.card ι : ℝ) * B)) (fun ω => by rw [abs_mul]; exact mul_le_mul (hbound i ω) (hSbd i ω) (abs_nonneg _) hB) have hXTint : ∀ i, Integrable (fun ω => X i ω * T i ω) μ := fun i => hInt_of_bd _ ((hmeas i).mul (hTmeas i)) (B * ((Fintype.card ι : ℝ) * B)) (fun ω => by rw [abs_mul]; exact mul_le_mul (hbound i ω) (hTbd i ω) (abs_nonneg _) hB) have hXWint : ∀ i, Integrable (fun ω => X i ω * W ω) μ := fun i => hInt_of_bd _ ((hmeas i).mul hWmeas) (B * ((Fintype.card ι : ℝ) * B)) (fun ω => by rw [abs_mul]; exact mul_le_mul (hbound i ω) (hWbd ω) (abs_nonneg _) hB) have hXS_zero : ∀ i, ∫ ω, X i ω * S i ω ∂μ = 0 := by intro i have hindep_i : IndepFun (X i) (S i) μ := hindep i rw [hindep_i.integral_fun_mul_eq_mul_integral (hmeas i).aestronglyMeasurable (hSmeas i).aestronglyMeasurable, hmean i, zero_mul] have hintY : (∫ ω, Y ω ∂μ) = 1 := by have hYeq : (∫ ω, Y ω ∂μ) = ∑ i, ∫ ω, X i ω * T i ω ∂μ := by rw [hY, integral_finset_sum _ (fun i _ => hXTint i)] have hW2eq : (∫ ω, W ω ^ 2 ∂μ) = ∑ i, ∫ ω, X i ω * W ω ∂μ := by have hpt : (fun ω => W ω ^ 2) = (fun ω => ∑ i, X i ω * W ω) := by funext ω; rw [← Finset.sum_mul, sq] simp only [hW, depSum] rw [hpt, integral_finset_sum _ (fun i _ => hXWint i)] have hXW_eq : ∀ i, (∫ ω, X i ω * W ω ∂μ) = ∫ ω, X i ω * T i ω ∂μ := by intro i -- … truncated; follow the source link for the rest …
Causalean.SteinMethod.stein_local_dependence_bound · Causalean/Mathlib/Probability/SteinMethod/DependencyCLT.lean:157 · uses depSum , gExpect , nbhdSum
3 supporting declarations (lemmas, instances)
  • abs_integral_mul_le_sqrt theorem — For square-integrable real-valued functions, the absolute value of their product integral is at most the product of the square roots of their two squared integrals.
    μ :
    f g :
    Ω → ℝ
    hf :
    MemLp f 2 μ
    hg :
    MemLp g 2 μ
    |∫ ω, f ω * g ω ∂μ| ≤ sqrt (∫ ω, f ω ^ 2 ∂μ) * sqrt (∫ ω, g ω ^ 2 ∂μ)
    Proof (Lean source)
    theorem abs_integral_mul_le_sqrt {μ : Measure Ω} (f g : Ω → ℝ) (hf : MemLp f 2 μ) (hg : MemLp g 2 μ) : |∫ ω, f ω * g ω ∂μ| ≤ sqrt (∫ ω, f ω ^ 2 ∂μ) * sqrt (∫ ω, g ω ^ 2 ∂μ) := by have hpq : (2 : ℝ).HolderConjugate 2 := by rw [Real.holderConjugate_iff]; constructor <;> norm_num have hf2 : MemLp f (ofReal 2) μ := by rwa [show ofReal 2 = 2 by norm_num] have hg2 : MemLp g (ofReal 2) μ := by rwa [show ofReal 2 = 2 by norm_num] have hkey := integral_mul_norm_le_Lp_mul_Lq (μ := μ) hpq hf2 hg2 -- Translate norms/powers to abs/squares, and the `rpow (1/2)` to `sqrt`. have heq1 : ∀ ω, ‖f ω‖ * ‖g ω‖ = |f ω * g ω| := by intro ω; rw [Real.norm_eq_abs, Real.norm_eq_abs, ← abs_mul] have hsqrt : ∀ (c : ℝ), c ^ (1 / (2:ℝ)) = sqrt c := by intro c; rw [Real.sqrt_eq_rpow] have hnormsq : ∀ ω, ‖f ω‖ ^ (2:ℝ) = f ω ^ 2 := by intro ω; rw [Real.norm_eq_abs, Real.rpow_two, sq_abs] have hnormsqg : ∀ ω, ‖g ω‖ ^ (2:ℝ) = g ω ^ 2 := by intro ω; rw [Real.norm_eq_abs, Real.rpow_two, sq_abs] calc |∫ ω, f ω * g ω ∂μ| ≤ ∫ ω, |f ω * g ω| ∂μ := abs_integral_le_integral_abs _ = ∫ ω, ‖f ω‖ * ‖g ω‖ ∂μ := by simp_rw [heq1] _ ≤ (∫ ω, ‖f ω‖ ^ (2:ℝ) ∂μ) ^ (1 / (2:ℝ)) * (∫ ω, ‖g ω‖ ^ (2:ℝ) ∂μ) ^ (1 / (2:ℝ)) := hkey _ = sqrt (∫ ω, f ω ^ 2 ∂μ) * sqrt (∫ ω, g ω ^ 2 ∂μ) := by rw [hsqrt, hsqrt]; simp_rw [hnormsq, hnormsqg]
    Causalean.SteinMethod.abs_integral_mul_le_sqrt · Causalean/Mathlib/Probability/SteinMethod/DependencyCLT.lean:55
  • steinSol_deriv_continuous theorem — A continuous differentiable test function with bounded values and bounded derivative has a Stein solution whose derivative is continuous.
    h :
    ℝ → ℝ
    hh :
    C L :
    hL :
    0 ≤ L
    hb :
    ∀ x, |h x| ≤ C
    hd :
    ∀ x, |deriv h x| ≤ L
    hdiff :
    Proof (Lean source)
    theorem steinSol_deriv_continuous (h : ℝ → ℝ) (hh : Continuous h) {C L : ℝ} (hL : 0 ≤ L) (hb : ∀ x, |h x| ≤ C) (hd : ∀ x, |deriv h x| ≤ L) (hdiff : Differentiable ℝ h) : Continuous (deriv (steinSol h)) := by have hlip : LipschitzWith (2 * L).toNNReal (deriv (steinSol h)) := by refine LipschitzWith.of_dist_le_mul (fun u v => ?_) rw [Real.dist_eq, Real.dist_eq, Real.coe_toNNReal _ (by positivity)] exact steinSol_deriv_lipschitz h hb hd hdiff u v exact hlip.continuous
    Causalean.SteinMethod.steinSol_deriv_continuous · Causalean/Mathlib/Probability/SteinMethod/DependencyCLT.lean:81
  • steinSol_taylor_right theorem — The standard-normal Stein solution has a first-order Taylor error that grows no faster than the test function's derivative bound times the squared step size.
    h :
    ℝ → ℝ
    C L :
    hb :
    ∀ x, |h x| ≤ C
    hd :
    ∀ x, |deriv h x| ≤ L
    hdiff :
    a t :
    |steinSol h (a + t) - steinSol h a - t * deriv (steinSol h) (a + t)| ≤ L * t ^ 2
    Proof (Lean source)
    theorem steinSol_taylor_right (h : ℝ → ℝ) {C L : ℝ} (hb : ∀ x, |h x| ≤ C) (hd : ∀ x, |deriv h x| ≤ L) (hdiff : Differentiable ℝ h) (a t : ℝ) : |steinSol h (a + t) - steinSol h a - t * deriv (steinSol h) (a + t)| ≤ L * t ^ 2 := by have hh : Continuous h := hdiff.continuous have hL : 0 ≤ L := le_trans (abs_nonneg (deriv h 0)) (hd 0) set f := steinSol h with hf set f' := deriv (steinSol h) with hf' have hf'cont : Continuous f' := steinSol_deriv_continuous h hh hL hb hd hdiff -- `s ↦ f (a + s * t)` has derivative `f' (a + s * t) * t`. have hg : ∀ s : ℝ, HasDerivAt (fun s => f (a + s * t)) (f' (a + s * t) * t) s := by intro s have hfderiv : HasDerivAt f (f' (a + s * t)) (a + s * t) := by rw [hf, hf']; exact steinSol_hasDerivAt h hh hb (a + s * t) |>.congr_deriv (by rw [(steinSol_hasDerivAt h hh hb (a + s * t)).deriv]) have hinner : HasDerivAt (fun s : ℝ => a + s * t) t s := by simpa using ((hasDerivAt_id s).mul_const t).const_add a exact hfderiv.comp s hinner -- FTC over `[0,1]`: `f (a + t) − f a = ∫₀¹ f' (a + s t) * t ds`. have hcont : Continuous (fun s : ℝ => f' (a + s * t) * t) := (hf'cont.comp (by fun_prop)).mul continuous_const have hFTC : (∫ s in (0:ℝ)..1, f' (a + s * t) * t) = f (a + t) - f a := by have := intervalIntegral.integral_eq_sub_of_hasDerivAt (f := fun s => f (a + s * t)) (f' := fun s => f' (a + s * t) * t) (fun s _ => hg s) (hcont.intervalIntegrable 0 1) simpa using this -- The remainder as an integral: `r = ∫₀¹ t·(f' (a + s t) − f' (a + t)) ds`. have hconst : (∫ _s in (0:ℝ)..1, t * deriv (steinSol h) (a + t)) = t * f' (a + t) := by rw [intervalIntegral.integral_const]; simp [hf'] have hrem : steinSol h (a + t) - steinSol h a - t * deriv (steinSol h) (a + t) = ∫ s in (0:ℝ)..1, (f' (a + s * t) * t - t * f' (a + t)) := by rw [intervalIntegral.integral_sub (hcont.intervalIntegrable 0 1) (continuous_const.intervalIntegrable 0 1)] rw [hFTC, hconst] rw [hrem] -- Bound the integrand pointwise by `2L·t²·(1 − s)` on `[0,1]`. have hbound_int : |∫ s in (0:ℝ)..1, (f' (a + s * t) * t - t * f' (a + t))| ≤ ∫ s in (0:ℝ)..1, 2 * L * t ^ 2 * (1 - s) := by refine (intervalIntegral.abs_integral_le_integral_abs (by norm_num)).trans ?_ refine intervalIntegral.integral_mono_on (by norm_num) ((hcont.sub continuous_const).abs.intervalIntegrable 0 1) ((continuous_const.mul (continuous_const.sub continuous_id)).intervalIntegrable 0 1) (fun s hs => ?_) have hs1 : s ≤ 1 := hs.2 have hlip := steinSol_deriv_lipschitz h hb hd hdiff (a + s * t) (a + t) calc |f' (a + s * t) * t - t * f' (a + t)| = |t| * |f' (a + s * t) - f' (a + t)| := by rw [← abs_mul]; ring_nf _ ≤ |t| * (2 * L * |(a + s * t) - (a + t)|) := by apply mul_le_mul_of_nonneg_left hlip (abs_nonneg _) _ = 2 * L * t ^ 2 * (1 - s) := by have hst : (a + s * t) - (a + t) = (s - 1) * t := by ring rw [hst, abs_mul, abs_of_nonpos (by linarith : s - 1 ≤ 0)] rw [show |t| * (2 * L * (-(s - 1) * |t|)) = 2 * L * (|t| * |t|) * (1 - s) by ring] rw [← abs_mul, abs_mul_self, sq] calc |∫ s in (0:ℝ)..1, (f' (a + s * t) * t - t * f' (a + t))| ≤ ∫ s in (0:ℝ)..1, 2 * L * t ^ 2 * (1 - s) := hbound_int _ = L * t ^ 2 := by rw [intervalIntegral.integral_const_mul] rw [show (fun s => 1 - s) = (fun s => (1:ℝ) - s) from rfl] rw [intervalIntegral.integral_sub (intervalIntegrable_const) (intervalIntegral.intervalIntegrable_id)] simp; ring
    Causalean.SteinMethod.steinSol_taylor_right · Causalean/Mathlib/Probability/SteinMethod/DependencyCLT.lean:92
Dep­Graph­CLT 3 core · 10 supporting This file derives the local-dependence Stein hypotheses from a dependency graph with bounded degree and uniformly small summands. ★ stein_cdf_clt_of_depGraph

Dependency-graph central limit theorem from primitive graph conditions

This file derives the local-dependence Stein hypotheses from a dependency graph with bounded degree and uniformly small summands. It defines DepGraph and DepGraph.nbhd, proves leave-out independence, separated-neighborhood covariance cancellation, the bounds DepGraph.var_nbhd_prod_le and DepGraph.sum_E_nbhd_sq_le, and concludes with the CDF central limit theorem stein_cdf_clt_of_depGraph.

structure DepGraph reviewed
Causalean.SteinMethod

A dependency graph for a family of real-valued random variables X on a probability space with law μ: bundles an adjacency relation on the index set that is reflexive and symmetric, together with measurability of each variable in the family and the defining property that any two index sets joined by no edge carry independent variable tuples. The closed neighborhood of an index is the set of indices adjacent to it.

Definition (Lean source)
X :
ι → Ω → ℝ
μ :
The dependency relation.
G :
ι → ι → Prop
Decidability of adjacency (for the neighborhood `Finset`).
decG :
Each index depends on itself.
refl :
∀ i, G i i
Symmetry of the dependency relation.
symm :
∀ i j
if
G i j
then
G j i
Each variable in the family is measurable.
meas :
∀ i, Measurable (X i)
Non-adjacent index sets carry independent variable tuples.
indep :
∀ A B : Finset ι
if
(∀ a ∈ A, ∀ b ∈ B, ¬ G a b)
then
IndepFun (fun ω => fun k : A => X k ω) (fun ω => fun k : B => X k ω) μ
def nbhd reviewed
Causalean.SteinMethod.DepGraph

The closed dependency neighborhood N i = {j | G i j}.

Definition (Lean source)
noncomputable def nbhd (i : ι) : Finset ι := by letI := D.decG; exact Finset.univ.filter (fun j => D.G i j)
theorem stein_cdf_clt_of_depGraph reviewed
Causalean.SteinMethod

The bounded dependency-graph CLT. Fix, for each n, a probability measure μ n, triangular-array summands X n i, and a dependency graph D n on the index set recording which pairs of summands may be dependent, with every dependency neighborhood of size at most m. Suppose the summands are uniformly bounded in absolute value by a constant sequence B n that tends to zero, with the product of the index-set cardinality and the cube of the bound also tending to zero, and suppose each summand is mean zero with the standardized sum having unit total variance. Then for every threshold s, the CDF of the dependency sum under μ n at s converges, as n → ∞, to the standard-normal CDF at s. The two Stein negligibility limits are derived internally.

Formal statement
Ω :
ℕ → Type*
∀ n, MeasurableSpace (Ω n)
μ :
∀ n, Measure (Ω n)
∀ n, IsProbabilityMeasure (μ n)
ι :
ℕ → Type*
∀ n, Fintype (ι n)
X :
∀ n
if
ι n
and
Ω n
then
D :
∀ n, DepGraph (X n) (μ n)
m :
hdeg :
∀ n i, ((D n).nbhd i).card ≤ m
B :
ℕ → ℝ
hB :
∀ n, 0 ≤ B n
hbound :
∀ n i ω, |X n i ω| ≤ B n
hB0 :
Tendsto B atTop (𝓝 0)
hNB3 :
Tendsto (fun n => (card (ι n) : ℝ) * (B n) ^ 3) atTop (𝓝 0)
hmean :
∀ n i, ∫ ω, X n i ω ∂(μ n) = 0
hvar :
∀ n, ∫ ω, (depSum (X n) ω) ^ 2 ∂(μ n) = 1
s :
Tendsto (fun n => ((μ n).map (depSum (X n))).real (Iic s)) atTop (𝓝 ((gaussianReal 0 1).real (Iic s)))
Proof (Lean source)
theorem stein_cdf_clt_of_depGraph {Ω : ℕ → Type*} [∀ n, MeasurableSpace (Ω n)] (μ : ∀ n, Measure (Ω n)) [∀ n, IsProbabilityMeasure (μ n)] {ι : ℕ → Type*} [∀ n, Fintype (ι n)] (X : ∀ n, ι n → Ω n → ℝ) (D : ∀ n, DepGraph (X n) (μ n)) (m : ℕ) (hdeg : ∀ n i, ((D n).nbhd i).card ≤ m) (B : ℕ → ℝ) (hB : ∀ n, 0 ≤ B n) (hbound : ∀ n i ω, |X n i ω| ≤ B n) (hB0 : Tendsto B atTop (𝓝 0)) (hNB3 : Tendsto (fun n => (card (ι n) : ℝ) * (B n) ^ 3) atTop (𝓝 0)) (hmean : ∀ n i, ∫ ω, X n i ω ∂(μ n) = 0) (hvar : ∀ n, ∫ ω, (depSum (X n) ω) ^ 2 ∂(μ n) = 1) (s : ℝ) : Tendsto (fun n => ((μ n).map (depSum (X n))).real (Iic s)) atTop (𝓝 ((gaussianReal 0 1).real (Iic s))) := by classical -- `nbhdSum (X n) (Nₙ) i ω = ∑_{k∈Nₙ i} X n k ω` definitionally. -- Leave-out independence and the self-membership hypothesis come from the dependency graph. have hindep : ∀ n i, IndepFun (X n i) (fun ω => ∑ j ∈ univ \ (D n).nbhd i, X n j ω) (μ n) := fun n i => (D n).indepFun_leaveOut i -- Error term 1: variance of the localized double sum, squeezed via `var_nbhd_prod_le`. have herr1 : Tendsto (fun n => variance (fun ω => ∑ i, X n i ω * nbhdSum (X n) (fun i => (D n).nbhd i) i ω) (μ n)) atTop (𝓝 0) := by -- Upper bound `2 m⁵ · N · B⁴ → 0`. have hub : Tendsto (fun n => 2 * (m : ℝ) ^ 5 * (card (ι n) : ℝ) * (B n) ^ 4) atTop (𝓝 0) := by have hfac : (fun n => 2 * (m : ℝ) ^ 5 * (card (ι n) : ℝ) * (B n) ^ 4) = (fun n => (2 * (m : ℝ) ^ 5) * (((card (ι n) : ℝ) * (B n) ^ 3) * B n)) := by funext n; ring rw [hfac] have h := (hNB3.mul hB0) simpa using (h.const_mul (2 * (m : ℝ) ^ 5)).congr (fun n => by ring) refine squeeze_zero (fun n => variance_nonneg _ _) (fun n => ?_) hub have := (D n).var_nbhd_prod_le (hB n) (hbound n) (hdeg n) simpa only [nbhdSum] using this -- Error term 2: `∑ᵢ E[|Xᵢ|·Tᵢ²]`, squeezed via `sum_E_nbhd_sq_le`. have herr2 : Tendsto (fun n => ∑ i, ∫ ω, |X n i ω| * (nbhdSum (X n) (fun i => (D n).nbhd i) i ω) ^ 2 ∂(μ n)) atTop (𝓝 0) := by have hub : Tendsto (fun n => (m : ℝ) ^ 2 * (card (ι n) : ℝ) * (B n) ^ 3) atTop (𝓝 0) := by have hfac : (fun n => (m : ℝ) ^ 2 * (card (ι n) : ℝ) * (B n) ^ 3) = (fun n => (m : ℝ) ^ 2 * ((card (ι n) : ℝ) * (B n) ^ 3)) := by funext n; ring rw [hfac] simpa using hNB3.const_mul ((m : ℝ) ^ 2) have hnonneg : ∀ n, 0 ≤ ∑ i, ∫ ω, |X n i ω| * (nbhdSum (X n) (fun i => (D n).nbhd i) i ω) ^ 2 ∂(μ n) := by intro n apply sum_nonneg intro i _ apply integral_nonneg intro ω positivity refine squeeze_zero hnonneg (fun n => ?_) hub have := DepGraph.sum_E_nbhd_sq_le (X := X n) (μ := μ n) (fun i => (D n).nbhd i) (fun i => (D n).meas i) (hB n) (hbound n) (hdeg n) simpa only [nbhdSum] using this exact stein_cdf_clt μ X (fun n => (D n).nbhd) (fun n i => (D n).meas i) B hB hbound hmean hindep hvar herr1 herr2 s
Causalean.SteinMethod.stein_cdf_clt_of_depGraph · Causalean/Mathlib/Probability/SteinMethod/DepGraphCLT.lean:391 · uses DepGraph , nbhd , depSum
10 supporting declarations (lemmas, instances)
  • mem_nbhd_iff theorem — Membership in the neighborhood is exactly adjacency.
    i j :
    ι
    j ∈ D.nbhd i ↔ D.G i j
    Proof (Lean source)
    theorem mem_nbhd_iff {i j : ι} : j ∈ D.nbhd i ↔ D.G i j := by letI := D.decG simp only [nbhd, mem_filter, Finset.mem_univ, true_and]
    Causalean.SteinMethod.DepGraph.mem_nbhd_iff · Causalean/Mathlib/Probability/SteinMethod/DepGraphCLT.lean:75
  • self_mem_nbhd theorem — Each index is in its own neighborhood.
    i :
    ι
    i ∈ D.nbhd i
    Proof (Lean source)
    theorem self_mem_nbhd (i : ι) : i ∈ D.nbhd i := D.mem_nbhd_iff.mpr (D.refl i)
    Causalean.SteinMethod.DepGraph.self_mem_nbhd · Causalean/Mathlib/Probability/SteinMethod/DepGraphCLT.lean:81
  • abs_nbhdSum_le theorem — If each summand is bounded in absolute value by B and every closed neighborhood has at most m indices, then the absolute value of each neighborhood sum is at most m times B.
    B :
    hB :
    0 ≤ B
    hbound :
    ∀ i ω, |X i ω| ≤ B
    m :
    i :
    ι
    hdeg :
    (D.nbhd i).card ≤ m
    ω :
    Ω
    |∑ k ∈ D.nbhd i, X k ω| ≤ (m : ℝ) * B
    Proof (Lean source)
    theorem abs_nbhdSum_le {B : ℝ} (hB : 0 ≤ B) (hbound : ∀ i ω, |X i ω| ≤ B) {m : ℕ} (i : ι) (hdeg : (D.nbhd i).card ≤ m) (ω : Ω) : |∑ k ∈ D.nbhd i, X k ω| ≤ (m : ℝ) * B := by calc |∑ k ∈ D.nbhd i, X k ω| ≤ ∑ k ∈ D.nbhd i, |X k ω| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ _k ∈ D.nbhd i, B := Finset.sum_le_sum (fun k _ => hbound k ω) _ = (D.nbhd i).card * B := by rw [Finset.sum_const, nsmul_eq_mul] _ ≤ (m : ℝ) * B := by apply mul_le_mul_of_nonneg_right _ hB exact_mod_cast hdeg
    Causalean.SteinMethod.DepGraph.abs_nbhdSum_le · Causalean/Mathlib/Probability/SteinMethod/DepGraphCLT.lean:97
  • abs_locProd_le theorem — If each summand has absolute value at most B and each neighborhood has at most m members, then a summand times its neighborhood sum has absolute value at most m times B squared.
    B :
    hB :
    0 ≤ B
    hbound :
    ∀ i ω, |X i ω| ≤ B
    m :
    hdeg :
    ∀ i, (D.nbhd i).card ≤ m
    i :
    ι
    ω :
    Ω
    |X i ω * ∑ k ∈ D.nbhd i, X k ω| ≤ (m : ℝ) * B ^ 2
    Proof (Lean source)
    theorem abs_locProd_le {B : ℝ} (hB : 0 ≤ B) (hbound : ∀ i ω, |X i ω| ≤ B) {m : ℕ} (hdeg : ∀ i, (D.nbhd i).card ≤ m) (i : ι) (ω : Ω) : |X i ω * ∑ k ∈ D.nbhd i, X k ω| ≤ (m : ℝ) * B ^ 2 := by rw [abs_mul] calc |X i ω| * |∑ k ∈ D.nbhd i, X k ω| ≤ B * ((m : ℝ) * B) := mul_le_mul (hbound i ω) (D.abs_nbhdSum_le hB hbound i (hdeg i) ω) (abs_nonneg _) hB _ = (m : ℝ) * B ^ 2 := by ring
    Causalean.SteinMethod.DepGraph.abs_locProd_le · Causalean/Mathlib/Probability/SteinMethod/DepGraphCLT.lean:110
  • indepFun_leaveOut theorem — Leave-out independence (the stein_cdf_clt hypothesis hindep).
    i :
    ι
    IndepFun (X i) (fun ω => ∑ j ∈ univ \ D.nbhd i, X j ω) μ
    Proof (Lean source)
    theorem indepFun_leaveOut (i : ι) : IndepFun (X i) (fun ω => ∑ j ∈ univ \ D.nbhd i, X j ω) μ := by classical -- The two index sets `{i}` and `univ \ N i` have no edges between them. have hsep : ∀ a ∈ ({i} : Finset ι), ∀ b ∈ univ \ D.nbhd i, ¬ D.G a b := by intro a ha b hb rw [mem_singleton] at ha; subst ha rw [mem_sdiff] at hb exact fun hab => hb.2 (D.mem_nbhd_iff.mpr hab) have hind := D.indep ({i} : Finset ι) (univ \ D.nbhd i) hsep -- Eval at `i` on the `{i}`-tuple, and the total sum on the `(univ \ N i)`-tuple. -- The two composing maps are measurable (Pi-evaluation / finite sum of evaluations). have hφ : Measurable fun t : (({i} : Finset ι) → ℝ) => t ⟨i, Finset.mem_singleton.mpr rfl⟩ := measurable_pi_apply _ have hψ : Measurable fun t : ((univ \ D.nbhd i : Finset ι) → ℝ) => ∑ k, t k := measurable_sum _ (fun k _ => measurable_pi_apply _) have hcomp := hind.comp hφ hψ -- Identify the two sides with `X i` and the leave-out sum. have h1 : (fun t : (({i} : Finset ι) → ℝ) => t ⟨i, Finset.mem_singleton.mpr rfl⟩) ∘ (fun ω => fun k : ({i} : Finset ι) => X k ω) = X i := rfl have h2 : (fun t : ((univ \ D.nbhd i : Finset ι) → ℝ) => ∑ k, t k) ∘ (fun ω => fun k : (univ \ D.nbhd i : Finset ι) => X k ω) = (fun ω => ∑ j ∈ univ \ D.nbhd i, X j ω) := by funext ω simp only [comp] rw [Finset.sum_coe_sort (univ \ D.nbhd i) (fun j => X j ω)] rw [h1, h2] at hcomp exact hcomp
    Causalean.SteinMethod.DepGraph.indepFun_leaveOut · Causalean/Mathlib/Probability/SteinMethod/DepGraphCLT.lean:123
  • cov_mul_nbhd_eq_zero theorem — Covariance vanishing for separated indices. If Nᵢ and Nⱼ have no edges between them, the localized products Xᵢ·Tᵢ and Xⱼ·Tⱼ are uncorrelated.
    i j :
    ι
    hsep :
    ∀ a ∈ D.nbhd i, ∀ b ∈ D.nbhd j, ¬ D.G a b
    μ[fun ω => (X i ω * ∑ k ∈ D.nbhd i, X k ω) * (X j ω * ∑ k ∈ D.nbhd j, X k ω)]
    = μ[fun ω => X i ω * ∑ k ∈ D.nbhd i, X k ω] * μ[fun ω => X j ω * ∑ k ∈ D.nbhd j, X k ω]
    Proof (Lean source)
    theorem cov_mul_nbhd_eq_zero {i j : ι} (hsep : ∀ a ∈ D.nbhd i, ∀ b ∈ D.nbhd j, ¬ D.G a b) : μ[fun ω => (X i ω * ∑ k ∈ D.nbhd i, X k ω) * (X j ω * ∑ k ∈ D.nbhd j, X k ω)] = μ[fun ω => X i ω * ∑ k ∈ D.nbhd i, X k ω] * μ[fun ω => X j ω * ∑ k ∈ D.nbhd j, X k ω] := by classical -- Tuples over the two neighborhoods are independent. have hind := D.indep (D.nbhd i) (D.nbhd j) hsep -- `φ` reads off `Xᵢ` (via `i ∈ Nᵢ`) and forms `Xᵢ · ∑_{k∈Nᵢ} Xₖ` from the `Nᵢ`-tuple. let φ : (↥(D.nbhd i) → ℝ) → ℝ := fun t => t ⟨i, D.self_mem_nbhd i⟩ * ∑ k, t k let ψ : (↥(D.nbhd j) → ℝ) → ℝ := fun t => t ⟨j, D.self_mem_nbhd j⟩ * ∑ k, t k have hφ : Measurable φ := (measurable_pi_apply _).mul (measurable_sum _ (fun k _ => measurable_pi_apply _)) have hψ : Measurable ψ := (measurable_pi_apply _).mul (measurable_sum _ (fun k _ => measurable_pi_apply _)) -- Both tuples are AEMeasurable (each coordinate `X k` is measurable). have hXi : AEMeasurable (fun ω => fun k : ↥(D.nbhd i) => X k ω) μ := (measurable_pi_lambda _ (fun k : ↥(D.nbhd i) => D.meas (↑k))).aemeasurable have hXj : AEMeasurable (fun ω => fun k : ↥(D.nbhd j) => X k ω) μ := (measurable_pi_lambda _ (fun k : ↥(D.nbhd j) => D.meas (↑k))).aemeasurable have key := hind.integral_fun_comp_mul_comp hXi hXj hφ.aestronglyMeasurable hψ.aestronglyMeasurable -- Identify `φ ∘ tupleᵢ = gᵢ` pointwise. have eφ : ∀ ω, φ (fun k : ↥(D.nbhd i) => X k ω) = X i ω * ∑ k ∈ D.nbhd i, X k ω := by intro ω simp only [φ] rw [Finset.sum_coe_sort (D.nbhd i) (fun k => X k ω)] have eψ : ∀ ω, ψ (fun k : ↥(D.nbhd j) => X k ω) = X j ω * ∑ k ∈ D.nbhd j, X k ω := by intro ω simp only [ψ] rw [Finset.sum_coe_sort (D.nbhd j) (fun k => X k ω)] simp only [eφ, eψ] at key exact key
    Causalean.SteinMethod.DepGraph.cov_mul_nbhd_eq_zero · Causalean/Mathlib/Probability/SteinMethod/DepGraphCLT.lean:154
  • memLp_locProd theorem — If every variable is bounded in absolute value by a nonnegative constant and each closed dependency neighborhood has bounded size, each variable times its neighborhood sum has a finite second moment.
    B :
    hB :
    0 ≤ B
    hbound :
    ∀ i ω, |X i ω| ≤ B
    m :
    hdeg :
    ∀ i, (D.nbhd i).card ≤ m
    i :
    ι
    MemLp (fun ω => X i ω * ∑ k ∈ D.nbhd i, X k ω) 2 μ
    Proof (Lean source)
    theorem memLp_locProd {B : ℝ} (hB : 0 ≤ B) (hbound : ∀ i ω, |X i ω| ≤ B) {m : ℕ} (hdeg : ∀ i, (D.nbhd i).card ≤ m) (i : ι) : MemLp (fun ω => X i ω * ∑ k ∈ D.nbhd i, X k ω) 2 μ := MemLp.of_bound (D.measurable_locProd i).aestronglyMeasurable ((m : ℝ) * B ^ 2) (Filter.Eventually.of_forall (fun ω => by rw [Real.norm_eq_abs]; exact D.abs_locProd_le hB hbound hdeg i ω))
    Causalean.SteinMethod.DepGraph.memLp_locProd · Causalean/Mathlib/Probability/SteinMethod/DepGraphCLT.lean:195
  • abs_cov_locProd_le theorem — If every variable is bounded in absolute value by a nonnegative constant and each closed dependency neighborhood has at most m members, the absolute covariance of any two localized products is at most twice the square of m times that bound squared.
    B :
    hB :
    0 ≤ B
    hbound :
    ∀ i ω, |X i ω| ≤ B
    m :
    hdeg :
    ∀ i, (D.nbhd i).card ≤ m
    i j :
    ι
    |covariance (fun ω => X i ω * ∑ k ∈ D.nbhd i, X k ω) (fun ω => X j ω * ∑ k ∈ D.nbhd j, X k ω) μ|
    ≤ 2 * ((m : ℝ) * B ^ 2) ^ 2
    Proof (Lean source)
    theorem abs_cov_locProd_le {B : ℝ} (hB : 0 ≤ B) (hbound : ∀ i ω, |X i ω| ≤ B) {m : ℕ} (hdeg : ∀ i, (D.nbhd i).card ≤ m) (i j : ι) : |covariance (fun ω => X i ω * ∑ k ∈ D.nbhd i, X k ω) (fun ω => X j ω * ∑ k ∈ D.nbhd j, X k ω) μ| ≤ 2 * ((m : ℝ) * B ^ 2) ^ 2 := by set gi := fun ω => X i ω * ∑ k ∈ D.nbhd i, X k ω with hgi set gj := fun ω => X j ω * ∑ k ∈ D.nbhd j, X k ω with hgj have hMi := D.memLp_locProd hB hbound hdeg i have hMj := D.memLp_locProd hB hbound hdeg j rw [covariance_eq_sub hMi hMj] -- `|gᵢ| ≤ mB²` and `|gⱼ| ≤ mB²` pointwise. have hbi : ∀ ω, |gi ω| ≤ (m : ℝ) * B ^ 2 := fun ω => D.abs_locProd_le hB hbound hdeg i ω have hbj : ∀ ω, |gj ω| ≤ (m : ℝ) * B ^ 2 := fun ω => D.abs_locProd_le hB hbound hdeg j ω have hC : (0 : ℝ) ≤ (m : ℝ) * B ^ 2 := by positivity -- Bound `|μ[gᵢ·gⱼ]| ≤ (mB²)²`. have hMi_int : Integrable gi μ := hMi.integrable one_le_two have hMj_int : Integrable gj μ := hMj.integrable one_le_two have hprod : |μ[fun ω => gi ω * gj ω]| ≤ ((m : ℝ) * B ^ 2) ^ 2 := by have hint : Integrable (fun ω => gi ω * gj ω) μ := hMi.integrable_mul hMj refine (abs_integral_le_integral_abs).trans ?_ calc ∫ ω, |gi ω * gj ω| ∂μ ≤ ∫ _ω, ((m : ℝ) * B ^ 2) ^ 2 ∂μ := by refine integral_mono hint.abs (integrable_const _) (fun ω => ?_) rw [abs_mul, sq] exact mul_le_mul (hbi ω) (hbj ω) (abs_nonneg _) hC _ = ((m : ℝ) * B ^ 2) ^ 2 := by rw [integral_const, probReal_univ, one_smul] -- Bound `|μ[gᵢ]·μ[gⱼ]| ≤ (mB²)²`. have hEi : |μ[gi]| ≤ (m : ℝ) * B ^ 2 := by refine (abs_integral_le_integral_abs).trans ?_ calc ∫ ω, |gi ω| ∂μ ≤ ∫ _ω, (m : ℝ) * B ^ 2 ∂μ := integral_mono hMi_int.abs (integrable_const _) hbi _ = (m : ℝ) * B ^ 2 := by rw [integral_const, probReal_univ, one_smul] have hEj : |μ[gj]| ≤ (m : ℝ) * B ^ 2 := by refine (abs_integral_le_integral_abs).trans ?_ calc ∫ ω, |gj ω| ∂μ ≤ ∫ _ω, (m : ℝ) * B ^ 2 ∂μ := integral_mono hMj_int.abs (integrable_const _) hbj _ = (m : ℝ) * B ^ 2 := by rw [integral_const, probReal_univ, one_smul] have hmean_prod : |μ[gi] * μ[gj]| ≤ ((m : ℝ) * B ^ 2) ^ 2 := by rw [abs_mul, sq] exact mul_le_mul hEi hEj (abs_nonneg _) hC -- Combine via the triangle inequality. calc |μ[fun ω => gi ω * gj ω] - μ[gi] * μ[gj]| ≤ |μ[fun ω => gi ω * gj ω]| + |μ[gi] * μ[gj]| := abs_sub _ _ _ ≤ ((m : ℝ) * B ^ 2) ^ 2 + ((m : ℝ) * B ^ 2) ^ 2 := add_le_add hprod hmean_prod _ = 2 * ((m : ℝ) * B ^ 2) ^ 2 := by ring
    Causalean.SteinMethod.DepGraph.abs_cov_locProd_le · Causalean/Mathlib/Probability/SteinMethod/DepGraphCLT.lean:206
  • var_nbhd_prod_le theorem — Pair-counting variance bound (herr1). With bounded summands |Xᵢ| ≤ B and degree ≤ m, the covariance double sum collapses to the ≤ N·m³ pairs at graph distance at most three, each bounded by 2(mB²)², giving Var(∑ᵢ Xᵢ·Tᵢ) ≤ 2·m⁵·N·B⁴.
    B :
    hB :
    0 ≤ B
    hbound :
    ∀ i ω, |X i ω| ≤ B
    m :
    hdeg :
    ∀ i, (D.nbhd i).card ≤ m
    variance (fun ω => ∑ i, X i ω * ∑ k ∈ D.nbhd i, X k ω) μ
    ≤ 2 * (m : ℝ) ^ 5 * (Fintype.card ι : ℝ) * B ^ 4
    Proof (Lean source)
    theorem var_nbhd_prod_le {B : ℝ} (hB : 0 ≤ B) (hbound : ∀ i ω, |X i ω| ≤ B) {m : ℕ} (hdeg : ∀ i, (D.nbhd i).card ≤ m) : variance (fun ω => ∑ i, X i ω * ∑ k ∈ D.nbhd i, X k ω) μ ≤ 2 * (m : ℝ) ^ 5 * (Fintype.card ι : ℝ) * B ^ 4 := by classical set g : ι → Ω → ℝ := fun i ω => X i ω * ∑ k ∈ D.nbhd i, X k ω with hg have hM : ∀ i, MemLp (g i) 2 μ := fun i => D.memLp_locProd hB hbound hdeg i -- Expand the variance into a covariance double sum. have hvar_eq : variance (fun ω => ∑ i, g i ω) μ = ∑ i, ∑ j, covariance (g i) (g j) μ := variance_fun_sum hM rw [show (fun ω => ∑ i, X i ω * ∑ k ∈ D.nbhd i, X k ω) = (fun ω => ∑ i, g i ω) from rfl, hvar_eq] -- For each `i`, restrict the inner sum to the "non-separated" `j`s; separated ones vanish. -- The non-separated set sits inside a double neighborhood expansion of `Nᵢ`. set S : ι → Finset ι := fun i => (D.nbhd i).biUnion (fun a => D.nbhd a) with hS set T : ι → Finset ι := fun i => (S i).biUnion (fun b => D.nbhd b) with hT -- `cov[gᵢ, gⱼ] = 0` when `j ∉ T i` (the indices are separated). have hsep_zero : ∀ i j, j ∉ T i → covariance (g i) (g j) μ = 0 := by intro i j hj -- Show `Nᵢ` and `Nⱼ` are separated. have hsep : ∀ a ∈ D.nbhd i, ∀ b ∈ D.nbhd j, ¬ D.G a b := by intro a ha b hb hab -- `b ∈ N a ⊆ S i`, and `j ∈ N b` (by symm), so `j ∈ T i` — contradiction. apply hj rw [hT, Finset.mem_biUnion] refine ⟨b, ?_, ?_⟩ · rw [hS, Finset.mem_biUnion] exact ⟨a, ha, D.mem_nbhd_iff.mpr hab⟩ · -- `b ∈ Nⱼ` means `G j b`; by symm `G b j`, i.e. `j ∈ N b`. exact D.mem_nbhd_iff.mpr (D.symm j b (D.mem_nbhd_iff.mp hb)) have hcov := D.cov_mul_nbhd_eq_zero hsep rw [covariance_eq_sub (hM i) (hM j)] rw [show (g i * g j) = (fun ω => g i ω * g j ω) from rfl] at * rw [hcov]; ring -- Drop the separated `j`s from the inner sum. have hinner : ∀ i, ∑ j, covariance (g i) (g j) μ = ∑ j ∈ T i, covariance (g i) (g j) μ := by intro i symm apply Finset.sum_subset (Finset.subset_univ _) intro j _ hj exact hsep_zero i j hj -- Bound: each retained covariance ≤ 2(mB²)², and `#(T i) ≤ m³`. have hcard_S : ∀ i, (S i).card ≤ m * m := by intro i calc (S i).card ≤ ∑ a ∈ D.nbhd i, (D.nbhd a).card := Finset.card_biUnion_le _ ≤ ∑ _a ∈ D.nbhd i, m := Finset.sum_le_sum (fun a _ => hdeg a) _ = (D.nbhd i).card * m := by rw [Finset.sum_const, smul_eq_mul] _ ≤ m * m := Nat.mul_le_mul_right m (hdeg i) have hcard_T : ∀ i, (T i).card ≤ m ^ 3 := by intro i calc (T i).card ≤ ∑ b ∈ S i, (D.nbhd b).card := Finset.card_biUnion_le _ ≤ ∑ _b ∈ S i, m := Finset.sum_le_sum (fun b _ => hdeg b) _ = (S i).card * m := by rw [Finset.sum_const, smul_eq_mul] _ ≤ (m * m) * m := Nat.mul_le_mul_right m (hcard_S i) _ = m ^ 3 := by ring -- Now bound the full double sum. have hCnn : (0 : ℝ) ≤ 2 * ((m : ℝ) * B ^ 2) ^ 2 := by positivity calc ∑ i, ∑ j, covariance (g i) (g j) μ = ∑ i, ∑ j ∈ T i, covariance (g i) (g j) μ := by exact Finset.sum_congr rfl (fun i _ => hinner i) _ ≤ ∑ i, ∑ j ∈ T i, |covariance (g i) (g j) μ| := Finset.sum_le_sum (fun i _ => Finset.sum_le_sum (fun j _ => le_abs_self _)) _ ≤ ∑ i, ∑ _j ∈ T i, 2 * ((m : ℝ) * B ^ 2) ^ 2 := Finset.sum_le_sum (fun i _ => Finset.sum_le_sum (fun j _ => D.abs_cov_locProd_le hB hbound hdeg i j)) _ = ∑ i, (T i).card * (2 * ((m : ℝ) * B ^ 2) ^ 2) := by refine Finset.sum_congr rfl (fun i _ => ?_) rw [Finset.sum_const, nsmul_eq_mul] _ ≤ ∑ _i : ι, (m ^ 3 : ℝ) * (2 * ((m : ℝ) * B ^ 2) ^ 2) := by refine Finset.sum_le_sum (fun i _ => ?_) apply mul_le_mul_of_nonneg_right _ hCnn exact_mod_cast hcard_T i _ = (Fintype.card ι : ℝ) * ((m ^ 3 : ℝ) * (2 * ((m : ℝ) * B ^ 2) ^ 2)) := by rw [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] _ = 2 * (m : ℝ) ^ 5 * (Fintype.card ι : ℝ) * B ^ 4 := by ring
    Causalean.SteinMethod.DepGraph.var_nbhd_prod_le · Causalean/Mathlib/Probability/SteinMethod/DepGraphCLT.lean:255
  • sum_E_nbhd_sq_le theorem — Negligibility bound (herr2). For any finite neighborhoods of size at most m, measurable summands bounded by B satisfy ∑ᵢ E[|Xᵢ|·Tᵢ²] ≤ m²·N·B³.
    N :
    ι → Finset ι
    hmeas :
    ∀ i, Measurable (X i)
    B :
    hB :
    0 ≤ B
    hbound :
    ∀ i ω, |X i ω| ≤ B
    m :
    hdeg :
    ∀ i, (N i).card ≤ m
    ∑ i, ∫ ω, |X i ω| * (∑ k ∈ N i, X k ω) ^ 2 ∂μ ≤ (m : ℝ) ^ 2 * (Fintype.card ι : ℝ) * B ^ 3
    Proof (Lean source)
    theorem sum_E_nbhd_sq_le (N : ι → Finset ι) (hmeas : ∀ i, Measurable (X i)) {B : ℝ} (hB : 0 ≤ B) (hbound : ∀ i ω, |X i ω| ≤ B) {m : ℕ} (hdeg : ∀ i, (N i).card ≤ m) : ∑ i, ∫ ω, |X i ω| * (∑ k ∈ N i, X k ω) ^ 2 ∂μ ≤ (m : ℝ) ^ 2 * (Fintype.card ι : ℝ) * B ^ 3 := by classical have hnbhd : ∀ i ω, |∑ k ∈ N i, X k ω| ≤ (m : ℝ) * B := by intro i ω calc |∑ k ∈ N i, X k ω| ≤ ∑ k ∈ N i, |X k ω| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ _k ∈ N i, B := Finset.sum_le_sum (fun k _ => hbound k ω) _ = (N i).card * B := by rw [Finset.sum_const, nsmul_eq_mul] _ ≤ (m : ℝ) * B := by apply mul_le_mul_of_nonneg_right _ hB exact_mod_cast hdeg i -- Per `i`, the integrand is bounded by the constant `m²·B³`. have hpt : ∀ i ω, |X i ω| * (∑ k ∈ N i, X k ω) ^ 2 ≤ (m : ℝ) ^ 2 * B ^ 3 := by intro i ω have h1 : |X i ω| ≤ B := hbound i ω have h2 : (∑ k ∈ N i, X k ω) ^ 2 ≤ ((m : ℝ) * B) ^ 2 := by rw [← sq_abs] exact pow_le_pow_left₀ (abs_nonneg _) (hnbhd i ω) 2 calc |X i ω| * (∑ k ∈ N i, X k ω) ^ 2 ≤ B * ((m : ℝ) * B) ^ 2 := mul_le_mul h1 h2 (sq_nonneg _) hB _ = (m : ℝ) ^ 2 * B ^ 3 := by ring -- Hence each integral is `≤ m²·B³`. have hint : ∀ i, ∫ ω, |X i ω| * (∑ k ∈ N i, X k ω) ^ 2 ∂μ ≤ (m : ℝ) ^ 2 * B ^ 3 := by intro i have hmeas_i : Measurable (fun ω => |X i ω| * (∑ k ∈ N i, X k ω) ^ 2) := ((hmeas i).abs).mul ((measurable_sum _ (fun k _ => hmeas k)).pow_const 2) have hbdd : ∀ ω, |(|X i ω| * (∑ k ∈ N i, X k ω) ^ 2)| ≤ (m : ℝ) ^ 2 * B ^ 3 := by intro ω rw [abs_of_nonneg (by positivity)] exact hpt i ω have hintegrable : Integrable (fun ω => |X i ω| * (∑ k ∈ N i, X k ω) ^ 2) μ := (MemLp.of_bound hmeas_i.aestronglyMeasurable ((m : ℝ) ^ 2 * B ^ 3) (Filter.Eventually.of_forall (fun ω => by rw [Real.norm_eq_abs]; exact hbdd ω))).integrable le_rfl calc ∫ ω, |X i ω| * (∑ k ∈ N i, X k ω) ^ 2 ∂μ ≤ ∫ _ω, (m : ℝ) ^ 2 * B ^ 3 ∂μ := integral_mono hintegrable (integrable_const _) (fun ω => hpt i ω) _ = (m : ℝ) ^ 2 * B ^ 3 := by rw [integral_const, probReal_univ, one_smul] -- Sum over `i` (there are `N = card ι` of them). calc ∑ i, ∫ ω, |X i ω| * (∑ k ∈ N i, X k ω) ^ 2 ∂μ ≤ ∑ _i : ι, (m : ℝ) ^ 2 * B ^ 3 := Finset.sum_le_sum (fun i _ => hint i) _ = (Fintype.card ι : ℝ) * ((m : ℝ) ^ 2 * B ^ 3) := by rw [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] _ = (m : ℝ) ^ 2 * (Fintype.card ι : ℝ) * B ^ 3 := by ring
    Causalean.SteinMethod.DepGraph.sum_E_nbhd_sq_le · Causalean/Mathlib/Probability/SteinMethod/DepGraphCLT.lean:337
Bounds 1 core · 5 supporting For an absolutely continuous test function h with bounded derivative ‖h'‖_∞ ≤ L, the Stein solution f_h is uniformly bounded by L and its derivative by 2·L: ‖f_h‖_∞ ≤ L, ‖f_h'‖_∞ ≤ 2·L. ★ steinSol_abs_le

Uniform bounds on the Stein solution (Chen–Goldstein–Shao)

For an absolutely continuous test function h with bounded derivative ‖h'‖_∞ ≤ L, the Stein solution f_h is uniformly bounded by L and its derivative by 2·L:

‖f_h‖_∞ ≤ L, ‖f_h'‖_∞ ≤ 2·L.

The file proves the public bounds steinSol_abs_le, steinSol_deriv_abs_le, and steinSol_deriv_lipschitz; the last packages the second-derivative bound as Lipschitz control of f_h'. The proof develops the needed Gaussian tail moment identities, two-sided lower Mills-ratio bounds, and the cancellation inequalities behind Chen-Goldstein-Shao Lemma 2.5. These are the bounds that make the local-dependence Stein estimate work for test functions such as h = cos(t * ·) and h = sin(t * ·).

theorem steinSol_abs_le reviewed
Causalean.SteinMethod

For a real-valued test function h that is bounded in absolute value by a constant C, has derivative bounded in absolute value by a constant L, and is differentiable everywhere, the Stein equation's solution steinSol h, evaluated at any point w, is bounded in absolute value by the derivative bound L.

Formal statement
h :
ℝ → ℝ
C L :
hb :
∀ x, |h x| ≤ C
hd :
∀ x, |deriv h x| ≤ L
hdiff :
w :
|steinSol h w| ≤ L
Proof (Lean source)
theorem steinSol_abs_le (h : ℝ → ℝ) {C L : ℝ} (hb : ∀ x, |h x| ≤ C) (hd : ∀ x, |deriv h x| ≤ L) (hdiff : Differentiable ℝ h) (w : ℝ) : |steinSol h w| ≤ L := by -- Notation for the four building blocks of the weighted identity. set P : ℝ := ∫ x in Ioi w, phi x with hP set Q : ℝ := ∫ x in Iic w, phi x with hQ set A : ℝ := ∫ x in Iic w, (h x - h w) * phi x with hA set B : ℝ := ∫ x in Ioi w, (h x - h w) * phi x with hB set E : ℝ := exp (w ^ 2 / 2) with hE have hPpos : 0 ≤ P := by rw [hP]; exact setIntegral_nonneg measurableSet_Ioi (fun x _ => (phi_pos x).le) have hQpos : 0 ≤ Q := by rw [hQ]; exact setIntegral_nonneg measurableSet_Iic (fun x _ => (phi_pos x).le) have hEpos : 0 < E := Real.exp_pos _ have hKpos : 0 < sqrt (2 * π) := Real.sqrt_pos.mpr (by positivity) -- Bounds on |A| and |B| coming from the Lipschitz estimates. have hAbound : |A| ≤ L * (w * Q + phi w) := by rw [hA, hQ]; exact abs_integral_diff_phi_Iic_le hdiff.continuous hb hd hdiff w have hBbound : |B| ≤ L * (phi w - w * P) := by rw [hB, hP]; exact abs_integral_diff_phi_Ioi_le hdiff.continuous hb hd hdiff w -- The weighted identity, with the cancellation pre-computed. have hid : sqrt (2 * π) * steinSol h w = E * (P * A - Q * B) := by rw [hE, hP, hQ, hA, hB]; exact steinSol_weighted_identity hdiff.continuous hb w -- Bound `√(2π)·|steinSol|`. have hmain : sqrt (2 * π) * |steinSol h w| ≤ sqrt (2 * π) * L := by calc sqrt (2 * π) * |steinSol h w| = |sqrt (2 * π) * steinSol h w| := by rw [abs_mul, abs_of_nonneg hKpos.le] _ = |E * (P * A - Q * B)| := by rw [hid] _ = E * |P * A - Q * B| := by rw [abs_mul, abs_of_nonneg hEpos.le] _ ≤ E * (P * |A| + Q * |B|) := by gcongr calc |P * A - Q * B| ≤ |P * A| + |Q * B| := abs_sub _ _ _ = P * |A| + Q * |B| := by rw [abs_mul, abs_mul, abs_of_nonneg hPpos, abs_of_nonneg hQpos] _ ≤ E * (P * (L * (w * Q + phi w)) + Q * (L * (phi w - w * P))) := by gcongr _ = L * (E * (P * (w * Q + phi w) + Q * (phi w - w * P))) := by ring _ = L * sqrt (2 * π) := by rw [weighted_moment_cancel w] _ = sqrt (2 * π) * L := by ring -- Cancel the positive factor `√(2π)`. exact le_of_mul_le_mul_left hmain hKpos
Causalean.SteinMethod.steinSol_abs_le · Causalean/Mathlib/Probability/SteinMethod/Bounds.lean:484 · uses steinSol
5 supporting declarations (lemmas, instances)
  • abs_le_exp_sq_div_four theorem — The absolute value of any real number is at most the exponential of one quarter of its square.
    x :
    |x| ≤ exp (x ^ 2 / 4)
    Proof (Lean source)
    theorem abs_le_exp_sq_div_four (x : ℝ) : |x| ≤ exp (x ^ 2 / 4) := by have h1 : |x| ≤ 1 + x ^ 2 / 4 := by nlinarith [sq_nonneg (|x| / 2 - 1), sq_abs x, abs_nonneg x] exact h1.trans (by have := Real.add_one_le_exp (x ^ 2 / 4); linarith)
    Causalean.SteinMethod.abs_le_exp_sq_div_four · Causalean/Mathlib/Probability/SteinMethod/Bounds.lean:123
  • steinSol_deriv_abs_le theorem — Sup bound on the derivative of the Stein solution in terms of the h-derivative bound.
    h :
    ℝ → ℝ
    C L :
    hb :
    ∀ x, |h x| ≤ C
    hd :
    ∀ x, |deriv h x| ≤ L
    hdiff :
    w :
    |deriv (steinSol h) w| ≤ 2 * L
    Proof (Lean source)
    theorem steinSol_deriv_abs_le (h : ℝ → ℝ) {C L : ℝ} (hb : ∀ x, |h x| ≤ C) (hd : ∀ x, |deriv h x| ≤ L) (hdiff : Differentiable ℝ h) (w : ℝ) : |deriv (steinSol h) w| ≤ 2 * L := by set K : ℝ := sqrt (2 * π) with hKdef have hKpos : 0 < K := Real.sqrt_pos.mpr (by positivity) have hKge43 : 4 / 3 ≤ K := by rw [hKdef, show (4/3:ℝ) = sqrt ((4/3)^2) by rw [Real.sqrt_sq (by norm_num)]] apply Real.sqrt_le_sqrt; nlinarith [Real.two_le_pi] set P : ℝ := ∫ x in Ioi w, phi x with hP set Q : ℝ := ∫ x in Iic w, phi x with hQ set A : ℝ := ∫ x in Iic w, (h x - h w) * phi x with hA set B : ℝ := ∫ x in Ioi w, (h x - h w) * phi x with hB set E : ℝ := exp (w ^ 2 / 2) with hE have hEpos : 0 < E := Real.exp_pos _ have hPpos : 0 ≤ P := by rw [hP]; exact setIntegral_nonneg measurableSet_Ioi (fun x _ => (phi_pos x).le) have hQpos : 0 ≤ Q := by rw [hQ]; exact setIntegral_nonneg measurableSet_Iic (fun x _ => (phi_pos x).le) -- The two nonnegative tail "first moments". have hao : phi w - w * P = ∫ x in Ioi w, (x - w) * phi x := by rw [hP]; exact (integral_Ioi_sub_mul_phi w).symm have hai : w * Q + phi w = ∫ x in Iic w, (w - x) * phi x := by rw [hQ]; exact (integral_Iic_sub_mul_phi w).symm have haoNonneg : 0 ≤ phi w - w * P := by rw [hao]; exact setIntegral_nonneg measurableSet_Ioi (fun x hx => mul_nonneg (by have := Set.mem_Ioi.mp hx; linarith) (phi_pos x).le) have haiNonneg : 0 ≤ w * Q + phi w := by rw [hai]; exact setIntegral_nonneg measurableSet_Iic (fun x hx => mul_nonneg (by have := Set.mem_Iic.mp hx; linarith) (phi_pos x).le) -- `E·φ w = 1`. have hEphi : E * phi w = 1 := exp_mul_phi w -- Stein equation and the weighted identity give the c-free derivative identity. have hstein : deriv (steinSol h) w = w * steinSol h w + (h w - gExpect h) := (steinSol_hasDerivAt h hdiff.continuous hb w).deriv have hwid : K * steinSol h w = E * (P * A - Q * B) := by rw [hKdef, hP, hQ, hA, hB, hE] exact steinSol_weighted_identity hdiff.continuous hb w have hKD : K * (h w - gExpect h) = -(A + B) := by rw [hKdef, hA, hB]; exact sqrt_mul_centered_eq hdiff.continuous hb w -- `K·deriv = w·E·(P A − Q B) − (A + B) = −E·(A·aₒ + B·aᵢ)`. have hKderiv : K * deriv (steinSol h) w = -(E * (A * (phi w - w * P) + B * (w * Q + phi w))) := by have hexpand : K * deriv (steinSol h) w = w * (K * steinSol h w) + K * (h w - gExpect h) := by rw [hstein]; ring rw [hexpand, hwid, hKD] -- `w·E(PA−QB) − (A+B) = −E(A(φ w−wP)+B(wQ+φ w))`, using `E·φ w = 1`. linear_combination (A + B) * hEphi -- Bound `K·|deriv| ≤ 2·L·E·(w Q + φ w)·(φ w − w P)`. have hAbound : |A| ≤ L * (w * Q + phi w) := by rw [hA, hQ]; exact abs_integral_diff_phi_Iic_le hdiff.continuous hb hd hdiff w have hBbound : |B| ≤ L * (phi w - w * P) := by rw [hB, hP]; exact abs_integral_diff_phi_Ioi_le hdiff.continuous hb hd hdiff w have hLnn : 0 ≤ L := le_trans (abs_nonneg (deriv h 0)) (hd 0) have hbound : K * |deriv (steinSol h) w| ≤ 2 * L * (E * ((w * Q + phi w) * (phi w - w * P))) := by calc K * |deriv (steinSol h) w| = |K * deriv (steinSol h) w| := by rw [abs_mul, abs_of_nonneg hKpos.le] _ = E * |A * (phi w - w * P) + B * (w * Q + phi w)| := by rw [hKderiv, abs_neg, abs_mul, abs_of_nonneg hEpos.le] _ ≤ E * (|A| * (phi w - w * P) + |B| * (w * Q + phi w)) := by gcongr calc |A * (phi w - w * P) + B * (w * Q + phi w)| ≤ |A * (phi w - w * P)| + |B * (w * Q + phi w)| := abs_add_le _ _ _ = |A| * (phi w - w * P) + |B| * (w * Q + phi w) := by rw [abs_mul, abs_mul, abs_of_nonneg haoNonneg, abs_of_nonneg haiNonneg] _ ≤ E * (L * (w * Q + phi w) * (phi w - w * P) + L * (phi w - w * P) * (w * Q + phi w)) := by gcongr _ = 2 * L * (E * ((w * Q + phi w) * (phi w - w * P))) := by ring -- `P, Q ≤ K`. have hPQK : Q + P = K := by rw [hQ, hP, hKdef]; exact integral_Iic_add_Ioi_phi w have hPleK : P ≤ K := by linarith have hQleK : Q ≤ K := by linarith have hden : (0:ℝ) < w ^ 2 + 1 := by positivity have hEaoNonneg : 0 ≤ E * (phi w - w * P) := mul_nonneg hEpos.le haoNonneg have hEaiNonneg : 0 ≤ E * (w * Q + phi w) := mul_nonneg hEpos.le haiNonneg -- `φ w ≤ 1`. have hphi_le_one : phi w ≤ 1 := by rw [show (1:ℝ) = exp 0 by simp]; unfold phi apply Real.exp_le_exp.mpr; nlinarith [sq_nonneg w] -- The analytic crux, via the pure inequality `crux_pure` and two-sided lower Mills. have hcrux : E * ((w * Q + phi w) * (phi w - w * P)) ≤ K := crux_pure hPpos hQpos hEpos hKge43 hEphi hPQK hphi_le_one haoNonneg haiNonneg (by rw [hP]; exact lower_mills w) (by rw [hQ]; exact lower_mills_left w) -- Conclude. have hfinal : K * |deriv (steinSol h) w| ≤ 2 * L * K := by calc K * |deriv (steinSol h) w| ≤ 2 * L * (E * ((w * Q + phi w) * (phi w - w * P))) := hbound _ ≤ 2 * L * K := by have h2L : 0 ≤ 2 * L := by linarith exact mul_le_mul_of_nonneg_left hcrux h2L have hfinal' : K * |deriv (steinSol h) w| ≤ K * (2 * L) := by rw [mul_comm K (2 * L)]; exact hfinal exact le_of_mul_le_mul_left hfinal' hKpos
    Causalean.SteinMethod.steinSol_deriv_abs_le · Causalean/Mathlib/Probability/SteinMethod/Bounds.lean:772
  • steinSol_deriv_hasDerivAt theorem — For a bounded differentiable test function, the derivative of its standard-normal Stein solution is differentiable at each point, with derivative equal to the solution value plus the point times its first derivative plus the derivative of the test function.
    h :
    ℝ → ℝ
    C :
    hb :
    ∀ x, |h x| ≤ C
    hdiff :
    w :
    HasDerivAt (deriv (steinSol h)) (steinSol h w + (w * deriv (steinSol h) w + deriv h w)) w
    Proof (Lean source)
    theorem steinSol_deriv_hasDerivAt (h : ℝ → ℝ) {C : ℝ} (hb : ∀ x, |h x| ≤ C) (hdiff : Differentiable ℝ h) (w : ℝ) : HasDerivAt (deriv (steinSol h)) (steinSol h w + (w * deriv (steinSol h) w + deriv h w)) w := by -- `deriv (steinSol h) = fun u => u * steinSol h u + (h u - gExpect h)` (Stein equation). have hderiv_eq : deriv (steinSol h) = fun u => u * steinSol h u + (h u - gExpect h) := by funext u; exact (steinSol_hasDerivAt h hdiff.continuous hb u).deriv -- `f` is differentiable with derivative `deriv (steinSol h) w`. have hfderiv : deriv (steinSol h) w = w * steinSol h w + (h w - gExpect h) := (steinSol_hasDerivAt h hdiff.continuous hb w).deriv have hf : HasDerivAt (steinSol h) (deriv (steinSol h) w) w := by rw [hfderiv]; exact steinSol_hasDerivAt h hdiff.continuous hb w rw [hderiv_eq] -- Differentiate `u ↦ u·f(u) + (h u − c)`. have hprod : HasDerivAt (fun u => u * steinSol h u) (1 * steinSol h w + w * deriv (steinSol h) w) w := (hasDerivAt_id w).mul hf have hh' : HasDerivAt (fun u => h u - gExpect h) (deriv h w) w := ((hdiff w).hasDerivAt).sub_const _ exact (hprod.fun_add hh').congr_deriv (by rw [hfderiv]; ring)
    Causalean.SteinMethod.steinSol_deriv_hasDerivAt · Causalean/Mathlib/Probability/SteinMethod/Bounds.lean:958
  • steinSol_secondDeriv_abs_le theorem — The absolute second derivative of the standard-normal Stein solution at each point is at most twice the uniform bound on the derivative of the test function.
    h :
    ℝ → ℝ
    C L :
    hb :
    ∀ x, |h x| ≤ C
    hd :
    ∀ x, |deriv h x| ≤ L
    hdiff :
    w :
    |steinSol h w + (w * deriv (steinSol h) w + deriv h w)| ≤ 2 * L
    Proof (Lean source)
    theorem steinSol_secondDeriv_abs_le (h : ℝ → ℝ) {C L : ℝ} (hb : ∀ x, |h x| ≤ C) (hd : ∀ x, |deriv h x| ≤ L) (hdiff : Differentiable ℝ h) (w : ℝ) : |steinSol h w + (w * deriv (steinSol h) w + deriv h w)| ≤ 2 * L := by -- `f + w f' + h' = (1+w²) f + w (h − c) + h'`, using the Stein equation `f' = w f + (h − c)`. have hstein : deriv (steinSol h) w = w * steinSol h w + (h w - gExpect h) := (steinSol_hasDerivAt h hdiff.continuous hb w).deriv have hrewrite : steinSol h w + (w * deriv (steinSol h) w + deriv h w) = ((1 + w ^ 2) * steinSol h w + w * (h w - gExpect h)) + deriv h w := by rw [hstein]; ring rw [hrewrite] calc |((1 + w ^ 2) * steinSol h w + w * (h w - gExpect h)) + deriv h w| ≤ |(1 + w ^ 2) * steinSol h w + w * (h w - gExpect h)| + |deriv h w| := abs_add_le _ _ _ ≤ L + L := by gcongr · exact steinSol_crux_le h hdiff.continuous hb hd hdiff w · exact hd w _ = 2 * L := by ring
    Causalean.SteinMethod.steinSol_secondDeriv_abs_le · Causalean/Mathlib/Probability/SteinMethod/Bounds.lean:982
  • steinSol_deriv_lipschitz theorem — Lipschitz bound on the derivative of the Stein solution (equivalent to ‖f_h''‖ ≤ 2L; Chen–Goldstein–Shao Lemma 2.5). The form f_h' is 2L-Lipschitz is what the second-order Taylor step in the local-dependence Stein bound consumes.
    h :
    ℝ → ℝ
    C L :
    hb :
    ∀ x, |h x| ≤ C
    hd :
    ∀ x, |deriv h x| ≤ L
    hdiff :
    u v :
    |deriv (steinSol h) u - deriv (steinSol h) v| ≤ 2 * L * |u - v|
    Proof (Lean source)
    theorem steinSol_deriv_lipschitz (h : ℝ → ℝ) {C L : ℝ} (hb : ∀ x, |h x| ≤ C) (hd : ∀ x, |deriv h x| ≤ L) (hdiff : Differentiable ℝ h) (u v : ℝ) : |deriv (steinSol h) u - deriv (steinSol h) v| ≤ 2 * L * |u - v| := by -- Mean value inequality: `deriv (steinSol h)` is differentiable everywhere with second -- derivative bounded by `2L`, so it is `2L`-Lipschitz. have hbound := Convex.norm_image_sub_le_of_norm_deriv_le (𝕜 := ℝ) (f := deriv (steinSol h)) (s := univ) (fun z _ => (steinSol_deriv_hasDerivAt h hb hdiff z).differentiableAt) (fun z _ => by rw [Real.norm_eq_abs, (steinSol_deriv_hasDerivAt h hb hdiff z).deriv] exact steinSol_secondDeriv_abs_le h hb hd hdiff z) convex_univ (Set.mem_univ v) (Set.mem_univ u) simpa [Real.norm_eq_abs] using hbound
    Causalean.SteinMethod.steinSol_deriv_lipschitz · Causalean/Mathlib/Probability/SteinMethod/Bounds.lean:1003
CLT 1 core · 3 supporting This file converts the local-dependence Stein estimate into CDF convergence to the standard normal law. ★ stein_cdf_clt

Local-dependence central limit theorem via Stein bounds

This file converts the local-dependence Stein estimate into CDF convergence to the standard normal law. It proves the reusable implication cdf_tendsto_of_charFun_tendsto from pointwise characteristic-function convergence to pointwise Gaussian CDF convergence, then applies the Stein bound to cosine and sine test functions in the bounded local-dependence central limit theorem stein_cdf_clt.

theorem stein_cdf_clt reviewed
Causalean.SteinMethod

The bounded local-dependence CLT (CDF form). Fix, for each sample size n, a probability measure μ n, triangular-array summands X n i, and an index-dependent neighborhood set N n i for each i, all jointly measurable. Suppose the summands are uniformly bounded by a nonnegative constant sequence B n, mean zero, and each summand is independent of the sum of the summands outside its neighborhood; suppose the standardized sum has unit variance, and that the variance of the neighborhood-weighted cross term and the aggregate third-absolute-moment error term both tend to zero as n → ∞. Then for every threshold s, the CDF of the dependency sum under μ n at s converges, as n → ∞, to the standard-normal CDF at s.

Formal statement
Ω :
ℕ → Type*
∀ n, MeasurableSpace (Ω n)
μ :
∀ n, Measure (Ω n)
∀ n, IsProbabilityMeasure (μ n)
ι :
ℕ → Type*
∀ n, Fintype (ι n)
∀ n, DecidableEq (ι n)
X :
∀ n
if
ι n
and
Ω n
then
N :
∀ n
if
ι n
then
Finset (ι n)
hmeas :
∀ n i, Measurable (X n i)
B :
ℕ → ℝ
hB :
∀ n, 0 ≤ B n
hbound :
∀ n i ω, |X n i ω| ≤ B n
hmean :
∀ n i, ∫ ω, X n i ω ∂(μ n) = 0
hindep :
∀ n i, IndepFun (X n i) (fun ω => ∑ j ∈ univ \ N n i, X n j ω) (μ n)
hvar :
∀ n, ∫ ω, (depSum (X n) ω) ^ 2 ∂(μ n) = 1
herr1 :
Tendsto (fun n => variance (fun ω => ∑ i, X n i ω * nbhdSum (X n) (N n) i ω) (μ n)) atTop (𝓝 0)
herr2 :
Tendsto (fun n => ∑ i, ∫ ω, |X n i ω| * (nbhdSum (X n) (N n) i ω) ^ 2 ∂(μ n)) atTop (𝓝 0)
s :
Tendsto (fun n => ((μ n).map (depSum (X n))).real (Iic s)) atTop (𝓝 ((gaussianReal 0 1).real (Iic s)))
Proof (Lean source)
theorem stein_cdf_clt {Ω : ℕ → Type*} [∀ n, MeasurableSpace (Ω n)] (μ : ∀ n, Measure (Ω n)) [∀ n, IsProbabilityMeasure (μ n)] {ι : ℕ → Type*} [∀ n, Fintype (ι n)] [∀ n, DecidableEq (ι n)] (X : ∀ n, ι n → Ω n → ℝ) (N : ∀ n, ι n → Finset (ι n)) (hmeas : ∀ n i, Measurable (X n i)) (B : ℕ → ℝ) (hB : ∀ n, 0 ≤ B n) (hbound : ∀ n i ω, |X n i ω| ≤ B n) (hmean : ∀ n i, ∫ ω, X n i ω ∂(μ n) = 0) (hindep : ∀ n i, IndepFun (X n i) (fun ω => ∑ j ∈ univ \ N n i, X n j ω) (μ n)) (hvar : ∀ n, ∫ ω, (depSum (X n) ω) ^ 2 ∂(μ n) = 1) (herr1 : Tendsto (fun n => variance (fun ω => ∑ i, X n i ω * nbhdSum (X n) (N n) i ω) (μ n)) atTop (𝓝 0)) (herr2 : Tendsto (fun n => ∑ i, ∫ ω, |X n i ω| * (nbhdSum (X n) (N n) i ω) ^ 2 ∂(μ n)) atTop (𝓝 0)) (s : ℝ) : Tendsto (fun n => ((μ n).map (depSum (X n))).real (Iic s)) atTop (𝓝 ((gaussianReal 0 1).real (Iic s))) := by classical -- `W n` is the standardized sum; it is measurable (finite sum of measurable maps). have hWmeas : ∀ n, Measurable (depSum (X n)) := fun n => by unfold depSum; exact measurable_sum _ (fun i _ => hmeas n i) -- The law of `W n` is a probability measure. haveI : ∀ n, IsProbabilityMeasure ((μ n).map (depSum (X n))) := fun n => Measure.isProbabilityMeasure_map (hWmeas n).aemeasurable -- Package the laws. set lawn : ℕ → ProbabilityMeasure ℝ := fun n => ⟨(μ n).map (depSum (X n)), inferInstance⟩ with hlawn -- Reduce to characteristic-function convergence via Theorem 1. have hcoe : ∀ n, (lawn n : Measure ℝ) = (μ n).map (depSum (X n)) := fun n => rfl let ν₀ : ProbabilityMeasure ℝ := ⟨gaussianReal 0 1, inferInstance⟩ letI : NullSingletonClass (ν₀ : Measure ℝ) := nullSingletonClass_gaussianReal one_ne_zero refine cdf_tendsto_of_charFun_tendsto lawn ν₀ ?_ s intro t -- Test functions `cos(t·)` and `sin(t·)`: both bounded by `1` with derivative bounded by `|t|`. have hcos_cont : Continuous (fun x => cos (t * x)) := by fun_prop have hcos_diff : Differentiable ℝ (fun x => cos (t * x)) := by fun_prop have hcos_b : ∀ x, |cos (t * x)| ≤ 1 := fun x => Real.abs_cos_le_one _ have hcos_d : ∀ x, |deriv (fun x => cos (t * x)) x| ≤ |t| := by intro x have hderiv : deriv (fun x => cos (t * x)) x = -(t * sin (t * x)) := by have h := (Real.hasDerivAt_cos (t * x)).comp x ((hasDerivAt_id x).const_mul t) simpa [mul_comm, Function.comp_def] using h.deriv rw [hderiv, abs_neg, abs_mul] calc |t| * |sin (t * x)| ≤ |t| * 1 := mul_le_mul_of_nonneg_left (Real.abs_sin_le_one _) (abs_nonneg _) _ = |t| := mul_one _ have hsin_cont : Continuous (fun x => sin (t * x)) := by fun_prop have hsin_diff : Differentiable ℝ (fun x => sin (t * x)) := by fun_prop have hsin_b : ∀ x, |sin (t * x)| ≤ 1 := fun x => Real.abs_sin_le_one _ have hsin_d : ∀ x, |deriv (fun x => sin (t * x)) x| ≤ |t| := by intro x have hderiv : deriv (fun x => sin (t * x)) x = t * cos (t * x) := by have h := (Real.hasDerivAt_sin (t * x)).comp x ((hasDerivAt_id x).const_mul t) simpa [mul_comm, Function.comp_def] using h.deriv rw [hderiv, abs_mul] calc |t| * |cos (t * x)| ≤ |t| * 1 := mul_le_mul_of_nonneg_left (Real.abs_cos_le_one _) (abs_nonneg _) _ = |t| := mul_one _ -- Stein convergence of the cos- and sin-expectations to the Gaussian expectations. have hcos_tendsto : Tendsto (fun n => ∫ ω, cos (t * depSum (X n) ω) ∂(μ n)) atTop (𝓝 (gExpect (fun x => cos (t * x)))) := stein_expect_tendsto μ X N hmeas B hB hbound hmean hindep hvar herr1 herr2 (fun x => cos (t * x)) hcos_b hcos_d hcos_diff have hsin_tendsto : Tendsto (fun n => ∫ ω, sin (t * depSum (X n) ω) ∂(μ n)) atTop (𝓝 (gExpect (fun x => sin (t * x)))) := stein_expect_tendsto μ X N hmeas B hB hbound hmean hindep hvar herr1 herr2 (fun x => sin (t * x)) hsin_b hsin_d hsin_diff -- Decompose `charFun` of the limit Gaussian into the cos/sin Gaussian expectations. have hgauss : charFun (gaussianReal 0 1) t = (↑(gExpect (fun x => cos (t * x))) : ℂ) + (↑(gExpect (fun x => sin (t * x))) : ℂ) * I := by have hmap : (gaussianReal 0 1).map id = gaussianReal 0 1 := Measure.map_id have := charFun_map_eq_cos_sin (gaussianReal 0 1) id measurable_id t rw [hmap] at this simpa [gExpect, comp] using this -- Decompose `charFun` of each law `lawn n` into the cos/sin sample expectations. have hlaw : ∀ n, charFun (lawn n : Measure ℝ) t = (↑(∫ ω, cos (t * depSum (X n) ω) ∂(μ n)) : ℂ) + (↑(∫ ω, sin (t * depSum (X n) ω) ∂(μ n)) : ℂ) * I := by intro n rw [hcoe n] exact charFun_map_eq_cos_sin (μ n) (depSum (X n)) (hWmeas n) t -- Combine: real and imaginary parts converge, hence the complex char-functions converge. have hν₀ : (ν₀ : Measure ℝ) = gaussianReal 0 1 := rfl rw [hν₀, hgauss] simp_rw [hlaw] refine Tendsto.add ?_ (Tendsto.mul_const I ?_) · exact (Complex.continuous_ofReal.tendsto _).comp hcos_tendsto · exact (Complex.continuous_ofReal.tendsto _).comp hsin_tendsto
3 supporting declarations (lemmas, instances)
  • cdf_tendsto_of_charFun_tendsto theorem — CDF convergence from characteristic-function convergence. A sequence of real probability laws whose characteristic functions converge to those of an atomless target law has convergent CDF values at every threshold.
    lawn :
    ℕ → ProbabilityMeasure
    hchar :
    ∀ t : ℝ,
    Tendsto (fun n => charFun (lawn n : Measure ℝ) t) atTop (𝓝 (charFun (ν : Measure ℝ) t))
    s :
    Tendsto (fun n => (lawn n : Measure ℝ).real (Iic s)) atTop (𝓝 ((ν : Measure ℝ).real (Iic s)))
    Proof (Lean source)
    theorem cdf_tendsto_of_charFun_tendsto (lawn : ℕ → ProbabilityMeasure ℝ) (ν : ProbabilityMeasure ℝ) [NullSingletonClass (ν : Measure ℝ)] (hchar : ∀ t : ℝ, Tendsto (fun n => charFun (lawn n : Measure ℝ) t) atTop (𝓝 (charFun (ν : Measure ℝ) t))) (s : ℝ) : Tendsto (fun n => (lawn n : Measure ℝ).real (Iic s)) atTop (𝓝 ((ν : Measure ℝ).real (Iic s))) := by -- Lévy continuity (`clt` package): char-function convergence ⇒ weak convergence. have hweak : Tendsto lawn atTop (𝓝 ν) := by rw [MeasureTheory.ProbabilityMeasure.tendsto_iff_tendsto_charFun] intro t exact hchar t -- Atomlessness makes the frontier of `Iic s` null. have hnull : (ν : Measure ℝ) (frontier (Iic s)) = 0 := by rw [frontier_Iic] exact measure_singleton s -- Portmanteau: weak convergence ⇒ measure convergence on null-frontier sets. have hmeas := MeasureTheory.ProbabilityMeasure.tendsto_measure_of_null_frontier_of_tendsto' (μ := ν) (μs := lawn) hweak (E := Iic s) hnull -- Pass to real-valued measures. have hfin : ∀ n, (lawn n : Measure ℝ) (Iic s) ≠ ⊤ := fun n => measure_ne_top _ _ refine (ENNReal.tendsto_toReal ?_).comp hmeas exact measure_ne_top _ _
    Causalean.SteinMethod.cdf_tendsto_of_charFun_tendsto · Causalean/Mathlib/Probability/SteinMethod/CLT.lean:42
  • charFun_map_eq_cos_sin theorem — A measurable real random variable under a finite measure has a characteristic function whose real and imaginary components are the corresponding cosine and sine integrals.
    Ω :
    W :
    Ω → ℝ
    hW :
    t :
    charFun (ν.map W) t
    = (↑(∫ ω, cos (t * W ω) ∂ν) : ℂ) + (↑(∫ ω, sin (t * W ω) ∂ν) : ℂ) * I
    Proof (Lean source)
    theorem charFun_map_eq_cos_sin {Ω : Type*} [MeasurableSpace Ω] (ν : Measure Ω) [IsFiniteMeasure ν] (W : Ω → ℝ) (hW : Measurable W) (t : ℝ) : charFun (ν.map W) t = (↑(∫ ω, cos (t * W ω) ∂ν) : ℂ) + (↑(∫ ω, sin (t * W ω) ∂ν) : ℂ) * I := by -- Move the integral back to `ν` via `integral_map`. have hg : AEStronglyMeasurable (fun x : ℝ => exp (↑t * ↑x * I)) (ν.map W) := (Complex.measurable_exp.comp ((measurable_const.mul Complex.measurable_ofReal).mul measurable_const)).aestronglyMeasurable rw [charFun_apply_real, integral_map hW.aemeasurable hg] -- Integrability of the real/imaginary integrands. have hcosint : Integrable (fun ω => (↑(cos (t * W ω)) : ℂ)) ν := (integrable_bdd_real (fun ω => cos (t * W ω)) (Real.measurable_cos.comp (measurable_const.mul hW)) (fun ω => Real.abs_cos_le_one _)).ofReal have hsinint : Integrable (fun ω => (↑(sin (t * W ω)) : ℂ) * I) ν := ((integrable_bdd_real (fun ω => sin (t * W ω)) (Real.measurable_sin.comp (measurable_const.mul hW)) (fun ω => Real.abs_sin_le_one _)).ofReal).mul_const I -- Rewrite the complex exponential pointwise and split. have hpt : ∀ ω, exp (↑t * ↑(W ω) * I) = ↑(cos (t * W ω)) + ↑(sin (t * W ω)) * I := by intro ω rw [show (↑t * ↑(W ω) : ℂ) = ↑(t * W ω) by push_cast; ring, Complex.exp_mul_I, Complex.ofReal_cos, Complex.ofReal_sin] simp_rw [hpt] rw [integral_add hcosint hsinint] congr 1 · exact integral_complex_ofReal · have hmc := integral_mul_const (μ := ν) I (fun ω => (↑(sin (t * W ω)) : ℂ)) refine hmc.trans ?_ congr 1 exact integral_complex_ofReal
    Causalean.SteinMethod.charFun_map_eq_cos_sin · Causalean/Mathlib/Probability/SteinMethod/CLT.lean:76
  • stein_expect_tendsto theorem — For uniformly bounded, mean-zero locally dependent sums with unit variance whose Stein error terms vanish, expectations of a differentiable test function converge to its standard-normal expectation.
    Ω :
    ℕ → Type*
    ∀ n, MeasurableSpace (Ω n)
    μ :
    ∀ n, Measure (Ω n)
    ∀ n, IsProbabilityMeasure (μ n)
    ι :
    ℕ → Type*
    ∀ n, Fintype (ι n)
    ∀ n, DecidableEq (ι n)
    X :
    ∀ n
    if
    ι n
    and
    Ω n
    then
    N :
    ∀ n
    if
    ι n
    then
    Finset (ι n)
    hmeas :
    ∀ n i, Measurable (X n i)
    B :
    ℕ → ℝ
    hB :
    ∀ n, 0 ≤ B n
    hbound :
    ∀ n i ω, |X n i ω| ≤ B n
    hmean :
    ∀ n i, ∫ ω, X n i ω ∂(μ n) = 0
    hindep :
    ∀ n i, IndepFun (X n i) (fun ω => ∑ j ∈ univ \ N n i, X n j ω) (μ n)
    hvar :
    ∀ n, ∫ ω, (depSum (X n) ω) ^ 2 ∂(μ n) = 1
    herr1 :
    Tendsto (fun n => variance (fun ω => ∑ i, X n i ω * nbhdSum (X n) (N n) i ω) (μ n)) atTop (𝓝 0)
    herr2 :
    Tendsto (fun n => ∑ i, ∫ ω, |X n i ω| * (nbhdSum (X n) (N n) i ω) ^ 2 ∂(μ n)) atTop (𝓝 0)
    h :
    ℝ → ℝ
    C L :
    hb :
    ∀ x, |h x| ≤ C
    hd :
    ∀ x, |deriv h x| ≤ L
    hdiff :
    Tendsto (fun n => ∫ ω, h (depSum (X n) ω) ∂(μ n)) atTop (𝓝 (gExpect h))
    Proof (Lean source)
    theorem stein_expect_tendsto {Ω : ℕ → Type*} [∀ n, MeasurableSpace (Ω n)] (μ : ∀ n, Measure (Ω n)) [∀ n, IsProbabilityMeasure (μ n)] {ι : ℕ → Type*} [∀ n, Fintype (ι n)] [∀ n, DecidableEq (ι n)] (X : ∀ n, ι n → Ω n → ℝ) (N : ∀ n, ι n → Finset (ι n)) (hmeas : ∀ n i, Measurable (X n i)) (B : ℕ → ℝ) (hB : ∀ n, 0 ≤ B n) (hbound : ∀ n i ω, |X n i ω| ≤ B n) (hmean : ∀ n i, ∫ ω, X n i ω ∂(μ n) = 0) (hindep : ∀ n i, IndepFun (X n i) (fun ω => ∑ j ∈ univ \ N n i, X n j ω) (μ n)) (hvar : ∀ n, ∫ ω, (depSum (X n) ω) ^ 2 ∂(μ n) = 1) (herr1 : Tendsto (fun n => variance (fun ω => ∑ i, X n i ω * nbhdSum (X n) (N n) i ω) (μ n)) atTop (𝓝 0)) (herr2 : Tendsto (fun n => ∑ i, ∫ ω, |X n i ω| * (nbhdSum (X n) (N n) i ω) ^ 2 ∂(μ n)) atTop (𝓝 0)) (h : ℝ → ℝ) {C L : ℝ} (hb : ∀ x, |h x| ≤ C) (hd : ∀ x, |deriv h x| ≤ L) (hdiff : Differentiable ℝ h) : Tendsto (fun n => ∫ ω, h (depSum (X n) ω) ∂(μ n)) atTop (𝓝 (gExpect h)) := by -- The Stein bound: `|E[h(Wₙ)] − E[h(Z)]| ≤ err₁(n) + err₂(n)` with both errors → 0. set lhs : ℕ → ℝ := fun n => ∫ ω, h (depSum (X n) ω) ∂(μ n) with hlhs set rhs : ℕ → ℝ := fun n => 2 * L * sqrt (variance (fun ω => ∑ i, X n i ω * nbhdSum (X n) (N n) i ω) (μ n)) + L * ∑ i, ∫ ω, |X n i ω| * (nbhdSum (X n) (N n) i ω) ^ 2 ∂(μ n) with hrhs have hbound_n : ∀ n, |lhs n - gExpect h| ≤ rhs n := fun n => stein_local_dependence_bound (X n) (N n) (hmeas n) (hB n) (hbound n) (hmean n) (hindep n) (hvar n) h hb hd hdiff -- The error sequence converges to `0`. have hrhs0 : Tendsto rhs atTop (𝓝 0) := by have ht1 : Tendsto (fun n => 2 * L * sqrt (variance (fun ω => ∑ i, X n i ω * nbhdSum (X n) (N n) i ω) (μ n))) atTop (𝓝 0) := by have hsqrt : Tendsto (fun n => sqrt (variance (fun ω => ∑ i, X n i ω * nbhdSum (X n) (N n) i ω) (μ n))) atTop (𝓝 0) := by have := (Real.continuous_sqrt.tendsto 0).comp herr1 simpa [Real.sqrt_zero, Function.comp_def] using this simpa using hsqrt.const_mul (2 * L) have ht2 : Tendsto (fun n => L * ∑ i, ∫ ω, |X n i ω| * (nbhdSum (X n) (N n) i ω) ^ 2 ∂(μ n)) atTop (𝓝 0) := by simpa using herr2.const_mul L simpa [hrhs] using ht1.add ht2 -- Squeeze: `|lhs n − gExpect h| ≤ rhs n → 0` forces `lhs n → gExpect h`. rw [← tendsto_sub_nhds_zero_iff] refine squeeze_zero_norm (fun n => ?_) hrhs0 rw [Real.norm_eq_abs]; exact hbound_n n
    Causalean.SteinMethod.stein_expect_tendsto · Causalean/Mathlib/Probability/SteinMethod/CLT.lean:111
Standardized­Dep­Graph­CLT 2 core · 2 supporting A standardization wrapper around the abstract Stein dependency-graph CLT Causalean.SteinMethod.stein_cdf_clt_of_depGraph. ★ bounded_degree_dependency_clt

Standardized bounded-degree dependency-graph CLT

A standardization wrapper around the abstract Stein dependency-graph CLT Causalean.SteinMethod.stein_cdf_clt_of_depGraph. The engine consumes an array that has already been standardized to unit variance with a summand bound tending to 0 and a Lyapunov limit card · Bₙ³ → 0. Real applications instead arrive with fixed bounded summands |X| ≤ M, a raw second moment ∫ (∑ᵢ Xᵢ)² = vₙ, and a linear variance floor c · card ιₙ ≤ vₙ — so this file supplies the missing layer: it divides through by √vₙ, re-derives unit variance, converts the summand bound into Bₙ = (M/√c)/√(card ιₙ), discharges card · Bₙ³ → 0 internally, and adds the prefix-shift plumbing for the eventual-hypothesis variants. Downstream a user can invoke it on raw mean-zero bounded summands and get CDF convergence of (∑ᵢ Xᵢ)/√vₙ to N(0,1) in one step.

def depGraph_div_const reviewed
Causalean.SteinMethod

Dividing every summand in a dependency graph by the same deterministic constant preserves the graph and transfers the independence field by measurable post-composition.

Definition (Lean source)
noncomputable def depGraph_div_const {Ω ι : Type*} [MeasurableSpace Ω] [Fintype ι] {μ : Measure Ω} {X : ι → Ω → ℝ} (D : DepGraph X μ) (s : ℝ) : DepGraph (fun i ω => X i ω / s) μ := by classical refine { G := D.G decG := D.decG refl := D.refl symm := D.symm meas := fun i => (D.meas i).div_const s indep := ?_ } intro A B hAB have h := D.indep A B hAB let φ : (A → ℝ) → (A → ℝ) := fun v k => v k / s let ψ : (B → ℝ) → (B → ℝ) := fun v k => v k / s have hφ : Measurable φ := by exact measurable_pi_lambda φ fun k => by have hk : Measurable (fun v : A → ℝ => v k) := measurable_pi_apply k simpa [φ] using hk.div_const s have hψ : Measurable ψ := by exact measurable_pi_lambda ψ fun k => by have hk : Measurable (fun v : B → ℝ => v k) := measurable_pi_apply k simpa [ψ] using hk.div_const s exact h.comp hφ hψ
theorem bounded_degree_dependency_clt reviewed
Causalean.SteinMethod

Bounded-degree dependency-graph CLT (raw, variance-floor form). Fix, for each n, a probability measure μ n, triangular-array summands X n i, and a dependency graph Dep n on the index set, with every dependency neighborhood of size at most a fixed bound Dmax. Suppose the summands are uniformly bounded in absolute value by a nonnegative constant M and mean zero, with the total variance v n satisfying, for a strictly positive constant c, a floor v n ≥ c · card (ι n) eventually in n; suppose also the index-set cardinality diverges to infinity. Then for every threshold s, the CDF of the standardized sum depSum (X n) / √(v n) under μ n at s converges, as n → ∞, to the standard-normal CDF at s. The index-size divergence together with the variance floor forces the Lyapunov ratio card (ι n) · (M / √(v n))³ → 0 that drives the underlying Stein bound.

Formal statement
Ω :
ℕ → Type*
∀ n, MeasurableSpace (Ω n)
μ :
∀ n, Measure (Ω n)
∀ n, IsProbabilityMeasure (μ n)
ι :
ℕ → Type*
∀ n, Fintype (ι n)
X :
∀ n
if
ι n
and
Ω n
then
Dep :
∀ n, DepGraph (X n) (μ n)
Dmax :
hdeg :
∀ n i, ((Dep n).nbhd i).card ≤ Dmax
M :
hM :
0 ≤ M
hbound :
∀ n i ω, |X n i ω| ≤ M
hmean :
∀ n i, ∫ ω, X n i ω ∂(μ n) = 0
v :
ℕ → ℝ
hv :
∀ n, ∫ ω, (depSum (X n) ω) ^ 2 ∂(μ n) = v n
c :
hc :
0 < c
hvc :
∀ᶠ n in atTop, c * (card (ι n) : ℝ) ≤ v n
hcard :
Tendsto (fun n => card (ι n)) atTop atTop
s :
Tendsto (fun n => ((μ n).map (fun ω => depSum (X n) ω / sqrt (v n))).real (Iic s)) atTop (𝓝 ((gaussianReal 0 1).real (Iic s)))
Proof (Lean source)
theorem bounded_degree_dependency_clt {Ω : ℕ → Type*} [∀ n, MeasurableSpace (Ω n)] (μ : ∀ n, Measure (Ω n)) [∀ n, IsProbabilityMeasure (μ n)] {ι : ℕ → Type*} [∀ n, Fintype (ι n)] (X : ∀ n, ι n → Ω n → ℝ) (Dep : ∀ n, DepGraph (X n) (μ n)) (Dmax : ℕ) (hdeg : ∀ n i, ((Dep n).nbhd i).card ≤ Dmax) (M : ℝ) (hM : 0 ≤ M) (hbound : ∀ n i ω, |X n i ω| ≤ M) (hmean : ∀ n i, ∫ ω, X n i ω ∂(μ n) = 0) (v : ℕ → ℝ) (hv : ∀ n, ∫ ω, (depSum (X n) ω) ^ 2 ∂(μ n) = v n) (c : ℝ) (hc : 0 < c) (hvc : ∀ᶠ n in atTop, c * (card (ι n) : ℝ) ≤ v n) (hcard : Tendsto (fun n => card (ι n)) atTop atTop) (s : ℝ) : Tendsto (fun n => ((μ n).map (fun ω => depSum (X n) ω / sqrt (v n))).real (Iic s)) atTop (𝓝 ((gaussianReal 0 1).real (Iic s))) := by classical rcases eventually_atTop.1 hvc with ⟨Nv, hNv⟩ rcases eventually_atTop.1 (hcard.eventually_ge_atTop 1) with ⟨Nc, hNc⟩ let N := max Nv Nc have hvc_tail : ∀ n, c * (card (ι (n + N)) : ℝ) ≤ v (n + N) := by intro n apply hNv omega have hcard_pos_tail : ∀ n, 0 < card (ι (n + N)) := by intro n have hge : 1 ≤ card (ι (n + N)) := hNc (n + N) (by omega) exact Nat.lt_of_lt_of_le Nat.zero_lt_one hge have hcard_tail : Tendsto (fun n => card (ι (n + N))) atTop atTop := hcard.comp (tendsto_add_atTop_nat N) have htail := bounded_degree_dependency_clt_of_variance_floor_all (μ := fun n => μ (n + N)) (X := fun n => X (n + N)) (Dep := fun n => Dep (n + N)) Dmax (fun n i => hdeg (n + N) i) M hM (fun n i ω => hbound (n + N) i ω) (fun n i => hmean (n + N) i) (fun n => v (n + N)) (fun n => hv (n + N)) c hc hvc_tail hcard_pos_tail hcard_tail s exact (tendsto_add_atTop_iff_nat N).1 htail
2 supporting declarations (lemmas, instances)
  • bounded_degree_dependency_clt_of_variance_floor_all theorem — Dependency-graph CLT wrapper when the linear variance floor holds at every index. The public theorem below removes this all-index convenience by shifting to a tail.
    Ω :
    ℕ → Type*
    ∀ n, MeasurableSpace (Ω n)
    μ :
    ∀ n, Measure (Ω n)
    ∀ n, IsProbabilityMeasure (μ n)
    ι :
    ℕ → Type*
    ∀ n, Fintype (ι n)
    X :
    ∀ n
    if
    ι n
    and
    Ω n
    then
    Dep :
    ∀ n, DepGraph (X n) (μ n)
    Dmax :
    hdeg :
    ∀ n i, ((Dep n).nbhd i).card ≤ Dmax
    M :
    hM :
    0 ≤ M
    hbound :
    ∀ n i ω, |X n i ω| ≤ M
    hmean :
    ∀ n i, ∫ ω, X n i ω ∂(μ n) = 0
    v :
    ℕ → ℝ
    hv :
    ∀ n, ∫ ω, (depSum (X n) ω) ^ 2 ∂(μ n) = v n
    c :
    hc :
    0 < c
    hvc :
    ∀ n, c * (card (ι n) : ℝ) ≤ v n
    hcard_pos :
    ∀ n, 0 < card (ι n)
    hcard :
    Tendsto (fun n => card (ι n)) atTop atTop
    s :
    Tendsto (fun n => ((μ n).map (fun ω => depSum (X n) ω / sqrt (v n))).real (Iic s)) atTop (𝓝 ((gaussianReal 0 1).real (Iic s)))
    Proof (Lean source)
    theorem bounded_degree_dependency_clt_of_variance_floor_all {Ω : ℕ → Type*} [∀ n, MeasurableSpace (Ω n)] (μ : ∀ n, Measure (Ω n)) [∀ n, IsProbabilityMeasure (μ n)] {ι : ℕ → Type*} [∀ n, Fintype (ι n)] (X : ∀ n, ι n → Ω n → ℝ) (Dep : ∀ n, DepGraph (X n) (μ n)) (Dmax : ℕ) (hdeg : ∀ n i, ((Dep n).nbhd i).card ≤ Dmax) (M : ℝ) (hM : 0 ≤ M) (hbound : ∀ n i ω, |X n i ω| ≤ M) (hmean : ∀ n i, ∫ ω, X n i ω ∂(μ n) = 0) (v : ℕ → ℝ) (hv : ∀ n, ∫ ω, (depSum (X n) ω) ^ 2 ∂(μ n) = v n) (c : ℝ) (hc : 0 < c) (hvc : ∀ n, c * (card (ι n) : ℝ) ≤ v n) (hcard_pos : ∀ n, 0 < card (ι n)) (hcard : Tendsto (fun n => card (ι n)) atTop atTop) (s : ℝ) : Tendsto (fun n => ((μ n).map (fun ω => depSum (X n) ω / Real.sqrt (v n))).real (Iic s)) atTop (𝓝 ((gaussianReal 0 1).real (Iic s))) := by classical set Xs : ∀ n, ι n → Ω n → ℝ := fun n i ω => X n i ω / Real.sqrt (v n) with hXs set Ds : ∀ n, DepGraph (Xs n) (μ n) := fun n => depGraph_div_const (Dep n) (Real.sqrt (v n)) with hDs set cardR : ℕ → ℝ := fun n => (card (ι n) : ℝ) with hcardR set K : ℝ := M / Real.sqrt c with hK set B : ℕ → ℝ := fun n => K / Real.sqrt (cardR n) with hBdef have hcardR_pos : ∀ n, 0 < cardR n := by intro n have hpos : (0 : ℝ) < (card (ι n) : ℝ) := by exact_mod_cast hcard_pos n simpa [cardR] using hpos have hv_pos : ∀ n, 0 < v n := by intro n have hfloor : 0 < c * cardR n := mul_pos hc (hcardR_pos n) exact lt_of_lt_of_le hfloor (by simpa [cardR] using hvc n) have hmeas : ∀ n i, Measurable (Xs n i) := fun n i => (Ds n).meas i have hdeg' : ∀ n i, ((Ds n).nbhd i).card ≤ Dmax := by intro n i exact hdeg n i have hB_nonneg : ∀ n, 0 ≤ B n := by intro n have hc_sqrt : 0 < Real.sqrt c := Real.sqrt_pos.mpr hc have hK_nonneg : 0 ≤ K := by rw [hK] exact div_nonneg hM hc_sqrt.le exact div_nonneg hK_nonneg (Real.sqrt_nonneg _) have hbound' : ∀ n i ω, |Xs n i ω| ≤ B n := by intro n i ω have hsv : 0 < Real.sqrt (v n) := Real.sqrt_pos.mpr (hv_pos n) have hsf : 0 < Real.sqrt (c * cardR n) := Real.sqrt_pos.mpr (mul_pos hc (hcardR_pos n)) have hs_le : Real.sqrt (c * cardR n) ≤ Real.sqrt (v n) := Real.sqrt_le_sqrt (by simpa [cardR] using hvc n) calc |Xs n i ω| = |X n i ω| / Real.sqrt (v n) := by simp [hXs, abs_div, abs_of_pos hsv] _ ≤ M / Real.sqrt (v n) := div_le_div_of_nonneg_right (hbound n i ω) hsv.le _ ≤ M / Real.sqrt (c * cardR n) := div_le_div_of_nonneg_left hM hsf hs_le _ = B n := by rw [hBdef, hK, Real.sqrt_mul hc.le (cardR n)] field_simp [(Real.sqrt_pos.mpr hc).ne', (Real.sqrt_pos.mpr (hcardR_pos n)).ne'] have hmean' : ∀ n i, ∫ ω, Xs n i ω ∂(μ n) = 0 := by intro n i have hsv_ne : Real.sqrt (v n) ≠ 0 := (Real.sqrt_pos.mpr (hv_pos n)).ne' have hfun : (fun ω => Xs n i ω) = fun ω => (Real.sqrt (v n))⁻¹ * X n i ω := by funext ω simp [hXs, div_eq_inv_mul] rw [hfun, integral_const_mul, hmean n i, mul_zero] have hdep : ∀ n, depSum (Xs n) = fun ω => depSum (X n) ω / Real.sqrt (v n) := by intro n funext ω simp [depSum, hXs, Finset.sum_div] have hvar' : ∀ n, ∫ ω, (depSum (Xs n) ω) ^ 2 ∂(μ n) = 1 := by intro n have hvn_pos : 0 < v n := hv_pos n have hsv_ne : Real.sqrt (v n) ≠ 0 := (Real.sqrt_pos.mpr hvn_pos).ne' rw [hdep n] have hfun : (fun ω => (depSum (X n) ω / Real.sqrt (v n)) ^ 2) = fun ω => ((Real.sqrt (v n)) ^ 2)⁻¹ * (depSum (X n) ω) ^ 2 := by funext ω field_simp [hsv_ne] rw [hfun, integral_const_mul, hv n, Real.sq_sqrt hvn_pos.le] field_simp [hvn_pos.ne'] have hcardR_tendsto : Tendsto cardR atTop atTop := by exact tendsto_natCast_atTop_atTop.comp hcard have hsqrtcard : Tendsto (fun n => Real.sqrt (cardR n)) atTop atTop := Real.tendsto_sqrt_atTop.comp hcardR_tendsto have hB0 : Tendsto B atTop (𝓝 0) := by have hlim : Tendsto (fun n => K / Real.sqrt (cardR n)) atTop (𝓝 0) := hsqrtcard.const_div_atTop K simpa [B] using hlim have hNB3eq : (fun n => cardR n * (B n) ^ 3) = fun n => K ^ 3 / Real.sqrt (cardR n) := by funext n have hcpos : 0 < cardR n := hcardR_pos n have hs_ne : Real.sqrt (cardR n) ≠ 0 := (Real.sqrt_pos.mpr hcpos).ne' rw [hBdef] calc cardR n * (K / Real.sqrt (cardR n)) ^ 3 = K ^ 3 * (cardR n / (Real.sqrt (cardR n)) ^ 3) := by ring _ = K ^ 3 / Real.sqrt (cardR n) := by rw [show (Real.sqrt (cardR n)) ^ 3 = Real.sqrt (cardR n) * (Real.sqrt (cardR n)) ^ 2 by ring, Real.sq_sqrt hcpos.le] field_simp [hs_ne] have hNB3 : Tendsto (fun n => (card (ι n) : ℝ) * (B n) ^ 3) atTop (𝓝 0) := by have hlim : Tendsto (fun n => K ^ 3 / Real.sqrt (cardR n)) atTop (𝓝 0) := hsqrtcard.const_div_atTop (K ^ 3) simpa [cardR, hNB3eq] using hlim have hclt := stein_cdf_clt_of_depGraph μ Xs Ds Dmax hdeg' B hB_nonneg hbound' hB0 hNB3 hmean' hvar' s exact hclt.congr (fun n => by rw [hdep n])
    Causalean.SteinMethod.bounded_degree_dependency_clt_of_variance_floor_all · Causalean/Mathlib/Probability/SteinMethod/StandardizedDepGraphCLT.lean:57
  • bounded_degree_dependency_clt_eventually_bounded theorem — Eventual-bound variant of bounded_degree_dependency_clt: only the tail of a triangular array affects the limiting CDF, so the uniform summand bound need only hold after a finite prefix.
    Ω :
    ℕ → Type*
    ∀ n, MeasurableSpace (Ω n)
    μ :
    ∀ n, Measure (Ω n)
    ∀ n, IsProbabilityMeasure (μ n)
    ι :
    ℕ → Type*
    ∀ n, Fintype (ι n)
    X :
    ∀ n
    if
    ι n
    and
    Ω n
    then
    Dep :
    ∀ n, DepGraph (X n) (μ n)
    Dmax :
    hdeg :
    ∀ n i, ((Dep n).nbhd i).card ≤ Dmax
    M :
    hM :
    0 ≤ M
    hbound :
    ∀ᶠ n in atTop, ∀ i ω, |X n i ω| ≤ M
    hmean :
    ∀ n i, ∫ ω, X n i ω ∂(μ n) = 0
    v :
    ℕ → ℝ
    hv :
    ∀ n, ∫ ω, (depSum (X n) ω) ^ 2 ∂(μ n) = v n
    c :
    hc :
    0 < c
    hvc :
    ∀ᶠ n in atTop, c * (card (ι n) : ℝ) ≤ v n
    hcard :
    Tendsto (fun n => card (ι n)) atTop atTop
    s :
    Tendsto (fun n => ((μ n).map (fun ω => depSum (X n) ω / sqrt (v n))).real (Iic s)) atTop (𝓝 ((gaussianReal 0 1).real (Iic s)))
    Proof (Lean source)
    theorem bounded_degree_dependency_clt_eventually_bounded {Ω : ℕ → Type*} [∀ n, MeasurableSpace (Ω n)] (μ : ∀ n, Measure (Ω n)) [∀ n, IsProbabilityMeasure (μ n)] {ι : ℕ → Type*} [∀ n, Fintype (ι n)] (X : ∀ n, ι n → Ω n → ℝ) (Dep : ∀ n, DepGraph (X n) (μ n)) (Dmax : ℕ) (hdeg : ∀ n i, ((Dep n).nbhd i).card ≤ Dmax) (M : ℝ) (hM : 0 ≤ M) (hbound : ∀ᶠ n in atTop, ∀ i ω, |X n i ω| ≤ M) (hmean : ∀ n i, ∫ ω, X n i ω ∂(μ n) = 0) (v : ℕ → ℝ) (hv : ∀ n, ∫ ω, (depSum (X n) ω) ^ 2 ∂(μ n) = v n) (c : ℝ) (hc : 0 < c) (hvc : ∀ᶠ n in atTop, c * (card (ι n) : ℝ) ≤ v n) (hcard : Tendsto (fun n => card (ι n)) atTop atTop) (s : ℝ) : Tendsto (fun n => ((μ n).map (fun ω => depSum (X n) ω / sqrt (v n))).real (Iic s)) atTop (𝓝 ((gaussianReal 0 1).real (Iic s))) := by classical rcases eventually_atTop.1 hbound with ⟨Nb, hNb⟩ have hbound_tail : ∀ n i ω, |X (n + Nb) i ω| ≤ M := by intro n i ω exact hNb (n + Nb) (by omega) i ω have hvc_tail : ∀ᶠ n in atTop, c * (card (ι (n + Nb)) : ℝ) ≤ v (n + Nb) := by rcases eventually_atTop.1 hvc with ⟨Nv, hNv⟩ exact eventually_atTop.2 ⟨Nv, fun n hn => hNv (n + Nb) (by omega)⟩ have hcard_tail : Tendsto (fun n => card (ι (n + Nb))) atTop atTop := hcard.comp (tendsto_add_atTop_nat Nb) have htail := bounded_degree_dependency_clt (μ := fun n => μ (n + Nb)) (X := fun n => X (n + Nb)) (Dep := fun n => Dep (n + Nb)) Dmax (fun n i => hdeg (n + Nb) i) M hM hbound_tail (fun n i => hmean (n + Nb) i) (fun n => v (n + Nb)) (fun n => hv (n + Nb)) c hc hvc_tail hcard_tail s exact (tendsto_add_atTop_iff_nat Nb).1 htail
    Causalean.SteinMethod.bounded_degree_dependency_clt_eventually_bounded · Causalean/Mathlib/Probability/SteinMethod/StandardizedDepGraphCLT.lean:228