Exact Lean source
YoungGeneralSharpConcentration
formalization/Cloning/YoungGeneralSharpConcentration.lean
Source hash: 0a93dbb178c5ff3888ceb754322c9e07264d20cdcbf40b0fd25b54c8fbb94c76
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
theorem
Cloning.YoungGeneral.finite_mgf_half_letheorem Cloning.YoungGeneral.word_mgf_half_letheorem Cloning.YoungGeneral.word_tail_half_letheorem Cloning.YoungGeneral.centeredIndicator_secondMomenttheorem Cloning.YoungGeneral.centeredIndicator_secondMoment_le_halftheorem Cloning.YoungGeneral.rowCount_tail_half_letheorem Cloning.YoungGeneral.max_rowCount_tail_half_le1import Cloning.YoungGeneralConcentration
2
3/-! A stronger elementary Chernoff estimate retaining the variance of the
4centered letter indicator. The spare factor in the exponential is needed to
5absorb the physical Young law's polynomial dimension prefactor. -/
6noncomputable section
7open scoped BigOperators Topology
8open Filter
9namespace Cloning.YoungGeneral
10set_option maxHeartbeats 600000
11
12/-- Retaining the second moment improves the earlier coarse MGF constant. -/
13theorem finite_mgf_half_le {d : ℕ} (p x : Fin d→ℝ)
14 (hp : ∀i,0≤p i) (hs : ∑i,p i=1)
15 (hx : ∀i,|x i|≤1) (hm : ∑i,p i*x i=0)
16 (hv : ∑i,p i*(x i)^2≤1/2)
17 (t : ℝ) (ht : |t|≤1) :
18 (∑i,p i*Real.exp (t*x i))≤Real.exp (t^2/2) := by
19 have hb (i : Fin d) : Real.exp (t*x i)≤1+t*x i+t^2*(x i)^2 := by
20 have htx : |t*x i|≤1 := by
21 rw [abs_mul]
22 exact (mul_le_mul ht (hx i) (abs_nonneg _) (by norm_num)).trans_eq (by norm_num)
23 have h := Real.norm_exp_sub_one_sub_id_le (show ‖t*x i‖≤1 by simpa using htx)
24 rw [Real.norm_eq_abs,Real.norm_eq_abs,sq_abs] at h
25 have := (abs_le.mp h).2
26 nlinarith
27 calc
28 _≤∑i,p i*(1+t*x i+t^2*(x i)^2) :=
29 Finset.sum_le_sum (fun i _=>mul_le_mul_of_nonneg_left (hb i) (hp i))
30 _=1+t^2*∑i,p i*(x i)^2 := by
31 simp_rw [mul_add,mul_one,
32 show ∀i,p i*(t*x i)=t*(p i*x i) by intro i; ring,
33 show ∀i,p i*(t^2*(x i)^2)=t^2*(p i*(x i)^2) by intro i; ring]
34 rw [Finset.sum_add_distrib,Finset.sum_add_distrib,← Finset.mul_sum,
35 ← Finset.mul_sum,hs,hm]
36 ring
37 _≤1+t^2/2 := by nlinarith [mul_le_mul_of_nonneg_left hv (sq_nonneg t)]
38 _≤_ := by simpa [add_comm] using Real.add_one_le_exp (t^2/2)
39
40theorem word_mgf_half_le {d N : ℕ} (p x : Fin d→ℝ)
41 (hp : ∀i,0≤p i) (hs : ∑i,p i=1)
42 (hx : ∀i,|x i|≤1) (hm : ∑i,p i*x i=0)
43 (hv : ∑i,p i*(x i)^2≤1/2)
44 (t : ℝ) (ht : |t|≤1) :
45 (∑w : Fin N→Fin d,wordWeight p w*Real.exp (t*∑k,x (w k)))≤
46 Real.exp ((N:ℝ)*t^2/2) := by
47 rw [word_mgf_eq]
48 calc
49 _≤Real.exp (t^2/2)^N := pow_le_pow_left₀
50 (Finset.sum_nonneg (fun i _=>mul_nonneg (hp i) (Real.exp_pos _).le))
51 (finite_mgf_half_le p x hp hs hx hm hv t ht) N
52 _=_ := by rw [← Real.exp_nat_mul]; congr 1; ring
53
54theorem word_tail_half_le {d N : ℕ} (p x : Fin d→ℝ)
55 (hp : ∀i,0≤p i) (hs : ∑i,p i=1)
56 (hx : ∀i,|x i|≤1) (hm : ∑i,p i*x i=0)
57 (hv : ∑i,p i*(x i)^2≤1/2)
58 (ε : ℝ) (hε : 0≤ε) (hε1 : ε≤1) :
59 (∑w : Fin N→Fin d,
60 if (N:ℝ)*ε≤∑k,x (w k) then wordWeight p w else 0)≤
61 Real.exp (-(N:ℝ)*ε^2/2) := by
62 classical
63 have ht : |ε|≤1 := by simpa only [abs_of_nonneg hε] using hε1
64 have hpoint (w : Fin N→Fin d) :
65 (if (N:ℝ)*ε≤∑k,x (w k) then wordWeight p w else 0)≤
66 Real.exp (-ε*(N:ℝ)*ε)*(wordWeight p w*Real.exp (ε*∑k,x (w k))) := by
67 split_ifs with h
68 · have hexp : (1:ℝ)≤Real.exp (-ε*(N:ℝ)*ε+ε*∑k,x (w k)) := by
69 apply Real.one_le_exp_iff.mpr
70 have := mul_le_mul_of_nonneg_left h hε
71 linarith
72 have hb := mul_le_mul_of_nonneg_left hexp (wordWeight_nonneg p hp w)
73 rw [Real.exp_add] at hb
74 nlinarith
75 · exact mul_nonneg (Real.exp_pos _).le
76 (mul_nonneg (wordWeight_nonneg p hp w) (Real.exp_pos _).le)
77 calc
78 _≤∑w : Fin N→Fin d,Real.exp (-ε*(N:ℝ)*ε)*
79 (wordWeight p w*Real.exp (ε*∑k,x (w k))) :=
80 Finset.sum_le_sum (fun w _=>hpoint w)
81 _=Real.exp (-ε*(N:ℝ)*ε)*
82 (∑w : Fin N→Fin d,wordWeight p w*Real.exp (ε*∑k,x (w k))) :=
83 (Finset.mul_sum ..).symm
84 _≤Real.exp (-ε*(N:ℝ)*ε)*Real.exp ((N:ℝ)*ε^2/2) :=
85 mul_le_mul_of_nonneg_left (word_mgf_half_le p x hp hs hx hm hv ε ht) (Real.exp_pos _).le
86 _=_ := by rw [← Real.exp_add]; congr 1; ring
87
88theorem centeredIndicator_secondMoment {d : ℕ} (p : Fin d→ℝ)
89 (hs : ∑i,p i=1) (i : Fin d) :
90 ∑j,p j*(centeredIndicator p i j)^2=p i*(1-p i) := by
91 classical
92 have he (j : Fin d) : p j*(centeredIndicator p i j)^2=
93 (if j=i then p j else 0)-2*p i*(if j=i then p j else 0)+p j*(p i)^2 := by
94 unfold centeredIndicator
95 split_ifs <;> ring
96 simp_rw [he]
97 rw [Finset.sum_add_distrib,Finset.sum_sub_distrib,← Finset.mul_sum,← Finset.sum_mul,hs]
98 simp
99 ring
100
101/-- A centered Bernoulli indicator has variance at most 1/4, hence at most
102the 1/2 required for the stronger exponential estimate. -/
103theorem centeredIndicator_secondMoment_le_half {d : ℕ} (p : Fin d→ℝ)
104 (hs : ∑i,p i=1) (i : Fin d) :
105 ∑j,p j*(centeredIndicator p i j)^2≤1/2 := by
106 rw [centeredIndicator_secondMoment p hs i]
107 nlinarith [sq_nonneg (p i-1/2)]
108
109theorem rowCount_tail_half_le {d N : ℕ} (p : Fin d→ℝ)
110 (hp : ∀i,0≤p i) (hs : ∑i,p i=1)
111 (ε : ℝ) (hε : 0≤ε) (hε1 : ε≤1) (i : Fin d) :
112 (∑w : Fin N→Fin d,
113 if (N:ℝ)*ε≤|(rowCount w i:ℝ)-N*p i| then wordWeight p w else 0)≤
114 2*Real.exp (-(N:ℝ)*ε^2/2) := by
115 classical
116 let x := centeredIndicator p i
117 have hp1 := word_tail_half_le (N:=N) p x hp hs
118 (centeredIndicator_abs_le p hp hs i) (centeredIndicator_mean p hs i)
119 (centeredIndicator_secondMoment_le_half p hs i) ε hε hε1
120 have hn1 := word_tail_half_le (N:=N) p (fun j=>-x j) hp hs
121 (fun j=>by simpa using centeredIndicator_abs_le p hp hs i j)
122 (by simp only [mul_neg,Finset.sum_neg_distrib,centeredIndicator_mean p hs i,neg_zero,x])
123 (by simpa only [neg_sq,x] using centeredIndicator_secondMoment_le_half p hs i)
124 ε hε hε1
125 have hpoint (w : Fin N→Fin d) :
126 (if (N:ℝ)*ε≤|(rowCount w i:ℝ)-N*p i| then wordWeight p w else 0)≤
127 (if (N:ℝ)*ε≤∑k,x (w k) then wordWeight p w else 0)+
128 (if (N:ℝ)*ε≤∑k,-x (w k) then wordWeight p w else 0) := by
129 simp only [x,centeredIndicator_sum,Finset.sum_neg_distrib]
130 have hw := wordWeight_nonneg p hp w
131 split_ifs <;> simp_all only [not_le,le_abs,neg_sub,false_or] <;> first | contradiction | linarith
132 have hsum := Finset.sum_le_sum
133 (fun w (_ : w∈(Finset.univ : Finset (Fin N→Fin d)))=>hpoint w)
134 rw [Finset.sum_add_distrib] at hsum
135 linarith
136
137theorem max_rowCount_tail_half_le {d N : ℕ} (p : Fin d→ℝ)
138 (hp : ∀i,0≤p i) (hs : ∑i,p i=1)
139 (ε : ℝ) (hε : 0≤ε) (hε1 : ε≤1) :
140 (∑w : Fin N→Fin d,
141 if ∃i,(N:ℝ)*ε≤|(rowCount w i:ℝ)-N*p i| then wordWeight p w else 0)≤
142 2*d*Real.exp (-(N:ℝ)*ε^2/2) := by
143 classical
144 have hpoint (w : Fin N→Fin d) :
145 (if ∃i,(N:ℝ)*ε≤|(rowCount w i:ℝ)-N*p i| then wordWeight p w else 0)≤
146 ∑i,if (N:ℝ)*ε≤|(rowCount w i:ℝ)-N*p i| then wordWeight p w else 0 := by
147 split_ifs with h
148 · obtain ⟨i,hi⟩ := h
149 have hh := Finset.single_le_sum (s:=(Finset.univ : Finset (Fin d)))
150 (f:=fun j=>if (N:ℝ)*ε≤|(rowCount w j:ℝ)-N*p j| then wordWeight p w else 0)
151 (fun j _=>by have := wordWeight_nonneg p hp w; positivity) (Finset.mem_univ i)
152 simpa only [if_pos hi] using hh
153 · exact Finset.sum_nonneg (fun i _=>by have := wordWeight_nonneg p hp w; positivity)
154 calc
155 _≤∑w : Fin N→Fin d,∑i,
156 if (N:ℝ)*ε≤|(rowCount w i:ℝ)-N*p i| then wordWeight p w else 0 :=
157 Finset.sum_le_sum (fun w _=>hpoint w)
158 _=∑i,∑w : Fin N→Fin d,
159 if (N:ℝ)*ε≤|(rowCount w i:ℝ)-N*p i| then wordWeight p w else 0 := Finset.sum_comm
160 _≤∑_i : Fin d,2*Real.exp (-(N:ℝ)*ε^2/2) :=
161 Finset.sum_le_sum (fun i _=>rowCount_tail_half_le p hp hs ε hε hε1 i)
162 _=_ := by simp; ring
163
164end Cloning.YoungGeneral