goldbach-spectral-bridge
Li and Liu's GRH + S ⇒ Goldbach in Lean, checked against the paper by Comparator: clean it up together, and settle S
| 1 | module |
| 2 | |
| 3 | public import ConditionalGoldbach.Proofs.DensityEulerIdentity |
| 4 | import Mathlib.Topology.Algebra.InfiniteSum.Field |
| 5 | |
| 6 | /-! Uniform arithmetic cancellation in the model kernel. -/ |
| 7 | public section |
| 8 | |
| 9 | set_option autoImplicit false |
| 10 | noncomputable section |
| 11 | open scoped BigOperators ComplexConjugate Topology |
| 12 | open MeasureTheory Filter Set Complex |
| 13 | namespace ConditionalGoldbach |
| 14 | open MathlibNt.SieveTheory.SingularSeries hiding singularSeries |
| 15 | attribute [local instance] Classical.propDecidable |
| 16 | |
| 17 | lemma model_euler_unramified_bound {p q : ℝ} (hp : 2 < p) (_hq0 : 0 ≤ q) (hq1 : q ≤ 1) : |
| 18 | (p * (p - 2) / (p - 1)^2) * (1 + q / (p - 2)) ≤ (1 - q / p)⁻¹ := by |
| 19 | have hp0 : 0 < p := by linarith |
| 20 | have hden : 0 < 1 - q / p := by rw [sub_pos, div_lt_one hp0]; linarith |
| 21 | rw [inv_eq_one_div, le_div_iff₀ hden] |
| 22 | have hsq : 0 ≤ (1 - q)^2 := sq_nonneg _ |
| 23 | have he : (p * (p - 2) / (p - 1)^2) * (1 + q / (p - 2)) * (1 - q / p) = |
| 24 | 1 - (1 - q)^2 / (p - 1)^2 := by |
| 25 | field_simp [show p - 1 ≠ 0 by linarith, show p - 2 ≠ 0 by linarith]; ring |
| 26 | rw [he] |
| 27 | exact sub_le_self _ (div_nonneg hsq (sq_nonneg _)) |
| 28 | |
| 29 | lemma model_euler_ramified_bound {p x : ℝ} (hp : 2 < p) (hx : 1 ≤ x) : |
| 30 | p / (p - 1) ≤ x * (1 - x⁻¹ / p)⁻¹ := by |
| 31 | have hp0 : 0 < p := by linarith |
| 32 | have hx0 : 0 < x := by linarith |
| 33 | have hxi : x⁻¹ ≤ 1 := (inv_le_one₀ hx0).mpr hx |
| 34 | have hden : 0 < 1 - x⁻¹ / p := by rw [sub_pos, div_lt_one hp0]; linarith |
| 35 | rw [← div_eq_mul_inv, le_div_iff₀ hden] |
| 36 | have he : p * (1 - x⁻¹ / p) = p - x⁻¹ := by field_simp |
| 37 | rw [div_mul_eq_mul_div, div_le_iff₀ (by linarith : 0 < p - 1), he] |
| 38 | have hprod := mul_nonneg (sub_nonneg.mpr hx) (show 0 ≤ (p - 1) * x - 1 by nlinarith) |
| 39 | have : (p - x⁻¹) * x ≤ (x * (p - 1)) * x := by |
| 40 | rw [sub_mul, inv_mul_cancel₀ hx0.ne'] |
| 41 | nlinarith |
| 42 | nlinarith |
| 43 | |
| 44 | lemma model_zeta_factor_eq (p : ℕ) (hp : p.Prime) (σ : ℝ) (hσ : 0 < σ) : |
| 45 | ‖(1 - (p : ℂ)^(-((1 + σ : ℝ) : ℂ)))⁻¹‖ = |
| 46 | (1 - (p : ℝ)^(-σ) / p)⁻¹ := by |
| 47 | have hp0 : (0 : ℝ) < p := by exact_mod_cast hp.pos |
| 48 | have hp1 : (1 : ℝ) < p := by exact_mod_cast hp.one_lt |
| 49 | have hq : (p : ℝ)^(-σ) ≤ 1 := Real.rpow_le_one_of_one_le_of_nonpos hp1.le (by linarith) |
| 50 | have hden : 0 < 1 - (p : ℝ)^(-σ) / p := by |
| 51 | rw [sub_pos, div_lt_one hp0] |
| 52 | exact hq.trans_lt hp1 |
| 53 | have he : (p : ℂ)^(-((1 + σ : ℝ) : ℂ)) = (((p : ℝ)^(-σ) / p : ℝ) : ℂ) := by |
| 54 | rw [show -((1 + σ : ℝ) : ℂ) = ((-(1 + σ) : ℝ) : ℂ) by push_cast; rfl, |
| 55 | show (p : ℂ) = ((p : ℝ) : ℂ) by simp, ← Complex.ofReal_cpow hp0.le] |
| 56 | congr 1 |
| 57 | rw [show -(1 + σ) = -σ - 1 by ring, Real.rpow_sub hp0, Real.rpow_one] |
| 58 | rw [he, show (1 : ℂ) = ((1 : ℝ) : ℂ) by rfl, ← Complex.ofReal_sub, norm_inv, Complex.norm_real, Real.norm_eq_abs, |
| 59 | abs_of_pos hden] |
| 60 | |
| 61 | lemma model_euler_factor_bound (N p : ℕ) (hN : 0 < N) {w : ℂ} (hw : 0 < w.re) : |
| 62 | ‖((1 + liuBaseDeviation p : ℝ) : ℂ) * (1 + densityEulerTerm N p w) * |
| 63 | (if p ∈ N.primeFactors.filter (fun p => 2 < p) then (liuCorrectionFactor p : ℂ) else 1)‖ ≤ |
| 64 | (if p ∈ N.primeFactors.filter (fun p => 2 < p) then (p : ℝ)^w.re else 1) * |
| 65 | ‖if p.Prime then (1 - (p : ℂ)^(-((1 + w.re : ℝ) : ℂ)))⁻¹ else 1‖ := by |
| 66 | have hb : 0 < 1 + liuBaseDeviation p := one_add_liuBaseDeviation_pos p |
| 67 | have hmem : p ∈ N.primeFactors.filter (fun p => 2 < p) ↔ p.Prime ∧ 2 < p ∧ p ∣ N := by |
| 68 | simp only [Finset.mem_filter, Nat.mem_primeFactors] |
| 69 | have hn : N ≠ 0 := hN.ne' |
| 70 | tauto |
| 71 | by_cases hp : p.Prime |
| 72 | · have hp0 : (0 : ℝ) < p := by exact_mod_cast hp.pos |
| 73 | have hp1 : (1 : ℝ) < p := by exact_mod_cast hp.one_lt |
| 74 | rw [ite_eq_left hp, model_zeta_factor_eq p hp w.re hw] |
| 75 | by_cases hp2 : 2 < p |
| 76 | · have hp2r : (2 : ℝ) < p := by exact_mod_cast hp2 |
| 77 | have hbase : 1 + liuBaseDeviation p = p * (p - 2) / ((p : ℝ) - 1)^2 := by |
| 78 | rw [one_add_liuBaseDeviation_eq_baseFactor hp hp2] |
| 79 | field_simp [show (p : ℝ) - 1 ≠ 0 by linarith]; ring |
| 80 | have hq0 : 0 ≤ (p : ℝ)^(-w.re) := Real.rpow_nonneg hp0.le _ |
| 81 | have hq1 : (p : ℝ)^(-w.re) ≤ 1 := |
| 82 | Real.rpow_le_one_of_one_le_of_nonpos hp1.le (by linarith) |
| 83 | by_cases hpd : p ∣ N |
| 84 | · have hm := hmem.mpr ⟨hp, hp2, hpd⟩ |
| 85 | simp only [hm, ite_true, densityEulerTerm, hpd, not_true_eq_false, and_false, |
| 86 | ite_false, add_zero, mul_one] |
| 87 | rw [← Complex.ofReal_mul, Complex.norm_real, Real.norm_eq_abs, |
| 88 | abs_of_nonneg (mul_nonneg hb.le (le_of_lt (liuCorrectionFactor_pos hp2))), |
| 89 | hbase, liuCorrectionFactor] |
| 90 | have he : p * (p - 2) / ((p : ℝ) - 1)^2 * ((p - 1) / (p - 2)) = p / (p - 1) := by |
| 91 | field_simp [show (p : ℝ) - 1 ≠ 0 by linarith, show (p : ℝ) - 2 ≠ 0 by linarith] |
| 92 | rw [he, Real.rpow_neg hp0.le] |
| 93 | exact model_euler_ramified_bound hp2r (Real.one_le_rpow hp1.le hw.le) |
| 94 | · have hm : p ∉ N.primeFactors.filter (fun p => 2 < p) := by simp [hmem, hpd] |
| 95 | simp only [hm, ite_false, mul_one, one_mul] |
| 96 | rw [norm_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_pos hb] |
| 97 | apply (mul_le_mul_of_nonneg_left (norm_add_le 1 (densityEulerTerm N p w)) hb.le).trans |
| 98 | rw [norm_one, densityEulerTerm, ite_eq_left ⟨hp, hp2, hpd⟩, norm_div, |
| 99 | Complex.norm_natCast_cpow_of_pos hp.pos, Complex.neg_re] |
| 100 | have hd : ‖(p : ℂ) - 2‖ = (p : ℝ) - 2 := by |
| 101 | rw [show (p : ℂ) - 2 = (((p : ℝ) - 2 : ℝ) : ℂ) by push_cast; rfl, |
| 102 | Complex.norm_real, Real.norm_eq_abs, abs_of_pos (by linarith)] |
| 103 | rw [hd, hbase] |
| 104 | exact model_euler_unramified_bound hp2r hq0 hq1 |
| 105 | · have hm : p ∉ N.primeFactors.filter (fun p => 2 < p) := by simp [hmem, hp2] |
| 106 | simp only [hm, ite_false, one_mul, mul_one, liuBaseDeviation, hp2, and_false, |
| 107 | add_zero, Complex.ofReal_one, densityEulerTerm, false_and, norm_one] |
| 108 | have hq : (p : ℝ)^(-w.re) / p < 1 := by |
| 109 | apply (div_lt_one hp0).mpr |
| 110 | exact (Real.rpow_le_one_of_one_le_of_nonpos hp1.le (by linarith)).trans_lt hp1 |
| 111 | exact (one_le_inv₀ (by linarith : 0 < 1 - (p : ℝ)^(-w.re) / p)).mpr (by linarith [div_nonneg (Real.rpow_nonneg hp0.le (-w.re)) hp0.le]) |
| 112 | · have hm : p ∉ N.primeFactors.filter (fun p => 2 < p) := by simp [hmem, hp] |
| 113 | simp [hm, hp, liuBaseDeviation, densityEulerTerm] |
| 114 | |
| 115 | /-- The finite ramified-prime factor is absorbed by the scaling factor `N^σ`. -/ |
| 116 | lemma model_primeFactors_rpow_bound (N : ℕ) (hN : 0 < N) (σ : ℝ) (hσ : 0 ≤ σ) : |
| 117 | (∏ p ∈ N.primeFactors.filter (fun p => 2 < p), (p : ℝ)^σ) ≤ (N : ℝ)^σ := by |
| 118 | rw [Real.finsetProd_rpow _ _ (fun p hp => Nat.cast_nonneg p)] |
| 119 | apply Real.rpow_le_rpow (Finset.prod_nonneg (fun p hp => Nat.cast_nonneg p)) _ hσ |
| 120 | have hd : (∏ p ∈ N.primeFactors.filter (fun p => 2 < p), p) ∣ N := |
| 121 | (Finset.prod_dvd_prod_of_subset _ _ (fun p => p) (Finset.filter_subset _ _)).trans |
| 122 | (Nat.prod_primeFactors_dvd N) |
| 123 | simpa only [Nat.cast_prod] using (Nat.cast_le.mpr (Nat.le_of_dvd hN hd) : |
| 124 | ((∏ p ∈ N.primeFactors.filter (fun p => 2 < p), p : ℕ) : ℝ) ≤ (N : ℝ)) |
| 125 | |
| 126 | /-- Exact cancellation of the singular series with the Euler correction yields a bound |
| 127 | independent of `N` once its Mellin scaling has been included. -/ |
| 128 | theorem singularSeries_densityEuler_scaled_bound (N : ℕ) (hN : 0 < N) |
| 129 | {w : ℂ} (hw : 0 < w.re) : |
| 130 | ‖(N : ℂ)^(-w) * (singularSeries N : ℂ) * densityEulerProduct N w‖ ≤ |
| 131 | 2 * ‖riemannZeta ((1 + w.re : ℝ) : ℂ)‖ := by |
| 132 | let F := N.primeFactors.filter (fun p => 2 < p) |
| 133 | have he : HasProd (fun p => 1 + densityEulerTerm N p w) (densityEulerProduct N w) := by |
| 134 | rw [densityEulerProduct_eq_tprod] |
| 135 | exact (multipliable_one_add_of_summable (densityEulerTerm_summable_norm N hw)).hasProd |
| 136 | have hb : HasProd (fun p => ((1 + liuBaseDeviation p : ℝ) : ℂ)) (C2 : ℂ) := |
| 137 | multipliable_one_add_liuBaseDeviation.hasProd.map Complex.ofRealHom Complex.continuous_ofReal |
| 138 | have hc : HasProd (fun p => if p ∈ F then (liuCorrectionFactor p : ℂ) else 1) |
| 139 | (liuCorrection N : ℂ) := by |
| 140 | have hh : HasProd (fun p => if p ∈ F then (liuCorrectionFactor p : ℂ) else 1) |
| 141 | (∏ p ∈ F, if p ∈ F then (liuCorrectionFactor p : ℂ) else 1) := |
| 142 | hasProd_prod_of_ne_finset_one (fun p hp => ite_eq_right hp) |
| 143 | convert hh using 1 |
| 144 | rw [Finset.prod_ite_of_true (fun p hp => hp)] |
| 145 | simp only [liuCorrection, Complex.ofReal_prod, F] |
| 146 | have hx : HasProd (fun p => if p ∈ F then (p : ℝ)^w.re else 1) |
| 147 | (∏ p ∈ F, (p : ℝ)^w.re) := by |
| 148 | have hh : HasProd (fun p => if p ∈ F then (p : ℝ)^w.re else 1) |
| 149 | (∏ p ∈ F, if p ∈ F then (p : ℝ)^w.re else 1) := |
| 150 | hasProd_prod_of_ne_finset_one (fun p hp => ite_eq_right hp) |
| 151 | simpa only [Finset.prod_ite_of_true (fun p hp => hp)] using hh |
| 152 | have hz : HasProd (fun p : ℕ => if p.Prime then |
| 153 | (1 - (p : ℂ)^(-((1 + w.re : ℝ) : ℂ)))⁻¹ else 1) |
| 154 | (riemannZeta ((1 + w.re : ℝ) : ℂ)) := by |
| 155 | convert ((hasProd_subtype_iff_mulIndicator |
| 156 | (f := fun p : ℕ => (1 - (p : ℂ)^(-((1 + w.re : ℝ) : ℂ)))⁻¹) |
| 157 | (s := {p : ℕ | p.Prime})).mp |
| 158 | (riemannZeta_eulerProduct_hasProd (by simp; linarith : 1 < (((1 + w.re : ℝ) : ℂ)).re))) using 1 |
| 159 | ext p |
| 160 | by_cases hp : p.Prime <;> simp [Set.mulIndicator, hp] |
| 161 | have hprod : ‖(C2 : ℂ) * densityEulerProduct N w * (liuCorrection N : ℂ)‖ ≤ |
| 162 | (∏ p ∈ F, (p : ℝ)^w.re) * ‖riemannZeta ((1 + w.re : ℝ) : ℂ)‖ := by |
| 163 | apply le_of_tendsto_of_tendsto' ((hb.mul he).mul hc).norm (hx.mul hz.norm) |
| 164 | intro s |
| 165 | apply Finset.prod_le_prod₀ (fun p hp => norm_nonneg _) |
| 166 | intro p hp |
| 167 | exact model_euler_factor_bound N p hN hw |
| 168 | have hprod' : ‖(C2 : ℂ) * densityEulerProduct N w * (liuCorrection N : ℂ)‖ ≤ |
| 169 | (N : ℝ)^w.re * ‖riemannZeta ((1 + w.re : ℝ) : ℂ)‖ := |
| 170 | hprod.trans (mul_le_mul_of_nonneg_right (model_primeFactors_rpow_bound N hN w.re hw.le) |
| 171 | (norm_nonneg _)) |
| 172 | have hscale : ‖(N : ℂ)^(-w)‖ * (N : ℝ)^w.re = 1 := by |
| 173 | rw [Complex.norm_natCast_cpow_of_pos hN, Complex.neg_re, |
| 174 | Real.rpow_neg (Nat.cast_nonneg _), inv_mul_cancel₀ (Real.rpow_pos_of_pos (by exact_mod_cast hN) _).ne'] |
| 175 | have heq : (N : ℂ)^(-w) * (singularSeries N : ℂ) * densityEulerProduct N w = |
| 176 | (2 : ℂ) * (N : ℂ)^(-w) * ((C2 : ℂ) * densityEulerProduct N w * (liuCorrection N : ℂ)) := by |
| 177 | unfold singularSeries liuSingularSeries C2 |
| 178 | push_cast |
| 179 | ring |
| 180 | rw [heq, norm_mul, norm_mul, Complex.norm_ofNat] |
| 181 | calc |
| 182 | _ ≤ 2 * ‖(N : ℂ)^(-w)‖ * ((N : ℝ)^w.re * ‖riemannZeta ((1 + w.re : ℝ) : ℂ)‖) := by |
| 183 | exact mul_le_mul_of_nonneg_left hprod' (by positivity) |
| 184 | _ = _ := by calc |
| 185 | _ = 2 * (‖(N : ℂ)^(-w)‖ * (N : ℝ)^w.re) * ‖riemannZeta ((1 + w.re : ℝ) : ℂ)‖ := by ring |
| 186 | _ = _ := by rw [hscale]; ring |
| 187 | |
| 188 | end ConditionalGoldbach |
