| 1 | module |
| 2 | |
| 3 | public import E424.ToolDefs |
| 4 | |
| 5 | @[expose] public section |
| 6 | |
| 7 | /-! |
| 8 | # Erdős 424: helpers for tool T7 (Kusmin-Landau). |
| 9 | |
| 10 | `kl_sum_le`: `‖∑_{i<n} e(y i)‖ ≤ 2/θ` when the increments `y (i+1) - y i` are monotone in `i` and lie |
| 11 | in `[k+θ, k+1-θ]` for one integer `k`. Proof: `e(y i) = d_i (e(y i) - e(y (i+1)))` with |
| 12 | `d_i = 1/(1 - e(u_i)) = 1/2 + (cot(π u_i)/2) i`, Abel summation, and `cot` is antitone on `(0, π)`. |
| 13 | -/ |
| 14 | |
| 15 | set_option linter.style.header false |
| 16 | |
| 17 | namespace E424 |
| 18 | |
| 19 | open Finset |
| 20 | |
| 21 | /-- `e` is 1-periodic. -/ |
| 22 | lemma kl_ee_add_int (x : ℝ) (k : ℤ) : ee (x + k) = ee x := by |
| 23 | unfold ee |
| 24 | have h : ((2 * Real.pi * (x + k) : ℝ) : ℂ) * Complex.I |
| 25 | = (2 * Real.pi * x : ℝ) * Complex.I + (k : ℂ) * (2 * Real.pi * Complex.I) := by |
| 26 | push_cast; ring |
| 27 | rw [h, Complex.exp_add, Complex.exp_int_mul_two_pi_mul_I, mul_one] |
| 28 | |
| 29 | /-- `e` is additive. -/ |
| 30 | lemma kl_ee_add (x y : ℝ) : ee (x + y) = ee x * ee y := by |
| 31 | unfold ee |
| 32 | rw [← Complex.exp_add] |
| 33 | congr 1 |
| 34 | push_cast |
| 35 | ring |
| 36 | |
| 37 | /-- `e(x) = (cos πx + i sin πx)²`. -/ |
| 38 | lemma kl_ee_eq (x : ℝ) : |
| 39 | ee x = ((Real.cos (Real.pi * x) : ℂ) + (Real.sin (Real.pi * x) : ℂ) * Complex.I) ^ 2 := by |
| 40 | have h1 : Complex.exp (((Real.pi * x : ℝ) : ℂ) * Complex.I) |
| 41 | = (Real.cos (Real.pi * x) : ℂ) + (Real.sin (Real.pi * x) : ℂ) * Complex.I := by |
| 42 | rw [Complex.exp_mul_I, ← Complex.ofReal_cos, ← Complex.ofReal_sin] |
| 43 | have h2 : ee x = Complex.exp (((Real.pi * x : ℝ) : ℂ) * Complex.I) ^ 2 := by |
| 44 | rw [← Complex.exp_nat_mul] |
| 45 | unfold ee |
| 46 | congr 1 |
| 47 | push_cast |
| 48 | ring |
| 49 | rw [h2, h1] |
| 50 | |
| 51 | /-- Algebra behind `kl_inv_one_sub_ee`: `(1 - (c + s i)²)(1/2 + (c/s)/2 · i) = 1` for `s² + c² = 1`. -/ |
| 52 | lemma kl_inv_aux (c s : ℝ) (hs : s ≠ 0) (hc : s ^ 2 + c ^ 2 = 1) : |
| 53 | (1 - ((c : ℂ) + (s : ℂ) * Complex.I) ^ 2) * (1 / 2 + ((c / s / 2 : ℝ) : ℂ) * Complex.I) = 1 := by |
| 54 | apply Complex.ext |
| 55 | · simp [pow_two] |
| 56 | field_simp |
| 57 | linear_combination hc |
| 58 | · simp [pow_two] |
| 59 | field_simp |
| 60 | linear_combination (-c) * hc |
| 61 | |
| 62 | /-- `1/(1 - e(x)) = 1/2 + (cot(πx)/2) i` when `sin(πx) ≠ 0`. -/ |
| 63 | lemma kl_inv_one_sub_ee (x : ℝ) (hs : Real.sin (Real.pi * x) ≠ 0) : |
| 64 | (1 - ee x)⁻¹ = 1 / 2 + ((Real.cos (Real.pi * x) / Real.sin (Real.pi * x) / 2 : ℝ) : ℂ) * Complex.I := by |
| 65 | have hc : Real.sin (Real.pi * x) ^ 2 + Real.cos (Real.pi * x) ^ 2 = 1 := Real.sin_sq_add_cos_sq _ |
| 66 | rw [kl_ee_eq] |
| 67 | exact inv_eq_of_mul_eq_one_right (kl_inv_aux _ _ hs hc) |
| 68 | |
| 69 | /-- `1 - e(x) ≠ 0` when `sin(πx) ≠ 0`. -/ |
| 70 | lemma kl_one_sub_ee_ne (x : ℝ) (hs : Real.sin (Real.pi * x) ≠ 0) : 1 - ee x ≠ 0 := by |
| 71 | intro h |
| 72 | have h' := kl_inv_one_sub_ee x hs |
| 73 | rw [h, inv_zero] at h' |
| 74 | generalize ((Real.cos (Real.pi * x) / Real.sin (Real.pi * x) / 2 : ℝ)) = r at h' |
| 75 | norm_num [Complex.ext_iff] at h' |
| 76 | |
| 77 | |
| 78 | /-- `cot` is antitone on `(0, π)`. -/ |
| 79 | lemma kl_cot_anti {a b : ℝ} (ha : 0 < a) (hab : a ≤ b) (hb : b < Real.pi) : |
| 80 | Real.cos b / Real.sin b ≤ Real.cos a / Real.sin a := by |
| 81 | have hsa : 0 < Real.sin a := Real.sin_pos_of_pos_of_lt_pi ha (by linarith) |
| 82 | have hsb : 0 < Real.sin b := Real.sin_pos_of_pos_of_lt_pi (by linarith) hb |
| 83 | have hsab : 0 ≤ Real.sin (b - a) := |
| 84 | Real.sin_nonneg_of_nonneg_of_le_pi (by linarith) (by linarith) |
| 85 | have hsa' := hsa.ne' |
| 86 | have hsb' := hsb.ne' |
| 87 | have key : Real.cos a / Real.sin a - Real.cos b / Real.sin b |
| 88 | = Real.sin (b - a) / (Real.sin a * Real.sin b) := by |
| 89 | rw [Real.sin_sub] |
| 90 | field_simp |
| 91 | have : 0 ≤ Real.sin (b - a) / (Real.sin a * Real.sin b) := div_nonneg hsab (mul_pos hsa hsb).le |
| 92 | linarith |
| 93 | |
| 94 | /-- Abel summation: `∑_{i≤L} d_i (z_i - z_{i+1}) = d_0 z_0 - d_L z_{L+1} + ∑_{i<L} (d_{i+1} - d_i) z_{i+1}`. -/ |
| 95 | lemma kl_abel (d z : ℕ → ℂ) (L : ℕ) : |
| 96 | ∑ i ∈ range (L + 1), d i * (z i - z (i + 1)) |
| 97 | = d 0 * z 0 - d L * z (L + 1) + ∑ i ∈ range L, (d (i + 1) - d i) * z (i + 1) := by |
| 98 | induction L with |
| 99 | | zero => simp [mul_sub] |
| 100 | | succ L ih => |
| 101 | rw [sum_range_succ, ih, sum_range_succ (fun i => (d (i + 1) - d i) * z (i + 1)) L] |
| 102 | ring |
| 103 | |
| 104 | /-- `‖r · i‖ = |r|` for real `r`. -/ |
| 105 | lemma kl_norm_ofReal_mul_I (r : ℝ) : ‖(r : ℂ) * Complex.I‖ = |r| := by |
| 106 | rw [norm_mul, Complex.norm_I, mul_one, Complex.norm_real, Real.norm_eq_abs] |
| 107 | |
| 108 | /-- Kusmin-Landau. If the increments `y (i+1) - y i` (`i < n`) are monotone in `i` and lie in |
| 109 | `[k+θ, k+1-θ]` for one integer `k`, then `‖∑_{i<n} e(y i)‖ ≤ 2/θ`. -/ |
| 110 | theorem kl_sum_le (y : ℕ → ℝ) (n : ℕ) (k : ℤ) (θ : ℝ) (hθ : 0 < θ) (hθ2 : θ ≤ 1 / 2) |
| 111 | (hinc : ∀ i < n, (k : ℝ) + θ ≤ y (i + 1) - y i ∧ y (i + 1) - y i ≤ k + 1 - θ) |
| 112 | (hmono : ∀ i < n, ∀ j < n, i ≤ j → y (i + 1) - y i ≤ y (j + 1) - y j) : |
| 113 | ‖∑ i ∈ range n, ee (y i)‖ ≤ 2 / θ := by |
| 114 | rcases n with _ | L |
| 115 | · simp only [range_zero, sum_empty, norm_zero] |
| 116 | positivity |
| 117 | -- `u i` is the fractional part of the increment, `c i = cot(π u i)`, `d i = 1/(1 - e(u i))` |
| 118 | let u : ℕ → ℝ := fun i => y (i + 1) - y i - k |
| 119 | let c : ℕ → ℝ := fun i => Real.cos (Real.pi * u i) / Real.sin (Real.pi * u i) |
| 120 | let d : ℕ → ℂ := fun i => 1 / 2 + ((c i / 2 : ℝ) : ℂ) * Complex.I |
| 121 | have hu : ∀ i < L + 1, θ ≤ u i ∧ u i ≤ 1 - θ := by |
| 122 | intro i hi |
| 123 | obtain ⟨h1, h2⟩ := hinc i hi |
| 124 | constructor <;> simp only [u] <;> linarith |
| 125 | have hpos : ∀ i < L + 1, 0 < Real.pi * u i := fun i hi => |
| 126 | mul_pos Real.pi_pos (by linarith [(hu i hi).1]) |
| 127 | have hlt : ∀ i < L + 1, Real.pi * u i < Real.pi := fun i hi => by |
| 128 | have h := mul_lt_mul_of_pos_left (show u i < 1 by linarith [(hu i hi).2]) Real.pi_pos |
| 129 | linarith [mul_one Real.pi] |
| 130 | have hsin : ∀ i < L + 1, Real.sin (Real.pi * u i) ≠ 0 := fun i hi => |
| 131 | (Real.sin_pos_of_pos_of_lt_pi (hpos i hi) (hlt i hi)).ne' |
| 132 | -- one Abel term: `e(y i) = d i (e(y i) - e(y (i+1)))` |
| 133 | have hstep : ∀ i < L + 1, ee (y i) = d i * (ee (y i) - ee (y (i + 1))) := by |
| 134 | intro i hi |
| 135 | have hy : y (i + 1) = y i + (u i + k) := by simp only [u]; ring |
| 136 | have hee : ee (y (i + 1)) = ee (y i) * ee (u i) := by |
| 137 | rw [hy, kl_ee_add, kl_ee_add_int] |
| 138 | have hinv : (1 - ee (u i))⁻¹ = d i := kl_inv_one_sub_ee (u i) (hsin i hi) |
| 139 | have hne := kl_one_sub_ee_ne (u i) (hsin i hi) |
| 140 | have hfac : ee (y i) - ee (y i) * ee (u i) = ee (y i) * (1 - ee (u i)) := by ring |
| 141 | rw [hee, ← hinv, hfac] |
| 142 | field_simp |
| 143 | have hz : ∀ i, ‖ee (y i)‖ = 1 := fun i => by |
| 144 | unfold ee |
| 145 | exact Complex.norm_exp_ofReal_mul_I _ |
| 146 | have hsum : ∑ i ∈ range (L + 1), ee (y i) |
| 147 | = d 0 * ee (y 0) - d L * ee (y (L + 1)) + ∑ i ∈ range L, (d (i + 1) - d i) * ee (y (i + 1)) := by |
| 148 | have hS : ∑ i ∈ range (L + 1), ee (y i) |
| 149 | = ∑ i ∈ range (L + 1), d i * (ee (y i) - ee (y (i + 1))) := |
| 150 | sum_congr rfl (fun i hi => hstep i (mem_range.mp hi)) |
| 151 | exact hS.trans (kl_abel d (fun i => ee (y i)) L) |
| 152 | -- cot is antitone along the increasing `u`, and bounded by `K = cot(πθ)` |
| 153 | have hcanti : ∀ i j, i < L + 1 → j < L + 1 → i ≤ j → c j ≤ c i := by |
| 154 | intro i j hi hj hij |
| 155 | have huij : u i ≤ u j := by |
| 156 | have := hmono i hi j hj hij |
| 157 | simp only [u] |
| 158 | linarith |
| 159 | exact kl_cot_anti (hpos i hi) (mul_le_mul_of_nonneg_left huij Real.pi_pos.le) (hlt j hj) |
| 160 | set K : ℝ := Real.cos (Real.pi * θ) / Real.sin (Real.pi * θ) with hKdef |
| 161 | have hsinθ : 2 * θ ≤ Real.sin (Real.pi * θ) := by |
| 162 | have h := Real.mul_le_sin (x := Real.pi * θ) (mul_pos Real.pi_pos hθ).le |
| 163 | (by nlinarith [Real.pi_pos]) |
| 164 | have e : 2 / Real.pi * (Real.pi * θ) = 2 * θ := by field_simp |
| 165 | linarith |
| 166 | have hKle : 2 * K ≤ 1 / θ := by |
| 167 | have hs : 0 < Real.sin (Real.pi * θ) := by linarith |
| 168 | have h1 : K ≤ 1 / Real.sin (Real.pi * θ) := by |
| 169 | rw [hKdef] |
| 170 | gcongr |
| 171 | exact Real.cos_le_one _ |
| 172 | have h2 : 1 / Real.sin (Real.pi * θ) ≤ 1 / (2 * θ) := |
| 173 | one_div_le_one_div_of_le (by positivity) hsinθ |
| 174 | have h3 : 2 * (1 / (2 * θ)) = 1 / θ := by field_simp |
| 175 | linarith |
| 176 | have hc0 : c 0 ≤ K := kl_cot_anti (mul_pos Real.pi_pos hθ) |
| 177 | (mul_le_mul_of_nonneg_left (hu 0 (by omega)).1 Real.pi_pos.le) (hlt 0 (by omega)) |
| 178 | have hcL : -K ≤ c L := by |
| 179 | have hrefl : Real.cos (Real.pi * (1 - θ)) / Real.sin (Real.pi * (1 - θ)) = -K := by |
| 180 | rw [hKdef, show Real.pi * (1 - θ) = Real.pi - Real.pi * θ by ring, Real.cos_pi_sub, |
| 181 | Real.sin_pi_sub, neg_div] |
| 182 | have h := kl_cot_anti (hpos L (by omega)) |
| 183 | (mul_le_mul_of_nonneg_left (hu L (by omega)).2 Real.pi_pos.le) |
| 184 | (by nlinarith [Real.pi_pos]) |
| 185 | rw [hrefl] at h |
| 186 | exact h |
| 187 | have hcK : ∀ i < L + 1, |c i| ≤ K := fun i hi => |
| 188 | abs_le.mpr ⟨by linarith [hcanti i L hi (by omega) (by omega)], |
| 189 | by linarith [hcanti 0 i (by omega) hi (Nat.zero_le i)]⟩ |
| 190 | -- norms of the Abel weights |
| 191 | have hdnorm : ∀ i < L + 1, ‖d i‖ ≤ 1 / 2 + K / 2 := fun i hi => by |
| 192 | have h := norm_add_le (1 / 2 : ℂ) (((c i / 2 : ℝ) : ℂ) * Complex.I) |
| 193 | have e1 : ‖(1 / 2 : ℂ)‖ = 1 / 2 := by norm_num |
| 194 | rw [kl_norm_ofReal_mul_I, e1] at h |
| 195 | change ‖d i‖ ≤ _ at h ⊢ |
| 196 | have := hcK i hi |
| 197 | rw [abs_div, abs_two] at h |
| 198 | linarith |
| 199 | have hde : ∀ i, d (i + 1) - d i = ((c (i + 1) - c i) / 2 : ℝ) * Complex.I := fun i => by |
| 200 | simp only [d] |
| 201 | push_cast |
| 202 | ring |
| 203 | have hdiff : ∀ i ∈ range L, ‖d (i + 1) - d i‖ = (c i - c (i + 1)) / 2 := by |
| 204 | intro i hi |
| 205 | have hi' := mem_range.mp hi |
| 206 | have hmon : c (i + 1) ≤ c i := hcanti i (i + 1) (by omega) (by omega) (by omega) |
| 207 | rw [hde i, kl_norm_ofReal_mul_I, abs_of_nonpos (by linarith)] |
| 208 | ring |
| 209 | -- assemble |
| 210 | have hnorm : ‖∑ i ∈ range (L + 1), ee (y i)‖ ≤ ‖d 0‖ + ‖d L‖ + ∑ i ∈ range L, ‖d (i + 1) - d i‖ := by |
| 211 | rw [hsum] |
| 212 | have hA := norm_add_le (d 0 * ee (y 0) - d L * ee (y (L + 1))) |
| 213 | (∑ i ∈ range L, (d (i + 1) - d i) * ee (y (i + 1))) |
| 214 | have hB := norm_sub_le (d 0 * ee (y 0)) (d L * ee (y (L + 1))) |
| 215 | have hC := norm_sum_le (range L) (fun i => (d (i + 1) - d i) * ee (y (i + 1))) |
| 216 | simp only [norm_mul, hz, mul_one] at hB hC |
| 217 | linarith |
| 218 | have htele : ∑ i ∈ range L, (c i - c (i + 1)) / 2 = (c 0 - c L) / 2 := by |
| 219 | rw [← sum_div, sum_range_sub' c L] |
| 220 | have hsumd : ∑ i ∈ range L, ‖d (i + 1) - d i‖ ≤ K := by |
| 221 | rw [sum_congr rfl hdiff, htele] |
| 222 | linarith [hc0, hcL] |
| 223 | have h1 := hdnorm 0 (by omega) |
| 224 | have h2 := hdnorm L (by omega) |
| 225 | have hθ1 : 1 ≤ 1 / θ := by rw [le_div_iff₀ hθ]; linarith |
| 226 | have h2θ : 2 / θ = 1 / θ + 1 / θ := by ring |
| 227 | linarith |
| 228 | |
| 229 | end E424 |
| 230 | |