| 1 | module |
| 2 | |
| 3 | public import E424.DirichletError.L28 |
| 4 | public import E424.DivisorMoments |
| 5 | public import E424.Tools.T4 |
| 6 | public import E424.Tools.T6 |
| 7 | public import E424.DirichletError.L29AuxD |
| 8 | |
| 9 | @[expose] public section |
| 10 | |
| 11 | /-! |
| 12 | # Section 7 of the outline: L29 |
| 13 | -/ |
| 14 | |
| 15 | set_option linter.style.header false |
| 16 | open Finset MeasureTheory |
| 17 | |
| 18 | namespace E424 |
| 19 | |
| 20 | /-- `Err = m⁻¹ (e_1-part + e_2-part)`. -/ |
| 21 | theorem Err_split (S : Finset ℕ) (hS : ∀ s ∈ S, 1 ≤ s) (hm : 0 < ms S) (N t : ℝ) (hN : 0 < N) : |
| 22 | Err S N t = (((ms S)⁻¹ : ℝ) : ℂ) * |
| 23 | (∑ n ∈ Icc 1 ⌊4 * N⌋₊, ((wt N n * (F n * (ms S - rc S n)) : ℝ) : ℂ) * nit n t + |
| 24 | ∑ n ∈ Icc 1 ⌊4 * N⌋₊, ((wt N n * e2 S n : ℝ) : ℂ) * nit n t) := by |
| 25 | rw [L28 S hS N t hN, ← sum_add_distrib, mul_sum] |
| 26 | refine sum_congr rfl fun n _ => ?_ |
| 27 | rw [← add_mul, ← mul_assoc, ← Complex.ofReal_add, ← Complex.ofReal_mul] |
| 28 | congr 2 |
| 29 | have : e2 S n = rc S n * F n - ∑ s ∈ S with s ∣ n, F (n / s) := by |
| 30 | unfold e2; rw [sum_sub_distrib, sum_const, nsmul_eq_mul]; rfl |
| 31 | rw [this]; unfold wt |
| 32 | field_simp |
| 33 | ring |
| 34 | |
| 35 | /-- One dyadic scale, before normalisation. -/ |
| 36 | theorem L29_scale : ∃ C > 0, ∀ (z : ℝ) (S : Finset ℕ), 3 ≤ z → IsFam z S → 0 < ms S → |
| 37 | ∀ N H : ℝ, 1 ≤ H → 40 * H ≤ N → |
| 38 | ∫ t in (-(N / H))..(N / H), ‖Err S N t‖ ^ 2 ≤ C / ms S ^ 2 * |
| 39 | (1 / H + H * (S.card : ℝ) ^ 2 / N + Dsum S N H / H + |
| 40 | ∑ n ∈ Icc 1 ⌊4 * N⌋₊ with N < (n : ℕ) ∧ (n : ℝ) < 4 * N, rc S n * badCount S n / n) := by |
| 41 | obtain ⟨C1, hC1, h1⟩ := gallagher_disc |
| 42 | obtain ⟨C2, hC2, h2⟩ := e1_step |
| 43 | obtain ⟨C3, hC3, h3⟩ := e2_step |
| 44 | refine ⟨2 * (C1 * C2 + C3), by positivity, fun z S hz hS hm N H hH hN => ?_⟩ |
| 45 | have hN0 : 0 < N := by linarith |
| 46 | have hH0 : 0 < H := by linarith |
| 47 | have hT : 4 ≤ N / H := by rw [le_div_iff₀ hH0]; linarith |
| 48 | have hS1 : ∀ s ∈ S, 1 ≤ s := fun s hs => by |
| 49 | have : (1 : ℝ) < s := by linarith [(hS s hs).1] |
| 50 | exact_mod_cast this.le |
| 51 | set T := N / H with hTdef |
| 52 | set P1 : ℝ → ℂ := fun t => |
| 53 | ∑ n ∈ Icc 1 ⌊4 * N⌋₊, ((wt N n * (F n * (ms S - rc S n)) : ℝ) : ℂ) * nit n t with hP1 |
| 54 | set P2 : ℝ → ℂ := fun t => |
| 55 | ∑ n ∈ Icc 1 ⌊4 * N⌋₊, ((wt N n * e2 S n : ℝ) : ℂ) * nit n t with hP2 |
| 56 | have c1 : Continuous P1 := continuous_finsetSum _ fun n _ => continuous_const.mul (continuous_nit n) |
| 57 | have c2 : Continuous P2 := continuous_finsetSum _ fun n _ => continuous_const.mul (continuous_nit n) |
| 58 | have hpt : ∀ t, ‖Err S N t‖ ^ 2 ≤ 2 / ms S ^ 2 * (‖P1 t‖ ^ 2 + ‖P2 t‖ ^ 2) := by |
| 59 | intro t |
| 60 | rw [Err_split S hS1 hm N t hN0, norm_mul, Complex.norm_real, Real.norm_eq_abs, |
| 61 | abs_of_pos (by positivity), mul_pow] |
| 62 | have h4 : ‖P1 t + P2 t‖ ^ 2 ≤ 2 * (‖P1 t‖ ^ 2 + ‖P2 t‖ ^ 2) := by |
| 63 | have h5 := norm_add_le (P1 t) (P2 t) |
| 64 | nlinarith [norm_nonneg (P1 t + P2 t), sq_nonneg (‖P1 t‖ - ‖P2 t‖)] |
| 65 | calc (ms S)⁻¹ ^ 2 * ‖P1 t + P2 t‖ ^ 2 ≤ (ms S)⁻¹ ^ 2 * (2 * (‖P1 t‖ ^ 2 + ‖P2 t‖ ^ 2)) := by gcongr |
| 66 | _ = _ := by field_simp |
| 67 | have i1 : IntervalIntegrable (fun t => ‖P1 t‖ ^ 2) volume (-T) T := |
| 68 | (c1.norm.pow 2).intervalIntegrable _ _ |
| 69 | have i2 : IntervalIntegrable (fun t => ‖P2 t‖ ^ 2) volume (-T) T := |
| 70 | (c2.norm.pow 2).intervalIntegrable _ _ |
| 71 | have hint : ∫ t in (-T)..T, ‖Err S N t‖ ^ 2 ≤ |
| 72 | 2 / ms S ^ 2 * ((∫ t in (-T)..T, ‖P1 t‖ ^ 2) + ∫ t in (-T)..T, ‖P2 t‖ ^ 2) := by |
| 73 | rw [← intervalIntegral.integral_add i1 i2, ← intervalIntegral.integral_const_mul] |
| 74 | exact intervalIntegral.integral_mono_on (by linarith) |
| 75 | (((continuous_Err S N).norm.pow 2).intervalIntegrable _ _) ((i1.add i2).const_mul _) |
| 76 | fun t _ => hpt t |
| 77 | have j1 : ∫ t in (-T)..T, ‖P1 t‖ ^ 2 ≤ |
| 78 | C1 * C2 * (1 / H + H * (S.card : ℝ) ^ 2 / N + Dsum S N H / H) := by |
| 79 | refine (h1 N T (by linarith) hT (fun n => wt N n * (F n * (ms S - rc S n))) |
| 80 | fun n hn => wt_supp hN0 (left_ne_zero_of_mul hn)).trans ?_ |
| 81 | calc _ ≤ C1 * T ^ 2 * (C2 / N ^ 2 * (H + H ^ 3 * (S.card : ℝ) ^ 2 / N + H * Dsum S N H)) := |
| 82 | mul_le_mul_of_nonneg_left (h2 z S hz hS N H hH hN) (by positivity) |
| 83 | _ = _ := by rw [hTdef]; field_simp |
| 84 | have j2 := h3 S N H hH hN |
| 85 | change ∫ t in (-T)..T, ‖P2 t‖ ^ 2 ≤ _ at j2 |
| 86 | set B := ∑ n ∈ Icc 1 ⌊4 * N⌋₊ with N < (n : ℕ) ∧ (n : ℝ) < 4 * N, rc S n * badCount S n / n with hB |
| 87 | have hB0 : 0 ≤ B := sum_nonneg fun n _ => |
| 88 | div_nonneg ((sq_nonneg _).trans (e2_sq_le S n)) (Nat.cast_nonneg n) |
| 89 | have hD0 : 0 ≤ Dsum S N H := sum_nonneg fun _ _ => sum_nonneg fun _ _ => |
| 90 | div_nonneg (mul_nonneg (ind_nonneg _) (sq_nonneg _)) (Nat.cast_nonneg _) |
| 91 | set X := 1 / H + H * (S.card : ℝ) ^ 2 / N + Dsum S N H / H with hX |
| 92 | have hX0 : 0 ≤ X := by positivity |
| 93 | refine hint.trans ?_ |
| 94 | calc _ ≤ 2 / ms S ^ 2 * (C1 * C2 * X + C3 * B) := by gcongr |
| 95 | _ ≤ 2 / ms S ^ 2 * ((C1 * C2 + C3) * (X + B)) := by |
| 96 | gcongr |
| 97 | nlinarith [mul_nonneg (mul_nonneg hC1.le hC2.le) hB0, mul_nonneg hC3.le hX0] |
| 98 | _ = _ := by ring |
| 99 | |
| 100 | /-- **Lemma 29**, error bound, for a θ-family of elements `≤ lo^0.49`. `V` bounds the shifted fourth |
| 101 | moments, `y` the discrepancies `D_W h`, `b` the last bracket of the outline. -/ |
| 102 | theorem L29 : ∃ C > 0, ∃ N0 : ℝ, ∀ W : Win, 3 ≤ W.lo → N0 ≤ W.lo → 1 ≤ W.len → |
| 103 | ∀ (z : ℝ) (S : Finset ℕ), 3 ≤ z → IsFam z S → (∀ s ∈ S, (s : ℝ) ≤ W.lo ^ (0.49 : ℝ)) → 0 < ms S → |
| 104 | ∀ H : ℝ, 1 ≤ H → H ≤ W.lo ^ (0.001 : ℝ) → ∀ y V b : ℝ, |
| 105 | (∀ h : ℕ, (h : ℝ) ≤ 8 * H → W.D h ≤ y) → |
| 106 | (∀ h : ℕ, (h : ℝ) ≤ 8 * H → W.E (fun n => (ms S - rc S (n + h)) ^ 4) ≤ V) → |
| 107 | W.E (fun n => rc S n * badCount S n) ≤ b → |
| 108 | ∑ k ∈ W.dy, ∫ t in (-(2 ^ k / H))..(2 ^ k / H), ‖Err S (2 ^ k) t‖ ^ 2 ≤ |
| 109 | C * W.len / ms S ^ 2 * (1 / H + W.lo ^ (-(0.01 : ℝ)) + Real.sqrt (y * V) + b) := by |
| 110 | obtain ⟨C, hC, hscale⟩ := L29_scale |
| 111 | refine ⟨16 * C, by positivity, 100, fun W hlo3 hlo hlen z S hz hS hSle hm H hH hHle y V b hy hV hb => ?_⟩ |
| 112 | have hlo0 : 0 < W.lo := by linarith |
| 113 | have hlen0 : 0 < W.len := by linarith |
| 114 | have hH0 : 0 < H := by linarith |
| 115 | have hH10 : 10 * H ≤ W.lo := by |
| 116 | have h1 : H ≤ W.lo ^ (1 / 2 : ℝ) := |
| 117 | hHle.trans (Real.rpow_le_rpow_of_exponent_le (by linarith) (by norm_num)) |
| 118 | rw [← Real.sqrt_eq_rpow] at h1 |
| 119 | have h2 : 10 ≤ Real.sqrt W.lo := Real.le_sqrt_of_sq_le (by linarith) |
| 120 | nlinarith [Real.sq_sqrt hlo0.le] |
| 121 | have hcard : (S.card : ℝ) ≤ W.lo ^ (0.49 : ℝ) := by |
| 122 | have hp : 0 ≤ W.lo ^ (0.49 : ℝ) := by positivity |
| 123 | have hsub : S ⊆ Icc 1 ⌊W.lo ^ (0.49 : ℝ)⌋₊ := fun s hs => by |
| 124 | rw [mem_Icc, Nat.le_floor_iff hp] |
| 125 | refine ⟨?_, hSle s hs⟩ |
| 126 | have : (1 : ℝ) < s := by linarith [(hS s hs).1] |
| 127 | exact_mod_cast this.le |
| 128 | have := card_le_card hsub |
| 129 | rw [Nat.card_Icc, Nat.add_sub_cancel] at this |
| 130 | exact (Nat.cast_le.mpr this).trans (Nat.floor_le hp) |
| 131 | have hX : ∀ k ∈ W.dy, H * (S.card : ℝ) ^ 2 / 2 ^ k ≤ W.lo ^ (-(0.01 : ℝ)) := by |
| 132 | intro k hk |
| 133 | obtain ⟨hk1, -⟩ := dy_spec hk |
| 134 | have hk' : W.lo ≤ 2 ^ k := by linarith |
| 135 | calc H * (S.card : ℝ) ^ 2 / 2 ^ k ≤ W.lo ^ (0.001 : ℝ) * (W.lo ^ (0.49 : ℝ)) ^ 2 / W.lo := by gcongr |
| 136 | _ = W.lo ^ (-(0.019 : ℝ)) := by |
| 137 | rw [← Real.rpow_natCast, ← Real.rpow_mul hlo0.le, ← Real.rpow_add hlo0, |
| 138 | ← Real.rpow_sub_one hlo0.ne'] |
| 139 | norm_num |
| 140 | _ ≤ _ := Real.rpow_le_rpow_of_exponent_le (by linarith) (by norm_num) |
| 141 | set r := W.lo ^ (-(0.01 : ℝ)) with hr |
| 142 | have hr0 : 0 ≤ r := by positivity |
| 143 | have hb0 : 0 ≤ b := (Win.E_nonneg hlen0.le fun n _ => (sq_nonneg _).trans (e2_sq_le S n)).trans hb |
| 144 | have hterm : ∀ k ∈ W.dy, ∫ t in (-(2 ^ k / H))..(2 ^ k / H), ‖Err S (2 ^ k) t‖ ^ 2 ≤ |
| 145 | C / ms S ^ 2 * ((1 / H + r) + 1 / H * Dsum S (2 ^ k) H + |
| 146 | ∑ n ∈ Icc 1 ⌊4 * (2 : ℝ) ^ k⌋₊ with (2 : ℝ) ^ k < (n : ℕ) ∧ (n : ℝ) < 4 * 2 ^ k, |
| 147 | rc S n * badCount S n / n) := by |
| 148 | intro k hk |
| 149 | obtain ⟨hk1, -⟩ := dy_spec hk |
| 150 | refine (hscale z S hz hS hm (2 ^ k) H hH (by linarith)).trans ?_ |
| 151 | refine mul_le_mul_of_nonneg_left ?_ (by positivity) |
| 152 | have := hX k hk |
| 153 | rw [div_eq_mul_one_div (Dsum S (2 ^ k) H), mul_comm (Dsum S (2 ^ k) H)] |
| 154 | linarith |
| 155 | refine (sum_le_sum hterm).trans ?_ |
| 156 | rw [← mul_sum, sum_add_distrib, sum_add_distrib, sum_const, nsmul_eq_mul, ← mul_sum] |
| 157 | have k1 : (W.dy.card : ℝ) * (1 / H + r) ≤ 2 * W.len * (1 / H + r) := |
| 158 | mul_le_mul_of_nonneg_right (dy_card W hlo0 hlen0.le) (by positivity) |
| 159 | have k2 : 1 / H * ∑ k ∈ W.dy, Dsum S (2 ^ k) H ≤ 16 * W.len * Real.sqrt (y * V) := by |
| 160 | calc _ ≤ 1 / H * (16 * H * W.len * Real.sqrt (y * V)) := |
| 161 | mul_le_mul_of_nonneg_left (Dsum_total W hlo0 hlen0 S hH hy hV) (by positivity) |
| 162 | _ = _ := by field_simp |
| 163 | have k3 : ∑ k ∈ W.dy, ∑ n ∈ Icc 1 ⌊4 * (2 : ℝ) ^ k⌋₊ with (2 : ℝ) ^ k < (n : ℕ) ∧ (n : ℝ) < 4 * 2 ^ k, |
| 164 | rc S n * badCount S n / n ≤ 2 * (b * W.len) := by |
| 165 | refine (dy_overlap W hlo0 _ (fun k _ p hp => (mem_filter.mp hp).2) |
| 166 | (fun n => rc S n * badCount S n) fun n => (sq_nonneg _).trans (e2_sq_le S n)).trans ?_ |
| 167 | rw [Win.sum_eq_E_mul hlen0] |
| 168 | gcongr |
| 169 | have hsq : 0 ≤ Real.sqrt (y * V) := Real.sqrt_nonneg _ |
| 170 | calc _ ≤ C / ms S ^ 2 * (2 * W.len * (1 / H + r) + 16 * W.len * Real.sqrt (y * V) + |
| 171 | 2 * (b * W.len)) := by gcongr |
| 172 | _ ≤ C / ms S ^ 2 * (16 * W.len * (1 / H + r + Real.sqrt (y * V) + b)) := by |
| 173 | gcongr |
| 174 | have : 0 ≤ W.len * (1 / H + r) := by positivity |
| 175 | have : 0 ≤ W.len * b := by positivity |
| 176 | nlinarith |
| 177 | _ = _ := by ring |
| 178 | |
| 179 | end E424 |
| 180 | |