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

All files · 261 lines · source at the verified commit

1module
2
3public import E424.HighBand.L35Aux4
4
5@[expose] public section
6
7/-!
8# Lemma 35, part 5: the bound with all parameters explicit
9-/
10
11set_option linter.style.header false
12open Finset MeasureTheory
13
14namespace E424.Sm35
15
16/-- `∑_N` of the coarse smoothings is `F̄`. -/
17theorem sum_Sm_eq_Fb (W : Win) (hlo : 1 ≤ W.lo) {Q x : ℝ} (hQ : 10 ≤ Q)
18 (hx1 : 20 * W.lo ≤ Real.exp x) (hx2 : 20 * Real.exp x ≤ W.hi) :
19 ∑ k ∈ W.dy, Sm (2 ^ k) Q x = Fb Q x := by
20 have hQ0 : 0 < Q := by linarith
21 set X := Real.exp x with hX
22 have hX0 : 0 < X := Real.exp_pos x
23 have hM1 : Real.exp (x + 1) ≤ (⌈W.hi⌉₊ : ℝ) := by
24 refine le_trans ?_ (Nat.le_ceil _)
25 rw [Real.exp_add]
26 have := Real.exp_one_lt_d9
27 nlinarith
28 rw [Fb_eq (by linarith) hM1]
29 have h1 : ∀ k ∈ W.dy, Sm (2 ^ k) Q x = ∑ n ∈ Icc 1 ⌈W.hi⌉₊, cf (2 ^ k) n * tri Q (x - Real.log n) := by
30 intro k hk
31 refine Sm_extend (by positivity) ?_
32 have := (mem_filter.mp hk).2.2
33 have hp : (0 : ℝ) < 2 ^ k := by positivity
34 exact le_trans (by linarith) (Nat.le_ceil W.hi)
35 rw [sum_congr rfl h1, sum_comm]
36 refine sum_congr rfl fun n hn => ?_
37 rw [← sum_mul]
38 by_cases hz : tri Q (x - Real.log n) = 0
39 · rw [hz, mul_zero, mul_zero]
40 congr 1
41 have hδ : 1 / Q ≤ 1 / 10 := by gcongr
42 have h2 := near (by norm_num) (by norm_num) (mem_Icc.mp hn).1
43 ((lt_of_tri_ne_zero hQ0 hz).le.trans hδ)
44 have h3 := sum_gw W (by linarith) (y := n) (by nlinarith [h2.1]) (by nlinarith [h2.2])
45 (by nlinarith [h2.1])
46 unfold cf
47 rw [← sum_div, ← sum_mul, h3, one_mul]
48
49set_option maxHeartbeats 1600000 in
50/-- The bound with explicit parameters. -/
51theorem explicit_bound : ∃ K > 0, ∀ (W : Win) (Q H T : ℝ) (M : ℕ) (d D : ℝ), 1 ≤ W.lo → W.lo < W.hi → 6 ≤ W.len →
52 10 ≤ Q → 2 ≤ H → 20 * H ^ 2 ≤ W.lo → Q * H ≤ W.lo → 20 * H ≤ M → (M : ℝ) ≤ 21 * H → (M : ℝ) ≤ W.lo →
53 0 < T → T ≤ H → 1 ≤ T → 0 ≤ d → 0 ≤ D →
54 (∀ k ∈ W.dy, ((2 : ℝ) ^ k) ^ (0.58 : ℝ) ≤ d * Q) →
55 (∀ h : ℕ, 1 ≤ h → h ≤ M → W.sum (fun n => ind (F (n + h) ≠ F n)) ≤ D * W.len) →
56 (∫ x in (Real.log W.lo + 3)..(Real.log W.hi - 3), (F ⌊Real.exp x⌋₊ - Fb Q x) ^ 2) ≤
57 2 * (∑ k ∈ W.dy, ∫ t in {t : ℝ | ((2 : ℝ) ^ k) ^ (0.58 : ℝ) ≤ |t| ∧ |t| ≤ 2 ^ k / T},
58 ‖Fp (2 ^ k) t‖ ^ 2) + K * (1 / H ^ 2 + D + d ^ 2 + (T / H) ^ 4) * W.len := by
59 obtain ⟨C, hC, hstep⟩ := step1
60 obtain ⟨K, hK, hwt⟩ := weight_bound
61 refine ⟨64 * C ^ 2 + 2688 * C ^ 2 * 42 + 4 * K, by positivity, ?_⟩
62 intro W Q H T M d D hlo hlt hlen hQ hH hHlo hQH hM1 hM2 hM3 hT hTH hT1 hd hD hdk hDh
63 have hlo0 : 0 < W.lo := by linarith
64 have hhi0 : 0 < W.hi := by linarith
65 have hH0 : 0 < H := by linarith
66 have hQ0 : 0 < Q := by linarith
67 have hlen' : W.len = Real.log W.hi - Real.log W.lo := Real.log_div hhi0.ne' hlo0.ne'
68 have hE : 20 ≤ Real.exp 3 := by
69 have e : Real.exp 3 = Real.exp 1 ^ 3 := by rw [← Real.exp_nat_mul]; norm_num
70 rw [e]
71 have := Real.exp_one_gt_d9
72 calc (20 : ℝ) ≤ 2.7182818283 ^ 3 := by norm_num
73 _ ≤ _ := by gcongr
74 have hdy : ∀ k ∈ W.dy, 4 * W.lo ≤ (2 : ℝ) ^ k ∧ 16 * (2 : ℝ) ^ k ≤ W.hi := fun k hk => (mem_filter.mp hk).2
75 -- the two families of smoothings
76 set S1 : ℕ → ℝ → ℝ := fun k x => Sm (2 ^ k) (2 ^ k / H) x with hS1
77 set S2 : ℕ → ℝ → ℝ := fun k x => Sm (2 ^ k) Q x with hS2
78 have hab : Real.log W.lo + 3 ≤ Real.log W.hi - 3 := by linarith
79 -- pointwise bound
80 have hpt : ∀ x ∈ Set.Icc (Real.log W.lo + 3) (Real.log W.hi - 3),
81 (F ⌊Real.exp x⌋₊ - Fb Q x) ^ 2 ≤ 64 * C ^ 2 / H ^ 2 + 2688 * C ^ 2 / H * Kf M ⌊Real.exp x⌋₊ +
82 8 * ∑ k ∈ W.dy, (S1 k x - S2 k x) ^ 2 := by
83 intro x hx
84 set X := Real.exp x with hX
85 have hX0 : 0 < X := Real.exp_pos x
86 have hX1 : 20 * W.lo ≤ X := by
87 calc 20 * W.lo ≤ Real.exp 3 * W.lo := by gcongr
88 _ = Real.exp (Real.log W.lo + 3) := by rw [Real.exp_add, Real.exp_log hlo0, mul_comm]
89 _ ≤ X := Real.exp_le_exp.mpr hx.1
90 have hX2 : 20 * X ≤ W.hi := by
91 have h1 : X ≤ W.hi / Real.exp 3 := by
92 calc X ≤ Real.exp (Real.log W.hi - 3) := Real.exp_le_exp.mpr hx.2
93 _ = _ := by rw [Real.exp_sub, Real.exp_log hhi0]
94 rw [le_div_iff₀ (Real.exp_pos 3)] at h1
95 nlinarith
96 set m := ⌊X⌋₊ with hm
97 have hK0 := Kf_nonneg M m
98 have hK1 : Kf M m ≤ 42 * H := (Kf_le M m).trans (by linarith)
99 have hgw := sum_gw W hlo0 (y := X) (by linarith) (by linarith) (by linarith)
100 have hFsum : F m = ∑ k ∈ W.dy, gw (X / 2 ^ k) * F m := by rw [← sum_mul, hgw, one_mul]
101 have hFb := sum_Sm_eq_Fb W hlo hQ hX1 hX2
102 have hout : ∀ k : ℕ, ¬(X / 8 < 2 ^ k ∧ (2 : ℝ) ^ k < 2 * X) → X ≤ 2 ^ k / 2 ∨ 8 * 2 ^ k ≤ X := by
103 intro k hk
104 rw [not_and_or, not_lt, not_lt] at hk
105 rcases hk with hk | hk
106 · right; linarith
107 · left; linarith
108 have hrk : ∀ k ∈ W.dy, (10 : ℝ) ≤ 2 ^ k / H := by
109 intro k hk
110 rw [le_div_iff₀ hH0]
111 have := (hdy k hk).1
112 nlinarith
113 set u := ∑ k ∈ W.dy, (gw (X / 2 ^ k) * F m - S1 k x) with hu
114 set v := ∑ k ∈ W.dy, (S1 k x - S2 k x) with hv
115 have huv : F m - Fb Q x = u + v := by
116 rw [hu, hv, ← sum_add_distrib, ← hFb]
117 nth_rewrite 1 [hFsum]
118 rw [← sum_sub_distrib]
119 exact sum_congr rfl fun k _ => by ring
120 have hu2 : u ^ 2 ≤ 16 * (C / H * (1 + Kf M m)) ^ 2 := by
121 set B := C / H * (1 + Kf M m) with hB
122 have hB0 : 0 ≤ B := by positivity
123 have hk1 : ∀ k ∈ W.dy, (gw (X / 2 ^ k) * F m - S1 k x) ^ 2 ≤
124 if X / 8 < 2 ^ k ∧ (2 : ℝ) ^ k < 2 * X then B ^ 2 else 0 := by
125 intro k hk
126 split_ifs with hc
127 · rw [← sq_abs, abs_sub_comm]
128 refine pow_le_pow_left₀ (abs_nonneg _) ?_ 2
129 exact hstep (2 ^ k) H x M hH (by have := (hdy k hk).1; linarith) hM1
130 · simp only [hS1]
131 rw [gw_exp_eq_zero (by positivity) (hout k hc), Sm_eq_zero (by positivity) (hrk k hk) (hout k hc)]
132 simp
133 have h1 := sq_sum_overlap W.dy X (fun k => gw (X / 2 ^ k) * F m - S1 k x) (fun k hk hc => by
134 simp only [hS1]
135 rw [gw_exp_eq_zero (by positivity) (hout k hc), Sm_eq_zero (by positivity) (hrk k hk) (hout k hc)]
136 simp)
137 refine h1.trans ?_
138 have h2 := sum_le_sum hk1
139 rw [← sum_filter, sum_const, nsmul_eq_mul] at h2
140 have h3 : ((W.dy.filter fun k : ℕ => X / 8 < 2 ^ k ∧ (2 : ℝ) ^ k < 2 * X).card : ℝ) ≤ 4 := by
141 exact_mod_cast card_overlap W.dy X
142 have h4 := mul_le_mul_of_nonneg_right h3 (sq_nonneg B)
143 linarith
144 have hv2 : v ^ 2 ≤ 4 * ∑ k ∈ W.dy, (S1 k x - S2 k x) ^ 2 :=
145 sq_sum_overlap W.dy X (fun k => S1 k x - S2 k x) (fun k hk hc => by
146 simp only [hS1, hS2]
147 rw [Sm_eq_zero (by positivity) (hrk k hk) (hout k hc),
148 Sm_eq_zero (by positivity) hQ (hout k hc), sub_zero])
149 have hB2 : (C / H * (1 + Kf M m)) ^ 2 ≤ 2 * C ^ 2 / H ^ 2 + 84 * C ^ 2 / H * Kf M m := by
150 have e1 : (C / H * (1 + Kf M m)) ^ 2 = C ^ 2 / H ^ 2 * (1 + Kf M m) ^ 2 := by ring
151 have e2 : 2 * C ^ 2 / H ^ 2 + 84 * C ^ 2 / H * Kf M m =
152 C ^ 2 / H ^ 2 * (2 + 2 * (42 * H) * Kf M m) := by field_simp; ring
153 rw [e1, e2]
154 refine mul_le_mul_of_nonneg_left ?_ (by positivity)
155 nlinarith [sq_nonneg (1 - Kf M m)]
156 rw [huv]
157 have e3 : 64 * C ^ 2 / H ^ 2 + 2688 * C ^ 2 / H * Kf M m =
158 32 * (2 * C ^ 2 / H ^ 2 + 84 * C ^ 2 / H * Kf M m) := by ring
159 rw [e3]
160 have e4 : (u + v) ^ 2 ≤ 2 * u ^ 2 + 2 * v ^ 2 := by linarith [sq_nonneg (u - v), sub_sq u v, add_sq u v]
161 linarith
162 -- integrate
163 have hcont : ∀ k, Continuous fun x => (S1 k x - S2 k x) ^ 2 := fun k =>
164 ((continuous_Sm _ _).sub (continuous_Sm _ _)).pow 2
165 have hKint : IntervalIntegrable (fun x => Kf M ⌊Real.exp x⌋₊) volume (Real.log W.lo + 3)
166 (Real.log W.hi - 3) :=
167 integrable_floor_exp (B := 2 * M) (fun n => by rw [abs_of_nonneg (Kf_nonneg M n)]; exact Kf_le M n) _ _
168 have hSint : IntervalIntegrable (fun x => ∑ k ∈ W.dy, (S1 k x - S2 k x) ^ 2) volume
169 (Real.log W.lo + 3) (Real.log W.hi - 3) :=
170 (continuous_finsetSum _ fun k _ => hcont k).intervalIntegrable _ _
171 have hmono : (∫ x in (Real.log W.lo + 3)..(Real.log W.hi - 3), (F ⌊Real.exp x⌋₊ - Fb Q x) ^ 2) ≤
172 ∫ x in (Real.log W.lo + 3)..(Real.log W.hi - 3), (64 * C ^ 2 / H ^ 2 +
173 2688 * C ^ 2 / H * Kf M ⌊Real.exp x⌋₊ + 8 * ∑ k ∈ W.dy, (S1 k x - S2 k x) ^ 2) := by
174 have hR := ((intervalIntegrable_const (c := 64 * C ^ 2 / H ^ 2)).add
175 (hKint.const_mul (2688 * C ^ 2 / H))).add (hSint.const_mul 8)
176 rw [intervalIntegral.integral_of_le hab, intervalIntegral.integral_of_le hab]
177 refine integral_mono_of_nonneg (Filter.Eventually.of_forall fun x => sq_nonneg _) hR.1 ?_
178 refine (ae_restrict_iff' measurableSet_Ioc).mpr (Filter.Eventually.of_forall fun x hx => ?_)
179 exact hpt x ⟨hx.1.le, hx.2⟩
180 refine hmono.trans ?_
181 rw [intervalIntegral.integral_add ((intervalIntegrable_const).add (hKint.const_mul _))
182 (hSint.const_mul _), intervalIntegral.integral_add intervalIntegrable_const (hKint.const_mul _),
183 intervalIntegral.integral_const, intervalIntegral.integral_const_mul,
184 intervalIntegral.integral_const_mul, smul_eq_mul]
185 -- part 1
186 have q1 : (Real.log W.hi - 3 - (Real.log W.lo + 3)) * (64 * C ^ 2 / H ^ 2) ≤
187 64 * C ^ 2 * (1 / H ^ 2) * W.len := by
188 have : 64 * C ^ 2 * (1 / H ^ 2) * W.len = W.len * (64 * C ^ 2 / H ^ 2) := by ring
189 rw [this]
190 refine mul_le_mul_of_nonneg_right (by linarith) (by positivity)
191 -- part 2
192 have q2 : 2688 * C ^ 2 / H * (∫ x in (Real.log W.lo + 3)..(Real.log W.hi - 3), Kf M ⌊Real.exp x⌋₊) ≤
193 2688 * C ^ 2 * 42 * D * W.len := by
194 have h1 := int_Kf W hlo hlt hlen M hM3 (D * W.len) hDh
195 have h2 : 2 * (M : ℝ) * (D * W.len) ≤ 2 * (21 * H) * (D * W.len) := by gcongr
196 calc _ ≤ 2688 * C ^ 2 / H * (2 * (21 * H) * (D * W.len)) := by gcongr; linarith
197 _ = _ := by field_simp; ring
198 -- part 3
199 have q3 : ∀ k ∈ W.dy, ∫ x in (Real.log W.lo + 3)..(Real.log W.hi - 3), (S1 k x - S2 k x) ^ 2 ≤
200 (1 / 4) * (K * (d ^ 2 + (T / H) ^ 4) + ∫ t in {t : ℝ | ((2 : ℝ) ^ k) ^ (0.58 : ℝ) ≤ |t| ∧
201 |t| ≤ 2 ^ k / T}, ‖Fp (2 ^ k) t‖ ^ 2) := by
202 intro k hk
203 obtain ⟨hk1, hk2⟩ := hdy k hk
204 set N : ℝ := 2 ^ k with hN
205 have hN1 : 1 ≤ N := by linarith
206 have hN0 : 0 < N := by linarith
207 have hq : 0 < N / H := by positivity
208 have hs1 : HasCompactSupport fun x => (S1 k x - S2 k x) ^ 2 :=
209 ((hasCompactSupport_Sm N hq).sub (hasCompactSupport_Sm N hQ0)).comp_left (g := fun y : ℝ => y ^ 2)
210 (by simp)
211 have h1 : ∫ x in (Real.log W.lo + 3)..(Real.log W.hi - 3), (S1 k x - S2 k x) ^ 2 ≤
212 ∫ x, (S1 k x - S2 k x) ^ 2 := by
213 rw [intervalIntegral.integral_of_le hab]
214 exact setIntegral_le_integral ((hcont k).integrable_of_hasCompactSupport hs1)
215 (Filter.Eventually.of_forall fun x => sq_nonneg _)
216 have h2 := plancherel_Sm hq hQ0 N
217 have h3 := hwt N (N ^ (0.58 : ℝ)) (N / T) (N / H) Q hN1 (by positivity)
218 (by
219 calc N ^ (0.58 : ℝ) ≤ N ^ (1 : ℝ) := Real.rpow_le_rpow_of_exponent_le hN1 (by norm_num)
220 _ = N := Real.rpow_one N) (by positivity) (div_le_self hN0.le hT1) hQ0
221 (by rw [le_div_iff₀ hH0]; linarith)
222 have e1 : N / H / (N / T) = T / H := by field_simp
223 rw [e1, h2] at h3
224 have h4 : (N ^ (0.58 : ℝ) / Q) ^ 2 ≤ d ^ 2 := by
225 refine pow_le_pow_left₀ (by positivity) ?_ 2
226 rw [div_le_iff₀ hQ0]; exact hdk k hk
227 have h5 : K * ((N ^ (0.58 : ℝ) / Q) ^ 2 + (T / H) ^ 4) ≤ K * (d ^ 2 + (T / H) ^ 4) := by gcongr
228 have h6 : 0 ≤ ∫ x, (S1 k x - S2 k x) ^ 2 := integral_nonneg fun x => sq_nonneg _
229 have h7 : 4 * ∫ x, (S1 k x - S2 k x) ^ 2 ≤ 2 * Real.pi * ∫ x, (S1 k x - S2 k x) ^ 2 := by
230 have := Real.pi_gt_three
231 nlinarith
232 refine h1.trans ?_
233 have h8 := h7.trans h3
234 linarith
235 have q4 : ∫ x in (Real.log W.lo + 3)..(Real.log W.hi - 3), ∑ k ∈ W.dy, (S1 k x - S2 k x) ^ 2 ≤
236 ∑ k ∈ W.dy, (1 / 4) * (K * (d ^ 2 + (T / H) ^ 4) + ∫ t in {t : ℝ | ((2 : ℝ) ^ k) ^ (0.58 : ℝ) ≤ |t| ∧
237 |t| ≤ 2 ^ k / T}, ‖Fp (2 ^ k) t‖ ^ 2) := by
238 rw [intervalIntegral.integral_finsetSum fun k _ => (hcont k).intervalIntegrable _ _]
239 exact sum_le_sum q3
240 rw [← mul_sum, sum_add_distrib, sum_const, nsmul_eq_mul] at q4
241 set Z := ∑ k ∈ W.dy, ∫ t in {t : ℝ | ((2 : ℝ) ^ k) ^ (0.58 : ℝ) ≤ |t| ∧ |t| ≤ 2 ^ k / T},
242 ‖Fp (2 ^ k) t‖ ^ 2 with hZ
243 have q5 : (W.dy.card : ℝ) * (K * (d ^ 2 + (T / H) ^ 4)) ≤ 2 * W.len * (K * (d ^ 2 + (T / H) ^ 4)) :=
244 mul_le_mul_of_nonneg_right (card_dy W hlo hlt hlen) (by positivity)
245 set a1 := 1 / H ^ 2 with ha1
246 set a4 := d ^ 2 + (T / H) ^ 4 with ha4
247 have n1 : 0 ≤ a1 := by positivity
248 have n4 : 0 ≤ a4 := by positivity
249 have nL : 0 ≤ W.len := by linarith
250 have e : (64 * C ^ 2 + 2688 * C ^ 2 * 42 + 4 * K) * (a1 + D + d ^ 2 + (T / H) ^ 4) * W.len =
251 64 * C ^ 2 * a1 * W.len + 2688 * C ^ 2 * 42 * D * W.len + 4 * W.len * (K * a4) +
252 (64 * C ^ 2 * (D + a4) * W.len + 2688 * C ^ 2 * 42 * (a1 + a4) * W.len +
253 4 * K * (a1 + D) * W.len) := by rw [ha4]; ring
254 rw [e]
255 have r1 : 0 ≤ 64 * C ^ 2 * (D + a4) * W.len := by positivity
256 have r2 : 0 ≤ 2688 * C ^ 2 * 42 * (a1 + a4) * W.len := by positivity
257 have r3 : 0 ≤ 4 * K * (a1 + D) * W.len := by positivity
258 linarith
259
260end E424.Sm35
261