Exact Lean source
YoungMultinomialLocalLimit
formalization/Cloning/YoungMultinomialLocalLimit.lean
Source hash: d682047856c941457cb35eb2ce591b77d0ca738fd7dc60a0ee1383331e44765e
Full source copied without mathematical changes from the snapshot whose input hash matches the passing audit. Select a line number for a stable source pointer.
The declarations belong to the compiled inventory covered by the project’s shared axiom audit. That audit records an aggregate union, without attributing axioms to individual declarations.
Declarations in this module
1import Cloning.YoungMultinomialLocal
2
3/-!
4# Uniform moving-window multinomial local limit
5
6The spectrum may change arbitrarily with sample size. A uniform positive lower
7bound and a fixed central-window radius suffice; no convergence of spectra or
8lattice centers is assumed.
9-/
10
11noncomputable section
12open scoped BigOperators Topology
13open Filter
14namespace Cloning.YoungMultinomial
15
16theorem inv_sqrt_nat_tendsto_zero :
17 Tendsto (fun N : ℕ ↦ (Real.sqrt (N : ℝ))⁻¹) atTop (𝓝 0) :=
18 tendsto_inv_atTop_zero.comp (Real.tendsto_sqrt_atTop.comp tendsto_natCast_atTop_atTop)
19
20/-- Uniform local Gaussian approximation along arbitrary moving spectra and
21central lattice points. The Gaussian denominator is explicit, and both its
22entropy and factorial errors are proved above. -/
23theorem multinomialMass_div_gaussianMass_tendsto_one_subsequence {ι : Type*} [Fintype ι]
24 (n : ℕ → ℕ) (hn : Tendsto n atTop atTop)
25 (p x : ℕ → ι → ℝ) (μ : ℕ → ι → ℕ) (a R : ℝ) (ha : 0 < a) (hR : 0 ≤ R)
26 (hp : ∀ᶠ N in atTop, ∀ i, a ≤ p N i)
27 (hx : ∀ᶠ N in atTop, ∀ i, |x N i| ≤ R)
28 (hsum : ∀ N, ∑ i, p N i = 1) (hzero : ∀ N, ∑ i, x N i = 0)
29 (hcount : ∀ N i, (μ N i : ℝ) = (n N : ℝ) * (p N i + x N i / Real.sqrt (n N))) :
30 Tendsto (fun N ↦ multinomialMass (n N) (p N) (μ N) / gaussianMass (n N) (p N) (x N))
31 atTop (𝓝 1) := by
32 have hsmall : ∀ᶠ N : ℕ in atTop, R / Real.sqrt (n N : ℝ) ≤ a / 2 := by
33 have hh : Tendsto (fun N : ℕ ↦ R / Real.sqrt (n N : ℝ)) atTop (𝓝 0) := by
34 simpa only [div_eq_mul_inv, mul_zero] using (inv_sqrt_nat_tendsto_zero.comp hn).const_mul R
35 exact (hh.eventually (eventually_lt_nhds (show (0 : ℝ) < a / 2 by positivity))).mono
36 (fun _ h ↦ h.le)
37 have hq : ∀ᶠ N : ℕ in atTop, ∀ i, a / 2 ≤ p N i + x N i / Real.sqrt (n N) := by
38 filter_upwards [hp, hx, hsmall, hn.eventually (eventually_ge_atTop 1)] with N hpN hxN hsmallN hN i
39 have hnN : (0 : ℝ) < n N := by exact_mod_cast (show 0 < n N by omega)
40 have hs : 0 < Real.sqrt (n N : ℝ) := Real.sqrt_pos.mpr hnN
41 have hδ : |x N i / Real.sqrt (n N)| ≤ a / 2 := by
42 rw [abs_div, abs_of_pos hs]
43 exact (div_le_div_of_nonneg_right (hxN i) hs.le).trans hsmallN
44 linarith [hpN i, neg_abs_le (x N i / Real.sqrt (n N))]
45 have hst i : Tendsto (fun N ↦ stirlingResidual (μ N i)) atTop (𝓝 0) := by
46 have hb : ∀ᶠ N : ℕ in atTop, a / 2 * (n N : ℝ) ≤ (μ N i : ℝ) := by
47 filter_upwards [hq] with N hqN
48 rw [hcount]
49 nlinarith [mul_le_mul_of_nonneg_left (hqN i) (Nat.cast_nonneg (n N))]
50 have ht : Tendsto (fun N ↦ (μ N i : ℝ)) atTop atTop :=
51 tendsto_atTop_mono' atTop hb
52 ((tendsto_natCast_atTop_atTop.comp hn).const_mul_atTop (by positivity : (0 : ℝ) < a / 2))
53 exact stirlingResidual_tendsto_zero.comp (tendsto_natCast_atTop_iff.mp ht)
54 have hstsum : Tendsto (fun N ↦ ∑ i, stirlingResidual (μ N i)) atTop (𝓝 0) := by
55 simpa using tendsto_finset_sum Finset.univ (fun i _ ↦ hst i)
56 have hu i : Tendsto (fun N ↦ x N i / Real.sqrt (n N) / p N i) atTop (𝓝 0) := by
57 apply tendsto_zero_iff_norm_tendsto_zero.mpr
58 apply squeeze_zero' (Eventually.of_forall fun _ ↦ norm_nonneg _) ?_
59 (show Tendsto (fun N : ℕ ↦ R / a * (Real.sqrt (n N : ℝ))⁻¹) atTop (𝓝 0) by
60 simpa using (inv_sqrt_nat_tendsto_zero.comp hn).const_mul (R / a))
61 filter_upwards [hp, hx, hn.eventually (eventually_ge_atTop 1)] with N hpN hxN hN
62 have hnN : (0 : ℝ) < n N := by exact_mod_cast (show 0 < n N by omega)
63 have hs : 0 < Real.sqrt (n N : ℝ) := Real.sqrt_pos.mpr hnN
64 have hpN0 : 0 < p N i := ha.trans_le (hpN i)
65 rw [Real.norm_eq_abs, abs_div, abs_div, abs_of_pos hs, abs_of_pos hpN0]
66 calc
67 _ ≤ R / Real.sqrt (n N) / a := by gcongr; exact hxN i; exact hpN i
68 _ = _ := by ring
69 have hlog i : Tendsto (fun N ↦ Real.log ((p N i + x N i / Real.sqrt (n N)) / p N i))
70 atTop (𝓝 0) := by
71 have h1 : Tendsto (fun N ↦ 1 + x N i / Real.sqrt (n N) / p N i) atTop (𝓝 1) := by
72 simpa using (hu i).const_add 1
73 have hh := (Real.continuousAt_log (by norm_num : (1 : ℝ) ≠ 0)).tendsto.comp h1
74 simp only [Real.log_one] at hh
75 apply hh.congr'
76 filter_upwards [hp] with N hpN
77 have hpN0 : p N i ≠ 0 := (ha.trans_le (hpN i)).ne'
78 dsimp only [Function.comp_apply]
79 congr 1
80 field_simp
81 let entropyError := fun N : ℕ ↦ (n N : ℝ) *
82 (∑ i, (p N i + x N i / Real.sqrt (n N)) *
83 Real.log ((p N i + x N i / Real.sqrt (n N)) / p N i)) -
84 ∑ i, (x N i) ^ 2 / (2 * p N i)
85 have he : Tendsto entropyError atTop (𝓝 0) := by
86 apply tendsto_zero_iff_norm_tendsto_zero.mpr
87 apply squeeze_zero' (Eventually.of_forall fun _ ↦ norm_nonneg _) ?_
88 (show Tendsto (fun N : ℕ ↦ 4 * Fintype.card ι * R ^ 3 / a ^ 2 *
89 (Real.sqrt (n N : ℝ))⁻¹) atTop (𝓝 0) by
90 simpa using (inv_sqrt_nat_tendsto_zero.comp hn).const_mul (4 * Fintype.card ι * R ^ 3 / a ^ 2))
91 filter_upwards [hp, hx, hsmall, hn.eventually (eventually_ge_atTop 1)] with N hpN hxN hsN hN
92 simpa only [entropyError, Real.norm_eq_abs, div_mul_eq_div_mul_one_div, one_div] using
93 central_entropy_bound (p N) (x N) (n N) a R
94 (by exact_mod_cast (show 0 < n N by omega)) ha hR hpN hxN hsN (hzero N)
95 have hl : Tendsto (fun N ↦ Real.log (multinomialMass (n N) (p N) (μ N)) -
96 gaussianLogMass (n N) (p N) (x N)) atTop (𝓝 0) := by
97 have hlogsum : Tendsto (fun N ↦ ∑ i, Real.log ((p N i + x N i / Real.sqrt (n N)) / p N i))
98 atTop (𝓝 0) := by
99 simpa using tendsto_finset_sum Finset.univ (fun i _ ↦ hlog i)
100 have hh := ((he.neg.sub (hlogsum.const_mul (1 / 2))).add (stirlingResidual_tendsto_zero.comp hn)).sub hstsum
101 simp only [neg_zero, mul_zero, sub_zero, zero_add] at hh
102 apply hh.congr'
103 filter_upwards [hp, hq, hn.eventually (eventually_ge_atTop 1)] with N hpN hqN hN
104 exact (central_log_error_eq (n N) (p N) (x N) (μ N) (fun i ↦ ha.trans_le (hpN i))
105 (by omega) (hsum N) (hzero N) (fun i ↦ (by positivity : (0 : ℝ) < a / 2).trans_le (hqN i))
106 (hcount N)).symm
107 have hh := Real.continuous_exp.continuousAt.tendsto.comp hl
108 simp only [Real.exp_zero] at hh
109 apply hh.congr'
110 filter_upwards [hp] with N hpN
111 simp only [Function.comp_apply, Real.exp_sub, gaussianMass,
112 Real.exp_log (multinomialMass_pos (n N) (p N) (μ N) (fun i ↦ ha.trans_le (hpN i)))]
113
114/-- The usual sample-size version of the uniform moving-window limit. -/
115theorem multinomialMass_div_gaussianMass_tendsto_one {ι : Type*} [Fintype ι]
116 (p x : ℕ → ι → ℝ) (μ : ℕ → ι → ℕ) (a R : ℝ) (ha : 0 < a) (hR : 0 ≤ R)
117 (hp : ∀ᶠ N in atTop, ∀ i, a ≤ p N i)
118 (hx : ∀ᶠ N in atTop, ∀ i, |x N i| ≤ R)
119 (hsum : ∀ N, ∑ i, p N i = 1) (hzero : ∀ N, ∑ i, x N i = 0)
120 (hcount : ∀ N i, (μ N i : ℝ) = N * (p N i + x N i / Real.sqrt N)) :
121 Tendsto (fun N ↦ multinomialMass N (p N) (μ N) / gaussianMass N (p N) (x N))
122 atTop (𝓝 1) :=
123 multinomialMass_div_gaussianMass_tendsto_one_subsequence id tendsto_id p x μ a R ha hR
124 hp hx hsum hzero hcount
125
126end Cloning.YoungMultinomial