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

All files · 298 lines · source at the verified commit

1module
2
3public import E424.HighBand.L31Aux
4public import E424.Tools.T5
5
6@[expose] public section
7
8/-!
9# Lemma 31 auxiliaries, part 2
10
11* `blocks_bound`: T5 applied block by block on `[N 16^j, N 16^{j+1})`, combined by Cauchy-Schwarz.
12* `card_le_of_separated`: counting integers `k` with a point of `E` in `[k, k+1)` via two parity classes.
13-/
14
15set_option linter.style.header false
16open Finset
17
18namespace E424
19
20/-- T5 over all of `[N, R]`: split into `≤ log(R/N) + 1` blocks `[N 16^j, N 16^{j+1})` and use
21Cauchy-Schwarz over the blocks. The coefficients satisfy `‖a n‖ ≤ cmax / n` and have total mass `≤ 1`. -/
22theorem blocks_bound : ∃ C > 0, ∀ (N R T : ℝ), 1 ≤ N → 1 ≤ T → T ≤ N → N ≤ R →
23 ∀ (𝒩 : Finset ℕ) (a : ℕ → ℂ) (cmax : ℝ), 0 ≤ cmax → (∀ n ∈ 𝒩, N ≤ n ∧ (n : ℝ) ≤ R) →
24 (∀ n ∈ 𝒩, ‖a n‖ ≤ cmax / n) → ∑ n ∈ 𝒩, ‖a n‖ ≤ 1 →
25 ∀ τ : Finset ℝ, (∀ t ∈ τ, |t| ≤ T) → (∀ t ∈ τ, ∀ t' ∈ τ, t ≠ t' → 1 ≤ |t - t'|) →
26 ∑ t ∈ τ, ‖∑ n ∈ 𝒩, a n * nit n t‖ ^ 2 ≤
27 (Real.log (R / N) + 1) * (2 * C * Real.log (2 * R)) * cmax := by
28 obtain ⟨C, hC, h5⟩ := T5_discrete_mean_value
29 refine ⟨C, hC, fun N R T hN hT hTN hNR 𝒩 a cmax hc hrange ha hmass τ hτT hsep => ?_⟩
30 have hN0 : 0 < N := by linarith
31 have hl16 : (1 : ℝ) ≤ Real.log 16 := by
32 rw [Real.le_log_iff_exp_le (by norm_num)]
33 have := Real.exp_one_lt_d9
34 linarith
35 have hl16' : 0 < Real.log 16 := by linarith
36 -- block index
37 set j : ℕ → ℕ := fun n => ⌊Real.log ((n : ℝ) / N) / Real.log 16⌋₊ with hj
38 have hnpos : ∀ n ∈ 𝒩, 0 < (n : ℝ) := fun n hn => by linarith [(hrange n hn).1]
39 have hy : ∀ n ∈ 𝒩, 0 ≤ Real.log ((n : ℝ) / N) / Real.log 16 := fun n hn => by
40 apply div_nonneg _ hl16'.le
41 apply Real.log_nonneg
42 rw [le_div_iff₀ hN0]; linarith [(hrange n hn).1]
43 -- n lies in [N 16^j, N 16^(j+1))
44 have hblock : ∀ n ∈ 𝒩, N * 16 ^ j n ≤ n ∧ (n : ℝ) ≤ 16 * (N * 16 ^ j n) := by
45 intro n hn
46 have h1 := Nat.floor_le (hy n hn)
47 have h2 := Nat.lt_floor_add_one (Real.log ((n : ℝ) / N) / Real.log 16)
48 have hnN : 0 < (n : ℝ) / N := div_pos (hnpos n hn) hN0
49 rw [le_div_iff₀ hl16'] at h1
50 rw [div_lt_iff₀ hl16'] at h2
51 have e1 : ((16 : ℝ) ^ j n) ≤ (n : ℝ) / N := by
52 rw [← Real.log_le_log_iff (by positivity) hnN, Real.log_pow]; exact h1
53 have e2 : (n : ℝ) / N ≤ 16 ^ (j n + 1) := by
54 rw [← Real.log_le_log_iff hnN (by positivity), Real.log_pow]; push_cast; exact h2.le
55 constructor
56 · rw [le_div_iff₀ hN0] at e1; linarith
57 · rw [div_le_iff₀ hN0] at e2; rw [pow_succ] at e2; linarith
58 have hjmem : ∀ n ∈ 𝒩, j n ∈ range (⌊Real.log (R / N)⌋₊ + 1) := by
59 intro n hn
60 rw [mem_range, Nat.lt_succ_iff]
61 apply Nat.le_floor
62 have h1 := Nat.floor_le (hy n hn)
63 have h3 : Real.log ((n : ℝ) / N) ≤ Real.log (R / N) :=
64 Real.log_le_log (div_pos (hnpos n hn) hN0) (div_le_div_of_nonneg_right (hrange n hn).2 hN0.le)
65 have h4 : Real.log ((n : ℝ) / N) / Real.log 16 ≤ Real.log (R / N) :=
66 (div_le_self (Real.log_nonneg (by rw [le_div_iff₀ hN0]; linarith [(hrange n hn).1])) hl16).trans h3
67 exact (show (j n : ℝ) ≤ _ from h1).trans h4
68 set blk : ℕ → Finset ℕ := fun i => 𝒩.filter fun n => j n = i with hblk
69 have hsplit : ∀ t, ∑ n ∈ 𝒩, a n * nit n t = ∑ i ∈ range (⌊Real.log (R / N)⌋₊ + 1),
70 ∑ n ∈ blk i, a n * nit n t := fun t =>
71 (Finset.sum_fiberwise_of_maps_to (g := j) hjmem _).symm
72 have hlogR : 0 ≤ Real.log (2 * R) := Real.log_nonneg (by linarith)
73 -- per block bound
74 have hper : ∀ i ∈ range (⌊Real.log (R / N)⌋₊ + 1),
75 ∑ t ∈ τ, ‖∑ n ∈ blk i, a n * nit n t‖ ^ 2 ≤
76 2 * C * Real.log (2 * R) * cmax * ∑ n ∈ blk i, ‖a n‖ := by
77 intro i _
78 rcases (blk i).eq_empty_or_nonempty with he | hne
79 · simp [he]
80 set M := N * 16 ^ i with hM
81 have hM1 : N ≤ M := le_mul_of_one_le_right hN0.le (one_le_pow₀ (by norm_num))
82 have hMn : ∀ n ∈ blk i, M ≤ n ∧ (n : ℝ) ≤ 16 * M := fun n hn => by
83 obtain ⟨hn1, hn2⟩ := mem_filter.1 hn
84 have := hblock n hn1
85 rw [hn2] at this
86 exact this
87 obtain ⟨n0, hn0⟩ := hne
88 have hMR : M ≤ R := (hMn n0 hn0).1.trans (hrange n0 (mem_filter.1 hn0).1).2
89 have hbound := h5 M T (by linarith) hT (blk i) a hMn τ hτT hsep
90 have hlogM : Real.log (2 * M) ≤ Real.log (2 * R) :=
91 Real.log_le_log (by linarith) (by linarith)
92 have hsq : ∑ n ∈ blk i, ‖a n‖ ^ 2 ≤ cmax / M * ∑ n ∈ blk i, ‖a n‖ := by
93 rw [Finset.mul_sum]
94 refine Finset.sum_le_sum fun n hn => ?_
95 have h1 := ha n (mem_filter.1 hn).1
96 have h2 : cmax / n ≤ cmax / M := div_le_div_of_nonneg_left hc (by linarith) (hMn n hn).1
97 calc ‖a n‖ ^ 2 = ‖a n‖ * ‖a n‖ := sq _
98 _ ≤ cmax / M * ‖a n‖ := mul_le_mul_of_nonneg_right (h1.trans h2) (norm_nonneg _)
99 _ = _ := by ring
100 have hMpos : 0 < M := by linarith
101 calc _ ≤ C * (T + M) * Real.log (2 * M) * ∑ n ∈ blk i, ‖a n‖ ^ 2 := hbound
102 _ ≤ C * (2 * M) * Real.log (2 * R) * (cmax / M * ∑ n ∈ blk i, ‖a n‖) := by
103 have hlM : 0 ≤ Real.log (2 * M) := Real.log_nonneg (by linarith)
104 gcongr
105 linarith
106 _ = _ := by field_simp
107 have hcs : ∀ t, ‖∑ n ∈ 𝒩, a n * nit n t‖ ^ 2 ≤
108 ((range (⌊Real.log (R / N)⌋₊ + 1)).card : ℝ) *
109 ∑ i ∈ range (⌊Real.log (R / N)⌋₊ + 1), ‖∑ n ∈ blk i, a n * nit n t‖ ^ 2 := by
110 intro t
111 rw [hsplit t]
112 calc _ ≤ (∑ i ∈ range (⌊Real.log (R / N)⌋₊ + 1), ‖∑ n ∈ blk i, a n * nit n t‖) ^ 2 :=
113 pow_le_pow_left₀ (norm_nonneg _) (norm_sum_le _ _) 2
114 _ ≤ _ := sq_sum_le_card_mul_sum_sq
115 have hmassfib : ∑ i ∈ range (⌊Real.log (R / N)⌋₊ + 1), ∑ n ∈ blk i, ‖a n‖ = ∑ n ∈ 𝒩, ‖a n‖ :=
116 Finset.sum_fiberwise_of_maps_to (g := j) hjmem _
117 have hJ : ((range (⌊Real.log (R / N)⌋₊ + 1)).card : ℝ) ≤ Real.log (R / N) + 1 := by
118 rw [card_range]; push_cast
119 linarith [Nat.floor_le (Real.log_nonneg (show 1 ≤ R / N by rw [le_div_iff₀ hN0]; linarith))]
120 have hK : 0 ≤ 2 * C * Real.log (2 * R) * cmax := by positivity
121 calc _ ≤ ∑ t ∈ τ, ((range (⌊Real.log (R / N)⌋₊ + 1)).card : ℝ) *
122 ∑ i ∈ range (⌊Real.log (R / N)⌋₊ + 1), ‖∑ n ∈ blk i, a n * nit n t‖ ^ 2 :=
123 Finset.sum_le_sum fun t _ => hcs t
124 _ = ((range (⌊Real.log (R / N)⌋₊ + 1)).card : ℝ) *
125 ∑ i ∈ range (⌊Real.log (R / N)⌋₊ + 1), ∑ t ∈ τ, ‖∑ n ∈ blk i, a n * nit n t‖ ^ 2 := by
126 rw [← Finset.mul_sum, Finset.sum_comm]
127 _ ≤ ((range (⌊Real.log (R / N)⌋₊ + 1)).card : ℝ) *
128 ∑ i ∈ range (⌊Real.log (R / N)⌋₊ + 1),
129 2 * C * Real.log (2 * R) * cmax * ∑ n ∈ blk i, ‖a n‖ :=
130 mul_le_mul_of_nonneg_left (Finset.sum_le_sum hper) (Nat.cast_nonneg _)
131 _ = ((range (⌊Real.log (R / N)⌋₊ + 1)).card : ℝ) *
132 (2 * C * Real.log (2 * R) * cmax * ∑ n ∈ 𝒩, ‖a n‖) := by
133 rw [← Finset.mul_sum, hmassfib]
134 _ ≤ (Real.log (R / N) + 1) * (2 * C * Real.log (2 * R) * cmax * 1) := by
135 have hlg : 0 ≤ Real.log (R / N) :=
136 Real.log_nonneg (by rw [le_div_iff₀ hN0]; linarith)
137 exact mul_le_mul hJ (mul_le_mul_of_nonneg_left hmass hK) (by positivity) (by linarith)
138 _ = _ := by ring
139
140/-- If every `1`-separated finite subset of `E ∩ [-N, N]` has at most `X` points, then a finite set `K` of
141integers each of which is `⌊t⌋` for some `t ∈ E`, `|t| ≤ N` has at most `2 X` elements (split by parity,
142so that the chosen points `t_k ∈ [k, k+1)` are separated). -/
143theorem card_le_of_separated (E : Set ℝ) (N X : ℝ)
144 (hX : ∀ τ : Finset ℝ, (∀ t ∈ τ, t ∈ E ∧ |t| ≤ N) → (∀ t ∈ τ, ∀ t' ∈ τ, t ≠ t' → 1 ≤ |t - t'|) →
145 (τ.card : ℝ) ≤ X)
146 (K : Finset ℤ) (hK : ∀ k ∈ K, ∃ t ∈ E, |t| ≤ N ∧ ⌊t⌋ = k) : (K.card : ℝ) ≤ 2 * X := by
147 choose! tt htE htN htk using hK
148 have hpar : ∀ (P : ℤ → Prop) [DecidablePred P], (∀ k ∈ K, ∀ k' ∈ K, P k → P k' → k ≠ k' → 2 ≤ |k - k'|) →
149 ((K.filter P).card : ℝ) ≤ X := by
150 intro P _ hP
151 have hinj : Set.InjOn tt ↑(K.filter P) := by
152 intro k hk k' hk' h
153 have := htk k (mem_filter.1 hk).1
154 have := htk k' (mem_filter.1 hk').1
155 rw [← htk k (mem_filter.1 hk).1, ← htk k' (mem_filter.1 hk').1, h]
156 have hc : ((K.filter P).image tt).card = (K.filter P).card := card_image_of_injOn hinj
157 rw [← hc]
158 refine hX _ (fun t ht => ?_) (fun t ht t' ht' hne => ?_)
159 · obtain ⟨k, hk, rfl⟩ := mem_image.1 ht
160 exact ⟨htE k (mem_filter.1 hk).1, htN k (mem_filter.1 hk).1⟩
161 · obtain ⟨k, hk, rfl⟩ := mem_image.1 ht
162 obtain ⟨k', hk', rfl⟩ := mem_image.1 ht'
163 have hkk : k ≠ k' := fun h => hne (by rw [h])
164 have h2 := hP k (mem_filter.1 hk).1 k' (mem_filter.1 hk').1 (mem_filter.1 hk).2
165 (mem_filter.1 hk').2 hkk
166 have a1 := Int.floor_le (tt k)
167 have a2 := Int.lt_floor_add_one (tt k)
168 have b1 := Int.floor_le (tt k')
169 have b2 := Int.lt_floor_add_one (tt k')
170 rw [htk k (mem_filter.1 hk).1] at a1 a2
171 rw [htk k' (mem_filter.1 hk').1] at b1 b2
172 have h2' : (2 : ℝ) ≤ |((k : ℝ) - k')| := by exact_mod_cast h2
173 rcases le_abs'.1 h2' with h | h
174 · rw [abs_of_nonpos (by linarith)]; linarith
175 · rw [abs_of_nonneg (by linarith)]; linarith
176 have hev := hpar Even (by
177 intro k _ k' _ hk hk' hne
178 obtain ⟨a, rfl⟩ := hk
179 obtain ⟨b, rfl⟩ := hk'
180 have : a ≠ b := fun h => hne (by rw [h])
181 rw [show a + a - (b + b) = 2 * (a - b) by ring, abs_mul]
182 have : 1 ≤ |a - b| := Int.one_le_abs (sub_ne_zero.2 this)
183 simp; omega)
184 have hod := hpar (fun k => ¬ Even k) (by
185 intro k _ k' _ hk hk' hne
186 rw [Int.not_even_iff_odd] at hk hk'
187 obtain ⟨a, rfl⟩ := hk
188 obtain ⟨b, rfl⟩ := hk'
189 have : a ≠ b := fun h => hne (by rw [h])
190 rw [show 2 * a + 1 - (2 * b + 1) = 2 * (a - b) by ring, abs_mul]
191 have : 1 ≤ |a - b| := Int.one_le_abs (sub_ne_zero.2 this)
192 simp; omega)
193 have h' : (K.card : ℝ) = (K.filter Even).card + (K.filter fun k => ¬ Even k).card := by
194 exact_mod_cast (Finset.card_filter_add_card_filter_not (s := K) (p := Even)).symm
195 linarith
196
197/-- `Ω` of a product of nonzero naturals is the sum of the `Ω`s. -/
198theorem cardFactors_prod_eq {ι : Type*} (s : Finset ι) (f : ι → ℕ) (hf : ∀ i ∈ s, f i ≠ 0) :
199 ArithmeticFunction.cardFactors (∏ i ∈ s, f i) = ∑ i ∈ s, ArithmeticFunction.cardFactors (f i) := by
200 classical
201 induction s using Finset.induction_on with
202 | empty => simp
203 | insert a s ha ih =>
204 rw [prod_insert ha, sum_insert ha, ArithmeticFunction.cardFactors_mul (hf a (mem_insert_self _ _))
205 (prod_ne_zero_iff.2 fun i hi => hf i (mem_insert_of_mem hi)),
206 ih fun i hi => hf i (mem_insert_of_mem hi)]
207
208/-- **Counting at one cell.** `Sv` a θ-family of elements in `[m, M]` of mass `≤ 1`, `ℓ + 1` with `N ≤ m^(ℓ+1)`.
209A `1`-separated set `τ ⊂ [-N, N]` of points with `|P(t)| > δ` has `|τ| δ^{2(ℓ+1)}` at most the T5 bound for
210`P^{ℓ+1}`, whose coefficients are `≤ ((200(ℓ+1)+1)^200)^ℓ / n`. -/
211theorem cell_count : ∃ C > 0, ∀ (z : ℝ), 3 ≤ z → ∀ Sv : Finset ℕ, IsFam z Sv →
212 ∑ s ∈ Sv, 1 / (s : ℝ) ≤ 1 → ∀ (ℓ : ℕ) (N m M : ℝ), 1 ≤ N → 1 ≤ m → m ≤ M →
213 (∀ s ∈ Sv, m ≤ (s : ℝ) ∧ (s : ℝ) ≤ M) → N ≤ m ^ (ℓ + 1) → ∀ δ : ℝ, 0 < δ →
214 ∀ τ : Finset ℝ, (∀ t ∈ τ, |t| ≤ N) → (∀ t ∈ τ, ∀ t' ∈ τ, t ≠ t' → 1 ≤ |t - t'|) →
215 (∀ t ∈ τ, δ < ‖∑ s ∈ Sv, ((1 / (s : ℝ) : ℝ) : ℂ) * nit s t‖) →
216 (τ.card : ℝ) * δ ^ (2 * (ℓ + 1)) ≤
217 (Real.log (M ^ (ℓ + 1) / N) + 1) * (2 * C * Real.log (2 * M ^ (ℓ + 1))) *
218 (((200 * (ℓ + 1) + 1 : ℝ) ^ 200) ^ ℓ) := by
219 obtain ⟨C, hC, hB⟩ := blocks_bound
220 refine ⟨C, hC, fun z hz Sv hS hmass ℓ N m M hN hm hmM hrng hNm δ hδ τ hτN hsep hτδ => ?_⟩
221 have hS0 : ∀ s ∈ Sv, s ≠ 0 := fun s hs h0 => by
222 have := (hrng s hs).1
223 rw [h0] at this
224 simp at this
225 linarith
226 set 𝒩 := (Fintype.piFinset fun _ : Fin (ℓ + 1) => Sv).image (fun f => ∏ i, f i) with h𝒩
227 set a : ℕ → ℂ := fun n => ((tupleCount Sv (ℓ + 1) n : ℕ) : ℂ) / (n : ℂ) with ha
228 set cmax : ℝ := ((200 * (ℓ + 1) + 1 : ℝ) ^ 200) ^ ℓ with hcmax
229 have hpow := fun t => pow_sum_nit Sv hS0 (ℓ + 1) t
230 have hmem : ∀ n ∈ 𝒩, ∃ f ∈ Fintype.piFinset (fun _ : Fin (ℓ + 1) => Sv), ∏ i, f i = n := fun n hn =>
231 mem_image.1 hn
232 have hn0 : ∀ n ∈ 𝒩, n ≠ 0 := by
233 intro n hn
234 obtain ⟨f, hf, rfl⟩ := hmem n hn
235 exact prod_ne_zero_iff.2 fun i _ => hS0 _ (Fintype.mem_piFinset.1 hf i)
236 have hrange : ∀ n ∈ 𝒩, N ≤ n ∧ (n : ℝ) ≤ M ^ (ℓ + 1) := by
237 intro n hn
238 obtain ⟨f, hf, rfl⟩ := hmem n hn
239 have hf' := fun i => hrng _ (Fintype.mem_piFinset.1 hf i)
240 rw [Nat.cast_prod]
241 constructor
242 · calc N ≤ m ^ (ℓ + 1) := hNm
243 _ = ∏ _i : Fin (ℓ + 1), m := by simp
244 _ ≤ _ := prod_le_prod₀ (fun i _ => by linarith) fun i _ => (hf' i).1
245 · calc _ ≤ ∏ _i : Fin (ℓ + 1), M :=
246 prod_le_prod₀ (fun i _ => by have := (hf' i).1; positivity) fun i _ => (hf' i).2
247 _ = _ := by simp
248 have hcoef : ∀ n ∈ 𝒩, ‖a n‖ ≤ cmax / n := by
249 intro n hn
250 have hnn : (0 : ℝ) < n := by
251 have := Nat.pos_of_ne_zero (hn0 n hn)
252 exact_mod_cast this
253 have hΩ : ArithmeticFunction.cardFactors n ≤ 200 * (ℓ + 1) := by
254 obtain ⟨f, hf, rfl⟩ := hmem n hn
255 rw [cardFactors_prod_eq _ _ fun i _ => hS0 _ (Fintype.mem_piFinset.1 hf i)]
256 calc _ ≤ ∑ _i : Fin (ℓ + 1), 200 :=
257 sum_le_sum fun i _ => cardFactors_le_of_isFam hz (hS _ (Fintype.mem_piFinset.1 hf i))
258 _ = _ := by simp [mul_comm]
259 have hc := tupleCount_le_isFam hz hS ℓ (hn0 n hn)
260 have hc' : (tupleCount Sv (ℓ + 1) n : ℝ) ≤ cmax := by
261 refine (Nat.cast_le.2 hc).trans ?_
262 rw [hcmax]
263 push_cast
264 gcongr
265 exact_mod_cast hΩ
266 rw [ha]
267 simp only [norm_div, Complex.norm_natCast]
268 exact div_le_div_of_nonneg_right hc' hnn.le
269 have hmass' : ∑ n ∈ 𝒩, ‖a n‖ ≤ 1 := by
270 have h0 := hpow 0
271 have e : ∀ n, nit n 0 = 1 := fun n => by simp [nit]
272 simp only [e, mul_one] at h0
273 have h1 : ((∑ s ∈ Sv, 1 / (s : ℝ) : ℝ) ^ (ℓ + 1) : ℝ) =
274 ∑ n ∈ 𝒩, (tupleCount Sv (ℓ + 1) n : ℝ) / (n : ℝ) := by
275 apply Complex.ofReal_injective
276 push_cast at h0 ⊢
277 exact h0
278 have h2 : ∑ n ∈ 𝒩, ‖a n‖ = ∑ n ∈ 𝒩, (tupleCount Sv (ℓ + 1) n : ℝ) / (n : ℝ) := by
279 refine sum_congr rfl fun n _ => ?_
280 rw [ha]
281 simp only [norm_div, Complex.norm_natCast]
282 rw [h2, ← h1]
283 exact pow_le_one₀ (sum_nonneg fun s _ => by positivity) hmass
284 have hcmax0 : 0 ≤ cmax := by positivity
285 have hmain := hB N (M ^ (ℓ + 1)) N hN hN le_rfl
286 (hNm.trans (pow_le_pow_left₀ (by linarith) hmM _)) 𝒩 a cmax hcmax0 hrange hcoef hmass' τ hτN hsep
287 have hexp : ∀ t, (∑ n ∈ 𝒩, a n * nit n t) = (∑ s ∈ Sv, ((1 / (s : ℝ) : ℝ) : ℂ) * nit s t) ^ (ℓ + 1) := by
288 intro t
289 rw [hpow t]
290 calc (τ.card : ℝ) * δ ^ (2 * (ℓ + 1)) = ∑ _t ∈ τ, δ ^ (2 * (ℓ + 1)) := by simp
291 _ ≤ ∑ t ∈ τ, ‖∑ n ∈ 𝒩, a n * nit n t‖ ^ 2 := by
292 refine sum_le_sum fun t ht => ?_
293 rw [hexp t, norm_pow, ← pow_mul, mul_comm (ℓ + 1) 2]
294 exact pow_le_pow_left₀ hδ.le (hτδ t ht).le _
295 _ ≤ _ := hmain
296
297end E424
298