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/RoughElements/L8.lean

All files · 222 lines · source at the verified commit

1module
2
3public import E424.RoughElements.L7
4public import E424.RoughElements.L8Aux
5
6@[expose] public section
7
8/-!
9# Section 3 of the outline: L8
10-/
11
12set_option linter.style.header false
13open Finset
14
15namespace E424
16
17namespace LS
18
19theorem coprime_q {m : ℕ} (h6 : m.Coprime 6) (h35 : m.Coprime 35) : m.Coprime Inp.q := by
20 have h2 : m.Coprime 2 := h6.coprime_dvd_right (by norm_num)
21 have h3 : m.Coprime 3 := h6.coprime_dvd_right (by norm_num)
22 have h5 : m.Coprime 5 := h35.coprime_dvd_right (by norm_num)
23 have h7 : m.Coprime 7 := h35.coprime_dvd_right (by norm_num)
24 unfold Inp.q
25 exact ((h2.pow_right _).mul_right (h3.pow_right _)).mul_right (h5.pow_right _) |>.mul_right (h7.pow_right _)
26
27theorem coprime_84 {m : ℕ} (k : ℕ) (h6 : m.Coprime 6) (h35 : m.Coprime 35) :
28 m.Coprime (84 * 6 ^ k) := by
29 have h3 : m.Coprime 3 := h6.coprime_dvd_right (by norm_num)
30 have h7 : m.Coprime 7 := h35.coprime_dvd_right (by norm_num)
31 have h2 : m.Coprime 2 := h6.coprime_dvd_right (by norm_num)
32 have h84 : m.Coprime (2 * 2 * 3 * 7) := ((h2.mul_right h2).mul_right h3).mul_right h7
33 exact (by simpa using h84 : m.Coprime 84).mul_right (h6.pow_right _)
34
35/-- `e(ξ s(x) / e)` splits into an additive character of `x` and a function of `x mod P`. -/
36theorem ee_sfun {P k : ℕ} {o : ℕ → ℕ} (ho : ∀ i, o i < 6 ^ k) (e ξ : ℕ) {x : ℕ} (hx : 1 ≤ x) :
37 ee ((ξ : ℝ) / e * sfun P k o x) =
38 ee (-((ξ : ℝ) / e * (84 * o (x % P) + 1))) * ee (((84 * 6 ^ k : ℕ) : ℝ) * ξ / e * x) := by
39 have h1 := ho (x % P)
40 have h2 : 6 ^ k * 1 ≤ 6 ^ k * x := Nat.mul_le_mul_left _ hx
41 have h3 : ((sfun P k o x : ℕ) : ℝ) = 84 * (6 ^ k * x - o (x % P)) - 1 := by
42 unfold sfun
43 rw [Nat.cast_sub (by omega), Nat.cast_mul, Nat.cast_sub (by omega)]
44 push_cast
45 ring
46 rw [← ee_add, h3]
47 congr 1
48 push_cast
49 ring
50
51end LS
52
53open LS
54
55/-- **Lemma 8**, bilinear large sieve, with the characters hidden: `w e` is `∑*_ξ W(ξ/e)`, and
56`N_d = (|𝒵||𝒞| + ∑_{e ∣ d, e > 1} w e) / d`. (`w` is determined by Möbius inversion.) -/
57theorem L8 : ∃ C > 0, ∀ (P : ℕ), Squarefree P → P.Coprime 6 → 35 ∣ P →
58 ∀ (k : ℕ) (o : ℕ → ℕ), (∀ i, o i < 6 ^ k) → ∀ n ≥ 1, ∀ (α κ Z : ℝ) (𝒵 𝒞 : Finset ℕ),
59 0 < α → 0 < κ → 1 ≤ Z →
60 (∀ z ∈ 𝒵, 1 ≤ z ∧ (z : ℝ) ≤ Z) → α * Z / 2 ≤ 𝒵.card →
61 (∀ c ∈ 𝒞, 0 < c ∧ c < Inp.q ^ n) → κ * (Inp.q ^ n : ℕ) ≤ 𝒞.card →
62 ∃ w : ℕ → ℝ,
63 (∀ d ≥ 1, d.Coprime (6 * P) →
64 (((𝒵 ×ˢ 𝒞).filter fun p => d ∣ sfun P k o (Inp.q ^ n * p.1 - p.2)).card : ℝ) =
65 (𝒵.card * 𝒞.card + ∑ e ∈ d.divisors.erase 1, w e) / d) ∧
66 ∀ E : ℕ, 1 ≤ E → 4 * (E : ℝ) ^ 2 * P ≤ (Inp.q ^ n : ℕ) → 4 * (E : ℝ) ^ 2 * P ≤ Z →
67 ∑ e ∈ Ioc E (2 * E) with e.Coprime (6 * P), |w e| ≤
68 Real.sqrt (C / (α * κ)) * (𝒵.card * 𝒞.card) := by
69 obtain ⟨C1, hC1, hT1⟩ := T1_large_sieve
70 refine ⟨420 * C1 ^ 2, by positivity, ?_⟩
71 intro P hsq hP6 h35 k o ho n hn α κ Z 𝒵 𝒞 hα hκ hZ h𝒵 h𝒵c h𝒞 h𝒞c
72 set Q := Inp.q ^ n with hQdef
73 have hP0 : 0 < P := hsq.ne_zero.bot_lt
74 have hx : ∀ z ∈ 𝒵, ∀ c ∈ 𝒞, 1 ≤ Q * z - c ∧ c ≤ Q * z := by
75 intro z hz c hc
76 have h1 := (h𝒞 c hc).2
77 have h2 : Q * 1 ≤ Q * z := Nat.mul_le_mul_left _ (h𝒵 z hz).1
78 omega
79 set S : ℕ × ℕ → ℕ := fun p => sfun P k o (Q * p.1 - p.2) with hS
80 set W : ℕ → ℕ → ℂ := fun e ξ => ∑ p ∈ 𝒵 ×ˢ 𝒞, ee ((ξ : ℝ) / e * S p) with hW
81 set wc : ℕ → ℂ := fun e => ∑ ξ ∈ range e with ξ.Coprime e, W e ξ with hwc
82 refine ⟨fun e => (wc e).re, ?_, ?_⟩
83 · intro d hd _
84 have hd0 : (d : ℝ) ≠ 0 := by exact_mod_cast (by omega : d ≠ 0)
85 have h1 : ((((𝒵 ×ˢ 𝒞).filter fun p => d ∣ S p).card : ℂ)) * d = ∑ e ∈ d.divisors, wc e := by
86 have h2 : ∀ p : ℕ × ℕ, (if d ∣ S p then (d : ℂ) else 0) =
87 ∑ e ∈ d.divisors, ∑ ξ ∈ range e with ξ.Coprime e, ee ((ξ : ℝ) / e * S p) := by
88 intro p
89 have := sum_ee_range (d := d) hd (S p : ℤ)
90 simp only [Int.natCast_dvd_natCast] at this
91 rw [← this]
92 exact sum_range_eq_sum_reduced hd fun y => ee (y * ((S p : ℤ) : ℝ))
93 rw [card_filter, Nat.cast_sum, sum_mul]
94 have h3 : ∀ p ∈ 𝒵 ×ˢ 𝒞, ((if d ∣ S p then 1 else 0 : ℕ) : ℂ) * d =
95 if d ∣ S p then (d : ℂ) else 0 := fun p _ => by split_ifs <;> simp
96 rw [sum_congr rfl h3]
97 simp_rw [h2]
98 rw [sum_comm]
99 refine sum_congr rfl fun e _ => ?_
100 rw [sum_comm]
101 have h4 : wc 1 = (𝒵.card * 𝒞.card : ℂ) := by
102 simp [hwc, hW, ee_zero]
103 rw [← add_sum_erase _ _ (Nat.one_mem_divisors.mpr (by omega)), h4] at h1
104 rw [eq_div_iff hd0]
105 have h5 := congrArg Complex.re h1
106 simpa using h5
107 · intro E hE hEQ hEZ
108 obtain ⟨P', rfl⟩ := h35
109 have hP'0 : 0 < P' := Nat.pos_of_mul_pos_left hP0
110 have hP'6 : P'.Coprime 6 := hP6.coprime_dvd_left (Dvd.intro_left _ rfl)
111 have hP'35 : P'.Coprime 35 := ((Nat.squarefree_mul_iff.mp hsq).1).symm
112 obtain ⟨Q', hQ'⟩ : 35 ∣ Q :=
113 (show 35 ∣ Inp.q by decide +kernel).trans (dvd_pow_self _ (by omega))
114 have hvZ : Q'.Coprime P' :=
115 (((coprime_q hP'6 hP'35).pow_right n).coprime_dvd_right (Dvd.intro_left _ hQ'.symm)).symm
116 have hcop : ∀ e : ℕ, e.Coprime (6 * (35 * P')) → e.Coprime 6 ∧ e.Coprime 35 := fun e he =>
117 ⟨he.coprime_dvd_right (Dvd.intro _ rfl),
118 he.coprime_dvd_right ⟨6 * P', by ring⟩⟩
119 set u := 84 * 6 ^ k with hu
120 have huC : ∀ e : ℕ, e.Coprime (6 * (35 * P')) → u.Coprime e := fun e he =>
121 (coprime_84 k (hcop e he).1 (hcop e he).2).symm
122 have huZ : ∀ e : ℕ, e.Coprime (6 * (35 * P')) → (Q * u).Coprime e := fun e he =>
123 (((coprime_q (hcop e he).1 (hcop e he).2).pow_right n).mul_right
124 (coprime_84 k (hcop e he).1 (hcop e he).2)).symm
125 have hQ0 : 0 < Q := pow_pos (by decide) n
126 have hQR : (0 : ℝ) < Q := by exact_mod_cast hQ0
127 have hP'R : (0 : ℝ) < P' := by exact_mod_cast hP'0
128 set γ : (Σ _ : ℕ, ℕ) → ℕ → ℝ := fun i a => (u : ℝ) * i.2 / i.1 + a / (35 * P' : ℕ) with hγ
129 -- pointwise bound
130 have hpt : ∀ e ξ : ℕ, ‖W e ξ‖ ≤ ∑ a ∈ range (35 * P'),
131 ‖hat 𝒵 (Q * γ ⟨e, ξ⟩ a)‖ * ‖hat 𝒞 (γ ⟨e, ξ⟩ a)‖ := by
132 intro e ξ
133 have h := bilinear_le hP0
134 (fun i => ee (-((ξ : ℝ) / e * (84 * o i + 1)))) (fun i => (norm_ee _).le)
135 ((u : ℝ) * ξ / e) Q 𝒵 𝒞 (fun z hz c hc => (hx z hz c hc).2)
136 refine le_trans (le_of_eq ?_) h
137 congr 1
138 refine sum_congr rfl fun p hp => ?_
139 rw [mem_product] at hp
140 exact ee_sfun ho e ξ (hx _ hp.1 _ hp.2).1
141 -- the sum over `𝒞`
142 have hsumC : ∑ i ∈ fracs E (35 * P'), ∑ a ∈ range (35 * P'), ‖hat 𝒞 (γ i a)‖ ^ 2 ≤
143 C1 * (2 * Q) * 𝒞.card := by
144 have h := sieve_sum hT1 (v := 1) hE hP0 dvd_rfl (Nat.coprime_one_left _) huC 𝒞 Q
145 (fun c hc => (h𝒞 c hc).2)
146 simp only [Nat.cast_one, one_mul] at h
147 refine h.trans ?_
148 gcongr
149 linarith
150 -- the sum over `𝒵`
151 have hsumZ : ∑ i ∈ fracs E (35 * P'), ∑ a ∈ range (35 * P'), ‖hat 𝒵 (Q * γ i a)‖ ^ 2 ≤
152 35 * (C1 * (3 * Z) * 𝒵.card) := by
153 have h := sieve_sum hT1 (P := 35 * P') (v := Q') hE hP'0 (Dvd.intro_left _ rfl) hvZ huZ 𝒵
154 (⌊Z⌋₊ + 1) (fun z hz => Nat.lt_succ_of_le (Nat.le_floor (h𝒵 z hz).2))
155 have hfold : ∀ i : (Σ _ : ℕ, ℕ), ∑ a ∈ range (35 * P'), ‖hat 𝒵 (Q * γ i a)‖ ^ 2 =
156 35 * ∑ a ∈ range P',
157 ‖hat 𝒵 (((Q * u : ℕ) : ℝ) * i.2 / i.1 + (Q' : ℝ) * a / P')‖ ^ 2 := by
158 intro i
159 have hpt' : ∀ a : ℕ, Q * γ i a =
160 ((Q * u : ℕ) : ℝ) * i.2 / i.1 + (Q' : ℝ) * a / P' := by
161 intro a
162 have hQ'' : (Q : ℝ) = 35 * Q' := by exact_mod_cast hQ'
163 simp only [hγ]
164 rw [mul_add]
165 congr 1
166 · push_cast; ring
167 · rw [hQ'']; push_cast; field_simp
168 simp_rw [hpt']
169 have := sum_range_periodic (fun a : ℕ =>
170 ‖hat 𝒵 (((Q * u : ℕ) : ℝ) * i.2 / i.1 + (Q' : ℝ) * a / P')‖ ^ 2) P' ?_ 35
171 · simpa using this
172 · intro m x
173 congr 2
174 refine sum_congr rfl fun z _ => ?_
175 rw [← ee_add_int _ (z * Q' * m : ℤ)]
176 rw [← ee_add_int (z * (((Q * u : ℕ) : ℝ) * i.2 / i.1 + (Q' : ℝ) * x / P'))
177 (z * Q' * m * 2 : ℤ)]
178 congr 1
179 push_cast
180 field_simp
181 ring
182 simp_rw [hfold]
183 rw [← mul_sum]
184 refine mul_le_mul_of_nonneg_left (h.trans ?_) (by norm_num)
185 have hfl : (⌊Z⌋₊ : ℝ) ≤ Z := Nat.floor_le (by linarith)
186 have : 4 * (E : ℝ) ^ 2 * P' ≤ Z := by
187 refine le_trans ?_ hEZ
188 push_cast
189 have : 0 ≤ 4 * (E : ℝ) ^ 2 * P' := by positivity
190 linarith
191 gcongr
192 push_cast
193 linarith
194 -- conclusion
195 have hstep : ∑ e ∈ Ioc E (2 * E) with e.Coprime (6 * (35 * P')), |(wc e).re| ≤
196 ∑ i ∈ fracs E (35 * P'), ∑ a ∈ range (35 * P'),
197 ‖hat 𝒵 (Q * γ i a)‖ * ‖hat 𝒞 (γ i a)‖ := by
198 rw [fracs, sum_sigma]
199 refine sum_le_sum fun e _ => (Complex.abs_re_le_norm _).trans ?_
200 refine (norm_sum_le _ _).trans (sum_le_sum fun ξ _ => hpt e ξ)
201 refine hstep.trans ?_
202 rw [← sum_product'] at hsumC hsumZ ⊢
203 have hCS := sum_mul_sq_le_sq_mul_sq (fracs E (35 * P') ×ˢ range (35 * P'))
204 (fun p => ‖hat 𝒵 (Q * γ p.1 p.2)‖) (fun p => ‖hat 𝒞 (γ p.1 p.2)‖)
205 have hprod := mul_le_mul hsumZ hsumC (sum_nonneg fun _ _ => by positivity)
206 (by positivity : 0 ≤ 35 * (C1 * (3 * Z) * (𝒵.card : ℝ)))
207 have hfin : 35 * (C1 * (3 * Z) * (𝒵.card : ℝ)) * (C1 * (2 * Q) * 𝒞.card) ≤
208 420 * C1 ^ 2 / (α * κ) * (𝒵.card * 𝒞.card : ℝ) ^ 2 := by
209 have h1 : Z ≤ 2 * 𝒵.card / α := by rw [le_div_iff₀ hα]; linarith
210 have h2 : (Q : ℝ) ≤ 𝒞.card / κ := by rw [le_div_iff₀ hκ]; linarith
211 calc 35 * (C1 * (3 * Z) * (𝒵.card : ℝ)) * (C1 * (2 * Q) * 𝒞.card)
212 ≤ 35 * (C1 * (3 * (2 * 𝒵.card / α)) * (𝒵.card : ℝ)) *
213 (C1 * (2 * (𝒞.card / κ)) * 𝒞.card) := by gcongr
214 _ = _ := by field_simp; ring
215 have hsq' := (hCS.trans hprod).trans hfin
216 rw [← Real.sqrt_sq (by positivity : (0 : ℝ) ≤ 𝒵.card * 𝒞.card),
217 ← Real.sqrt_mul (by positivity)]
218 exact Real.le_sqrt_of_sq_le hsq'
219
220end E424
221
222