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/DirichletError/L29AuxC.lean

All files · 279 lines · source at the verified commit

1module
2
3public import E424.DirichletError.L29AuxB
4
5@[expose] public section
6
7/-!
8# L29, step 3: freezing the weight, splitting off `F p`, one dyadic scale of `e_1`
9-/
10
11set_option linter.style.header false
12open Finset
13
14namespace E424
15
16theorem gw_lipschitz : ∃ K > 0, ∀ x y : ℝ, |gw x - gw y| ≤ K * |x - y| := by
17 have hc : HasCompactSupport gw := by
18 refine HasCompactSupport.intro (isCompact_Icc (a := (1 : ℝ)) (b := 4)) fun x hx => gw_eq_zero ?_
19 rw [Set.mem_Icc, not_and_or] at hx
20 rcases hx with h | h
21 · exact Or.inl (by linarith)
22 · exact Or.inr (by linarith)
23 obtain ⟨K, hK⟩ := ContDiff.lipschitzWith_of_hasCompactSupport hc gw_contDiff (by norm_num)
24 refine ⟨K + 1, by positivity, fun x y => ?_⟩
25 have := hK.dist_le_mul x y
26 rw [Real.dist_eq, Real.dist_eq] at this
27 nlinarith [abs_nonneg (x - y)]
28
29/-- The weight `gw(n/N)/n`. -/
30noncomputable def wt (N : ℝ) (n : ℕ) : ℝ := gw (n / N) / n
31
32theorem wt_nonneg (N : ℝ) (n : ℕ) : 0 ≤ wt N n := div_nonneg (gw_nonneg _) (Nat.cast_nonneg n)
33
34theorem wt_supp {N : ℝ} (hN : 0 < N) {n : ℕ} (h : wt N n ≠ 0) : N < n ∧ (n : ℝ) < 4 * N := by
35 by_contra hc
36 refine h ?_
37 rw [wt, gw_eq_zero, zero_div]
38 rw [not_and_or, not_lt, not_lt] at hc
39 rcases hc with hc | hc
40 · exact Or.inl ((div_le_one hN).mpr hc)
41 · exact Or.inr ((le_div_iff₀ hN).mpr hc)
42
43theorem wt_le {N : ℝ} (hN : 0 < N) (n : ℕ) : wt N n ≤ 1 / N := by
44 by_cases h : wt N n = 0
45 · rw [h]; positivity
46 · have := (wt_supp hN h).1
47 unfold wt
48 exact div_le_div₀ zero_le_one (gw_le_one _) hN this.le
49
50theorem wt_lip : ∃ K > 0, ∀ N : ℝ, 0 < N → ∀ p h : ℕ, N / 2 ≤ p →
51 |wt N (p + h) - wt N p| ≤ K * h / N ^ 2 := by
52 obtain ⟨K, hK, hg⟩ := gw_lipschitz
53 refine ⟨2 * K + 4, by positivity, fun N hN p h hp => ?_⟩
54 have hp0 : (0 : ℝ) < p := by linarith
55 have hh : (0 : ℝ) ≤ h := Nat.cast_nonneg h
56 have e : wt N (p + h) - wt N p =
57 (gw (((p + h : ℕ) : ℝ) / N) - gw (p / N)) / p - gw (((p + h : ℕ) : ℝ) / N) * (h / (p * (p + h))) := by
58 unfold wt; push_cast; field_simp; ring
59 rw [e]
60 have h1 : |(gw (((p + h : ℕ) : ℝ) / N) - gw (p / N)) / p| ≤ 2 * K * h / N ^ 2 := by
61 rw [abs_div, abs_of_pos hp0, div_le_iff₀ hp0]
62 refine (hg _ _).trans ?_
63 have : ((p + h : ℕ) : ℝ) / N - p / N = h / N := by push_cast; ring
64 rw [this, abs_of_nonneg (by positivity)]
65 calc K * (h / N) = 2 * K * h / N ^ 2 * (N / 2) := by field_simp
66 _ ≤ _ := by gcongr
67 have h2 : |gw (((p + h : ℕ) : ℝ) / N) * (h / (p * (p + h)))| ≤ 4 * h / N ^ 2 := by
68 rw [abs_of_nonneg (mul_nonneg (gw_nonneg _) (by positivity))]
69 calc gw (((p + h : ℕ) : ℝ) / N) * (h / (p * (p + h))) ≤ 1 * (h / (N / 2 * (N / 2))) := by
70 gcongr
71 · exact gw_le_one _
72 · linarith
73 _ = 4 * h / N ^ 2 := by field_simp; ring
74 calc _ ≤ 2 * K * h / N ^ 2 + 4 * h / N ^ 2 := (abs_sub _ _).trans (add_le_add h1 h2)
75 _ = _ := by ring
76
77theorem Sh_freeze (w E : ℕ → ℝ) (p l : ℕ) (κ R : ℝ) (hκ : 0 ≤ κ)
78 (hw : ∀ h ∈ Icc 1 l, |w (p + h) - w p| ≤ κ) (hE : ∀ n, |E n| ≤ R) :
79 Sh (fun n => w n * E n) p l ^ 2 ≤ 2 * (w p * Sh E p l) ^ 2 + 2 * (l * (κ * R)) ^ 2 := by
80 have e : Sh (fun n => w n * E n) p l =
81 w p * Sh E p l + ∑ h ∈ Icc 1 l, (w (p + h) - w p) * E (p + h) := by
82 unfold Sh; rw [mul_sum, ← sum_add_distrib]
83 exact sum_congr rfl fun h _ => by ring
84 have h1 : |∑ h ∈ Icc 1 l, (w (p + h) - w p) * E (p + h)| ≤ l * (κ * R) := by
85 refine (abs_sum_le_sum_abs _ _).trans ?_
86 calc _ ≤ ∑ h ∈ Icc 1 l, κ * R := sum_le_sum fun h hh => by
87 rw [abs_mul]; exact mul_le_mul (hw h hh) (hE _) (abs_nonneg _) hκ
88 _ = _ := by rw [sum_const, Nat.card_Icc, nsmul_eq_mul, Nat.add_sub_cancel]
89 have h2 := sq_le_sq' (abs_le.mp h1).1 (abs_le.mp h1).2
90 rw [e]
91 nlinarith [sq_nonneg (w p * Sh E p l - ∑ h ∈ Icc 1 l, (w (p + h) - w p) * E (p + h))]
92
93theorem F_sub_sq_le (a b : ℕ) : (F a - F b) ^ 2 ≤ ind (F a ≠ F b) := by
94 by_cases h : F a = F b
95 · rw [h]; simp [ind]
96 · rw [ind_true h]
97 have := F_nonneg a; have := F_nonneg b; have := F_le_one a; have := F_le_one b
98 nlinarith
99
100theorem Sh_split (g : ℕ → ℝ) (p l : ℕ) :
101 Sh (fun n => F n * g n) p l ^ 2 ≤ 2 * Sh g p l ^ 2 +
102 2 * (l * ∑ h ∈ Icc 1 l, ind (F (p + h) ≠ F p) * g (p + h) ^ 2) := by
103 have e : Sh (fun n => F n * g n) p l =
104 F p * Sh g p l + ∑ h ∈ Icc 1 l, (F (p + h) - F p) * g (p + h) := by
105 unfold Sh; rw [mul_sum, ← sum_add_distrib]
106 exact sum_congr rfl fun h _ => by ring
107 have h1 : (∑ h ∈ Icc 1 l, (F (p + h) - F p) * g (p + h)) ^ 2 ≤
108 l * ∑ h ∈ Icc 1 l, ind (F (p + h) ≠ F p) * g (p + h) ^ 2 := by
109 refine (sq_sum_le_card_mul_sum_sq).trans ?_
110 rw [Nat.card_Icc, Nat.add_sub_cancel]
111 refine mul_le_mul_of_nonneg_left (sum_le_sum fun h _ => ?_) (Nat.cast_nonneg l)
112 rw [mul_pow]
113 exact mul_le_mul_of_nonneg_right (F_sub_sq_le _ _) (sq_nonneg _)
114 have h2 : (F p * Sh g p l) ^ 2 ≤ Sh g p l ^ 2 := by
115 rw [mul_pow]
116 have := F_nonneg p; have := F_le_one p
117 exact mul_le_of_le_one_left (sq_nonneg _) (by nlinarith)
118 rw [e]
119 nlinarith [sq_nonneg (F p * Sh g p l - ∑ h ∈ Icc 1 l, (F (p + h) - F p) * g (p + h))]
120
121theorem abs_ms_sub_rc_le (S : Finset ℕ) (n : ℕ) : |ms S - rc S n| ≤ S.card := by
122 have h1 : ms S ≤ S.card := by
123 unfold ms
124 refine (sum_le_sum (g := fun _ => (1 : ℝ)) fun s _ => ?_).trans (by simp)
125 rcases Nat.eq_zero_or_pos s with h | h
126 · simp [h]
127 · exact div_le_one_of_le₀ (by exact_mod_cast h) (by positivity)
128 have h2 : rc S n ≤ S.card := by
129 unfold rc; exact_mod_cast card_filter_le _ _
130 rw [abs_le]
131 constructor <;> linarith [ms_nonneg S, rc_nonneg S n]
132
133/-- The part of the main term that needs `D_W`: `∑_{h ≤ 8H} ∑_{N<p<4N} 1(F(p+h) ≠ F p)(m - r(p+h))²/p`. -/
134noncomputable def Dsum (S : Finset ℕ) (N H : ℝ) : ℝ :=
135 ∑ h ∈ Icc 1 ⌊8 * H⌋₊, ∑ p ∈ Icc ⌈N / 2⌉₊ ⌊4 * N⌋₊ with N < (p : ℕ) ∧ (p : ℝ) < 4 * N,
136 ind (F (p + h) ≠ F p) * (ms S - rc S (p + h)) ^ 2 / p
137
138theorem step_bound {N H K : ℝ} (hK : 0 < K) (S : Finset ℕ)
139 (hlip : ∀ p h : ℕ, N / 2 ≤ p → |wt N (p + h) - wt N p| ≤ K * h / N ^ 2)
140 (hH : 1 ≤ H) (hN : 40 * H ≤ N) (p : ℕ) (hp : p ∈ Icc ⌈N / 2⌉₊ ⌊4 * N⌋₊) :
141 stepC (N / H) (fun n => wt N n * (F n * (ms S - rc S n))) p ≤
142 (if N < (p : ℕ) ∧ (p : ℝ) < 4 * N then 4 / N ^ 2 * (stepC (N / H) (fun n => ms S - rc S n) p +
143 32 * H * ∑ h ∈ Icc 1 ⌊8 * H⌋₊, ind (F (p + h) ≠ F p) * (ms S - rc S (p + h)) ^ 2 / p) else 0) +
144 16 * (8 * H * (K * (8 * H) / N ^ 2 * S.card)) ^ 2 / N := by
145 have hN0 : 0 < N := by linarith
146 rw [mem_Icc, Nat.ceil_le, Nat.le_floor_iff (by linarith)] at hp
147 have hp0 : (0 : ℝ) < p := by linarith
148 have hT : 4 ≤ N / H := by rw [le_div_iff₀ (by linarith)]; linarith
149 set δ := Real.exp (1 / (N / H)) - 1 with hδ
150 set g : ℕ → ℝ := fun n => ms S - rc S n with hg
151 set Z := (8 * H * (K * (8 * H) / N ^ 2 * S.card)) ^ 2 with hZ
152 have hZ0 : 0 ≤ Z := sq_nonneg _
153 have hd1 : 1 / (N / H) < δ := (exp_inv_bounds hT).1
154 have hd2 : δ ≤ 1 / (N / H) + (1 / (N / H)) ^ 2 := (exp_inv_bounds hT).2.1
155 have hd : 0 < δ := lt_trans (by positivity) hd1
156 have hL : (Lp δ p : ℝ) + 3 ≤ 8 * H := by
157 have h1 := (Lp_spec (mul_pos hd hp0)).1
158 rw [one_div_div] at hd2
159 have h4 : δ * N ≤ 41 / 40 * H := by
160 have : (H / N) ≤ 1 / 40 := by rw [div_le_iff₀ hN0]; linarith
161 calc δ * N ≤ (H / N + (H / N) ^ 2) * N := by gcongr
162 _ = H * (1 + H / N) := by field_simp
163 _ ≤ _ := by nlinarith
164 nlinarith
165 have hj : ∀ j ∈ range 4, ((Lp δ p + j : ℕ) : ℝ) ≤ 8 * H := fun j hj => by
166 have : (j : ℝ) ≤ 3 := by
167 have := mem_range.mp hj
168 exact_mod_cast (by omega : j ≤ 3)
169 push_cast; linarith
170 have hfr : ∀ j ∈ range 4, Sh (fun n => wt N n * (F n * g n)) p (Lp δ p + j) ^ 2 ≤
171 2 * (wt N p * Sh (fun n => F n * g n) p (Lp δ p + j)) ^ 2 + 2 * Z := by
172 intro j hj'
173 have hl := hj j hj'
174 refine (Sh_freeze (wt N) (fun n => F n * g n) p _ (K * (8 * H) / N ^ 2) S.card (by positivity)
175 ?_ ?_).trans ?_
176 · intro h hh
177 refine (hlip p h hp.1).trans ?_
178 have : (h : ℝ) ≤ ((Lp δ p + j : ℕ) : ℝ) := by exact_mod_cast (mem_Icc.mp hh).2
179 gcongr; linarith
180 · intro n
181 rw [abs_mul, abs_of_nonneg (F_nonneg n)]
182 exact (mul_le_of_le_one_left (abs_nonneg _) (F_le_one n)).trans (abs_ms_sub_rc_le S n)
183 · rw [hZ]
184 gcongr
185 have hdiv : 8 * Z / p ≤ 16 * Z / N := by
186 rw [div_le_div_iff₀ hp0 hN0]; nlinarith
187 unfold stepC
188 rw [← hδ]
189 split_ifs with hc
190 · have hmain : ∀ j ∈ range 4, Sh (fun n => wt N n * (F n * g n)) p (Lp δ p + j) ^ 2 ≤
191 4 / N ^ 2 * (Sh g p (Lp δ p + j) ^ 2 + 8 * H * ∑ h ∈ Icc 1 ⌊8 * H⌋₊,
192 ind (F (p + h) ≠ F p) * g (p + h) ^ 2) + 2 * Z := by
193 intro j hj'
194 refine (hfr j hj').trans (add_le_add_left ?_ _)
195 have h1 := Sh_split g p (Lp δ p + j)
196 have h2 : ∑ h ∈ Icc 1 (Lp δ p + j), ind (F (p + h) ≠ F p) * g (p + h) ^ 2 ≤
197 ∑ h ∈ Icc 1 ⌊8 * H⌋₊, ind (F (p + h) ≠ F p) * g (p + h) ^ 2 :=
198 sum_le_sum_of_subset_of_nonneg
199 (Icc_subset_Icc_right ((Nat.le_floor_iff (by linarith)).mpr (hj j hj')))
200 fun _ _ _ => mul_nonneg (ind_nonneg _) (sq_nonneg _)
201 have h3 : 0 ≤ ∑ h ∈ Icc 1 (Lp δ p + j), ind (F (p + h) ≠ F p) * g (p + h) ^ 2 :=
202 sum_nonneg fun _ _ => mul_nonneg (ind_nonneg _) (sq_nonneg _)
203 have h4 := mul_le_mul (hj j hj') h2 h3 (by linarith)
204 have h5 : wt N p ^ 2 ≤ 1 / N ^ 2 := by
205 rw [← one_div_pow]; exact pow_le_pow_left₀ (wt_nonneg N p) (wt_le hN0 p) 2
206 rw [mul_pow]
207 calc 2 * (wt N p ^ 2 * Sh (fun n => F n * g n) p (Lp δ p + j) ^ 2)
208 ≤ 2 * (1 / N ^ 2 * (2 * Sh g p (Lp δ p + j) ^ 2 + 2 * (8 * H * ∑ h ∈ Icc 1 ⌊8 * H⌋₊,
209 ind (F (p + h) ≠ F p) * g (p + h) ^ 2))) := by gcongr; linarith
210 _ = _ := by ring
211 have h6 := sum_le_sum hmain
212 rw [sum_add_distrib, ← mul_sum, sum_add_distrib, sum_const, sum_const, card_range, nsmul_eq_mul,
213 nsmul_eq_mul] at h6
214 have h7 := div_le_div_of_nonneg_right h6 hp0.le
215 refine h7.trans ?_
216 rw [← sum_div]
217 refine le_trans (le_of_eq ?_) (add_le_add_right hdiv _)
218 push_cast; ring
219 · have hw : wt N p = 0 := by
220 by_contra h; exact hc (wt_supp hN0 h)
221 have h6 := sum_le_sum hfr
222 simp only [hw, zero_mul, ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, mul_zero,
223 zero_add, sum_const, card_range, nsmul_eq_mul] at h6
224 have h7 := div_le_div_of_nonneg_right h6 hp0.le
225 rw [zero_add]
226 refine h7.trans (le_trans (le_of_eq ?_) hdiv)
227 push_cast; ring
228
229/-- All of `e_1` on one scale. -/
230theorem e1_step : ∃ C > 0, ∀ (z : ℝ) (S : Finset ℕ), 3 ≤ z → IsFam z S → ∀ N H : ℝ, 1 ≤ H →
231 40 * H ≤ N → ∑ p ∈ Icc ⌈N / 2⌉₊ ⌊4 * N⌋₊,
232 stepC (N / H) (fun n => wt N n * (F n * (ms S - rc S n))) p ≤
233 C / N ^ 2 * (H + H ^ 3 * (S.card : ℝ) ^ 2 / N + H * Dsum S N H) := by
234 obtain ⟨K, hK, hlip⟩ := wt_lip
235 obtain ⟨C, hC, hvar⟩ := variance_sum
236 refine ⟨4 * C + 128 + 262144 * K ^ 2, by positivity, fun z S hz hS N H hH hN => ?_⟩
237 have hN0 : 0 < N := by linarith
238 have h1 := hvar z S hz hS N H hH hN
239 refine (sum_le_sum fun p hp => step_bound hK S (hlip N hN0) hH hN p hp).trans ?_
240 rw [sum_add_distrib, ← sum_filter, ← mul_sum, sum_add_distrib, ← mul_sum, sum_comm, sum_const,
241 nsmul_eq_mul]
242 change 4 / N ^ 2 * (_ + 32 * H * Dsum S N H) + _ ≤ _
243 set D := Dsum S N H with hD
244 have hD0 : 0 ≤ D := sum_nonneg fun _ _ => sum_nonneg fun _ _ =>
245 div_nonneg (mul_nonneg (ind_nonneg _) (sq_nonneg _)) (Nat.cast_nonneg _)
246 set X := H ^ 3 * (S.card : ℝ) ^ 2 / N with hX
247 have hX0 : 0 ≤ X := by positivity
248 have hcard : ((Icc ⌈N / 2⌉₊ ⌊4 * N⌋₊).card : ℝ) ≤ 4 * N := by
249 rw [Nat.card_Icc]
250 have h2 : 1 ≤ ⌈N / 2⌉₊ := Nat.one_le_iff_ne_zero.mpr (Nat.ceil_pos.mpr (by linarith)).ne'
251 have h3 : ⌊4 * N⌋₊ + 1 - ⌈N / 2⌉₊ ≤ ⌊4 * N⌋₊ := by omega
252 exact (Nat.cast_le.mpr h3).trans (Nat.floor_le (by linarith))
253 have h4 : ((Icc ⌈N / 2⌉₊ ⌊4 * N⌋₊).card : ℝ) *
254 (16 * (8 * H * (K * (8 * H) / N ^ 2 * S.card)) ^ 2 / N) ≤ 262144 * K ^ 2 / N ^ 2 * X := by
255 calc _ ≤ 4 * N * (16 * (8 * H * (K * (8 * H) / N ^ 2 * S.card)) ^ 2 / N) := by gcongr
256 _ = 262144 * K ^ 2 / N ^ 2 * (H ^ 4 * (S.card : ℝ) ^ 2 / N ^ 2) := by field_simp; ring
257 _ ≤ _ := by
258 gcongr
259 rw [hX]
260 calc H ^ 4 * (S.card : ℝ) ^ 2 / N ^ 2 = H ^ 3 * (S.card : ℝ) ^ 2 / N * (H / N) := by field_simp
261 _ ≤ H ^ 3 * (S.card : ℝ) ^ 2 / N * 1 := by
262 gcongr; rw [div_le_one hN0]; linarith
263 _ = _ := mul_one _
264 have h5 : 4 / N ^ 2 * (∑ p ∈ Icc ⌈N / 2⌉₊ ⌊4 * N⌋₊ with N < (p : ℕ) ∧ (p : ℝ) < 4 * N,
265 stepC (N / H) (fun n => ms S - rc S n) p + 32 * H * D) ≤
266 4 / N ^ 2 * (C * (H + X) + 32 * H * D) := by gcongr
267 refine (add_le_add h5 h4).trans ?_
268 have h6 : 4 / N ^ 2 * (C * (H + X) + 32 * H * D) + 262144 * K ^ 2 / N ^ 2 * X =
269 1 / N ^ 2 * (4 * C * (H + X) + 128 * (H * D) + 262144 * K ^ 2 * X) := by ring
270 have h7 : (4 * C + 128 + 262144 * K ^ 2) / N ^ 2 * (H + X + H * D) =
271 1 / N ^ 2 * ((4 * C + 128 + 262144 * K ^ 2) * (H + X + H * D)) := by ring
272 rw [h6, h7]
273 refine mul_le_mul_of_nonneg_left ?_ (by positivity)
274 have : 0 ≤ H * D := mul_nonneg (by linarith) hD0
275 have hK2 : 0 ≤ K ^ 2 := sq_nonneg K
276 nlinarith [mul_nonneg hK2 this, mul_nonneg hC.le this, mul_nonneg hK2 (by linarith : (0:ℝ) ≤ H)]
277
278end E424
279