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

All files · 408 lines · source at the verified commit

1module
2
3public import E424.DirichletError.Basic
4public import E424.Tools.T4
5public import E424.Tools.T11
6
7@[expose] public section
8
9/-!
10# Lemma 35, part 1: the triangle kernel, Riemann sums over `log n`, bounds for `F̄`
11-/
12
13set_option linter.style.header false
14open Finset MeasureTheory
15
16namespace E424.Sm35
17
18/- ## The triangle kernel -/
19
20theorem tri_nonneg {r : ℝ} (hr : 0 ≤ r) (u : ℝ) : 0 ≤ tri r u :=
21 mul_nonneg hr (le_max_left _ _)
22
23theorem tri_le {r : ℝ} (hr : 0 ≤ r) (u : ℝ) : tri r u ≤ r := by
24 unfold tri
25 have : max 0 (1 - r * |u|) ≤ 1 := max_le zero_le_one (by nlinarith [abs_nonneg u])
26 nlinarith
27
28theorem tri_eq_zero {r u : ℝ} (hr : 0 < r) (h : 1 / r ≤ |u|) : tri r u = 0 := by
29 rw [div_le_iff₀ hr] at h
30 unfold tri
31 rw [max_eq_left (by linarith), mul_zero]
32
33theorem lt_of_tri_ne_zero {r u : ℝ} (hr : 0 < r) (h : tri r u ≠ 0) : |u| < 1 / r := by
34 by_contra hc
35 exact h (tri_eq_zero hr (not_lt.mp hc))
36
37theorem tri_lip {r : ℝ} (hr : 0 ≤ r) (u v : ℝ) : |tri r u - tri r v| ≤ r ^ 2 * |u - v| := by
38 unfold tri
39 rw [← mul_sub, abs_mul, abs_of_nonneg hr, pow_two, mul_assoc]
40 refine mul_le_mul_of_nonneg_left ?_ hr
41 have h1 : |max 0 (1 - r * |u|) - max 0 (1 - r * |v|)| ≤ |(1 - r * |u|) - (1 - r * |v|)| := by
42 rw [max_comm 0, max_comm 0]; exact abs_max_sub_max_le_abs (1 - r * |u|) (1 - r * |v|) 0
43 refine h1.trans ?_
44 have : (1 - r * |u|) - (1 - r * |v|) = r * (|v| - |u|) := by ring
45 rw [this, abs_mul, abs_of_nonneg hr, abs_sub_comm u v]
46 exact mul_le_mul_of_nonneg_left (abs_abs_sub_abs_le v u) hr
47
48theorem continuous_tri (r : ℝ) : Continuous (tri r) := by
49 unfold tri; fun_prop
50
51theorem integral_tri {r : ℝ} (hr : 0 < r) : ∫ u, tri r u = 1 := by
52 have h := T11_fourier_tri r 0 hr
53 simp only [zero_mul, neg_zero, Complex.ofReal_zero, Complex.exp_zero, mul_one, zero_div,
54 Real.sinc_zero, one_pow, Complex.ofReal_one] at h
55 rw [integral_complex_ofReal] at h
56 exact_mod_cast h
57
58/- ## Counting -/
59
60theorem card_le {M : ℕ} {a b : ℝ} (h : a ≤ b) :
61 (((Icc 1 M).filter fun n : ℕ => a ≤ n ∧ (n : ℝ) ≤ b).card : ℝ) ≤ b - a + 1 := by
62 by_cases hb : 0 ≤ b
63 · have hsub : ((Icc 1 M).filter fun n : ℕ => a ≤ n ∧ (n : ℝ) ≤ b) ⊆ Icc ⌈a⌉₊ ⌊b⌋₊ := by
64 intro n hn
65 rw [mem_filter] at hn
66 rw [mem_Icc]
67 exact ⟨Nat.ceil_le.mpr hn.2.1, Nat.le_floor hn.2.2⟩
68 have h1 := card_le_card hsub
69 rw [Nat.card_Icc] at h1
70 have h2 : ((⌊b⌋₊ + 1 - ⌈a⌉₊ : ℕ) : ℝ) ≤ b - a + 1 := by
71 rcases le_total ⌈a⌉₊ (⌊b⌋₊ + 1) with h3 | h3
72 · rw [Nat.cast_sub h3]
73 push_cast
74 have := Nat.floor_le hb
75 have := Nat.le_ceil a
76 linarith
77 · rw [Nat.sub_eq_zero_of_le h3]; push_cast; linarith
78 exact le_trans (by exact_mod_cast h1) h2
79 · rw [filter_false_of_mem]
80 · simp; linarith
81 · rintro n _ ⟨_, h2⟩
82 exact hb ((Nat.cast_nonneg n).trans h2)
83
84/-- `e^δ ≤ 1 + δ + δ²`. -/
85theorem exp_le {δ : ℝ} (h0 : 0 ≤ δ) (h1 : δ ≤ 1) : Real.exp δ ≤ 1 + δ + δ ^ 2 := by
86 have := Real.abs_exp_sub_one_sub_id_le (x := δ) (by rw [abs_of_nonneg h0]; exact h1)
87 have := (abs_le.mp this).2
88 linarith
89
90/-- The `n` with `|x - log n| ≤ δ`. -/
91theorem near {x δ : ℝ} (h0 : 0 ≤ δ) (h1 : δ ≤ 1) {n : ℕ} (hn : 1 ≤ n) (h : |x - Real.log n| ≤ δ) :
92 Real.exp x * (1 - δ) ≤ n ∧ (n : ℝ) ≤ Real.exp x * (1 + 2 * δ) := by
93 have hn0 : (0 : ℝ) < n := by exact_mod_cast hn
94 rw [abs_le] at h
95 have e : (n : ℝ) = Real.exp x * Real.exp (Real.log n - x) := by
96 rw [← Real.exp_add, add_sub_cancel, Real.exp_log hn0]
97 rw [e]
98 constructor
99 · refine mul_le_mul_of_nonneg_left ?_ (Real.exp_pos x).le
100 have := Real.add_one_le_exp (Real.log n - x)
101 linarith
102 · refine mul_le_mul_of_nonneg_left ?_ (Real.exp_pos x).le
103 calc Real.exp (Real.log n - x) ≤ Real.exp δ := Real.exp_le_exp.mpr (by linarith)
104 _ ≤ 1 + δ + δ ^ 2 := exp_le h0 h1
105 _ ≤ 1 + 2 * δ := by nlinarith
106
107/- ## Riemann sum -/
108
109theorem cell {r : ℝ} (hr : 1 ≤ r) (x : ℝ) {n : ℕ} (hn : 1 ≤ n) :
110 |(∫ u in Real.log n..Real.log (n + 1 : ℕ), tri r (x - u)) - tri r (x - Real.log n) / n| ≤
111 2 * r ^ 2 / (n : ℝ) ^ 2 := by
112 have hn0 : (0 : ℝ) < n := by exact_mod_cast hn
113 set d := Real.log (n + 1 : ℕ) - Real.log n with hd
114 have hd' : d = Real.log (1 + 1 / n) := by
115 rw [hd, ← Real.log_div (by positivity) hn0.ne']; push_cast; congr 1; field_simp
116 have hd1 : d ≤ 1 / n := by
117 rw [hd']; have := Real.log_le_sub_one_of_pos (show 0 < 1 + 1 / (n : ℝ) by positivity); linarith
118 have hd0 : 1 / (n : ℝ) - 1 / (n : ℝ) ^ 2 ≤ d := by
119 rw [hd']
120 have := Real.one_sub_inv_le_log_of_pos (show 0 < 1 + 1 / (n : ℝ) by positivity)
121 refine le_trans ?_ this
122 rw [← sub_nonneg]
123 have : 1 - (1 + 1 / (n : ℝ))⁻¹ - (1 / n - 1 / (n : ℝ) ^ 2) = 1 / ((n : ℝ) ^ 2 * (n + 1)) := by
124 field_simp; ring
125 rw [this]; positivity
126 have hdpos : 0 ≤ d := by
127 rw [hd']; exact Real.log_nonneg (by linarith [show 0 < 1 / (n : ℝ) by positivity])
128 have hle : Real.log n ≤ Real.log (n + 1 : ℕ) := by linarith
129 have e1 : (∫ u in Real.log n..Real.log (n + 1 : ℕ), tri r (x - u)) - d * tri r (x - Real.log n) =
130 ∫ u in Real.log n..Real.log (n + 1 : ℕ), (tri r (x - u) - tri r (x - Real.log n)) := by
131 rw [intervalIntegral.integral_sub, intervalIntegral.integral_const, smul_eq_mul]
132 · exact ((continuous_tri r).comp (by fun_prop)).intervalIntegrable _ _
133 · exact continuous_const.intervalIntegrable _ _
134 have h1 : |(∫ u in Real.log n..Real.log (n + 1 : ℕ), tri r (x - u)) - d * tri r (x - Real.log n)| ≤
135 r ^ 2 * (1 / n) * (1 / n) := by
136 rw [e1]
137 have := intervalIntegral.norm_integral_le_of_norm_le_const (a := Real.log n)
138 (b := Real.log (n + 1 : ℕ)) (C := r ^ 2 * (1 / n))
139 (f := fun u => tri r (x - u) - tri r (x - Real.log n)) (fun u hu => by
140 rw [Set.uIoc_of_le hle] at hu
141 rw [Real.norm_eq_abs]
142 refine (tri_lip (by linarith) _ _).trans ?_
143 refine mul_le_mul_of_nonneg_left ?_ (by positivity)
144 rw [abs_le]
145 constructor <;> linarith [hu.1, hu.2])
146 rw [Real.norm_eq_abs] at this
147 refine this.trans ?_
148 refine mul_le_mul_of_nonneg_left ?_ (by positivity)
149 rw [abs_of_nonneg hdpos]; exact hd1
150 have h2 : |d * tri r (x - Real.log n) - tri r (x - Real.log n) / n| ≤ r * (1 / (n : ℝ) ^ 2) := by
151 have : d * tri r (x - Real.log n) - tri r (x - Real.log n) / n =
152 tri r (x - Real.log n) * (d - 1 / n) := by ring
153 rw [this, abs_mul, abs_of_nonneg (tri_nonneg (by linarith) _)]
154 refine mul_le_mul (tri_le (by linarith) _) ?_ (abs_nonneg _) (by linarith)
155 rw [abs_le]; constructor <;> [linarith; linarith [show 0 < 1 / (n : ℝ) ^ 2 by positivity]]
156 have h3 := abs_sub_le (∫ u in Real.log n..Real.log (n + 1 : ℕ), tri r (x - u))
157 (d * tri r (x - Real.log n)) (tri r (x - Real.log n) / n)
158 refine h3.trans ((add_le_add h1 h2).trans ?_)
159 have : r ^ 2 * (1 / n) * (1 / n) + r * (1 / (n : ℝ) ^ 2) = (r ^ 2 + r) / (n : ℝ) ^ 2 := by
160 field_simp
161 rw [this]
162 gcongr
163 nlinarith
164
165/-- `∑ tri_r(x - log n) / n = 1 + O(r e^{-x})`. -/
166theorem riemann {r : ℝ} (hr : 10 ≤ r) {x : ℝ} (hx : r ≤ Real.exp x) {M : ℕ}
167 (hM : Real.exp (x + 1) ≤ M) :
168 |(∑ n ∈ Icc 1 M, tri r (x - Real.log n) / n) - 1| ≤ 40 * r / Real.exp x := by
169 have hr0 : 0 < r := by linarith
170 set X := Real.exp x with hX
171 have hX0 : 0 < X := Real.exp_pos x
172 have hδ : 1 / r ≤ 1 / 10 := by gcongr
173 have hδ0 : 0 < 1 / r := by positivity
174 have hxlog : Real.log r ≤ x := by
175 rw [← Real.log_exp x]; exact Real.log_le_log hr0 hx
176 have hx1 : 1 ≤ x := by
177 refine le_trans ?_ hxlog
178 rw [Real.le_log_iff_exp_le hr0]; linarith [Real.exp_one_lt_d9]
179 have hM0 : 0 < (M : ℝ) := (Real.exp_pos _).trans_le hM
180 have hMlog : x + 1 ≤ Real.log (M + 1 : ℕ) := by
181 rw [Real.le_log_iff_exp_le (by positivity)]; push_cast; linarith
182 -- the integral as a sum over cells
183 have h1 : ∫ u in Real.log (1 : ℕ)..Real.log (M + 1 : ℕ), tri r (x - u) = 1 := by
184 rw [intervalIntegral.integral_eq_integral_of_support_subset]
185 · rw [integral_sub_left_eq_self (tri r) volume x, integral_tri hr0]
186 · intro u hu
187 have := abs_lt.mp (lt_of_tri_ne_zero hr0 hu)
188 simp only [Nat.cast_one, Real.log_one, Set.mem_Ioc]
189 constructor <;> linarith
190 have h2 := intervalIntegral.sum_integral_adjacent_intervals_Ico (f := fun u => tri r (x - u))
191 (a := fun k : ℕ => Real.log k) (μ := volume) (m := 1) (n := M + 1) (by omega)
192 (fun k _ => ((continuous_tri r).comp (by fun_prop)).intervalIntegrable _ _)
193 rw [h1] at h2
194 have hIco : Ico 1 (M + 1) = Icc 1 M := by ext; simp
195 rw [hIco] at h2
196 rw [← h2, ← sum_sub_distrib]
197 set S := (Icc 1 M).filter fun n : ℕ => X * (1 - 1 / r) - 1 ≤ n ∧ (n : ℝ) ≤ X * (1 + 2 * (1 / r))
198 with hS
199 have h3 : ∀ n ∈ Icc 1 M, |tri r (x - Real.log n) / n -
200 ∫ u in Real.log n..Real.log (n + 1 : ℕ), tri r (x - u)| ≤
201 if X * (1 - 1 / r) - 1 ≤ n ∧ (n : ℝ) ≤ X * (1 + 2 * (1 / r)) then 8 * r ^ 2 / X ^ 2 else 0 := by
202 intro n hn
203 have hn1 : 1 ≤ n := (mem_Icc.mp hn).1
204 have hn0 : (0 : ℝ) < n := by exact_mod_cast hn1
205 split_ifs with hc
206 · rw [abs_sub_comm]
207 refine (cell (by linarith) x hn1).trans ?_
208 have : X / 2 ≤ n := by
209 have : X * (1 / r) ≤ X * (1 / 10) := by gcongr
210 nlinarith [hc.1]
211 calc 2 * r ^ 2 / (n : ℝ) ^ 2 ≤ 2 * r ^ 2 / (X / 2) ^ 2 := by gcongr
212 _ = 8 * r ^ 2 / X ^ 2 := by field_simp; ring
213 · rw [not_and_or, not_le, not_le] at hc
214 have hlog : Real.log n ≤ Real.log (n + 1 : ℕ) := Real.log_le_log hn0 (by push_cast; linarith)
215 have hz : ∀ u ∈ Set.Icc (Real.log n) (Real.log (n + 1 : ℕ)), tri r (x - u) = 0 := by
216 intro u hu
217 by_contra hne
218 have hlt := abs_lt.mp (lt_of_tri_ne_zero hr0 hne)
219 rcases hc with hc | hc
220 · have h4 : Real.exp u ≤ n + 1 := by
221 have := Real.exp_le_exp.mpr hu.2
222 rwa [Real.exp_log (by positivity), Nat.cast_add, Nat.cast_one] at this
223 have h5 : X * (1 - 1 / r) ≤ Real.exp u := by
224 have e : Real.exp u = X * Real.exp (u - x) := by rw [hX, ← Real.exp_add]; ring_nf
225 rw [e]
226 refine mul_le_mul_of_nonneg_left ?_ hX0.le
227 have := Real.add_one_le_exp (u - x)
228 linarith
229 linarith
230 · have h4 : (n : ℝ) ≤ Real.exp u := by
231 have := Real.exp_le_exp.mpr hu.1
232 rwa [Real.exp_log hn0] at this
233 have h5 : Real.exp u ≤ X * (1 + 2 * (1 / r)) := by
234 have e : Real.exp u = X * Real.exp (u - x) := by rw [hX, ← Real.exp_add]; ring_nf
235 rw [e]
236 refine mul_le_mul_of_nonneg_left ?_ hX0.le
237 calc Real.exp (u - x) ≤ Real.exp (1 / r) := Real.exp_le_exp.mpr (by linarith)
238 _ ≤ 1 + 1 / r + (1 / r) ^ 2 := exp_le hδ0.le (by linarith)
239 _ ≤ _ := by nlinarith
240 linarith
241 rw [hz _ ⟨le_rfl, hlog⟩]
242 rw [intervalIntegral.integral_congr (g := fun _ => 0) (fun u hu => by
243 rw [Set.uIcc_of_le hlog] at hu; exact hz u hu)]
244 simp
245 refine (abs_sum_le_sum_abs _ _).trans ((sum_le_sum h3).trans ?_)
246 rw [← sum_filter, sum_const, nsmul_eq_mul]
247 have hcard := card_le (M := M) (a := X * (1 - 1 / r) - 1) (b := X * (1 + 2 * (1 / r))) (by
248 have : 0 ≤ X * (1 / r) := by positivity
249 nlinarith)
250 have hXr : 1 ≤ X * (1 / r) := by rw [mul_one_div, le_div_iff₀ hr0]; linarith
251 calc _ ≤ (X * (1 + 2 * (1 / r)) - (X * (1 - 1 / r) - 1) + 1) * (8 * r ^ 2 / X ^ 2) := by gcongr
252 _ ≤ (5 * (X * (1 / r))) * (8 * r ^ 2 / X ^ 2) := by gcongr; nlinarith
253 _ = 40 * r / X := by field_simp; ring
254
255/- ## `F̄` -/
256
257theorem Fb_eq {Q x : ℝ} (hQ : 1 ≤ Q) {M : ℕ} (hM : Real.exp (x + 1) ≤ M) :
258 Fb Q x = ∑ n ∈ Icc 1 M, F n / n * tri Q (x - Real.log n) := by
259 unfold Fb
260 refine sum_subset (Icc_subset_Icc_right (Nat.floor_le_of_le hM)) fun n hn hn' => ?_
261 rw [mem_Icc] at hn hn'
262 have h1 : ⌊Real.exp (x + 1)⌋₊ < n := by
263 by_contra hc; exact hn' ⟨hn.1, not_lt.mp hc⟩
264 have h2 := (Nat.floor_lt (Real.exp_pos _).le).mp h1
265 have hn0 : (0 : ℝ) < n := by exact_mod_cast hn.1
266 have h3 : x + 1 < Real.log n := (Real.lt_log_iff_exp_lt hn0).mpr h2
267 rw [tri_eq_zero (by linarith), mul_zero]
268 have : 1 / Q ≤ 1 := (div_le_one (by linarith)).mpr hQ
269 rw [abs_sub_comm]
270 exact this.trans ((by linarith : 1 ≤ Real.log n - x).trans (le_abs_self _))
271
272theorem Fb_nonneg {Q : ℝ} (hQ : 0 ≤ Q) (x : ℝ) : 0 ≤ Fb Q x :=
273 sum_nonneg fun n _ => mul_nonneg (div_nonneg (F_nonneg n) n.cast_nonneg) (tri_nonneg hQ _)
274
275theorem Fb_le {Q x : ℝ} (hQ : 10 ≤ Q) (hx : Q ≤ Real.exp x) : Fb Q x ≤ 1 + 40 * Q / Real.exp x := by
276 obtain ⟨M, hM⟩ := exists_nat_ge (Real.exp (x + 1))
277 rw [Fb_eq (by linarith) hM]
278 have h := (abs_le.mp (riemann hQ hx hM)).2
279 have : ∑ n ∈ Icc 1 M, F n / n * tri Q (x - Real.log n) ≤
280 ∑ n ∈ Icc 1 M, tri Q (x - Real.log n) / n := by
281 refine sum_le_sum fun n _ => ?_
282 rw [div_mul_eq_mul_div]
283 refine div_le_div_of_nonneg_right ?_ n.cast_nonneg
284 have := tri_nonneg (r := Q) (by linarith) (x - Real.log n)
285 nlinarith [F_le_one n]
286 linarith
287
288theorem Fb_lip_near {Q x x' : ℝ} (hQ : 100 ≤ Q) (hx : 10 * Q ≤ Real.exp x) (hle : x ≤ x')
289 (h : x' - x ≤ 1 / (2 * Q)) : |Fb Q x - Fb Q x'| ≤ 4 * Q * |x - x'| := by
290 have hQ0 : 0 < Q := by linarith
291 set X := Real.exp x with hX
292 have hX0 : 0 < X := Real.exp_pos x
293 obtain ⟨M, hM⟩ := exists_nat_ge (max (Real.exp (x + 1)) (Real.exp (x' + 1)))
294 rw [Fb_eq (by linarith) ((le_max_left _ _).trans hM), Fb_eq (by linarith) ((le_max_right _ _).trans hM),
295 ← sum_sub_distrib]
296 set δ := 1 / Q with hδ
297 have hδ0 : 0 < δ := by positivity
298 have hδ1 : δ ≤ 1 / 100 := by rw [hδ]; gcongr
299 have hhalf : 1 / (2 * Q) = δ / 2 := by rw [hδ]; field_simp
300 rw [hhalf] at h
301 have h3 : ∀ n ∈ Icc 1 M, |F n / n * tri Q (x - Real.log n) - F n / n * tri Q (x' - Real.log n)| ≤
302 if X * (1 - δ) ≤ n ∧ (n : ℝ) ≤ X * (1 + 3 / 2 * δ + 9 / 4 * δ ^ 2) then
303 1 / (X * (1 - δ)) * (Q ^ 2 * |x - x'|) else 0 := by
304 intro n hn
305 have hn1 : 1 ≤ n := (mem_Icc.mp hn).1
306 have hn0 : (0 : ℝ) < n := by exact_mod_cast hn1
307 have e : (n : ℝ) = X * Real.exp (Real.log n - x) := by
308 rw [hX, ← Real.exp_add, add_sub_cancel, Real.exp_log hn0]
309 split_ifs with hc
310 · rw [← mul_sub, abs_mul]
311 have hX1 : 0 < X * (1 - δ) := mul_pos hX0 (by linarith)
312 refine mul_le_mul ?_ ?_ (abs_nonneg _) (by positivity)
313 · rw [abs_of_nonneg (div_nonneg (F_nonneg n) hn0.le)]
314 calc F n / n ≤ 1 / n := by gcongr; exact F_le_one n
315 _ ≤ _ := one_div_le_one_div_of_le hX1 hc.1
316 · refine (tri_lip hQ0.le _ _).trans (le_of_eq ?_)
317 rw [sub_sub_sub_cancel_right]
318 · have hz : ∀ y, x ≤ y → y ≤ x' → tri Q (y - Real.log n) = 0 := by
319 intro y hy1 hy2
320 by_contra hne
321 have hlt := abs_lt.mp (lt_of_tri_ne_zero hQ0 hne)
322 refine hc ⟨?_, ?_⟩
323 · rw [e]
324 refine mul_le_mul_of_nonneg_left ?_ hX0.le
325 have := Real.add_one_le_exp (Real.log n - x)
326 linarith
327 · rw [e]
328 refine mul_le_mul_of_nonneg_left ?_ hX0.le
329 calc Real.exp (Real.log n - x) ≤ Real.exp (3 / 2 * δ) := Real.exp_le_exp.mpr (by linarith)
330 _ ≤ 1 + 3 / 2 * δ + (3 / 2 * δ) ^ 2 := exp_le (by positivity) (by linarith)
331 _ ≤ _ := by nlinarith
332 rw [hz x le_rfl hle, hz x' hle le_rfl]; simp
333 refine (abs_sum_le_sum_abs _ _).trans ((sum_le_sum h3).trans ?_)
334 rw [← sum_filter, sum_const, nsmul_eq_mul]
335 have hcard := card_le (M := M) (a := X * (1 - δ)) (b := X * (1 + 3 / 2 * δ + 9 / 4 * δ ^ 2)) (by
336 refine mul_le_mul_of_nonneg_left ?_ hX0.le
337 nlinarith)
338 have hX1 : 0 < 1 - δ := by linarith
339 have hXr : 1 ≤ X * δ / 10 := by
340 rw [hδ, mul_one_div, div_div, le_div_iff₀ (by positivity)]; linarith
341 have hc2 : X * (1 + 3 / 2 * δ + 9 / 4 * δ ^ 2) - X * (1 - δ) + 1 ≤ 3 * (X * δ) := by
342 have : X * δ * δ ≤ X * δ * (1 / 100) := by gcongr
343 nlinarith
344 calc _ ≤ 3 * (X * δ) * (1 / (X * (1 - δ)) * (Q ^ 2 * |x - x'|)) := by gcongr; linarith
345 _ = 3 * δ / (1 - δ) * (Q ^ 2 * |x - x'|) := by field_simp
346 _ ≤ 4 * δ * (Q ^ 2 * |x - x'|) := by
347 gcongr
348 rw [div_le_iff₀ hX1]; nlinarith
349 _ = 4 * Q * |x - x'| := by rw [hδ]; field_simp
350
351theorem Fb_lip {Q x x' : ℝ} (hQ : 100 ≤ Q) (hx : 40 * Q ≤ Real.exp x) (hx' : 40 * Q ≤ Real.exp x') :
352 |Fb Q x - Fb Q x'| ≤ 4 * Q * |x - x'| := by
353 have hQ0 : 0 < Q := by linarith
354 wlog hle : x ≤ x' generalizing x x'
355 · rw [abs_sub_comm, abs_sub_comm x]; exact this hx' hx (le_of_not_ge hle)
356 by_cases h : x' - x ≤ 1 / (2 * Q)
357 · exact Fb_lip_near hQ (by linarith) hle h
358 · have b : ∀ y, 40 * Q ≤ Real.exp y → 0 ≤ Fb Q y ∧ Fb Q y ≤ 2 := by
359 intro y hy
360 refine ⟨Fb_nonneg hQ0.le y, (Fb_le (by linarith) (by linarith)).trans ?_⟩
361 have : 40 * Q / Real.exp y ≤ 1 := (div_le_one (Real.exp_pos y)).mpr hy
362 linarith
363 have h1 := b x hx
364 have h2 := b x' hx'
365 have h3 : |Fb Q x - Fb Q x'| ≤ 2 := by rw [abs_le]; constructor <;> linarith
366 refine h3.trans ?_
367 rw [not_le] at h
368 have h4 : 1 / (2 * Q) ≤ |x - x'| := by rw [abs_sub_comm]; exact h.le.trans (le_abs_self _)
369 calc (2 : ℝ) = 4 * Q * (1 / (2 * Q)) := by field_simp; norm_num
370 _ ≤ _ := by gcongr
371
372/-- Bounds for `F̄` in the range of Lemma 35. -/
373theorem bounds : ∃ N0 : ℝ, ∀ lo ≥ N0, ∀ x, Real.log lo + 1 ≤ x →
374 0 ≤ Fb (Qs lo) x ∧ Fb (Qs lo) x ≤ 1 + lo ^ (-(0.4 : ℝ)) ∧
375 ∀ x', Real.log lo + 1 ≤ x' → |Fb (Qs lo) x - Fb (Qs lo) x'| ≤ 4 * Qs lo * |x - x'| := by
376 have ev1 : ∀ᶠ lo : ℝ in Filter.atTop, 100 ≤ lo ^ (0.59 : ℝ) :=
377 (tendsto_rpow_atTop (by norm_num)).eventually_ge_atTop _
378 have ev2 : ∀ᶠ lo : ℝ in Filter.atTop, 40 ≤ lo ^ (0.01 : ℝ) :=
379 (tendsto_rpow_atTop (by norm_num)).eventually_ge_atTop _
380 obtain ⟨N0, h⟩ := Filter.eventually_atTop.mp (ev1.and (ev2.and (Filter.eventually_ge_atTop 1)))
381 refine ⟨N0, fun lo hlo x hx => ?_⟩
382 obtain ⟨h1, h2, h3⟩ := h lo hlo
383 have hlo0 : 0 < lo := by linarith
384 have hQ : 100 ≤ Qs lo := h1
385 have key : 40 * Qs lo ≤ lo * lo ^ (-(0.4 : ℝ)) := by
386 calc 40 * Qs lo ≤ lo ^ (0.01 : ℝ) * lo ^ (0.59 : ℝ) := by unfold Qs; gcongr
387 _ = lo ^ (1 : ℝ) * lo ^ (-(0.4 : ℝ)) := by
388 rw [← Real.rpow_add hlo0, ← Real.rpow_add hlo0]; norm_num
389 _ = _ := by rw [Real.rpow_one]
390 have hle1 : lo ^ (-(0.4 : ℝ)) ≤ 1 := Real.rpow_le_one_of_one_le_of_nonpos h3 (by norm_num)
391 have hexp : ∀ y, Real.log lo + 1 ≤ y → lo ≤ Real.exp y := by
392 intro y hy
393 rw [← Real.log_le_iff_le_exp hlo0]; linarith
394 have hQ' : ∀ y, Real.log lo + 1 ≤ y → 40 * Qs lo ≤ Real.exp y := by
395 intro y hy
396 refine key.trans (le_trans ?_ (hexp y hy))
397 nlinarith
398 refine ⟨Fb_nonneg (by linarith) x, ?_, fun x' hx' => Fb_lip hQ (hQ' x hx) (hQ' x' hx')⟩
399 refine (Fb_le (by linarith) (by linarith [hQ' x hx])).trans ?_
400 have : 40 * Qs lo / Real.exp x ≤ lo ^ (-(0.4 : ℝ)) := by
401 rw [div_le_iff₀ (Real.exp_pos x)]
402 refine key.trans ?_
403 rw [mul_comm]
404 exact mul_le_mul_of_nonneg_left (hexp x hx) (by positivity)
405 linarith
406
407end E424.Sm35
408