Skip to content

Commit 277f450

Browse files
committed
Prove hR_vanish and assembly steps in CLT proof (2 sorrys remain)
Completed the convergence proof n*g(n) → -t²/2 in the CLT: - hR_vanish t≠0 case: n*R(s_n) → 0 via o(s²) bound and n*s_n²=t²/σ² - Assembly: n*g(n) = -t²/2 + n*R(s_n) → -t²/2 via Metric.tendsto_atTop Remaining sorrys: charFunRV_taylor_remainder (o(s²) bound) and multivariate_clt. https://claude.ai/code/session_014QBfnNXC35ou7oYV4ZhToi
1 parent 56f4a2f commit 277f450

2 files changed

Lines changed: 214 additions & 12 deletions

File tree

CentralLimitTheorem.lean

Lines changed: 107 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -490,14 +490,115 @@ theorem central_limit_theorem
490490

491491
-- n * R(s_n) → 0: from R = o(s²) and n·s_n² = t²/σ² (bounded)
492492
have hR_vanish : Filter.Tendsto (fun n : ℕ => ↑n * R (s_n n)) atTop (nhds 0) := by
493-
-- R(s) = o(s²): for any ε > 0, ‖R(s)‖ ≤ ε * s² for |s| < δ
494-
-- s_n → 0, so eventually |s_n| < δ
495-
-- Then ‖n * R(s_n)‖ ≤ n * ε * s_n² = ε * t²/σ²
496-
-- Since ε is arbitrary, n * R(s_n) → 0
497-
sorry
493+
rw [Metric.tendsto_atTop]
494+
intro ε' hε'
495+
-- Use hR_small with ε = ε' * σ² / (t² + 1) (or any small enough ε)
496+
-- For the case t = 0: s_n = 0, R(0) = 0, n*R(0) = 0 < ε'
497+
by_cases ht : t = 0
498+
· -- If t = 0, s_n = 0 for all n, R(0) = 0
499+
have hR0 : R 0 = 0 := by
500+
have h1 := hchar_taylor 0; simp at h1
501+
have h2 := CLTLemmas.charFunRV_zero μ (Y 0)
502+
rw [h2] at h1
503+
-- h1 : (1 : ℂ) = 1 + R 0, so R 0 = 0
504+
have h3 : (1 : ℂ) + R 0 = 1 + 0 := by rw [add_zero]; exact h1.symm
505+
exact add_left_cancel h3
506+
refine ⟨0, fun n _ => ?_⟩
507+
simp [hs_n_def, ht, hR0, dist_self]
508+
exact hε'
509+
· -- If t ≠ 0: use hR_small with small ε
510+
-- ‖n * R(s_n)‖ ≤ n * ε * s_n² = ε * t²/σ²
511+
have ht_sq_pos : (0 : ℝ) < t ^ 2 := by positivity
512+
have hσ_sq_pos : (0 : ℝ) < σ ^ 2 := by positivity
513+
-- Key: n * s_n² * σ² = t² for n ≥ 1
514+
have hns_sq : ∀ n : ℕ, n ≥ 1 → (↑n : ℝ) * s_n n ^ 2 * σ ^ 2 = t ^ 2 := by
515+
intro n hn
516+
simp only [hs_n_def, div_pow, mul_pow, Real.sq_sqrt (Nat.cast_nonneg n)]
517+
have : (↑n : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (by omega)
518+
have : σ ≠ 0 := ne_of_gt hσ_pos
519+
field_simp
520+
-- Choose ε_R = ε'σ²/(2t²) so ε_R * t²/σ² = ε'/2
521+
obtain ⟨δ, hδ_pos, hR_bound⟩ := hR_small (ε' * σ ^ 2 / (2 * t ^ 2)) (by positivity)
522+
-- Eventually |s_n n| < δ
523+
have hsn_bound : ∀ n : ℕ, n ≥ 1 → |s_n n| = |t| / (σ * Real.sqrt ↑n) := by
524+
intro n hn
525+
simp only [hs_n_def, abs_div, abs_mul, abs_of_pos hσ_pos,
526+
abs_of_nonneg (Real.sqrt_nonneg _)]
527+
refine ⟨max 1 (⌈t ^ 2 / (σ ^ 2 * δ ^ 2)⌉₊ + 1), fun n hn => ?_⟩
528+
have hn1 : n ≥ 1 := le_of_max_le_left hn
529+
have hn_large : n ≥ ⌈t ^ 2 / (σ ^ 2 * δ ^ 2)⌉₊ + 1 := le_of_max_le_right hn
530+
have hn_pos : (0 : ℝ) < ↑n := Nat.cast_pos.mpr (by omega)
531+
-- Show |s_n n| < δ
532+
have hs_small : |s_n n| < δ := by
533+
rw [hsn_bound n hn1]
534+
have h_denom_pos : 0 < σ * Real.sqrt ↑n :=
535+
mul_pos hσ_pos (Real.sqrt_pos.mpr hn_pos)
536+
rw [div_lt_iff₀ h_denom_pos]
537+
-- Need: |t| < δ * (σ * √n)
538+
-- Suffices: t² < δ²σ²n (squaring, both sides positive)
539+
have hn_bound : t ^ 2 / (σ ^ 2 * δ ^ 2) < ↑n := by
540+
calc t ^ 2 / (σ ^ 2 * δ ^ 2)
541+
≤ ↑⌈t ^ 2 / (σ ^ 2 * δ ^ 2)⌉₊ := Nat.le_ceil _
542+
_ < ↑(⌈t ^ 2 / (σ ^ 2 * δ ^ 2)⌉₊ + 1) := by exact_mod_cast Nat.lt_succ_of_le le_rfl
543+
_ ≤ ↑n := by exact_mod_cast hn_large
544+
-- t² < δ²σ²n
545+
have h_sq : t ^ 2 < (δ * (σ * Real.sqrt ↑n)) ^ 2 := by
546+
rw [mul_pow, mul_pow, Real.sq_sqrt (Nat.cast_nonneg n)]
547+
have hsd_pos : 0 < σ ^ 2 * δ ^ 2 := by positivity
548+
calc t ^ 2 = t ^ 2 / (σ ^ 2 * δ ^ 2) * (σ ^ 2 * δ ^ 2) := by field_simp
549+
_ < ↑n * (σ ^ 2 * δ ^ 2) := mul_lt_mul_of_pos_right hn_bound hsd_pos
550+
_ = δ ^ 2 * (σ ^ 2 * ↑n) := by ring
551+
calc |t| = Real.sqrt (t ^ 2) := by rw [Real.sqrt_sq_eq_abs]
552+
_ < Real.sqrt ((δ * (σ * Real.sqrt ↑n)) ^ 2) := Real.sqrt_lt_sqrt (sq_nonneg _) h_sq
553+
_ = δ * (σ * Real.sqrt ↑n) := Real.sqrt_sq (le_of_lt (mul_pos hδ_pos h_denom_pos))
554+
-- Bound ‖↑n * R(s_n n)‖
555+
rw [dist_zero_right]
556+
calc ‖(↑↑n : ℂ) * R (s_n n)‖
557+
= ↑n * ‖R (s_n n)‖ := by
558+
rw [norm_mul, Complex.norm_natCast]
559+
_ ≤ ↑n * (ε' * σ ^ 2 / (2 * t ^ 2) * s_n n ^ 2) := by
560+
gcongr; exact hR_bound (s_n n) hs_small
561+
_ = ε' * σ ^ 2 / (2 * t ^ 2) * (↑n * s_n n ^ 2) := by ring
562+
_ = ε' / 2 := by
563+
have h := hns_sq n hn1
564+
have2 : σ ^ 20 := ne_of_gt hσ_sq_pos
565+
have ht2 : t ^ 20 := ne_of_gt ht_sq_pos
566+
have : ↑n * s_n n ^ 2 = t ^ 2 / σ ^ 2 := by
567+
rw [eq_div_iff hσ2]; exact h
568+
rw [this]; field_simp
569+
_ < ε' := by linarith
498570
-- Now assemble: n * g(n) = -(n·s_n²·σ²/2) + n·R(s_n)
499571
-- → -t²/2 + 0 = -t²/2
500-
sorry
572+
-- Key real identity: n * s_n² * σ² = t² for n ≥ 1
573+
have hns_sq2 : ∀ n : ℕ, n ≥ 1 → (↑n : ℝ) * s_n n ^ 2 * σ ^ 2 = t ^ 2 := by
574+
intro n hn
575+
simp only [hs_n_def, div_pow, mul_pow, Real.sq_sqrt (Nat.cast_nonneg n)]
576+
have : (↑n : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (by omega)
577+
have : σ ≠ 0 := ne_of_gt hσ_pos
578+
field_simp
579+
-- Assemble via ε-δ
580+
rw [Metric.tendsto_atTop]
581+
intro ε hε
582+
obtain ⟨N, hN⟩ := (Metric.tendsto_atTop.mp hR_vanish) ε hε
583+
refine ⟨max 1 N, fun n hn => ?_⟩
584+
have hn1 : 1 ≤ n := le_of_max_le_left hn
585+
have hnN : N ≤ n := le_of_max_le_right hn
586+
-- Key ℂ identity: ↑n * ↑(s_n²) * ↑(σ²) = ↑(t²)
587+
have hc : (↑↑n : ℂ) * ↑(s_n n ^ 2) * ↑(σ ^ 2) = ↑(t ^ 2) := by
588+
have h := hns_sq2 n hn1
589+
rw [show (↑↑n : ℂ) = (↑(↑n : ℝ) : ℂ) from rfl,
590+
← Complex.ofReal_mul, ← Complex.ofReal_mul]
591+
exact_mod_cast h
592+
-- n * g(n) = -t²/2 + n * R(s_n)
593+
have hng : (↑↑n : ℂ) * g n = -(↑(t ^ 2) / 2) + ↑↑n * R (s_n n) := by
594+
simp only [hg_eq]; linear_combination -hc / 2
595+
-- dist(n*g(n), -t²/2) = dist(n*R(s_n), 0) < ε
596+
calc dist ((↑↑n : ℂ) * g n) (-(↑(t ^ 2) / 2))
597+
= dist (-(↑(t ^ 2) / 2 : ℂ) + ↑↑n * R (s_n n)) (-(↑(t ^ 2) / 2)) := by
598+
rw [hng]
599+
_ = dist (↑↑n * R (s_n n)) 0 := by
600+
simp only [dist_eq_norm, sub_zero]; congr 1; ring
601+
_ < ε := hN n hnN
501602

502603
-- Apply tendsto_one_add_pow_exp_of_tendsto
503604
have h_pow := Complex.tendsto_one_add_pow_exp_of_tendsto hg_tendsto

Funwithlean/CentralLimitTheorem.lean

Lines changed: 107 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -490,14 +490,115 @@ theorem central_limit_theorem
490490

491491
-- n * R(s_n) → 0: from R = o(s²) and n·s_n² = t²/σ² (bounded)
492492
have hR_vanish : Filter.Tendsto (fun n : ℕ => ↑n * R (s_n n)) atTop (nhds 0) := by
493-
-- R(s) = o(s²): for any ε > 0, ‖R(s)‖ ≤ ε * s² for |s| < δ
494-
-- s_n → 0, so eventually |s_n| < δ
495-
-- Then ‖n * R(s_n)‖ ≤ n * ε * s_n² = ε * t²/σ²
496-
-- Since ε is arbitrary, n * R(s_n) → 0
497-
sorry
493+
rw [Metric.tendsto_atTop]
494+
intro ε' hε'
495+
-- Use hR_small with ε = ε' * σ² / (t² + 1) (or any small enough ε)
496+
-- For the case t = 0: s_n = 0, R(0) = 0, n*R(0) = 0 < ε'
497+
by_cases ht : t = 0
498+
· -- If t = 0, s_n = 0 for all n, R(0) = 0
499+
have hR0 : R 0 = 0 := by
500+
have h1 := hchar_taylor 0; simp at h1
501+
have h2 := CLTLemmas.charFunRV_zero μ (Y 0)
502+
rw [h2] at h1
503+
-- h1 : (1 : ℂ) = 1 + R 0, so R 0 = 0
504+
have h3 : (1 : ℂ) + R 0 = 1 + 0 := by rw [add_zero]; exact h1.symm
505+
exact add_left_cancel h3
506+
refine ⟨0, fun n _ => ?_⟩
507+
simp [hs_n_def, ht, hR0, dist_self]
508+
exact hε'
509+
· -- If t ≠ 0: use hR_small with small ε
510+
-- ‖n * R(s_n)‖ ≤ n * ε * s_n² = ε * t²/σ²
511+
have ht_sq_pos : (0 : ℝ) < t ^ 2 := by positivity
512+
have hσ_sq_pos : (0 : ℝ) < σ ^ 2 := by positivity
513+
-- Key: n * s_n² * σ² = t² for n ≥ 1
514+
have hns_sq : ∀ n : ℕ, n ≥ 1 → (↑n : ℝ) * s_n n ^ 2 * σ ^ 2 = t ^ 2 := by
515+
intro n hn
516+
simp only [hs_n_def, div_pow, mul_pow, Real.sq_sqrt (Nat.cast_nonneg n)]
517+
have : (↑n : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (by omega)
518+
have : σ ≠ 0 := ne_of_gt hσ_pos
519+
field_simp
520+
-- Choose ε_R = ε'σ²/(2t²) so ε_R * t²/σ² = ε'/2
521+
obtain ⟨δ, hδ_pos, hR_bound⟩ := hR_small (ε' * σ ^ 2 / (2 * t ^ 2)) (by positivity)
522+
-- Eventually |s_n n| < δ
523+
have hsn_bound : ∀ n : ℕ, n ≥ 1 → |s_n n| = |t| / (σ * Real.sqrt ↑n) := by
524+
intro n hn
525+
simp only [hs_n_def, abs_div, abs_mul, abs_of_pos hσ_pos,
526+
abs_of_nonneg (Real.sqrt_nonneg _)]
527+
refine ⟨max 1 (⌈t ^ 2 / (σ ^ 2 * δ ^ 2)⌉₊ + 1), fun n hn => ?_⟩
528+
have hn1 : n ≥ 1 := le_of_max_le_left hn
529+
have hn_large : n ≥ ⌈t ^ 2 / (σ ^ 2 * δ ^ 2)⌉₊ + 1 := le_of_max_le_right hn
530+
have hn_pos : (0 : ℝ) < ↑n := Nat.cast_pos.mpr (by omega)
531+
-- Show |s_n n| < δ
532+
have hs_small : |s_n n| < δ := by
533+
rw [hsn_bound n hn1]
534+
have h_denom_pos : 0 < σ * Real.sqrt ↑n :=
535+
mul_pos hσ_pos (Real.sqrt_pos.mpr hn_pos)
536+
rw [div_lt_iff₀ h_denom_pos]
537+
-- Need: |t| < δ * (σ * √n)
538+
-- Suffices: t² < δ²σ²n (squaring, both sides positive)
539+
have hn_bound : t ^ 2 / (σ ^ 2 * δ ^ 2) < ↑n := by
540+
calc t ^ 2 / (σ ^ 2 * δ ^ 2)
541+
≤ ↑⌈t ^ 2 / (σ ^ 2 * δ ^ 2)⌉₊ := Nat.le_ceil _
542+
_ < ↑(⌈t ^ 2 / (σ ^ 2 * δ ^ 2)⌉₊ + 1) := by exact_mod_cast Nat.lt_succ_of_le le_rfl
543+
_ ≤ ↑n := by exact_mod_cast hn_large
544+
-- t² < δ²σ²n
545+
have h_sq : t ^ 2 < (δ * (σ * Real.sqrt ↑n)) ^ 2 := by
546+
rw [mul_pow, mul_pow, Real.sq_sqrt (Nat.cast_nonneg n)]
547+
have hsd_pos : 0 < σ ^ 2 * δ ^ 2 := by positivity
548+
calc t ^ 2 = t ^ 2 / (σ ^ 2 * δ ^ 2) * (σ ^ 2 * δ ^ 2) := by field_simp
549+
_ < ↑n * (σ ^ 2 * δ ^ 2) := mul_lt_mul_of_pos_right hn_bound hsd_pos
550+
_ = δ ^ 2 * (σ ^ 2 * ↑n) := by ring
551+
calc |t| = Real.sqrt (t ^ 2) := by rw [Real.sqrt_sq_eq_abs]
552+
_ < Real.sqrt ((δ * (σ * Real.sqrt ↑n)) ^ 2) := Real.sqrt_lt_sqrt (sq_nonneg _) h_sq
553+
_ = δ * (σ * Real.sqrt ↑n) := Real.sqrt_sq (le_of_lt (mul_pos hδ_pos h_denom_pos))
554+
-- Bound ‖↑n * R(s_n n)‖
555+
rw [dist_zero_right]
556+
calc ‖(↑↑n : ℂ) * R (s_n n)‖
557+
= ↑n * ‖R (s_n n)‖ := by
558+
rw [norm_mul, Complex.norm_natCast]
559+
_ ≤ ↑n * (ε' * σ ^ 2 / (2 * t ^ 2) * s_n n ^ 2) := by
560+
gcongr; exact hR_bound (s_n n) hs_small
561+
_ = ε' * σ ^ 2 / (2 * t ^ 2) * (↑n * s_n n ^ 2) := by ring
562+
_ = ε' / 2 := by
563+
have h := hns_sq n hn1
564+
have2 : σ ^ 20 := ne_of_gt hσ_sq_pos
565+
have ht2 : t ^ 20 := ne_of_gt ht_sq_pos
566+
have : ↑n * s_n n ^ 2 = t ^ 2 / σ ^ 2 := by
567+
rw [eq_div_iff hσ2]; exact h
568+
rw [this]; field_simp
569+
_ < ε' := by linarith
498570
-- Now assemble: n * g(n) = -(n·s_n²·σ²/2) + n·R(s_n)
499571
-- → -t²/2 + 0 = -t²/2
500-
sorry
572+
-- Key real identity: n * s_n² * σ² = t² for n ≥ 1
573+
have hns_sq2 : ∀ n : ℕ, n ≥ 1 → (↑n : ℝ) * s_n n ^ 2 * σ ^ 2 = t ^ 2 := by
574+
intro n hn
575+
simp only [hs_n_def, div_pow, mul_pow, Real.sq_sqrt (Nat.cast_nonneg n)]
576+
have : (↑n : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (by omega)
577+
have : σ ≠ 0 := ne_of_gt hσ_pos
578+
field_simp
579+
-- Assemble via ε-δ
580+
rw [Metric.tendsto_atTop]
581+
intro ε hε
582+
obtain ⟨N, hN⟩ := (Metric.tendsto_atTop.mp hR_vanish) ε hε
583+
refine ⟨max 1 N, fun n hn => ?_⟩
584+
have hn1 : 1 ≤ n := le_of_max_le_left hn
585+
have hnN : N ≤ n := le_of_max_le_right hn
586+
-- Key ℂ identity: ↑n * ↑(s_n²) * ↑(σ²) = ↑(t²)
587+
have hc : (↑↑n : ℂ) * ↑(s_n n ^ 2) * ↑(σ ^ 2) = ↑(t ^ 2) := by
588+
have h := hns_sq2 n hn1
589+
rw [show (↑↑n : ℂ) = (↑(↑n : ℝ) : ℂ) from rfl,
590+
← Complex.ofReal_mul, ← Complex.ofReal_mul]
591+
exact_mod_cast h
592+
-- n * g(n) = -t²/2 + n * R(s_n)
593+
have hng : (↑↑n : ℂ) * g n = -(↑(t ^ 2) / 2) + ↑↑n * R (s_n n) := by
594+
simp only [hg_eq]; linear_combination -hc / 2
595+
-- dist(n*g(n), -t²/2) = dist(n*R(s_n), 0) < ε
596+
calc dist ((↑↑n : ℂ) * g n) (-(↑(t ^ 2) / 2))
597+
= dist (-(↑(t ^ 2) / 2 : ℂ) + ↑↑n * R (s_n n)) (-(↑(t ^ 2) / 2)) := by
598+
rw [hng]
599+
_ = dist (↑↑n * R (s_n n)) 0 := by
600+
simp only [dist_eq_norm, sub_zero]; congr 1; ring
601+
_ < ε := hN n hnN
501602

502603
-- Apply tendsto_one_add_pow_exp_of_tendsto
503604
have h_pow := Complex.tendsto_one_add_pow_exp_of_tendsto hg_tendsto

0 commit comments

Comments
 (0)