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/Tools/T1.lean

All files · 308 lines · source at the verified commit

1module
2
3public import E424.ToolDefs
4
5@[expose] public section
6
7/-!
8# Erdős 424: tool T1. Absolute existential constants; Mathlib only.
9
10Gallagher's proof: Sobolev's inequality on disjoint intervals around the points, then Parseval.
11-/
12
13set_option linter.style.header false
14open Finset MeasureTheory
15
16namespace E424
17
18namespace LS
19
20theorem ee_add (x y : ℝ) : ee (x + y) = ee x * ee y := by
21 unfold ee
22 rw [← Complex.exp_add]
23 congr 1
24 push_cast
25 ring
26
27theorem norm_ee (x : ℝ) : ‖ee x‖ = 1 := by
28 unfold ee
29 exact Complex.norm_exp_ofReal_mul_I _
30
31theorem ee_int (k : ℤ) : ee k = 1 := by
32 unfold ee
33 rw [← Complex.exp_int_mul_two_pi_mul_I k]
34 congr 1
35 push_cast
36 ring
37
38theorem ee_add_int (x : ℝ) (k : ℤ) : ee (x + k) = ee x := by
39 rw [ee_add, ee_int, mul_one]
40
41theorem conj_ee (x : ℝ) : starRingEnd ℂ (ee x) = ee (-x) := by
42 unfold ee
43 rw [← Complex.exp_conj]
44 congr 1
45 rw [map_mul, Complex.conj_I, Complex.conj_ofReal]
46 push_cast
47 ring
48
49theorem hasDerivAt_ee (m x : ℝ) :
50 HasDerivAt (fun x : ℝ => ee (m * x)) ((2 * Real.pi * m : ℝ) * Complex.I * ee (m * x)) x := by
51 unfold ee
52 have h1 : HasDerivAt (fun x : ℝ => 2 * Real.pi * (m * x)) (2 * Real.pi * m) x := by
53 simpa [mul_assoc] using ((hasDerivAt_id x).const_mul m).const_mul (2 * Real.pi)
54 convert (h1.ofReal_comp.mul_const Complex.I).cexp using 1
55 ring
56
57theorem continuous_ee (m : ℝ) : Continuous fun x : ℝ => ee (m * x) :=
58 continuous_iff_continuousAt.mpr fun x => (hasDerivAt_ee m x).continuousAt
59
60@[fun_prop]
61theorem continuous_ee' : Continuous ee := by simpa using continuous_ee 1
62
63theorem integral_ee (k : ℤ) : ∫ x in (-1 : ℝ)..2, ee (k * x) = if k = 0 then 3 else 0 := by
64 split_ifs with hk
65 · subst hk
66 simp [ee]
67 norm_num
68 · have hne : ((2 * Real.pi * k : ℝ) : ℂ) * Complex.I ≠ 0 := by
69 refine mul_ne_zero ?_ Complex.I_ne_zero
70 rw [Complex.ofReal_ne_zero]
71 have : (k : ℝ) ≠ 0 := by exact_mod_cast hk
72 positivity
73 have hd : ∀ x ∈ Set.uIcc (-1 : ℝ) 2, HasDerivAt
74 (fun x : ℝ => ee (k * x) / (((2 * Real.pi * k : ℝ) : ℂ) * Complex.I)) (ee (k * x)) x := by
75 intro x _
76 exact ((hasDerivAt_ee k x).div_const (((2 * Real.pi * k : ℝ) : ℂ) * Complex.I)).congr_deriv
77 (mul_div_cancel_left₀ _ hne)
78 rw [intervalIntegral.integral_eq_sub_of_hasDerivAt hd
79 ((continuous_ee k).intervalIntegrable _ _)]
80 have h1 : ee ((k : ℝ) * 2) = 1 := by exact_mod_cast ee_int (k * 2)
81 have h2 : ee ((k : ℝ) * (-1)) = 1 := by exact_mod_cast ee_int (k * (-1))
82 rw [h1, h2, sub_self]
83
84/-- Trigonometric polynomial with frequencies `n - M`. -/
85noncomputable def tpoly (T : Finset ℤ) (M : ℤ) (c : ℤ → ℂ) (x : ℝ) : ℂ :=
86 ∑ n ∈ T, c n * ee (((n - M : ℤ) : ℝ) * x)
87
88theorem continuous_tpoly (T : Finset ℤ) (M : ℤ) (c : ℤ → ℂ) : Continuous (tpoly T M c) :=
89 continuous_finsetSum _ fun _ _ => continuous_const.mul (continuous_ee _)
90
91theorem hasDerivAt_tpoly (T : Finset ℤ) (M : ℤ) (c : ℤ → ℂ) (x : ℝ) :
92 HasDerivAt (tpoly T M c)
93 (tpoly T M (fun n => (2 * Real.pi * (n - M : ℤ) : ℝ) * Complex.I * c n) x) x := by
94 refine HasDerivAt.congr_deriv (HasDerivAt.fun_sum fun n _ =>
95 (hasDerivAt_ee ((n - M : ℤ) : ℝ) x).const_mul (c n)) (sum_congr rfl fun n _ => by ring)
96
97/-- Parseval on three periods. -/
98theorem integral_tpoly (T : Finset ℤ) (M : ℤ) (c : ℤ → ℂ) :
99 ∫ x in (-1 : ℝ)..2, ‖tpoly T M c x‖ ^ 2 = 3 * ∑ n ∈ T, ‖c n‖ ^ 2 := by
100 have key : ((∫ x in (-1 : ℝ)..2, ‖tpoly T M c x‖ ^ 2 : ℝ) : ℂ) =
101 ((3 * ∑ n ∈ T, ‖c n‖ ^ 2 : ℝ) : ℂ) := by
102 rw [← intervalIntegral.integral_ofReal]
103 have h1 : ∀ x : ℝ, ((‖tpoly T M c x‖ ^ 2 : ℝ) : ℂ) =
104 ∑ n ∈ T, ∑ m ∈ T, c n * starRingEnd ℂ (c m) * ee (((n - m : ℤ) : ℝ) * x) := by
105 intro x
106 rw [Complex.ofReal_pow, ← Complex.mul_conj', tpoly, map_sum, sum_mul_sum]
107 refine sum_congr rfl fun n _ => sum_congr rfl fun m _ => ?_
108 rw [map_mul, conj_ee]
109 have : ((n - m : ℤ) : ℝ) * x = ((n - M : ℤ) : ℝ) * x + -(((m - M : ℤ) : ℝ) * x) := by
110 push_cast; ring
111 rw [this, ee_add]
112 ring
113 simp_rw [h1]
114 rw [intervalIntegral.integral_finsetSum]
115 swap
116 · exact fun n _ => Continuous.intervalIntegrable (by fun_prop) _ _
117 rw [Complex.ofReal_mul, Complex.ofReal_sum, mul_sum]
118 refine sum_congr rfl fun n hn => ?_
119 rw [intervalIntegral.integral_finsetSum]
120 swap
121 · exact fun m _ => Continuous.intervalIntegrable (by fun_prop) _ _
122 simp_rw [intervalIntegral.integral_const_mul, integral_ee, sub_eq_zero]
123 rw [sum_eq_single n (fun m _ hm => by rw [if_neg hm.symm, mul_zero]) (fun h => absurd hn h)]
124 rw [if_pos rfl, Complex.mul_conj']
125 push_cast
126 ring
127 exact_mod_cast key
128
129/-- Sobolev's inequality on an interval. -/
130theorem sobolev_point {g g' h : ℝ → ℝ} (hg : ∀ x, HasDerivAt g (g' x) x) (hg' : Continuous g')
131 (hh : Continuous h) (hle : ∀ x, |g' x| ≤ h x) {γ δ : ℝ} (hδ : 0 < δ) :
132 g γ ≤ ∫ x in (γ - δ / 2)..(γ + δ / 2), (1 / δ * g x + h x) := by
133 have hgc : Continuous g := continuous_iff_continuousAt.mpr fun x => (hg x).continuousAt
134 have hh0 : ∀ x, 0 ≤ h x := fun x => (abs_nonneg _).trans (hle x)
135 set I := ∫ x in (γ - δ / 2)..(γ + δ / 2), h x with hI
136 have hpt : ∀ x ∈ Set.Icc (γ - δ / 2) (γ + δ / 2), g γ - I ≤ g x := by
137 intro x hx
138 have h1 : g γ - g x = ∫ y in x..γ, g' y :=
139 (intervalIntegral.integral_eq_sub_of_hasDerivAt (fun y _ => hg y)
140 (hg'.intervalIntegrable _ _)).symm
141 have h2 : |∫ y in x..γ, g' y| ≤ |∫ y in x..γ, h y| := by
142 refine intervalIntegral.norm_integral_le_abs_of_norm_le (μ := volume) (f := g') (g := h) ?_
143 (hh.intervalIntegrable _ _)
144 exact Filter.Eventually.of_forall fun y => hle y
145 have h3 : |∫ y in x..γ, h y| ≤ I := by
146 rw [abs_le]
147 rcases le_total x γ with hxγ | hxγ
148 · have h4 : 0 ≤ ∫ y in x..γ, h y := intervalIntegral.integral_nonneg hxγ fun y _ => hh0 y
149 have h5 : ∫ y in x..γ, h y ≤ I :=
150 intervalIntegral.integral_mono_interval hx.1 hxγ (by linarith)
151 (Filter.Eventually.of_forall hh0) (hh.intervalIntegrable _ _)
152 constructor <;> linarith
153 · have h4 : 0 ≤ ∫ y in γ..x, h y := intervalIntegral.integral_nonneg hxγ fun y _ => hh0 y
154 have h5 : ∫ y in γ..x, h y ≤ I :=
155 intervalIntegral.integral_mono_interval (by linarith) hxγ hx.2
156 (Filter.Eventually.of_forall hh0) (hh.intervalIntegrable _ _)
157 rw [intervalIntegral.integral_symm]
158 constructor <;> linarith
159 have := (le_abs_self _).trans (h2.trans h3)
160 linarith
161 have hint : ∫ _x in (γ - δ / 2)..(γ + δ / 2), (g γ - I) ≤ ∫ x in (γ - δ / 2)..(γ + δ / 2), g x :=
162 intervalIntegral.integral_mono_on (by linarith) (by simp) (hgc.intervalIntegrable _ _) hpt
163 rw [intervalIntegral.integral_const, smul_eq_mul] at hint
164 rw [intervalIntegral.integral_add (Continuous.intervalIntegrable (u := fun x => 1 / δ * g x)
165 (by fun_prop) _ _) (hh.intervalIntegrable _ _), intervalIntegral.integral_const_mul, ← hI]
166 have : g γ - I ≤ 1 / δ * ∫ x in (γ - δ / 2)..(γ + δ / 2), g x := by
167 rw [one_div, ← div_eq_inv_mul, le_div_iff₀ hδ]
168 linarith
169 linarith
170
171/-- The core estimate, points in `[0,1)`, `δ ≤ 1`. -/
172theorem large_sieve_core {ι : Type} (s : Finset ι) (γ : ι → ℝ) {δ : ℝ} (hδ : 0 < δ) (hδ1 : δ ≤ 1)
173 (h01 : ∀ i ∈ s, 0 ≤ γ i ∧ γ i < 1)
174 (hsep : ∀ i ∈ s, ∀ j ∈ s, i ≠ j → δ ≤ |γ i - γ j|)
175 (M : ℤ) (N : ℕ) (hN : 1 ≤ N) (a : ℤ → ℂ) :
176 ∑ i ∈ s, ‖tpoly (Ico M (M + N)) M a (γ i)‖ ^ 2 ≤
177 3 * (1 / δ + N + 4 * Real.pi ^ 2 * N) * ∑ n ∈ Ico M (M + N), ‖a n‖ ^ 2 := by
178 set T := Ico M (M + N)
179 have hN0 : (0 : ℝ) < N := by exact_mod_cast hN
180 set S := tpoly T M a with hS
181 set S' := tpoly T M (fun n => (2 * Real.pi * (n - M : ℤ) : ℝ) * Complex.I * a n) with hS'
182 have hSc : Continuous S := continuous_tpoly _ _ _
183 have hSc' : Continuous S' := continuous_tpoly _ _ _
184 set h : ℝ → ℝ := fun x => N * ‖S x‖ ^ 2 + 1 / N * ‖S' x‖ ^ 2 with hh
185 have hhc : Continuous h := by fun_prop
186 set G : ℝ → ℝ := fun x => 1 / δ * ‖S x‖ ^ 2 + h x with hG
187 have hGc : Continuous G := by fun_prop
188 have hG0 : ∀ x, 0 ≤ G x := fun x => by simp only [hG, hh]; positivity
189 have hpt : ∀ i ∈ s, ‖S (γ i)‖ ^ 2 ≤ ∫ x in Set.Ioo (γ i - δ / 2) (γ i + δ / 2), G x := by
190 intro i _
191 have := sobolev_point (g := fun x => ‖S x‖ ^ 2) (g' := fun x => 2 * inner ℝ (S x) (S' x))
192 (h := h) (fun x => (hasDerivAt_tpoly T M a x).norm_sq)
193 (by fun_prop) hhc (fun x => ?_) (γ := γ i) hδ
194 · rwa [intervalIntegral.integral_of_le (by linarith), integral_Ioc_eq_integral_Ioo] at this
195 · have h1 := abs_real_inner_le_norm (S x) (S' x)
196 have h2 : 0 ≤ 1 / (N : ℝ) * (N * ‖S x‖ - ‖S' x‖) ^ 2 := by positivity
197 have h3 : 1 / (N : ℝ) * (N * ‖S x‖ - ‖S' x‖) ^ 2 =
198 N * ‖S x‖ ^ 2 - 2 * (‖S x‖ * ‖S' x‖) + 1 / N * ‖S' x‖ ^ 2 := by
199 field_simp; ring
200 rw [abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 2)]
201 simp only [hh]
202 linarith
203 have hdisj : Set.Pairwise (s : Set ι)
204 (Function.onFun Disjoint fun i => Set.Ioo (γ i - δ / 2) (γ i + δ / 2)) := by
205 intro i hi j hj hij
206 rw [Function.onFun, Set.disjoint_left]
207 intro x hx hx'
208 have := hsep i hi j hj hij
209 have : |γ i - γ j| < δ := by
210 rw [abs_lt]; constructor <;> linarith [hx.1, hx.2, hx'.1, hx'.2]
211 linarith
212 have hGi : IntegrableOn G (Set.Ioc (-1) 2) :=
213 (hGc.integrableOn_Icc).mono_set Set.Ioc_subset_Icc_self
214 have hsub : (⋃ i ∈ s, Set.Ioo (γ i - δ / 2) (γ i + δ / 2)) ⊆ Set.Ioc (-1) 2 := by
215 intro x hx
216 simp only [Set.mem_iUnion] at hx
217 obtain ⟨i, hi, hx⟩ := hx
218 have := h01 i hi
219 constructor <;> linarith [hx.1, hx.2]
220 have hsum : ∑ i ∈ s, ∫ x in Set.Ioo (γ i - δ / 2) (γ i + δ / 2), G x ≤
221 ∫ x in (-1 : ℝ)..2, G x := by
222 rw [← integral_biUnion_finset s (fun i _ => measurableSet_Ioo) hdisj
223 (fun i hi => hGi.mono_set ((Set.subset_biUnion_of_mem (u := fun i =>
224 Set.Ioo (γ i - δ / 2) (γ i + δ / 2)) hi).trans hsub)),
225 intervalIntegral.integral_of_le (by norm_num)]
226 exact setIntegral_mono_set hGi (Filter.Eventually.of_forall hG0) hsub.eventuallyLE
227 refine (sum_le_sum hpt).trans (hsum.trans ?_)
228 have hGint : ∫ x in (-1 : ℝ)..2, G x = 1 / δ * (3 * ∑ n ∈ T, ‖a n‖ ^ 2) +
229 (N * (3 * ∑ n ∈ T, ‖a n‖ ^ 2) + 1 / N * (3 * ∑ n ∈ T,
230 ‖(2 * Real.pi * (n - M : ℤ) : ℝ) * Complex.I * a n‖ ^ 2)) := by
231 simp only [hG, hh]
232 rw [intervalIntegral.integral_add ((by fun_prop : Continuous _).intervalIntegrable _ _)
233 ((by fun_prop : Continuous _).intervalIntegrable _ _),
234 intervalIntegral.integral_add ((by fun_prop : Continuous _).intervalIntegrable _ _)
235 ((by fun_prop : Continuous _).intervalIntegrable _ _)]
236 simp only [intervalIntegral.integral_const_mul, hS, hS', integral_tpoly]
237 rw [hGint]
238 have hder : ∑ n ∈ T, ‖(2 * Real.pi * (n - M : ℤ) : ℝ) * Complex.I * a n‖ ^ 2 ≤
239 4 * Real.pi ^ 2 * N ^ 2 * ∑ n ∈ T, ‖a n‖ ^ 2 := by
240 rw [mul_sum]
241 refine sum_le_sum fun n hn => ?_
242 rw [norm_mul, norm_mul, Complex.norm_I, mul_one, Complex.norm_real, Real.norm_eq_abs, mul_pow,
243 sq_abs]
244 refine mul_le_mul_of_nonneg_right ?_ (by positivity)
245 have hn := mem_Ico.mp hn
246 have h1 : (0 : ℝ) ≤ ((n - M : ℤ) : ℝ) := by exact_mod_cast (by omega : (0 : ℤ) ≤ n - M)
247 have h2 : ((n - M : ℤ) : ℝ) ≤ N := by exact_mod_cast (by omega : n - M ≤ (N : ℤ))
248 have h3 : ((n - M : ℤ) : ℝ) ^ 2 ≤ (N : ℝ) ^ 2 := by gcongr
249 have : 0 < Real.pi ^ 2 := by positivity
250 rw [mul_pow, mul_pow]
251 nlinarith
252 have h4 : 1 / (N : ℝ) * (3 * ∑ n ∈ T, ‖(2 * Real.pi * (n - M : ℤ) : ℝ) * Complex.I * a n‖ ^ 2) ≤
253 1 / (N : ℝ) * (3 * (4 * Real.pi ^ 2 * N ^ 2 * ∑ n ∈ T, ‖a n‖ ^ 2)) := by gcongr
254 have h5 : 1 / (N : ℝ) * (3 * (4 * Real.pi ^ 2 * N ^ 2 * ∑ n ∈ T, ‖a n‖ ^ 2)) =
255 3 * (4 * Real.pi ^ 2 * N) * ∑ n ∈ T, ‖a n‖ ^ 2 := by field_simp
256 nlinarith
257
258end LS
259
260open LS in
261/-- **T1**, large sieve. `γ` is `δ`-separated mod 1. -/
262theorem T1_large_sieve : ∃ C > 0, ∀ (ι : Type) (s : Finset ι) (γ : ι → ℝ) (δ : ℝ), 0 < δ →
263 (∀ i ∈ s, ∀ j ∈ s, i ≠ j → ∀ k : ℤ, δ ≤ |γ i - γ j - k|) →
264 ∀ (M : ℤ) (N : ℕ) (a : ℤ → ℂ),
265 ∑ i ∈ s, ‖∑ n ∈ Ico M (M + N), a n * ee (n * γ i)‖ ^ 2 ≤
266 C * (N + 1 / δ) * ∑ n ∈ Ico M (M + N), ‖a n‖ ^ 2 := by
267 refine ⟨3 * (2 + 4 * Real.pi ^ 2), by positivity, fun ι s γ δ hδ hsep M N a => ?_⟩
268 rcases Nat.eq_zero_or_pos N with rfl | hN
269 · simp
270 have hfr : ∀ i, ‖∑ n ∈ Ico M (M + N), a n * ee (n * γ i)‖ =
271 ‖tpoly (Ico M (M + N)) M a (Int.fract (γ i))‖ := by
272 intro i
273 have : ∑ n ∈ Ico M (M + N), a n * ee (n * γ i) =
274 ee (M * γ i) * tpoly (Ico M (M + N)) M a (Int.fract (γ i)) := by
275 rw [tpoly, mul_sum]
276 refine sum_congr rfl fun n _ => ?_
277 have h : (n : ℝ) * γ i = M * γ i + (((n - M : ℤ) : ℝ) * Int.fract (γ i) +
278 ((n - M) * ⌊γ i⌋ : ℤ)) := by
279 simp only [Int.fract]; push_cast; ring
280 rw [h, ee_add, ee_add_int]
281 ring
282 rw [this, norm_mul, norm_ee, one_mul]
283 rw [sum_congr rfl fun i _ => by rw [hfr i]]
284 have hN1 : (1 : ℝ) ≤ N := by exact_mod_cast hN
285 have hcore := large_sieve_core s (fun i => Int.fract (γ i)) (δ := min δ 1)
286 (lt_min hδ one_pos) (min_le_right _ _)
287 (fun i _ => ⟨Int.fract_nonneg _, Int.fract_lt_one _⟩) (fun i hi j hj hij => ?_) M N hN a
288 · refine hcore.trans (mul_le_mul_of_nonneg_right ?_ (sum_nonneg fun _ _ => by positivity))
289 have h1 : 1 / min δ 1 ≤ 1 / δ + N := by
290 rcases min_choice δ 1 with h | h <;> rw [h]
291 · linarith
292 · have : 0 < 1 / δ := by positivity
293 linarith
294 have h2 : 0 < Real.pi ^ 2 := by positivity
295 have h3 : 0 < 1 / δ := by positivity
296 nlinarith [mul_pos h2 h3]
297 · refine (min_le_left _ _).trans ?_
298 have h := hsep i hi j hj hij (⌊γ i⌋ - ⌊γ j⌋)
299 have h' : Int.fract (γ i) - Int.fract (γ j) =
300 γ i - γ j - ((⌊γ i⌋ - ⌊γ j⌋ : ℤ) : ℝ) := by
301 rw [← Int.self_sub_floor, ← Int.self_sub_floor]
302 push_cast
303 ring
304 change δ ≤ |Int.fract (γ i) - Int.fract (γ j)|
305 rwa [h']
306
307end E424
308