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/L32Aux1.lean

All files · 305 lines · source at the verified commit

1module
2
3public import E424.DirichletError.Basic
4public import E424.Tools.T7
5public import E424.Tools.T8
6public import E424.Tools.T9
7
8@[expose] public section
9
10/-!
11# Lemma 32, auxiliary part 1: the weight `qw`, the scaled summand `HH`, its second derivative
12-/
13
14set_option linter.style.header false
15open Finset MeasureTheory
16
17namespace E424
18
19/-- `gw v / v`, smooth with support in `[1,4]`. -/
20noncomputable def qw (v : ℝ) : ℝ := gw v / v
21
22theorem qw_eq_zero {v : ℝ} (h : v ≤ 1 ∨ 4 ≤ v) : qw v = 0 := by
23 rw [qw, gw_eq_zero h, zero_div]
24
25theorem qw_contDiff : ContDiff ℝ 2 qw := by
26 rw [contDiff_iff_contDiffAt]
27 intro v
28 rcases lt_or_ge v 1 with h | h
29 · refine (contDiffAt_const (c := (0 : ℝ))).congr_of_eventuallyEq ?_
30 filter_upwards [Iio_mem_nhds h] with w hw using qw_eq_zero (Or.inl (le_of_lt hw))
31 · exact (gw_contDiff.contDiffAt.of_le (by norm_num)).div contDiffAt_id (by simp; linarith)
32
33theorem qw_hasDerivAt (v : ℝ) : HasDerivAt qw (deriv qw v) v :=
34 (qw_contDiff.differentiable (by norm_num) v).hasDerivAt
35
36theorem qw'_contDiff : ContDiff ℝ 1 (deriv qw) := by
37 have := qw_contDiff
38 rw [show (2 : WithTop ℕ∞) = 1 + 1 by norm_num, contDiff_succ_iff_deriv] at this
39 exact this.2.2
40
41theorem qw'_hasDerivAt (v : ℝ) : HasDerivAt (deriv qw) (deriv (deriv qw) v) v :=
42 (qw'_contDiff.differentiable (by norm_num) v).hasDerivAt
43
44theorem qw_compact : HasCompactSupport qw :=
45 HasCompactSupport.intro (K := Set.Icc 1 4) isCompact_Icc fun x hx => by
46 rw [Set.mem_Icc, not_and_or, not_le, not_le] at hx
47 exact qw_eq_zero (hx.imp le_of_lt le_of_lt)
48
49theorem qw_bound : ∃ B : ℝ, 0 < B ∧ ∀ v, |qw v| ≤ B ∧ |deriv qw v| ≤ B ∧ |deriv (deriv qw) v| ≤ B := by
50 obtain ⟨b0, h0⟩ := qw_compact.exists_bound_of_continuous qw_contDiff.continuous
51 obtain ⟨b1, h1⟩ := qw_compact.deriv.exists_bound_of_continuous qw'_contDiff.continuous
52 obtain ⟨b2, h2⟩ := qw_compact.deriv.deriv.exists_bound_of_continuous
53 (qw'_contDiff.continuous_deriv le_rfl)
54 refine ⟨max 1 (max b0 (max b1 b2)), by positivity, fun v => ⟨?_, ?_, ?_⟩⟩
55 · exact (h0 v).trans (by simp)
56 · exact (h1 v).trans (by simp)
57 · exact (h2 v).trans (by simp)
58
59/-- Scaled summand of the Gram sum, `v = (y - j')/Y`, `κ = (j - j')/Y`. -/
60noncomputable def HH (κ t t' v : ℝ) : ℂ :=
61 ((qw (v - κ) * qw v : ℝ) : ℂ) *
62 Complex.exp (((t' * Real.log v - t * Real.log (v - κ) : ℝ) : ℂ) * Complex.I)
63
64theorem HH_eq_zero {κ t t' v : ℝ} (h : v ≤ 1 ∨ 4 ≤ v) : HH κ t t' v = 0 := by
65 simp [HH, qw_eq_zero h]
66
67theorem HH_compact (κ t t' : ℝ) : HasCompactSupport (HH κ t t') :=
68 HasCompactSupport.intro (K := Set.Icc 1 4) isCompact_Icc fun x hx => by
69 rw [Set.mem_Icc, not_and_or, not_le, not_le] at hx
70 exact HH_eq_zero (hx.imp le_of_lt le_of_lt)
71
72theorem Q_contDiff (s : ℝ) : ContDiff ℝ 2 fun v : ℝ =>
73 ((qw v : ℝ) : ℂ) * Complex.exp (((s * Real.log v : ℝ) : ℂ) * Complex.I) := by
74 rw [contDiff_iff_contDiffAt]
75 intro v
76 rcases lt_or_ge v 1 with h | h
77 · refine (contDiffAt_const (c := (0 : ℂ))).congr_of_eventuallyEq ?_
78 filter_upwards [Iio_mem_nhds h] with w hw
79 simp [qw_eq_zero (Or.inl (le_of_lt hw))]
80 · have hv : v ≠ 0 := by linarith
81 refine (Complex.ofRealCLM.contDiff.contDiffAt.comp v qw_contDiff.contDiffAt).mul ?_
82 refine ContDiffAt.cexp (ContDiffAt.mul ?_ contDiffAt_const)
83 exact Complex.ofRealCLM.contDiff.contDiffAt.comp v
84 (contDiffAt_const.mul (Real.contDiffAt_log.2 hv))
85
86theorem HH_contDiff (κ t t' : ℝ) : ContDiff ℝ 2 (HH κ t t') := by
87 have h1 := (Q_contDiff (-t)).comp (contDiff_id.sub (contDiff_const (c := κ)))
88 have h2 := h1.mul (Q_contDiff t')
89 refine (congrArg (ContDiff ℝ 2) (funext fun v => ?_)).mpr h2
90 simp only [HH, Function.comp, id]
91 rw [mul_mul_mul_comm, ← Complex.exp_add]
92 push_cast
93 congr 2
94 ring
95
96/-- Second derivative of `G e^{iφ}`. -/
97theorem L32_second_bound {U : Set ℝ} (hU : IsOpen U) {G G1 G2 φ φ1 φ2 : ℝ → ℝ}
98 (hG : ∀ x ∈ U, HasDerivAt G (G1 x) x) (hG1 : ∀ x ∈ U, HasDerivAt G1 (G2 x) x)
99 (hφ : ∀ x ∈ U, HasDerivAt φ (φ1 x) x) (hφ1 : ∀ x ∈ U, HasDerivAt φ1 (φ2 x) x)
100 {x : ℝ} (hx : x ∈ U) :
101 ‖deriv (deriv fun v => (G v : ℂ) * Complex.exp ((φ v : ℂ) * Complex.I)) x‖ ≤
102 |G2 x| + 2 * |G1 x| * |φ1 x| + |G x| * (|φ2 x| + |φ1 x| ^ 2) := by
103 have hE : ∀ v ∈ U, HasDerivAt (fun v => Complex.exp ((φ v : ℂ) * Complex.I))
104 (Complex.exp ((φ v : ℂ) * Complex.I) * ((φ1 v : ℂ) * Complex.I)) v := fun v hv =>
105 (((hφ v hv).ofReal_comp).mul_const Complex.I).cexp
106 have h1 : ∀ v ∈ U, HasDerivAt (fun v => (G v : ℂ) * Complex.exp ((φ v : ℂ) * Complex.I))
107 (((G1 v : ℂ) + (G v : ℂ) * ((φ1 v : ℂ) * Complex.I)) *
108 Complex.exp ((φ v : ℂ) * Complex.I)) v := fun v hv => by
109 refine ((hG v hv).ofReal_comp.mul (hE v hv)).congr_deriv ?_
110 ring
111 have h2 : deriv (fun v => (G v : ℂ) * Complex.exp ((φ v : ℂ) * Complex.I)) =ᶠ[nhds x]
112 fun v => ((G1 v : ℂ) + (G v : ℂ) * ((φ1 v : ℂ) * Complex.I)) *
113 Complex.exp ((φ v : ℂ) * Complex.I) := by
114 filter_upwards [hU.mem_nhds hx] with v hv using (h1 v hv).deriv
115 have h3 := (((hG1 x hx).ofReal_comp.add ((hG x hx).ofReal_comp.mul
116 ((hφ1 x hx).ofReal_comp.mul_const Complex.I))).mul (hE x hx))
117 rw [h2.deriv_eq]
118 refine (le_of_eq (congrArg norm (HasDerivAt.deriv h3))).trans ?_
119 have hn : ‖Complex.exp ((φ x : ℂ) * Complex.I)‖ = 1 := Complex.norm_exp_ofReal_mul_I _
120 set E := Complex.exp ((φ x : ℂ) * Complex.I)
121 have hrw : ((G2 x : ℂ) + ((G1 x : ℂ) * ((φ1 x : ℂ) * Complex.I) +
122 (G x : ℂ) * ((φ2 x : ℂ) * Complex.I))) * E +
123 ((G1 x : ℂ) + (G x : ℂ) * ((φ1 x : ℂ) * Complex.I)) * (E * ((φ1 x : ℂ) * Complex.I)) =
124 ((G2 x : ℂ) + 2 * (G1 x : ℂ) * (φ1 x : ℂ) * Complex.I +
125 (G x : ℂ) * ((φ2 x : ℂ) * Complex.I + (φ1 x : ℂ) ^ 2 * Complex.I ^ 2)) * E := by ring
126 refine (le_of_eq (congrArg norm hrw)).trans ?_
127 rw [norm_mul, hn, mul_one]
128 refine (norm_add_le _ _).trans (add_le_add ((norm_add_le _ _).trans (add_le_add ?_ ?_)) ?_)
129 · simp
130 · simp
131 · rw [norm_mul]
132 refine mul_le_mul (by simp) ((norm_add_le _ _).trans (by simp)) (norm_nonneg _) (abs_nonneg _)
133
134theorem L32_psi_deriv {κ t t' v : ℝ} (h1 : v ≠ 0) (h2 : v - κ ≠ 0) :
135 HasDerivAt (fun v => t' * Real.log v - t * Real.log (v - κ)) (t' * v⁻¹ - t * (v - κ)⁻¹) v := by
136 have := ((hasDerivAt_id v).sub_const κ).log h2
137 refine (((Real.hasDerivAt_log h1).const_mul t').sub (this.const_mul t)).congr_deriv ?_
138 simp [one_div]
139
140theorem L32_psi_deriv2 {κ t t' v : ℝ} (h1 : v ≠ 0) (h2 : v - κ ≠ 0) :
141 HasDerivAt (fun v => t' * v⁻¹ - t * (v - κ)⁻¹) (t * ((v - κ)⁻¹) ^ 2 - t' * (v⁻¹) ^ 2) v := by
142 have := ((hasDerivAt_id v).sub_const κ).fun_inv h2
143 refine (((hasDerivAt_inv h1).const_mul t').sub (this.const_mul t)).congr_deriv ?_
144 simp only [id]
145 field_simp
146 ring
147
148/-- The derivatives of the weight `qw (v - κ) qw v`. -/
149theorem Gq_deriv (κ v : ℝ) : HasDerivAt (fun v => qw (v - κ) * qw v)
150 (deriv qw (v - κ) * qw v + qw (v - κ) * deriv qw v) v :=
151 ((qw_hasDerivAt (v - κ)).comp_sub_const v κ).mul (qw_hasDerivAt v)
152
153theorem Gq_deriv2 (κ v : ℝ) :
154 HasDerivAt (fun v => deriv qw (v - κ) * qw v + qw (v - κ) * deriv qw v)
155 ((deriv (deriv qw) (v - κ) * qw v + deriv qw (v - κ) * deriv qw v) +
156 (deriv qw (v - κ) * deriv qw v + qw (v - κ) * deriv (deriv qw) v)) v :=
157 (((qw'_hasDerivAt (v - κ)).comp_sub_const v κ).mul (qw_hasDerivAt v)).add
158 (((qw_hasDerivAt (v - κ)).comp_sub_const v κ).mul (qw'_hasDerivAt v))
159
160theorem HH_deriv2_eq_zero {κ t t' v : ℝ} (h : v < 1 ∨ 4 < v) :
161 deriv (deriv (HH κ t t')) v = 0 := by
162 have hop : ∃ U : Set ℝ, IsOpen U ∧ v ∈ U ∧ ∀ w ∈ U, HH κ t t' w = 0 := by
163 rcases h with h | h
164 · exact ⟨Set.Iio 1, isOpen_Iio, h, fun w hw => HH_eq_zero (Or.inl (le_of_lt hw))⟩
165 · exact ⟨Set.Ioi 4, isOpen_Ioi, h, fun w hw => HH_eq_zero (Or.inr (le_of_lt hw))⟩
166 obtain ⟨U, hU, hv, hz⟩ := hop
167 have h0 : HH κ t t' =ᶠ[nhds v] fun _ => 0 := by
168 filter_upwards [hU.mem_nhds hv] with w hw using hz w hw
169 have h1 := h0.deriv.deriv_eq
170 rw [h1]; simp
171
172theorem HH_second : ∃ C > 0, ∀ κ t t' : ℝ, |κ| ≤ 1 / 4 → ∀ v,
173 ‖deriv (deriv (HH κ t t')) v‖ ≤ C * (1 + |t' - t| + |t * κ|) ^ 2 := by
174 obtain ⟨B, hB, hq⟩ := qw_bound
175 refine ⟨30 * B ^ 2, by positivity, fun κ t t' hκ v => ?_⟩
176 rcases lt_or_ge v 1 with hv | hv
177 · rw [HH_deriv2_eq_zero (Or.inl hv), norm_zero]; positivity
178 have hκ' := abs_le.1 hκ
179 have hb := L32_second_bound (U := Set.Ioi (3 / 4)) isOpen_Ioi
180 (fun x _ => Gq_deriv κ x) (fun x _ => Gq_deriv2 κ x)
181 (fun x hx => L32_psi_deriv (κ := κ) (t := t) (t' := t')
182 (by rw [Set.mem_Ioi] at hx; linarith) (by rw [Set.mem_Ioi] at hx; linarith))
183 (fun x hx => L32_psi_deriv2 (by rw [Set.mem_Ioi] at hx; linarith)
184 (by rw [Set.mem_Ioi] at hx; linarith)) (x := v) (by rw [Set.mem_Ioi]; linarith)
185 refine (show ‖deriv (deriv (HH κ t t')) v‖ ≤ _ from hb).trans ?_
186 clear hb
187 have ha0 : 0 ≤ v⁻¹ := by positivity
188 have hb0 : 0 ≤ (v - κ)⁻¹ := inv_nonneg.2 (by linarith)
189 have ha2 : v⁻¹ ≤ 1 := inv_le_one_of_one_le₀ hv
190 have hb2 : (v - κ)⁻¹ ≤ 2 := by
191 rw [inv_le_comm₀ (by linarith) (by norm_num)]; linarith
192 have hab : v⁻¹ - (v - κ)⁻¹ = -κ * v⁻¹ * (v - κ)⁻¹ := by
193 have : v - κ ≠ 0 := by linarith
194 have : v ≠ 0 := by linarith
195 field_simp; ring
196 set a := v⁻¹
197 set b := (v - κ)⁻¹
198 set u := t' - t with hu
199 have e1 : t' * a - t * b = u * a - t * κ * (a * b) := by
200 rw [hu]; linear_combination t * hab
201 have e2 : t * b ^ 2 - t' * a ^ 2 = -(u * a ^ 2) + t * κ * (a * b * (a + b)) := by
202 rw [hu]; linear_combination (-t * (a + b)) * hab
203 have f1 : |t' * a - t * b| ≤ |u| + 2 * |t * κ| := by
204 rw [e1]
205 refine (abs_sub _ _).trans ?_
206 rw [abs_mul, abs_mul (t * κ), abs_of_nonneg ha0, abs_of_nonneg (mul_nonneg ha0 hb0)]
207 have : a * b ≤ 2 := by nlinarith
208 nlinarith [abs_nonneg u, abs_nonneg (t * κ)]
209 have f2 : |t * b ^ 2 - t' * a ^ 2| ≤ |u| + 6 * |t * κ| := by
210 rw [e2]
211 refine (abs_add_le _ _).trans ?_
212 rw [abs_neg, abs_mul, abs_mul (t * κ), abs_of_nonneg (by positivity : 0 ≤ a ^ 2),
213 abs_of_nonneg (by positivity : 0 ≤ a * b * (a + b))]
214 have h1 : a * b ≤ 2 := by nlinarith
215 have h2 : a * b * (a + b) ≤ 6 := by nlinarith [mul_nonneg ha0 hb0]
216 have h3 : a ^ 2 ≤ 1 := by nlinarith
217 nlinarith [abs_nonneg u, abs_nonneg (t * κ)]
218 have pm : ∀ x y : ℝ, |x| ≤ B → |y| ≤ B → |x * y| ≤ B ^ 2 := fun x y hx hy => by
219 rw [abs_mul, sq]; exact mul_le_mul hx hy (abs_nonneg _) hB.le
220 obtain ⟨q0, q1, q2⟩ := hq v
221 obtain ⟨p0, p1, p2⟩ := hq (v - κ)
222 have g0 := pm _ _ p0 q0
223 have g1 : |deriv qw (v - κ) * qw v + qw (v - κ) * deriv qw v| ≤ 2 * B ^ 2 :=
224 (abs_add_le _ _).trans (by linarith [pm _ _ p1 q0, pm _ _ p0 q1])
225 have g2 : |(deriv (deriv qw) (v - κ) * qw v + deriv qw (v - κ) * deriv qw v) +
226 (deriv qw (v - κ) * deriv qw v + qw (v - κ) * deriv (deriv qw) v)| ≤ 4 * B ^ 2 :=
227 (abs_add_le _ _).trans (by
228 linarith [pm _ _ p2 q0, pm _ _ p1 q1, pm _ _ p0 q2,
229 abs_add_le (deriv (deriv qw) (v - κ) * qw v) (deriv qw (v - κ) * deriv qw v),
230 abs_add_le (deriv qw (v - κ) * deriv qw v) (qw (v - κ) * deriv (deriv qw) v)])
231 set U := |u|
232 set K := |t * κ|
233 have hU : 0 ≤ U := abs_nonneg _
234 have hK : 0 ≤ K := abs_nonneg _
235 calc _ ≤ 4 * B ^ 2 + 2 * (2 * B ^ 2) * (U + 2 * K) + B ^ 2 * ((U + 6 * K) + (U + 2 * K) ^ 2) := by
236 gcongr
237 _ = B ^ 2 * (4 + 4 * (U + 2 * K) + (U + 6 * K) + (U + 2 * K) ^ 2) := by ring
238 _ ≤ B ^ 2 * (30 * (1 + U + K) ^ 2) := by
239 gcongr; nlinarith [mul_nonneg hU hK, sq_nonneg U, sq_nonneg K]
240 _ = _ := by ring
241
242/-- Riemann sums of a `C²` function with compact support, from T9. -/
243theorem L32_riemann_sum (H : ℝ → ℂ) (hH : ContDiff ℝ 2 H) (hc : HasCompactSupport H)
244 (Y s : ℝ) (hY : 0 < Y) :
245 ‖(Y : ℂ)⁻¹ * ∑' n : ℤ, H (((n : ℝ) - s) / Y) - ∫ v, H v‖ ≤
246 (Y ^ 2)⁻¹ * ∫ v, ‖deriv (deriv H) v‖ := by
247 have hY0 : Y ≠ 0 := hY.ne'
248 have hYc : (Y : ℂ) ≠ 0 := by exact_mod_cast hY0
249 have hl : ∀ x : ℝ, HasDerivAt (fun x : ℝ => (x - s) / Y) (1 / Y) x := fun x =>
250 ((hasDerivAt_id x).sub_const s).div_const Y
251 have hH' : ContDiff ℝ 1 (deriv H) := by
252 have := hH
253 rw [show (2 : WithTop ℕ∞) = 1 + 1 by norm_num, contDiff_succ_iff_deriv] at this
254 exact this.2.2
255 have d1 : deriv (fun x : ℝ => H ((x - s) / Y)) = fun x => (1 / Y : ℝ) • deriv H ((x - s) / Y) := by
256 ext x
257 exact ((hH.differentiable (by norm_num) _).hasDerivAt.scomp x (hl x)).deriv
258 have d2 : deriv (deriv fun x : ℝ => H ((x - s) / Y)) =
259 fun x => (1 / Y : ℝ) • (1 / Y : ℝ) • deriv (deriv H) ((x - s) / Y) := by
260 rw [d1]
261 ext x
262 exact (((hH'.differentiable (by norm_num) _).hasDerivAt.scomp x (hl x)).const_smul (1 / Y : ℝ)).deriv
263 have key := T9_euler_maclaurin (fun x => H ((x - s) / Y))
264 (hH.comp ((contDiff_id.sub contDiff_const).div_const Y))
265 (hc.comp_isClosedEmbedding (((Homeomorph.addRight (-s)).trans
266 (Homeomorph.mulRight₀ Y⁻¹ (inv_ne_zero hY0))).isClosedEmbedding))
267 have i1 : ∫ x : ℝ, H ((x - s) / Y) = (Y : ℂ) * ∫ v, H v := by
268 rw [integral_sub_right_eq_self (fun x => H (x / Y)) s, Measure.integral_comp_div, abs_of_pos hY,
269 Complex.real_smul]
270 have i2 : ∫ x : ℝ, ‖deriv (deriv fun x : ℝ => H ((x - s) / Y)) x‖ =
271 Y⁻¹ * ∫ v, ‖deriv (deriv H) v‖ := by
272 rw [d2]
273 simp only [norm_smul, Real.norm_eq_abs, abs_of_pos (one_div_pos.2 hY)]
274 rw [integral_const_mul, integral_const_mul,
275 integral_sub_right_eq_self (fun x => ‖deriv (deriv H) (x / Y)‖) s,
276 Measure.integral_comp_div (fun x => ‖deriv (deriv H) x‖), abs_of_pos hY, smul_eq_mul]
277 field_simp
278 rw [i1, i2] at key
279 have e : (Y : ℂ)⁻¹ * ∑' n : ℤ, H (((n : ℝ) - s) / Y) - ∫ v, H v =
280 (Y : ℂ)⁻¹ * (∑' n : ℤ, H (((n : ℝ) - s) / Y) - (Y : ℂ) * ∫ v, H v) := by
281 field_simp
282 rw [e, norm_mul, norm_inv, Complex.norm_real, Real.norm_eq_abs, abs_of_pos hY]
283 calc _ ≤ Y⁻¹ * (Y⁻¹ * ∫ v, ‖deriv (deriv H) v‖) := by gcongr
284 _ = _ := by ring
285
286theorem HH_riemann : ∃ C > 0, ∀ κ t t' Y s : ℝ, |κ| ≤ 1 / 4 → 0 < Y →
287 ‖(Y : ℂ)⁻¹ * ∑' n : ℤ, HH κ t t' (((n : ℝ) - s) / Y) - ∫ v, HH κ t t' v‖ ≤
288 C * (Y ^ 2)⁻¹ * (1 + |t' - t| + |t * κ|) ^ 2 := by
289 obtain ⟨C, hC, h⟩ := HH_second
290 refine ⟨3 * C, by positivity, fun κ t t' Y s hκ hY => ?_⟩
291 refine (L32_riemann_sum _ (HH_contDiff κ t t') (HH_compact κ t t') Y s hY).trans ?_
292 have hI : ∫ v, ‖deriv (deriv (HH κ t t')) v‖ ≤ C * (1 + |t' - t| + |t * κ|) ^ 2 * 3 := by
293 rw [← setIntegral_eq_integral_of_forall_compl_eq_zero (s := Set.Icc 1 4) (fun x hx => by
294 rw [Set.mem_Icc, not_and_or, not_le, not_le] at hx
295 rw [HH_deriv2_eq_zero hx, norm_zero])]
296 have := norm_setIntegral_le_of_norm_le_const (μ := volume) (s := Set.Icc (1 : ℝ) 4)
297 (f := fun v => ‖deriv (deriv (HH κ t t')) v‖) (C := C * (1 + |t' - t| + |t * κ|) ^ 2)
298 (by simp) (fun x _ => by rw [norm_norm]; exact h κ t t' hκ x)
299 refine (le_abs_self _).trans (this.trans (le_of_eq ?_))
300 norm_num [Measure.real]
301 calc _ ≤ (Y ^ 2)⁻¹ * (C * (1 + |t' - t| + |t * κ|) ^ 2 * 3) := by gcongr
302 _ = _ := by ring
303
304end E424
305