This journal is in preparation. Submissions are open as a pilot and the editorial board is being formed. Articles marked Demonstration show the format only.
Journal of Machine-Verified MathematicsPeer-reviewed mathematics with machine-checked proofs, for the age of AI

E424/HighBand/L30Aux.lean

All files · 560 lines · source at the verified commit

1module
2
3public import E424.DirichletError.L29AuxD
4public import E424.DivisorMoments.Moments
5public import E424.Tools.T4
6
7@[expose] public section
8
9/-!
10# Lemma 30 helpers (owner: h17)
11
12Cells `S2_v` of the block `S`, the Lipschitz replacement error `Cell`, and its Dirichlet expansion.
13Decomposition used by `L30`: `Fp N = m⁻¹ ∑_{v < M} Pv v · Fp (scaleV N v) + Cell + Err`.
14-/
15
16set_option linter.style.header false
17open Finset MeasureTheory
18
19namespace E424
20
21/-- Cell index of `s`: the `v` with `s ∈ S2_v` (the same index as `Pv`). -/
22noncomputable def cellOf (lo : ℝ) (s : ℕ) : ℕ := ⌊xi lo * Real.log s⌋₊
23
24/-- Scale of cell `v`: `N_v = N e^{-v/ξ}`. -/
25noncomputable def scaleV (lo N : ℝ) (v : ℕ) : ℝ := N * Real.exp (-(v : ℝ) / xi lo)
26
27/-- Number of cells: `cellOf lo s < cellCount lo` for every `s ≤ K2^200`. -/
28noncomputable def cellCount (lo : ℝ) : ℕ := ⌊xi lo * (200 * Real.log (K2 lo))⌋₊ + 1
29
30/-- The Lipschitz replacement error: `m_S⁻¹ ∑_{s ∈ S} s^{-1-it} (F_{N/s} - F_{N_{v(s)}})`. -/
31noncomputable def Cell (lo : ℝ) (S : Finset ℕ) (N t : ℝ) : ℂ :=
32 (((ms S)⁻¹ : ℝ) : ℂ) * ∑ s ∈ S, ((1 / s : ℝ) : ℂ) * nit s t *
33 (Fp (N / s) t - Fp (scaleV lo N (cellOf lo s)) t)
34
35/-- Real coefficient of `m^{-it}` in `Cell`: `m_S⁻¹ m⁻¹ ∑_{s ∈ S, s ∣ m} (g(m/N) - g(m/(s N_{v(s)}))) F(m/s)`. -/
36noncomputable def cellCoeff (lo : ℝ) (S : Finset ℕ) (N : ℝ) (m : ℕ) : ℝ :=
37 (ms S)⁻¹ * (1 / (m : ℝ)) * ∑ s ∈ S with s ∣ m,
38 (gw ((m : ℝ) / N) - gw ((m : ℝ) / (s * scaleV lo N (cellOf lo s)))) * F (m / s)
39
40/-- Cauchy-Schwarz over cells: with `|P_v| ≤ thr` for all `v`, the cell sum is controlled by its
41number of terms. -/
42theorem cell_cs (P a : ℕ → ℂ) (M : ℕ) (thr : ℝ) (hP : ∀ v, ‖P v‖ ≤ thr) :
43 ‖∑ v ∈ range M, P v * a v‖ ^ 2 ≤ M * thr ^ 2 * ∑ v ∈ range M, ‖a v‖ ^ 2 := by
44 have h1 : ‖∑ v ∈ range M, P v * a v‖ ≤ ∑ v ∈ range M, ‖P v‖ * ‖a v‖ :=
45 (norm_sum_le _ _).trans (le_of_eq (by simp))
46 have h2 : (∑ v ∈ range M, ‖P v‖ * ‖a v‖) ^ 2 ≤
47 (∑ v ∈ range M, ‖P v‖ ^ 2) * (∑ v ∈ range M, ‖a v‖ ^ 2) :=
48 Finset.sum_mul_sq_le_sq_mul_sq _ _ _
49 have h3 : ∑ v ∈ range M, ‖P v‖ ^ 2 ≤ M * thr ^ 2 := by
50 calc ∑ v ∈ range M, ‖P v‖ ^ 2 ≤ ∑ _v ∈ range M, thr ^ 2 :=
51 Finset.sum_le_sum fun v _ => pow_le_pow_left₀ (norm_nonneg _) (hP v) 2
52 _ = M * thr ^ 2 := by simp
53 have h4 : ‖∑ v ∈ range M, P v * a v‖ ^ 2 ≤ (∑ v ∈ range M, ‖P v‖ * ‖a v‖) ^ 2 :=
54 pow_le_pow_left₀ (norm_nonneg _) h1 2
55 have hS : 0 ≤ ∑ v ∈ range M, ‖a v‖ ^ 2 := Finset.sum_nonneg fun v _ => by positivity
56 calc _ ≤ _ := h4
57 _ ≤ _ := h2
58 _ ≤ (M * thr ^ 2) * ∑ v ∈ range M, ‖a v‖ ^ 2 := mul_le_mul_of_nonneg_right h3 hS
59
60/-- Continuity in `t` of the building blocks (finite sums of `nit` with constant coefficients). -/
61theorem nit_continuous (n : ℕ) : Continuous fun t : ℝ => nit n t := by
62 unfold nit; fun_prop
63
64theorem Fp_continuous (N : ℝ) : Continuous fun t : ℝ => Fp N t := by
65 unfold Fp
66 exact continuous_finsetSum _ fun n _ => continuous_const.mul (nit_continuous n)
67
68theorem Pv_continuous (lo : ℝ) (S : Finset ℕ) (v : ℕ) : Continuous fun t : ℝ => Pv lo S v t := by
69 unfold Pv
70 exact continuous_finsetSum _ fun s _ => continuous_const.mul (nit_continuous s)
71
72theorem Err_continuous (S : Finset ℕ) (N : ℝ) : Continuous fun t : ℝ => Err S N t := by
73 unfold Err
74 refine (Fp_continuous N).sub (continuous_const.mul (continuous_finsetSum _ fun s _ => ?_))
75 exact ((continuous_const.mul (nit_continuous s)).mul (Fp_continuous _))
76
77theorem Cell_continuous (lo : ℝ) (S : Finset ℕ) (N : ℝ) : Continuous fun t : ℝ => Cell lo S N t := by
78 unfold Cell
79 refine continuous_const.mul (continuous_finsetSum _ fun s _ => ?_)
80 exact (continuous_const.mul (nit_continuous s)).mul ((Fp_continuous _).sub (Fp_continuous _))
81
82/-- Exact decomposition of `Fp N` over the cells of `S` (`S ⊂ [1, K2^200]`). -/
83theorem Fp_decomp (lo N : ℝ) (S : Finset ℕ) (hS : ∀ s ∈ S, 0 < s)
84 (hSz : ∀ s ∈ S, (s : ℝ) ≤ K2 lo ^ 200) (t : ℝ) :
85 Fp N t = (((ms S)⁻¹ : ℝ) : ℂ) * ∑ v ∈ range (cellCount lo), Pv lo S v t * Fp (scaleV lo N v) t
86 + Cell lo S N t + Err S N t := by
87 have hmaps : ∀ s ∈ S, cellOf lo s ∈ range (cellCount lo) := fun s hs => by
88 rw [mem_range]
89 have h0 : (0 : ℝ) < s := by exact_mod_cast hS s hs
90 have hxi : 0 ≤ xi lo := Even.pow_nonneg (by decide) _
91 have hlog : Real.log s ≤ 200 * Real.log (K2 lo) := by
92 have := Real.log_le_log h0 (hSz s hs)
93 rwa [Real.log_pow] at this
94 unfold cellOf cellCount
95 exact Nat.lt_succ_of_le (Nat.floor_le_floor (mul_le_mul_of_nonneg_left hlog hxi))
96 have hfib : ∑ v ∈ range (cellCount lo), Pv lo S v t * Fp (scaleV lo N v) t =
97 ∑ s ∈ S, ((1 / s : ℝ) : ℂ) * nit s t * Fp (scaleV lo N (cellOf lo s)) t := by
98 rw [← Finset.sum_fiberwise_of_maps_to hmaps]
99 refine sum_congr rfl fun v _ => ?_
100 unfold Pv
101 rw [sum_mul]
102 refine sum_congr rfl fun s hs => ?_
103 have : cellOf lo s = v := (mem_filter.1 hs).2
104 rw [this]
105 unfold Cell Err
106 rw [hfib]
107 simp only [mul_sub, sum_sub_distrib, Finset.mul_sum]
108 ring
109
110/-- Sum over the multiples of `s` in `[1, M]`, reindexed by the quotient. -/
111theorem sum_dvd_Icc (s M : ℕ) (hs : 0 < s) (φ : ℕ → ℂ) :
112 ∑ m ∈ (Icc 1 M).filter (fun m => s ∣ m), φ m = ∑ n ∈ Icc 1 (M / s), φ (s * n) := by
113 have : (Icc 1 M).filter (fun m => s ∣ m) = (Icc 1 (M / s)).image (fun n => s * n) := by
114 ext m
115 simp only [mem_filter, mem_Icc, mem_image]
116 constructor
117 · rintro ⟨⟨h1, h2⟩, k, rfl⟩
118 refine ⟨k, ⟨?_, ?_⟩, rfl⟩
119 · rcases Nat.eq_zero_or_pos k with rfl | hk
120 · simp at h1
121 · exact hk
122 · exact (Nat.le_div_iff_mul_le hs).2 (by linarith)
123 · rintro ⟨k, ⟨h1, h2⟩, rfl⟩
124 refine ⟨⟨?_, ?_⟩, dvd_mul_right _ _⟩
125 · exact Nat.mul_pos hs h1
126 · exact (Nat.le_div_iff_mul_le hs).1 h2 |>.trans_eq' (mul_comm _ _) |> fun h => by linarith
127 rw [this, sum_image]
128 intro a _ b _ h
129 exact Nat.eq_of_mul_eq_mul_left hs h
130
131/-- `s⁻¹ s^{-it} F_X(t)` as a Dirichlet polynomial in the multiples of `s` up to `⌊R⌋`, if `4 s X ≤ R`. -/
132theorem shift_Fp (s : ℕ) (hs : 0 < s) (X R : ℝ) (hX : 0 < X) (hR : 4 * s * X ≤ R) (t : ℝ) :
133 ((1 / s : ℝ) : ℂ) * nit s t * Fp X t =
134 ∑ m ∈ (Icc 1 ⌊R⌋₊).filter (fun m => s ∣ m),
135 ((gw (m / (s * X)) * F (m / s) / m : ℝ) : ℂ) * nit m t := by
136 have hs0 : (0 : ℝ) < s := by exact_mod_cast hs
137 rw [sum_dvd_Icc s _ hs (fun m => ((gw (m / (s * X)) * F (m / s) / m : ℝ) : ℂ) * nit m t)]
138 have hsub : Icc 1 ⌊4 * X⌋₊ ⊆ Icc 1 (⌊R⌋₊ / s) := by
139 intro n hn
140 rw [mem_Icc] at hn ⊢
141 refine ⟨hn.1, (Nat.le_div_iff_mul_le hs).2 ?_⟩
142 rw [Nat.le_floor_iff (by nlinarith [Nat.cast_nonneg (α := ℝ) n])]
143 have := Nat.floor_le (a := 4 * X) (by linarith)
144 have h2 : (n : ℝ) ≤ 4 * X := (Nat.cast_le.2 hn.2).trans this
145 push_cast
146 nlinarith
147 unfold Fp
148 rw [mul_sum]
149 symm
150 rw [← sum_subset hsub]
151 · refine sum_congr rfl fun n hn => ?_
152 have hn1 : 1 ≤ n := (mem_Icc.1 hn).1
153 have hn0 : (0 : ℝ) < n := by exact_mod_cast hn1
154 rw [nit_mul s n hs hn1, Nat.mul_div_cancel_left _ hs]
155 have : ((s * n : ℕ) : ℝ) / (s * X) = n / X := by
156 push_cast; field_simp
157 rw [this]
158 push_cast
159 field_simp
160 · intro n hn hn'
161 rw [mem_Icc] at hn
162 rw [mem_Icc, not_and, not_le] at hn'
163 have h1 : 4 * X < n := by
164 have := Nat.lt_floor_add_one (4 * X)
165 have h2 : ⌊4 * X⌋₊ + 1 ≤ n := hn' hn.1
166 have : (⌊4 * X⌋₊ : ℝ) + 1 ≤ n := by exact_mod_cast h2
167 linarith
168 have : gw (((s * n : ℕ) : ℝ) / (s * X)) = 0 := by
169 refine gw_eq_zero (Or.inr ?_)
170 rw [le_div_iff₀ (by positivity)]
171 push_cast
172 nlinarith
173 rw [this]; simp
174
175/-- The cell scale: `s N_{v(s)} = N e^x` with `0 ≤ x < 1/ξ`. -/
176theorem scale_cell_exp (lo N : ℝ) (s : ℕ) (hs : 0 < s) (hξ : 1 ≤ xi lo) (hN : 0 < N) :
177 ∃ x : ℝ, 0 ≤ x ∧ x < 1 / xi lo ∧ (s : ℝ) * scaleV lo N (cellOf lo s) = N * Real.exp x := by
178 have hs1 : (1 : ℝ) ≤ s := by exact_mod_cast hs
179 have hs0 : (0 : ℝ) < s := by linarith
180 have hxi : 0 < xi lo := by linarith
181 have hlog : 0 ≤ Real.log s := Real.log_nonneg hs1
182 set v := cellOf lo s with hv
183 have h1 : (v : ℝ) ≤ xi lo * Real.log s := Nat.floor_le (mul_nonneg hxi.le hlog)
184 have h2 : xi lo * Real.log s < v + 1 := Nat.lt_floor_add_one _
185 have e1 : (v : ℝ) / xi lo ≤ Real.log s := by rw [div_le_iff₀ hxi]; linarith
186 have e2 : Real.log s - v / xi lo < 1 / xi lo := by
187 have : Real.log s < (v + 1) / xi lo := by rw [lt_div_iff₀ hxi]; linarith
188 have : (v + 1) / xi lo = v / xi lo + 1 / xi lo := by ring
189 linarith
190 refine ⟨Real.log s - v / xi lo, by linarith, e2, ?_⟩
191 unfold scaleV
192 rw [Real.exp_sub, Real.exp_log hs0, neg_div, Real.exp_neg]
193 field_simp
194
195/-- The cell scale is within a factor `2` of `N / s`: `N ≤ s N_{v(s)} < 2 N`. -/
196theorem scale_cell (lo N : ℝ) (s : ℕ) (hs : 0 < s) (hξ : 2 ≤ xi lo) (hN : 0 < N) :
197 N ≤ s * scaleV lo N (cellOf lo s) ∧ s * scaleV lo N (cellOf lo s) < 2 * N := by
198 obtain ⟨x, hx0, hx1, hid⟩ := scale_cell_exp lo N s hs (by linarith) hN
199 have h3 : 1 / xi lo ≤ 1 / 2 := one_div_le_one_div_of_le (by norm_num) hξ
200 rw [hid]
201 have hexp1 : 1 ≤ Real.exp x := Real.one_le_exp hx0
202 have hexp2 : Real.exp x < 2 := by
203 calc _ < Real.exp (Real.log 2) := Real.exp_lt_exp.2 (by linarith [Real.log_two_gt_d9])
204 _ = 2 := Real.exp_log (by norm_num)
205 constructor <;> nlinarith
206
207/-- `Cell` expands as a Dirichlet polynomial with coefficients `cellCoeff`, supported on `(N, 8N)`. -/
208theorem Cell_eq (lo N : ℝ) (S : Finset ℕ) (hS : ∀ s ∈ S, 0 < s) (hξ : 2 ≤ xi lo) (hN : 0 < N)
209 (t : ℝ) :
210 Cell lo S N t = ∑ m ∈ Icc 1 ⌊8 * N⌋₊, (cellCoeff lo S N m : ℂ) * nit m t := by
211 have hA : ∀ s ∈ S, ((1 / s : ℝ) : ℂ) * nit s t * (Fp (N / s) t - Fp (scaleV lo N (cellOf lo s)) t) =
212 ∑ m ∈ (Icc 1 ⌊8 * N⌋₊).filter (fun m => s ∣ m),
213 (((gw (m / N) - gw (m / (s * scaleV lo N (cellOf lo s)))) * F (m / s) / m : ℝ) : ℂ) * nit m t := by
214 intro s hs
215 have hs0 : (0 : ℝ) < s := by exact_mod_cast hS s hs
216 obtain ⟨hv1, hv2⟩ := scale_cell lo N s (hS s hs) hξ hN
217 have hv0 : 0 < scaleV lo N (cellOf lo s) := by unfold scaleV; positivity
218 rw [mul_sub, shift_Fp s (hS s hs) (N / s) (8 * N) (by positivity) (by
219 rw [show 4 * (s : ℝ) * (N / s) = 4 * N by field_simp]; linarith) t,
220 shift_Fp s (hS s hs) _ (8 * N) hv0 (by nlinarith) t, ← sum_sub_distrib]
221 refine sum_congr rfl fun m _ => ?_
222 rw [mul_div_cancel₀ _ hs0.ne', ← sub_mul]
223 push_cast
224 ring
225 unfold Cell
226 rw [sum_congr rfl hA, Finset.sum_comm' (t' := Icc 1 ⌊8 * N⌋₊) (s' := fun m => S.filter (· ∣ m))
227 (fun s m => by simp only [mem_filter]; tauto), mul_sum]
228 refine sum_congr rfl fun m hm => ?_
229 unfold cellCoeff
230 have hm0 : (0 : ℝ) < m := by
231 have := (mem_Icc.1 hm).1
232 exact_mod_cast this
233 push_cast
234 rw [← sum_mul, ← sum_div]
235 ring
236
237/-- Size of the cell coefficients: `|cellCoeff m| ≤ C m_S⁻¹ ξ⁻¹ r_S(m)/m` on `(N, 8N)`, `0` elsewhere. -/
238theorem cellCoeff_bound : ∃ C > 0, ∀ (lo N : ℝ) (S : Finset ℕ), (∀ s ∈ S, 0 < s) → 2 ≤ xi lo →
239 0 < N → ∀ m : ℕ,
240 |cellCoeff lo S N m| ≤ C * (ms S)⁻¹ * (xi lo)⁻¹ * (rc S m / m) *
241 (if N < m ∧ (m : ℝ) < 8 * N then 1 else 0) := by
242 obtain ⟨K, hK, hLip⟩ := gw_lipschitz
243 refine ⟨8 * K, by positivity, fun lo N S hS hξ hN m => ?_⟩
244 have hxi : 0 < xi lo := by linarith
245 have hA : 0 ≤ (ms S)⁻¹ := inv_nonneg.2 (ms_nonneg S)
246 by_cases hm : N < m ∧ (m : ℝ) < 8 * N
247 · rw [if_pos hm, mul_one]
248 obtain ⟨hm1, hm2⟩ := hm
249 have hm0 : (0 : ℝ) < m := by linarith
250 have hterm : ∀ s ∈ S.filter (· ∣ m),
251 |(gw ((m : ℝ) / N) - gw ((m : ℝ) / (s * scaleV lo N (cellOf lo s)))) * F (m / s)| ≤
252 8 * K * (xi lo)⁻¹ := by
253 intro s hs
254 have hsS := (mem_filter.1 hs).1
255 obtain ⟨x, hx0, hx1, hid⟩ := scale_cell_exp lo N s (hS s hsS) (by linarith) hN
256 rw [hid, abs_mul]
257 have hF : |F (m / s)| ≤ 1 := by
258 rw [abs_of_nonneg (F_nonneg _)]; exact F_le_one _
259 have hd : |gw ((m : ℝ) / N) - gw ((m : ℝ) / (N * Real.exp x))| ≤ 8 * K * (xi lo)⁻¹ := by
260 refine (hLip _ _).trans ?_
261 have e1 : (m : ℝ) / (N * Real.exp x) = (m / N) * Real.exp (-x) := by
262 rw [Real.exp_neg]; field_simp
263 have e2 : (m : ℝ) / N - (m / N) * Real.exp (-x) = (m / N) * (1 - Real.exp (-x)) := by ring
264 have h3 := Real.add_one_le_exp (-x)
265 have h4 : 0 < Real.exp (-x) := Real.exp_pos _
266 have h5 : (m : ℝ) / N < 8 := by rw [div_lt_iff₀ hN]; linarith
267 have h6 : 0 ≤ (m : ℝ) / N := by positivity
268 rw [e1, e2, abs_of_nonneg (mul_nonneg h6 (by linarith [Real.exp_le_one_iff.2 (show -x ≤ 0 by linarith)]))]
269 have h7 : 1 - Real.exp (-x) ≤ (xi lo)⁻¹ := by
270 have : x < (xi lo)⁻¹ := by simpa using hx1
271 linarith
272 have h8 : 0 ≤ 1 - Real.exp (-x) := by linarith [Real.exp_le_one_iff.2 (show -x ≤ 0 by linarith)]
273 calc K * ((m / N) * (1 - Real.exp (-x))) ≤ K * (8 * (xi lo)⁻¹) := by gcongr
274 _ = 8 * K * (xi lo)⁻¹ := by ring
275 calc _ ≤ 8 * K * (xi lo)⁻¹ * 1 := mul_le_mul hd hF (abs_nonneg _) (by positivity)
276 _ = _ := mul_one _
277 have hsum : |∑ s ∈ S.filter (· ∣ m),
278 (gw ((m : ℝ) / N) - gw ((m : ℝ) / (s * scaleV lo N (cellOf lo s)))) * F (m / s)| ≤
279 rc S m * (8 * K * (xi lo)⁻¹) := by
280 refine (abs_sum_le_sum_abs _ _).trans ?_
281 calc _ ≤ ∑ _s ∈ S.filter (· ∣ m), 8 * K * (xi lo)⁻¹ := sum_le_sum hterm
282 _ = _ := by rw [sum_const, nsmul_eq_mul]; rfl
283 unfold cellCoeff
284 rw [abs_mul, abs_mul, abs_of_nonneg hA, abs_of_nonneg (by positivity : 0 ≤ 1 / (m : ℝ))]
285 calc (ms S)⁻¹ * (1 / (m : ℝ)) * |∑ s ∈ S.filter (· ∣ m), _|
286 ≤ (ms S)⁻¹ * (1 / (m : ℝ)) * (rc S m * (8 * K * (xi lo)⁻¹)) := by gcongr
287 _ = _ := by ring
288 · rw [if_neg hm, mul_zero]
289 have hz : cellCoeff lo S N m = 0 := by
290 unfold cellCoeff
291 rw [Finset.sum_eq_zero, mul_zero]
292 intro s hs
293 have hsS := (mem_filter.1 hs).1
294 obtain ⟨hv1, hv2⟩ := scale_cell lo N s (hS s hsS) hξ hN
295 have hsv : 0 < (s : ℝ) * scaleV lo N (cellOf lo s) := by linarith
296 rcases not_and_or.1 hm with h | h
297 · have h' : (m : ℝ) ≤ N := not_lt.1 h
298 rw [gw_eq_zero (Or.inl ((div_le_one hN).2 h')),
299 gw_eq_zero (Or.inl ((div_le_one hsv).2 (h'.trans hv1)))]
300 simp
301 · have h' : 8 * N ≤ (m : ℝ) := not_lt.1 h
302 rw [gw_eq_zero (Or.inr (by rw [le_div_iff₀ hN]; linarith)),
303 gw_eq_zero (Or.inr (by rw [le_div_iff₀ hsv]; linarith))]
304 simp
305 rw [hz]; simp
306
307/-- Mean value over `[-T, T] ⊂ [-N, N]` as a set integral, from T4. -/
308theorem dir_L2 : ∃ C > 0, ∀ (N T : ℝ), 1 ≤ N → 0 ≤ T → T ≤ N → ∀ (s : Finset ℕ) (a : ℕ → ℂ),
309 (∀ n ∈ s, N ≤ n ∧ (n : ℝ) ≤ 16 * N) →
310 ∫ t in Set.Icc (-T) T, ‖∑ n ∈ s, a n * nit n t‖ ^ 2 ≤ C * N * ∑ n ∈ s, ‖a n‖ ^ 2 := by
311 obtain ⟨C, hC, h4⟩ := T4_mean_value
312 refine ⟨2 * C, by positivity, fun N T hN hT hTN s a hs => ?_⟩
313 have h := h4 N T hN hT s a hs
314 rw [MeasureTheory.integral_Icc_eq_integral_Ioc, ← intervalIntegral.integral_of_le (by linarith)]
315 have hnn : 0 ≤ ∑ n ∈ s, ‖a n‖ ^ 2 := sum_nonneg fun _ _ => by positivity
316 calc _ ≤ _ := h
317 _ ≤ 2 * C * N * ∑ n ∈ s, ‖a n‖ ^ 2 := by
318 have : C * (T + N) ≤ 2 * C * N := by nlinarith
319 exact (mul_le_mul_of_nonneg_right this hnn)
320
321/-- Mean square of a single Dirichlet polynomial `F_N` over `|t| ≤ T ≤ N`, uniformly in `N`. -/
322theorem Fp_L2 : ∃ C > 0, ∀ N T : ℝ, 1 ≤ N → 0 ≤ T → T ≤ N →
323 ∫ t in Set.Icc (-T) T, ‖Fp N t‖ ^ 2 ≤ C := by
324 obtain ⟨C, hC, hD⟩ := dir_L2
325 refine ⟨4 * C, by positivity, fun N T hN hT hTN => ?_⟩
326 have hN0 : 0 < N := by linarith
327 set s : Finset ℕ := (Icc 1 ⌊4 * N⌋₊).filter (fun n : ℕ => N < n) with hs
328 set a : ℕ → ℂ := fun n => ((gw (n / N) * F n / n : ℝ) : ℂ) with ha
329 have hFp : ∀ t, Fp N t = ∑ n ∈ s, a n * nit n t := fun t => by
330 unfold Fp
331 rw [hs, Finset.sum_filter_of_ne]
332 intro n _ hne
333 by_contra hn
334 refine hne ?_
335 have : gw (n / N) = 0 := gw_eq_zero (Or.inl ((div_le_one hN0).2 (not_lt.1 hn)))
336 simp [ha, this]
337 have hmem : ∀ n ∈ s, N ≤ n ∧ (n : ℝ) ≤ 16 * N := fun n hn => by
338 rw [hs, mem_filter, mem_Icc, Nat.le_floor_iff (by linarith)] at hn
339 exact ⟨hn.2.le, by linarith [hn.1.2]⟩
340 have hsum : ∑ n ∈ s, ‖a n‖ ^ 2 ≤ 4 / N := by
341 have hterm : ∀ n ∈ s, ‖a n‖ ^ 2 ≤ 1 / N ^ 2 := fun n hn => by
342 obtain ⟨hn1, -⟩ := hmem n hn
343 have hn0 : 0 < (n : ℝ) := by linarith
344 have h1 : ‖a n‖ ≤ 1 / n := by
345 simp only [ha, Complex.norm_real, Real.norm_eq_abs]
346 rw [abs_of_nonneg (by have := gw_nonneg (n / N); have := F_nonneg n; positivity)]
347 calc gw (n / N) * F n / n ≤ 1 * 1 / n := by
348 have := gw_nonneg (n / N); have := F_nonneg n
349 have := gw_le_one (n / N); have := F_le_one n
350 gcongr
351 _ = 1 / n := by ring
352 calc ‖a n‖ ^ 2 ≤ (1 / (n : ℝ)) ^ 2 := pow_le_pow_left₀ (norm_nonneg _) h1 2
353 _ ≤ (1 / N) ^ 2 := by gcongr
354 _ = 1 / N ^ 2 := by rw [one_div_pow]
355 have hcard : (s.card : ℝ) ≤ 4 * N := by
356 have : s.card ≤ ⌊4 * N⌋₊ := by
357 refine (card_le_card (filter_subset _ _)).trans ?_
358 simp
359 exact (Nat.cast_le.2 this).trans (Nat.floor_le (by linarith))
360 calc ∑ n ∈ s, ‖a n‖ ^ 2 ≤ ∑ _n ∈ s, 1 / N ^ 2 := sum_le_sum hterm
361 _ = s.card * (1 / N ^ 2) := by simp
362 _ ≤ 4 * N * (1 / N ^ 2) := by gcongr
363 _ = 4 / N := by field_simp
364 have h := hD N T hN hT hTN s a hmem
365 simp only [hFp]
366 calc _ ≤ C * N * ∑ n ∈ s, ‖a n‖ ^ 2 := h
367 _ ≤ C * N * (4 / N) := by gcongr
368 _ = 4 * C := by field_simp
369
370/-- Second moment of the cell term over `Low`: `∫ |Cell|² ≲ m_S⁻² ξ⁻² N ∑_{N<m<8N} r_S(m)²/m²`. -/
371theorem Cell_L2 : ∃ C > 0, ∀ (lo N : ℝ) (S : Finset ℕ), (∀ s ∈ S, 0 < s) → 2 ≤ xi lo →
372 2 ≤ K2 lo → 1 ≤ N → 0 < (ms S)⁻¹ →
373 ∫ t in Low lo N, ‖Cell lo S N t‖ ^ 2 ≤
374 C * ((ms S)⁻¹ * (xi lo)⁻¹) ^ 2 * N *
375 ∑ m ∈ (Icc 1 ⌊8 * N⌋₊).filter (fun m : ℕ => N < (m : ℝ)), rc S m ^ 2 / (m : ℝ) ^ 2 := by
376 obtain ⟨C1, hC1, hD⟩ := dir_L2
377 obtain ⟨C2, hC2, hB⟩ := cellCoeff_bound
378 refine ⟨C1 * C2 ^ 2, by positivity, fun lo N S hS hξ hK hN hA => ?_⟩
379 have hN0 : 0 < N := by linarith
380 have hxi : 0 < xi lo := by linarith
381 have hH1 : 1 ≤ H1 lo := one_le_pow₀ (by linarith : (1 : ℝ) ≤ K2 lo)
382 have hT0 : 0 ≤ N / H1 lo := div_nonneg hN0.le (by linarith)
383 have hTN : N / H1 lo ≤ N := div_le_self hN0.le hH1
384 set s : Finset ℕ := (Icc 1 ⌊8 * N⌋₊).filter (fun m : ℕ => N < (m : ℝ)) with hs
385 set a : ℕ → ℂ := fun m => (cellCoeff lo S N m : ℂ) with ha
386 have hcell : ∀ t, Cell lo S N t = ∑ m ∈ s, a m * nit m t := fun t => by
387 rw [Cell_eq lo N S hS hξ hN0 t, hs, Finset.sum_filter_of_ne]
388 intro m _ hne
389 by_contra hm
390 refine hne ?_
391 have h := hB lo N S hS hξ hN0 m
392 have : cellCoeff lo S N m = 0 := by
393 rw [if_neg (fun h => hm h.1), mul_zero] at h
394 exact abs_nonpos_iff.1 h
395 simp [ha, this]
396 have hmem : ∀ m ∈ s, N ≤ m ∧ (m : ℝ) ≤ 16 * N := fun m hm => by
397 rw [hs, mem_filter, mem_Icc, Nat.le_floor_iff (by linarith)] at hm
398 exact ⟨hm.2.le, by linarith [hm.1.2]⟩
399 have h := hD N (N / H1 lo) hN hT0 hTN s a hmem
400 have hcoef : ∀ m ∈ s, ‖a m‖ ^ 2 ≤ (C2 * ((ms S)⁻¹ * (xi lo)⁻¹)) ^ 2 * (rc S m ^ 2 / (m : ℝ) ^ 2) := by
401 intro m hm
402 have hm' := (mem_filter.1 hm).2
403 have hm8 : (m : ℝ) < 8 * N ∨ (m : ℝ) = 8 * N := by
404 have := (mem_Icc.1 (mem_filter.1 hm).1).2
405 have := Nat.floor_le (a := 8 * N) (by linarith)
406 have h2 : (m : ℝ) ≤ 8 * N := (Nat.cast_le.2 (mem_Icc.1 (mem_filter.1 hm).1).2).trans this
407 exact h2.lt_or_eq
408 have hm0 : (0 : ℝ) < m := by linarith
409 have hb := hB lo N S hS hξ hN0 m
410 simp only [ha, Complex.norm_real, Real.norm_eq_abs, sq_abs]
411 rcases hm8 with h8 | h8
412 · rw [if_pos ⟨hm', h8⟩, mul_one] at hb
413 calc cellCoeff lo S N m ^ 2 = |cellCoeff lo S N m| ^ 2 := (sq_abs _).symm
414 _ ≤ (C2 * (ms S)⁻¹ * (xi lo)⁻¹ * (rc S m / m)) ^ 2 := pow_le_pow_left₀ (abs_nonneg _) hb 2
415 _ = _ := by ring
416 · rw [if_neg (fun h => absurd h.2 (by rw [h8]; exact lt_irrefl _)), mul_zero] at hb
417 have : cellCoeff lo S N m = 0 := abs_nonpos_iff.1 hb
418 rw [this, zero_pow two_ne_zero]; positivity
419 have hsum : ∑ m ∈ s, ‖a m‖ ^ 2 ≤
420 (C2 * ((ms S)⁻¹ * (xi lo)⁻¹)) ^ 2 * ∑ m ∈ s, rc S m ^ 2 / (m : ℝ) ^ 2 := by
421 rw [mul_sum]; exact sum_le_sum hcoef
422 have hLow : ∫ t in Low lo N, ‖Cell lo S N t‖ ^ 2 =
423 ∫ t in Set.Icc (-(N / H1 lo)) (N / H1 lo), ‖∑ m ∈ s, a m * nit m t‖ ^ 2 := by
424 simp only [Low, hcell]
425 rw [hLow]
426 calc _ ≤ C1 * N * ∑ m ∈ s, ‖a m‖ ^ 2 := h
427 _ ≤ C1 * N * ((C2 * ((ms S)⁻¹ * (xi lo)⁻¹)) ^ 2 * ∑ m ∈ s, rc S m ^ 2 / (m : ℝ) ^ 2) := by gcongr
428 _ = _ := by ring
429
430/-- Second moment of `r_S` over a window, from Lemma 14 (`W.sum (r_S²) ≲ len + 1`). -/
431theorem rc_sq_sum : ∃ C > 0, ∀ (z : ℝ) (S : Finset ℕ) (W : Win), 2 ≤ z → IsFam z S →
432 1 ≤ W.lo → W.lo ≤ W.hi → (S.card : ℝ) ^ 4 ≤ W.lo →
433 W.sum (fun n => rc S n ^ 2) ≤ C * (W.len + 1) := by
434 obtain ⟨C, hC, h14⟩ := L14
435 refine ⟨C + 1, by positivity, fun z S W hz hS hlo hhi hcard => ?_⟩
436 have hlo0 : 0 < W.lo := by linarith
437 have hlen : 0 ≤ W.len := Real.log_nonneg ((one_le_div hlo0).mpr hhi)
438 have h4 := h14 z hz S hS W hlo hhi
439 have hc1 : (S.card : ℝ) ^ 4 / W.lo ≤ 1 := (div_le_one hlo0).2 hcard
440 have h1 := (abs_le.mp (sum_one_le W hlo0 hhi)).2
441 have h1' : 1 / W.lo ≤ 1 := (div_le_one hlo0).2 hlo
442 have hpt : W.sum (fun n => rc S n ^ 2) ≤ W.sum (fun n => (1 / 2 : ℝ) * 1 + (1 / 2 : ℝ) * rc S n ^ 4) :=
443 Win.sum_mono fun n _ => by
444 nlinarith [sq_nonneg (rc S n ^ 2 - 1)]
445 rw [Win.sum_add, Win.sum_const_mul, Win.sum_const_mul] at hpt
446 nlinarith
447
448/-- Overlap of the windows `(2^k, 8 · 2^k)` over `k ∈ 𝒩(W)`: each `m` lies in at most three. -/
449theorem cell_overlap (W : Win) (hlo : 0 < W.lo) (G : ℕ → ℝ) (hG : ∀ n, 0 ≤ G n) :
450 ∑ k ∈ W.dy, ∑ m ∈ (Icc 1 ⌊8 * (2 : ℝ) ^ k⌋₊).filter (fun m : ℕ => (2 : ℝ) ^ k < m),
451 G m / m ≤ 3 * W.sum G := by
452 have hG' : ∀ p : ℕ, 0 ≤ G p / p := fun p => div_nonneg (hG p) (Nat.cast_nonneg p)
453 have h1 : ∀ k ∈ W.dy, ∑ m ∈ (Icc 1 ⌊8 * (2 : ℝ) ^ k⌋₊).filter (fun m : ℕ => (2 : ℝ) ^ k < m),
454 G m / m ≤ ∑ p ∈ W.pts, if 2 ^ k < p ∧ p ≤ 2 ^ (k + 3) then G p / p else 0 := by
455 intro k hk
456 obtain ⟨hk1, hk2⟩ := dy_spec hk
457 have hpow : (0 : ℝ) < 2 ^ k := by positivity
458 rw [← sum_filter]
459 refine sum_le_sum_of_subset_of_nonneg (fun p hp => ?_) fun p _ _ => hG' p
460 rw [mem_filter, mem_Icc, Nat.le_floor_iff (by positivity)] at hp
461 obtain ⟨⟨-, h3⟩, h2⟩ := hp
462 have h8 : (p : ℝ) ≤ 2 ^ (k + 3) := by rw [pow_add]; linarith
463 rw [mem_filter, Win.mem_pts hlo.le (by linarith)]
464 refine ⟨⟨by linarith, by linarith⟩, by exact_mod_cast h2, by exact_mod_cast h8⟩
465 refine (sum_le_sum h1).trans ?_
466 rw [sum_comm, Win.sum, mul_sum]
467 refine sum_le_sum fun p _ => ?_
468 rw [← sum_filter, sum_const, nsmul_eq_mul]
469 refine mul_le_mul_of_nonneg_right ?_ (hG' p)
470 have hsub : (W.dy.filter fun k => 2 ^ k < p ∧ p ≤ 2 ^ (k + 3)) ⊆
471 Icc (Nat.clog 2 p - 3) (Nat.clog 2 p - 1) := by
472 intro k hk
473 obtain ⟨-, h2, h3⟩ := mem_filter.mp hk
474 have h4 := (Nat.lt_clog_iff_pow_lt (by norm_num)).2 h2
475 have h5 := (Nat.clog_le_iff_le_pow (by norm_num)).2 h3
476 rw [mem_Icc]; omega
477 have := (card_le_card hsub).trans (by rw [Nat.card_Icc]; omega : _ ≤ 3)
478 exact_mod_cast this
479
480/-- Size conditions on `lo` that hold for all large `lo`. -/
481theorem eventually_small (ε : ℝ) (hε : 0 < ε) : ∃ N0 : ℝ, ∀ lo : ℝ, N0 ≤ lo →
482 3 ≤ lo ∧ 2 ≤ K2 lo ∧ 2 ≤ xi lo ∧ K2 lo ^ 800 ≤ lo ∧
483 (cellCount lo : ℝ) ^ 2 * ((Real.log lo ^ 200)⁻¹) ^ 2 ≤ ε ∧
484 (xi lo)⁻¹ ^ 2 ≤ ε := by
485 obtain ⟨N1, hN1⟩ := Filter.eventually_atTop.1
486 ((Real.isLittleO_pow_log_id_atTop (n := 160000000)).bound one_pos)
487 set B : ℝ := max 2 (max (1 / ε) (6.4e15 / ε)) with hB
488 have hB2 : 2 ≤ B := le_max_left _ _
489 have hB1 : 1 / ε ≤ B := (le_max_left _ _).trans (le_max_right _ _)
490 have hB3 : 6.4e15 / ε ≤ B := (le_max_right _ _).trans (le_max_right _ _)
491 refine ⟨max (max N1 (Real.exp B)) 3, fun lo hlo => ?_⟩
492 have hlo3 : 3 ≤ lo := (le_max_right _ _).trans hlo
493 have hloN1 : N1 ≤ lo := ((le_max_left _ _).trans (le_max_left _ _)).trans hlo
494 have hloE : Real.exp B ≤ lo := ((le_max_right _ _).trans (le_max_left _ _)).trans hlo
495 have hlo0 : 0 < lo := by linarith
496 set L : ℝ := Real.log lo with hL
497 have hLB : B ≤ L := by
498 rw [hL]; exact (Real.le_log_iff_exp_le hlo0).2 hloE
499 have hL2 : 2 ≤ L := hB2.trans hLB
500 have hL1 : 1 ≤ L := by linarith
501 have hL0 : 0 < L := by linarith
502 have hK2 : K2 lo = L ^ 200000 := by simp [K2, C2, hL]
503 have hxi : xi lo = L ^ 100 := rfl
504 have hxi2 : 2 ≤ xi lo := by
505 rw [hxi]; nlinarith [one_le_pow₀ (n := 99) hL1, pow_succ L 99]
506 have hK2' : 2 ≤ K2 lo := by
507 rw [hK2]; nlinarith [one_le_pow₀ (n := 199999) hL1, pow_succ L 199999]
508 have h800 : K2 lo ^ 800 ≤ lo := by
509 rw [hK2, ← pow_mul]
510 have := hN1 lo hloN1
511 rw [one_mul, Real.norm_eq_abs, Real.norm_eq_abs, abs_of_nonneg (by positivity)] at this
512 rwa [id, abs_of_pos hlo0] at this
513 refine ⟨hlo3, hK2', hxi2, h800, ?_, ?_⟩
514 · -- cell count
515 have hlogL : Real.log (K2 lo) ≤ 200000 * L := by
516 rw [hK2, Real.log_pow]
517 have := Real.log_le_sub_one_of_pos hL0
518 push_cast; nlinarith
519 have hcc : (cellCount lo : ℝ) ≤ 8e7 * L ^ 101 := by
520 have h1 : xi lo * (200 * Real.log (K2 lo)) ≤ 4e7 * L ^ 101 := by
521 rw [hxi]
522 have : 0 ≤ L ^ 100 := by positivity
523 calc L ^ 100 * (200 * Real.log (K2 lo)) ≤ L ^ 100 * (200 * (200000 * L)) := by gcongr
524 _ = 4e7 * L ^ 101 := by ring
525 have h2 := Nat.floor_le (a := xi lo * (200 * Real.log (K2 lo))) (by
526 have : 0 ≤ Real.log (K2 lo) := Real.log_nonneg (by linarith)
527 rw [hxi]; exact mul_nonneg (pow_nonneg hL0.le _) (by linarith))
528 have h3 : (1 : ℝ) ≤ L ^ 101 := one_le_pow₀ hL1
529 unfold cellCount
530 push_cast
531 linarith
532 have hc0 : 0 ≤ (cellCount lo : ℝ) := Nat.cast_nonneg _
533 have h4 : (cellCount lo : ℝ) ^ 2 ≤ 6.4e15 * L ^ 202 := by
534 calc (cellCount lo : ℝ) ^ 2 ≤ (8e7 * L ^ 101) ^ 2 := pow_le_pow_left₀ hc0 hcc 2
535 _ = 6.4e15 * L ^ 202 := by ring
536 have h5 : ((L ^ 200)⁻¹) ^ 2 = (L ^ 400)⁻¹ := by
537 rw [inv_pow, ← pow_mul]
538 rw [h5]
539 have hp : L ^ 400 = L ^ 202 * L ^ 198 := by ring
540 have h6 : (1 : ℝ) ≤ L ^ 198 := one_le_pow₀ hL1
541 have h7 : L ≤ L ^ 198 := by
542 calc L = L ^ 1 := (pow_one L).symm
543 _ ≤ L ^ 198 := pow_le_pow_right₀ hL1 (by norm_num)
544 calc (cellCount lo : ℝ) ^ 2 * (L ^ 400)⁻¹ ≤ 6.4e15 * L ^ 202 * (L ^ 400)⁻¹ := by gcongr
545 _ = 6.4e15 / L ^ 198 := by rw [hp]; field_simp
546 _ ≤ 6.4e15 / L := by gcongr
547 _ ≤ ε := by
548 rw [div_le_iff₀ hL0]
549 have := (div_le_iff₀ hε).1 (hB3.trans hLB)
550 linarith
551 · have h1 : 1 / ε ≤ L := hB1.trans hLB
552 have h3 : L⁻¹ ≤ ε := by
553 rw [inv_le_comm₀ hL0 hε]; simpa using h1
554 have h4 : (xi lo)⁻¹ ^ 2 ≤ L⁻¹ := by
555 rw [hxi, inv_pow, ← pow_mul]
556 exact inv_anti₀ hL0 (by simpa using pow_le_pow_right₀ hL1 (show 1 ≤ 100 * 2 by norm_num))
557 exact h4.trans h3
558
559end E424
560