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

All files · 347 lines · source at the verified commit

1module
2
3public import E424.HighBand.L32
4public import E424.Tools.T12
5
6@[expose] public section
7
8/-!
9# Lemma 33, auxiliary: Gram row sums of the frequency vectors
10
11`vR Y t x = g(x/Y) x^{-1-it}` on real `x`; `ww Y H t n` is its average over the shifts `j < H`.
12`sS Y` is the summation range of L33. Everything here is about one level `Y`.
13-/
14
15set_option linter.style.header false
16open Finset MeasureTheory
17
18namespace E424
19
20/-- `g(x/Y) x^{-1-it}` for real `x`, the summand of L33 without the coefficient `b`.
21Zero unless `Y < x < 4Y`. -/
22noncomputable def vR (Y t x : ℝ) : ℂ :=
23 ((gw (x / Y) / x : ℝ) : ℂ) * Complex.exp (-(t * Real.log x : ℝ) * Complex.I)
24
25/-- The average of `vR` over the shifts `j < H`, evaluated at `n`. -/
26noncomputable def ww (Y : ℝ) (H : ℕ) (t : ℝ) (n : ℕ) : ℂ :=
27 (H : ℂ)⁻¹ * ∑ j ∈ range H, vR Y t ((n : ℝ) - j)
28
29/-- The summation range of L33: `(Y/2, 8Y]`. -/
30noncomputable def sS (Y : ℝ) : Finset ℕ := Ioc ⌊Y / 2⌋₊ ⌊8 * Y⌋₊
31
32lemma vR_eq_zero_of_le {Y t x : ℝ} (hY : 0 < Y) (h : x ≤ Y) : vR Y t x = 0 := by
33 have : gw (x / Y) = 0 := gw_eq_zero (Or.inl ((div_le_one hY).2 h))
34 simp [vR, this]
35
36lemma vR_eq_zero_of_ge {Y t x : ℝ} (hY : 0 < Y) (h : 4 * Y ≤ x) : vR Y t x = 0 := by
37 have : gw (x / Y) = 0 := gw_eq_zero (Or.inr ((le_div_iff₀ hY).2 (by linarith)))
38 simp [vR, this]
39
40/-- Points at distance at least `1` have distinct floors, so the weights `(1 + |t' - t|)^{-2}`
41of such a set add up to a constant. -/
42lemma sep_sum_le : ∃ C > 0, ∀ τ : Finset ℝ, (∀ t ∈ τ, ∀ t' ∈ τ, t ≠ t' → 1 ≤ |t - t'|) →
43 ∀ t ∈ τ, ∑ t' ∈ τ, ((1 + |t' - t|) ^ 2)⁻¹ ≤ C := by
44 have hsum : Summable fun m : ℤ => 1 / (m : ℝ) ^ 2 :=
45 Real.summable_one_div_int_pow.2 (by norm_num)
46 have hnn : ∀ m : ℤ, 0 ≤ 1 / (m : ℝ) ^ 2 := fun m => by positivity
47 refine ⟨1 + ∑' m : ℤ, 1 / (m : ℝ) ^ 2, by linarith [tsum_nonneg (L := SummationFilter.unconditional ℤ) hnn], fun τ hsep t ht => ?_⟩
48 rw [← add_sum_erase τ _ ht]
49 have hself : ((1 + |t - t|) ^ 2)⁻¹ = 1 := by simp
50 rw [hself]
51 have hmem : ∀ t' ∈ τ.erase t, t' ≠ t ∧ t' ∈ τ := fun t' h => ⟨ne_of_mem_erase h, mem_of_mem_erase h⟩
52 -- the shifted floor `⌊t'⌋ - ⌊t⌋`
53 set f : ℝ → ℤ := fun t' => ⌊t'⌋ - ⌊t⌋ with hf
54 have hfinj : Set.InjOn f (τ.erase t : Set ℝ) := by
55 intro a ha b hb hab
56 obtain ⟨ha1, ha2⟩ := hmem a ha
57 obtain ⟨hb1, hb2⟩ := hmem b hb
58 have hfl : ⌊a⌋ = ⌊b⌋ := by simp only [hf] at hab; omega
59 by_contra hne
60 have := hsep a ha2 b hb2 hne
61 have := Int.abs_sub_lt_one_of_floor_eq_floor hfl
62 linarith
63 have hbound : ∀ t' ∈ τ.erase t, ((1 + |t' - t|) ^ 2)⁻¹ ≤ 1 / ((f t' : ℝ)) ^ 2 := by
64 intro t' ht'
65 obtain ⟨hne, hmem'⟩ := hmem t' ht'
66 have hne0 : (f t' : ℝ) ≠ 0 := by
67 intro h0
68 have h0' : ⌊t'⌋ = ⌊t⌋ := by
69 have : f t' = 0 := by exact_mod_cast h0
70 simp only [hf] at this; omega
71 have := hsep t' hmem' t ht hne
72 have := Int.abs_sub_lt_one_of_floor_eq_floor h0'
73 linarith
74 have hle : |(f t' : ℝ)| ≤ 1 + |t' - t| := by
75 have h1 := Int.floor_le t'
76 have h2 := Int.lt_floor_add_one t'
77 have h3 := Int.floor_le t
78 have h4 := Int.lt_floor_add_one t
79 have hfe : (f t' : ℝ) = (⌊t'⌋ : ℝ) - ⌊t⌋ := by simp [hf]
80 rw [hfe, abs_le]
81 have := le_abs_self (t' - t)
82 have := neg_abs_le (t' - t)
83 constructor <;> linarith [abs_nonneg (t' - t)]
84 have hpos : 0 < (f t' : ℝ) ^ 2 := by positivity
85 have hsq : (f t' : ℝ) ^ 2 ≤ (1 + |t' - t|) ^ 2 := by
86 have := sq_abs (f t' : ℝ)
87 nlinarith [abs_nonneg (f t' : ℝ)]
88 rw [inv_eq_one_div]
89 exact one_div_le_one_div_of_le hpos hsq
90 have hrest : ∑ t' ∈ τ.erase t, ((1 + |t' - t|) ^ 2)⁻¹ ≤ ∑' m : ℤ, 1 / (m : ℝ) ^ 2 :=
91 calc ∑ t' ∈ τ.erase t, ((1 + |t' - t|) ^ 2)⁻¹
92 ≤ ∑ t' ∈ τ.erase t, 1 / (f t' : ℝ) ^ 2 := sum_le_sum hbound
93 _ = ∑ m ∈ (τ.erase t).image f, 1 / (m : ℝ) ^ 2 := by rw [sum_image hfinj]
94 _ ≤ ∑' m : ℤ, 1 / (m : ℝ) ^ 2 := Summable.sum_le_tsum _ (fun m _ => hnn m) hsum
95 linarith
96
97/-- Product of a `vR` with the conjugate of another, as one exponential. -/
98lemma vR_mul_conj (Y t t' x x' : ℝ) :
99 vR Y t x * starRingEnd ℂ (vR Y t' x') =
100 ((gw (x / Y) * gw (x' / Y) / (x * x') : ℝ) : ℂ) *
101 Complex.exp (((t' * Real.log x' - t * Real.log x : ℝ) : ℂ) * Complex.I) := by
102 have hc : ∀ y : ℝ, starRingEnd ℂ (Complex.exp (-(y : ℂ) * Complex.I)) =
103 Complex.exp ((y : ℂ) * Complex.I) := by
104 intro y
105 rw [← Complex.exp_conj]
106 congr 1
107 simp
108 have hE : Complex.exp (-((t * Real.log x : ℝ) : ℂ) * Complex.I) *
109 Complex.exp (((t' * Real.log x' : ℝ) : ℂ) * Complex.I) =
110 Complex.exp (((t' * Real.log x' - t * Real.log x : ℝ) : ℂ) * Complex.I) := by
111 rw [← Complex.exp_add]
112 congr 1
113 push_cast
114 ring
115 simp only [vR, map_mul, Complex.conj_ofReal, hc]
116 rw [← hE]
117 push_cast
118 ring
119
120/-- The Gram sum of the shifted vectors over `sS Y` is `Y⁻¹` times the Gram function of L32. -/
121lemma vR_gram_sum {Y : ℝ} (hY : 0 < Y) {j j' : ℕ} (hj : (j : ℝ) ≤ Y)
122 (t t' : ℝ) :
123 ∑ n ∈ sS Y, vR Y t ((n : ℝ) - j) * starRingEnd ℂ (vR Y t' ((n : ℝ) - j')) =
124 (Y : ℂ)⁻¹ * gram Y j j' t t' := by
125 have hterm : ∀ n : ℕ, vR Y t ((n : ℝ) - j) * starRingEnd ℂ (vR Y t' ((n : ℝ) - j')) =
126 ((gw (((n : ℝ) - j) / Y) * gw (((n : ℝ) - j') / Y) / (((n : ℝ) - j) * ((n : ℝ) - j')) : ℝ) : ℂ) *
127 Complex.exp (((t' * Real.log ((n : ℝ) - j') - t * Real.log ((n : ℝ) - j) : ℝ) : ℂ) *
128 Complex.I) := fun n => vR_mul_conj Y t t' _ _
129 have hset : ∑ n ∈ sS Y, vR Y t ((n : ℝ) - j) * starRingEnd ℂ (vR Y t' ((n : ℝ) - j')) =
130 ∑ n ∈ Icc 1 ⌊5 * Y⌋₊, vR Y t ((n : ℝ) - j) * starRingEnd ℂ (vR Y t' ((n : ℝ) - j')) := by
131 have h58 : ⌊5 * Y⌋₊ ≤ ⌊8 * Y⌋₊ := Nat.floor_mono (by linarith)
132 refine (sum_subset subset_union_left ?_).trans (sum_subset subset_union_right ?_).symm
133 · intro n hn hns
134 have hn' : n ∈ Icc 1 ⌊5 * Y⌋₊ := (mem_union.1 hn).resolve_left hns
135 rw [mem_Icc] at hn'
136 have hn'' : n ≤ ⌊Y / 2⌋₊ := by
137 by_contra h
138 exact hns (mem_Ioc.2 ⟨by omega, by omega⟩)
139 have hx : ((n : ℝ) - j) ≤ Y := by
140 have : (n : ℝ) ≤ Y / 2 := (Nat.cast_le.2 hn'').trans (Nat.floor_le (by positivity))
141 linarith
142 simp [vR_eq_zero_of_le hY hx]
143 · intro n hn hnI
144 have hn' : n ∈ sS Y := (mem_union.1 hn).resolve_right hnI
145 rw [sS, mem_Ioc] at hn'
146 have hgt : 5 * Y < n := by
147 have h1 := Nat.lt_floor_add_one (5 * Y)
148 have h2 : ⌊5 * Y⌋₊ + 1 ≤ n := by
149 by_contra h
150 exact hnI (mem_Icc.2 ⟨by omega, by omega⟩)
151 have h3 : ((⌊5 * Y⌋₊ + 1 : ℕ) : ℝ) ≤ n := Nat.cast_le.2 h2
152 push_cast at h3
153 linarith
154 simp [vR_eq_zero_of_ge hY (by linarith : 4 * Y ≤ (n : ℝ) - j)]
155 rw [hset, gram, ← mul_assoc, inv_mul_cancel₀ (by exact_mod_cast hY.ne' : (Y : ℂ) ≠ 0), one_mul]
156 exact sum_congr rfl fun n _ => hterm n
157
158/-- The Gram sum of the averaged vectors, expanded over the shifts. -/
159lemma ww_gram_eq {Y : ℝ} (hY : 0 < Y) {H : ℕ} (hH : ∀ j ∈ range H, (j : ℝ) ≤ Y) (t t' : ℝ) :
160 ∑ n ∈ sS Y, ww Y H t n * starRingEnd ℂ (ww Y H t' n) =
161 ((H : ℂ)⁻¹ * (H : ℂ)⁻¹) * ∑ j ∈ range H, ∑ j' ∈ range H,
162 (Y : ℂ)⁻¹ * gram Y j j' t t' := by
163 have hpt : ∀ n : ℕ, ww Y H t n * starRingEnd ℂ (ww Y H t' n) =
164 ((H : ℂ)⁻¹ * (H : ℂ)⁻¹) * ∑ j ∈ range H, ∑ j' ∈ range H,
165 vR Y t ((n : ℝ) - j) * starRingEnd ℂ (vR Y t' ((n : ℝ) - j')) := by
166 intro n
167 unfold ww
168 rw [map_mul, map_sum, map_inv₀, Complex.conj_natCast, mul_mul_mul_comm, sum_mul_sum]
169 rw [sum_congr rfl fun n _ => hpt n, ← mul_sum, sum_comm]
170 congr 1
171 refine sum_congr rfl fun j hj => ?_
172 rw [sum_comm]
173 refine sum_congr rfl fun j' hj' => ?_
174 exact vR_gram_sum hY (hH j hj) t t'
175
176/-- Summing `(if j = j' then A else 0) + E` over `j, j' < H`. -/
177lemma diag_sum (H : ℕ) (A E : ℝ) :
178 ∑ j ∈ range H, ∑ j' ∈ range H, ((if j = j' then A else 0) + E) = H * A + H * H * E := by
179 have hin : ∀ j ∈ range H, ∑ j' ∈ range H, ((if j = j' then A else 0) + E) = A + H * E := by
180 intro j hj
181 rw [sum_add_distrib, sum_ite_eq, if_pos hj, sum_const, card_range, nsmul_eq_mul]
182 rw [sum_congr rfl hin, sum_const, card_range, nsmul_eq_mul]
183 ring
184
185/-- Row sums of the Gram matrix of the averaged vectors `ww Y H` over a `1`-separated set of
186frequencies in the L33 range: `C/(H Y)` from the diagonal shifts, `C Y^{-0.003}/Y` from the rest. -/
187theorem ww_row_bound : ∃ C > 0, ∃ Y0 : ℝ, ∀ Y ≥ Y0, ∀ H : ℕ, 1 ≤ H → (H : ℝ) ≤ Real.log Y →
188 ∀ τ : Finset ℝ, (∀ t ∈ τ, Y ^ (1.03 : ℝ) ≤ |t| ∧ |t| ≤ Y ^ (1.86 : ℝ)) →
189 (∀ t ∈ τ, ∀ t' ∈ τ, t ≠ t' → 1 ≤ |t - t'|) → (τ.card : ℝ) ≤ Y ^ (0.012 : ℝ) →
190 ∀ t ∈ τ, ∑ t' ∈ τ, ‖∑ n ∈ sS Y, ww Y H t n * starRingEnd ℂ (ww Y H t' n)‖ ≤
191 C / (H * Y) + C * Y ^ (-(0.003 : ℝ)) / Y := by
192 obtain ⟨Cs, hCs, hsep⟩ := sep_sum_le
193 obtain ⟨C0, hC0, Y0, hL⟩ := L32
194 refine ⟨C0 * Cs + C0, by positivity, max Y0 1, fun Y hY H hH hHlog τ hτ hsep' hcard t ht => ?_⟩
195 have hY1 : (1 : ℝ) ≤ Y := le_trans (le_max_right _ _) hY
196 have hYY0 : Y0 ≤ Y := le_trans (le_max_left _ _) hY
197 have hY0 : 0 < Y := by linarith
198 have hHpos : (0 : ℝ) < H := by exact_mod_cast hH
199 have hjlog : ∀ j ∈ range H, (j : ℝ) ≤ Real.log Y := fun j hj => by
200 have h1 : (j : ℝ) + 1 ≤ H := by exact_mod_cast Nat.succ_le_of_lt (mem_range.1 hj)
201 linarith
202 have hjY : ∀ j ∈ range H, (j : ℝ) ≤ Y := fun j hj =>
203 (hjlog j hj).trans ((Real.log_le_sub_one_of_pos hY0).trans (by linarith))
204 have hYn : ‖(Y : ℂ)⁻¹‖ = Y⁻¹ := by rw [norm_inv, Complex.norm_real, Real.norm_of_nonneg hY0.le]
205 have hHn : ‖(H : ℂ)⁻¹‖ = (H : ℝ)⁻¹ := by rw [norm_inv, Complex.norm_natCast]
206 have hrow : ∀ t' ∈ τ, ‖∑ n ∈ sS Y, ww Y H t n * starRingEnd ℂ (ww Y H t' n)‖ ≤
207 ((H : ℝ)⁻¹ * (H : ℝ)⁻¹) * (Y⁻¹ * (H * (C0 / (1 + |t' - t|) ^ 2) +
208 H * H * (C0 * Y ^ (-(0.015 : ℝ))))) := by
209 intro t' ht'
210 rw [ww_gram_eq hY0 hjY t t', norm_mul, norm_mul, hHn]
211 have hgb : ∀ j ∈ range H, ∀ j' ∈ range H, ‖gram Y j j' t t'‖ ≤
212 (if j = j' then C0 / (1 + |t' - t|) ^ 2 else 0) + C0 * Y ^ (-(0.015 : ℝ)) :=
213 fun j hj j' hj' => hL Y hYY0 j j' t t' (hjlog j hj) (hjlog j' hj')
214 (hτ t ht).1 (hτ t ht).2 (hτ t' ht').1 (hτ t' ht').2
215 have hsum : ‖∑ j ∈ range H, ∑ j' ∈ range H, (Y : ℂ)⁻¹ * gram Y j j' t t'‖ ≤
216 Y⁻¹ * ∑ j ∈ range H, ∑ j' ∈ range H,
217 ((if j = j' then C0 / (1 + |t' - t|) ^ 2 else 0) + C0 * Y ^ (-(0.015 : ℝ))) := by
218 simp only [mul_sum]
219 refine (norm_sum_le _ _).trans (sum_le_sum fun j hj => (norm_sum_le _ _).trans
220 (sum_le_sum fun j' hj' => ?_))
221 rw [norm_mul, hYn]
222 exact mul_le_mul_of_nonneg_left (hgb j hj j' hj') (by positivity)
223 rw [diag_sum] at hsum
224 exact mul_le_mul_of_nonneg_left hsum (by positivity)
225 have hcalc : ∑ t' ∈ τ, ((H : ℝ)⁻¹ * (H : ℝ)⁻¹) * (Y⁻¹ * (H * (C0 / (1 + |t' - t|) ^ 2) +
226 H * H * (C0 * Y ^ (-(0.015 : ℝ))))) =
227 ((H : ℝ)⁻¹ * (H : ℝ)⁻¹) * (Y⁻¹ * (H * (C0 * ∑ t' ∈ τ, ((1 + |t' - t|) ^ 2)⁻¹) +
228 H * H * ((τ.card : ℝ) * (C0 * Y ^ (-(0.015 : ℝ)))))) := by
229 simp only [← mul_sum, sum_add_distrib, sum_const, nsmul_eq_mul, div_eq_mul_inv]
230 ring
231 have hpow : Y ^ (0.012 : ℝ) * Y ^ (-(0.015 : ℝ)) = Y ^ (-(0.003 : ℝ)) := by
232 rw [← Real.rpow_add hY0]; norm_num
233 have hR : (τ.card : ℝ) * (C0 * Y ^ (-(0.015 : ℝ))) ≤ C0 * Y ^ (-(0.003 : ℝ)) := by
234 have hE0 : 0 ≤ Y ^ (-(0.015 : ℝ)) := by positivity
235 calc (τ.card : ℝ) * (C0 * Y ^ (-(0.015 : ℝ))) = C0 * ((τ.card : ℝ) * Y ^ (-(0.015 : ℝ))) := by
236 ring
237 _ ≤ C0 * (Y ^ (0.012 : ℝ) * Y ^ (-(0.015 : ℝ))) := by gcongr
238 _ = C0 * Y ^ (-(0.003 : ℝ)) := by rw [hpow]
239 have hSv := hsep τ hsep' t ht
240 set Sv := ∑ t' ∈ τ, ((1 + |t' - t|) ^ 2)⁻¹ with hSv_def
241 have hkey : ((H : ℝ)⁻¹ * (H : ℝ)⁻¹) * (Y⁻¹ * (H * (C0 * Sv) +
242 H * H * ((τ.card : ℝ) * (C0 * Y ^ (-(0.015 : ℝ)))))) =
243 C0 * Sv / (H * Y) + ((τ.card : ℝ) * (C0 * Y ^ (-(0.015 : ℝ)))) / Y := by
244 field_simp
245 have hC1 : C0 * Sv ≤ C0 * Cs + C0 := by
246 nlinarith [mul_le_mul_of_nonneg_left hSv hC0.le]
247 have hC2 : (τ.card : ℝ) * (C0 * Y ^ (-(0.015 : ℝ))) ≤ (C0 * Cs + C0) * Y ^ (-(0.003 : ℝ)) := by
248 have : 0 ≤ Y ^ (-(0.003 : ℝ)) := by positivity
249 nlinarith [mul_nonneg (mul_nonneg hC0.le hCs.le) this, mul_nonneg hC0.le this]
250 calc ∑ t' ∈ τ, ‖∑ n ∈ sS Y, ww Y H t n * starRingEnd ℂ (ww Y H t' n)‖
251 ≤ ∑ t' ∈ τ, ((H : ℝ)⁻¹ * (H : ℝ)⁻¹) * (Y⁻¹ * (H * (C0 / (1 + |t' - t|) ^ 2) +
252 H * H * (C0 * Y ^ (-(0.015 : ℝ))))) := sum_le_sum hrow
253 _ = _ := hcalc
254 _ = C0 * Sv / (H * Y) + ((τ.card : ℝ) * (C0 * Y ^ (-(0.015 : ℝ)))) / Y := hkey
255 _ ≤ (C0 * Cs + C0) / (H * Y) + (C0 * Cs + C0) * Y ^ (-(0.003 : ℝ)) / Y := by
256 gcongr
257
258/-- With `k = 1` the average is `vR` itself. -/
259lemma ww_one (Y t : ℝ) (n : ℕ) : ww Y 1 t n = vR Y t n := by
260 simp [ww]
261
262/-- Summing a function against `vR` over `[1, 4Y]` is the same as over `sS Y`. -/
263lemma icc_sum_eq_sS {Y : ℝ} (hY : 0 < Y) (g : ℕ → ℂ) (t : ℝ) :
264 ∑ y ∈ Icc 1 ⌊4 * Y⌋₊, g y * vR Y t y = ∑ n ∈ sS Y, g n * vR Y t n := by
265 refine (sum_subset subset_union_right ?_).trans (sum_subset subset_union_left ?_).symm
266 · -- `n ∈ sS Y` outside `Icc 1 ⌊4Y⌋`: `n > 4Y`
267 intro n hn hnI
268 have hn' : n ∈ sS Y := (mem_union.1 hn).resolve_right hnI
269 rw [sS, mem_Ioc] at hn'
270 have hgt : 4 * Y < n := by
271 have h1 := Nat.lt_floor_add_one (4 * Y)
272 have h2 : ⌊4 * Y⌋₊ + 1 ≤ n := by
273 by_contra h
274 exact hnI (mem_Icc.2 ⟨by omega, by omega⟩)
275 have h3 : ((⌊4 * Y⌋₊ + 1 : ℕ) : ℝ) ≤ n := Nat.cast_le.2 h2
276 push_cast at h3
277 linarith
278 simp [vR_eq_zero_of_ge hY hgt.le]
279 · -- `n ∈ Icc 1 ⌊4Y⌋` outside `sS Y`: `n ≤ Y/2`
280 intro n hn hns
281 have hn' : n ∈ Icc 1 ⌊4 * Y⌋₊ := (mem_union.1 hn).resolve_left hns
282 rw [mem_Icc] at hn'
283 have h48 : ⌊4 * Y⌋₊ ≤ ⌊8 * Y⌋₊ := Nat.floor_mono (by linarith)
284 have hn'' : n ≤ ⌊Y / 2⌋₊ := by
285 by_contra h
286 exact hns (mem_Ioc.2 ⟨by omega, by omega⟩)
287 have hx : (n : ℝ) ≤ Y := by
288 have : (n : ℝ) ≤ Y / 2 := (Nat.cast_le.2 hn'').trans (Nat.floor_le (by positivity))
289 linarith
290 simp [vR_eq_zero_of_le hY hx]
291
292/-- The shifted sum: `∑_{y ∈ [1, 4Y]} b(y+j) vR(y) = ∑_{n ∈ sS Y} b(n) vR(n-j)`. -/
293lemma shift_sum {Y : ℝ} (hY : 0 < Y) {j : ℕ} (hj : (j : ℝ) ≤ Y) (b : ℕ → ℂ) (t : ℝ) :
294 ∑ y ∈ Icc 1 ⌊4 * Y⌋₊, b (y + j) * vR Y t y =
295 ∑ n ∈ sS Y, b n * vR Y t ((n : ℝ) - j) := by
296 have hinj : ∀ a ∈ Icc 1 ⌊4 * Y⌋₊, ∀ c ∈ Icc 1 ⌊4 * Y⌋₊, a + j = c + j → a = c :=
297 fun a _ c _ h => by omega
298 have hLHS : ∑ y ∈ Icc 1 ⌊4 * Y⌋₊, b (y + j) * vR Y t y =
299 ∑ n ∈ (Icc 1 ⌊4 * Y⌋₊).image (· + j), b n * vR Y t ((n : ℝ) - j) := by
300 rw [sum_image (fun a ha c hc h => hinj a ha c hc h)]
301 refine sum_congr rfl fun y _ => ?_
302 congr 2
303 push_cast
304 ring
305 have h48 : ⌊4 * Y⌋₊ ≤ ⌊8 * Y⌋₊ := Nat.floor_mono (by linarith)
306 have hmemb : ∀ y ∈ Icc 1 ⌊4 * Y⌋₊, y + j ≤ ⌊8 * Y⌋₊ := fun y hy => by
307 rw [mem_Icc] at hy
308 have h1 : (y : ℝ) ≤ 4 * Y := (Nat.le_floor_iff (by linarith)).1 hy.2
309 have h2 : ((y + j : ℕ) : ℝ) ≤ 8 * Y := by push_cast; linarith
310 exact Nat.le_floor h2
311 rw [hLHS]
312 refine (sum_subset subset_union_right ?_).trans (sum_subset subset_union_left ?_).symm
313 · -- `n ∈ sS Y` outside the image: `n - j` lies outside `(Y, 4Y)`
314 intro n hn hnI
315 have hn' : n ∈ sS Y := (mem_union.1 hn).resolve_right hnI
316 by_cases hx : (n : ℝ) - j ≤ Y
317 · simp [vR_eq_zero_of_le hY hx]
318 by_cases hx4 : 4 * Y ≤ (n : ℝ) - j
319 · simp [vR_eq_zero_of_ge hY hx4]
320 exfalso
321 replace hx := not_le.1 hx
322 replace hx4 := not_le.1 hx4
323 have hjn : j < n := by
324 have : (j : ℝ) < n := by linarith
325 exact_mod_cast this
326 have hy1 : 1 ≤ n - j := by
327 have : (0 : ℝ) < ((n - j : ℕ) : ℝ) := by rw [Nat.cast_sub hjn.le]; linarith
328 exact_mod_cast this
329 have hy4 : n - j ≤ ⌊4 * Y⌋₊ := Nat.le_floor (by rw [Nat.cast_sub hjn.le]; linarith)
330 apply hnI
331 refine mem_image.2 ⟨n - j, mem_Icc.2 ⟨hy1, hy4⟩, ?_⟩
332 omega
333 · -- `n` in the image outside `sS Y`: the shifted point is `≤ Y/2`
334 intro n hn hns
335 obtain ⟨y, hy, rfl⟩ := mem_image.1 ((mem_union.1 hn).resolve_left hns)
336 have hy' := hmemb y hy
337 have hle : y + j ≤ ⌊Y / 2⌋₊ := by
338 by_contra h
339 exact hns (mem_Ioc.2 ⟨by omega, hy'⟩)
340 have hy2 : (y : ℝ) ≤ Y / 2 := by
341 have h1 : ((y + j : ℕ) : ℝ) ≤ Y / 2 := (Nat.cast_le.2 hle).trans (Nat.floor_le (by positivity))
342 have h2 : ((y + j : ℕ) : ℝ) = (y : ℝ) + j := by push_cast; ring
343 linarith
344 simp [vR_eq_zero_of_le hY (hy2.trans (by linarith))]
345
346end E424
347