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 Mathlib.Analysis.Meromorphic.Basic |
| 4 | public import ConditionalGoldbach.Proofs.DensityEuler |
| 5 | public import ConditionalGoldbach.Proofs.SingularBounds |
| 6 | |
| 7 | /-! Exact Euler-factor cancellation at one and the density residue. -/ |
| 8 | public section |
| 9 | |
| 10 | set_option autoImplicit false |
| 11 | noncomputable section |
| 12 | open scoped BigOperators ComplexConjugate Topology ContDiff |
| 13 | open MeasureTheory Filter Set Complex |
| 14 | namespace ConditionalGoldbach |
| 15 | open MathlibNt.SieveTheory.SingularSeries hiding singularSeries |
| 16 | attribute [local instance] Classical.propDecidable |
| 17 | |
| 18 | lemma densityEuler_factor_at_one (N p : ℕ) (hN : 0 < N) : |
| 19 | (1 + densityEulerTerm N p 1) * ((1 + liuBaseDeviation p : ℝ) : ℂ) = |
| 20 | if p ∈ N.primeFactors.filter (fun p => 2 < p) then |
| 21 | ((1 + liuBaseDeviation p : ℝ) : ℂ) else 1 := by |
| 22 | by_cases hp : p.Prime ∧ 2 < p |
| 23 | · have hp2 : (2 : ℝ) < p := by exact_mod_cast hp.2 |
| 24 | have hpC : (p : ℂ) ≠ 0 := by exact_mod_cast (show p ≠ 0 by omega) |
| 25 | have hpm1 : (p : ℂ) - 1 ≠ 0 := by |
| 26 | intro he |
| 27 | have hr := congrArg Complex.re he |
| 28 | simp at hr |
| 29 | linarith |
| 30 | have hpm2 : (p : ℂ) - 2 ≠ 0 := by |
| 31 | intro he |
| 32 | have hr := congrArg Complex.re he |
| 33 | simp at hr |
| 34 | linarith |
| 35 | by_cases hpd : p ∣ N |
| 36 | · simp [densityEulerTerm, hp.1, hp.2, hpd, Nat.mem_primeFactors, hN.ne'] |
| 37 | · simp only [densityEulerTerm, hp.1, hp.2, hpd, not_false_eq_true, and_self, |
| 38 | ite_true, Complex.cpow_neg, Complex.cpow_one] |
| 39 | rw [ite_eq_right (by simp [Finset.mem_filter, Nat.mem_primeFactors, hpd]), |
| 40 | one_add_liuBaseDeviation_eq_baseFactor hp.1 hp.2] |
| 41 | push_cast |
| 42 | field_simp |
| 43 | ring |
| 44 | · have hpm : p ∉ N.primeFactors.filter (fun p => 2 < p) := by |
| 45 | intro hm |
| 46 | exact hp ⟨Nat.prime_of_mem_primeFactors (Finset.mem_filter.mp hm).1, |
| 47 | (Finset.mem_filter.mp hm).2⟩ |
| 48 | simp only [densityEulerTerm, liuBaseDeviation, hp, ite_false, add_zero, Complex.ofReal_one, |
| 49 | hpm] |
| 50 | rw [ite_eq_right (by tauto)] |
| 51 | norm_num |
| 52 | |
| 53 | lemma densityEuler_at_one_mul_C2 (N : ℕ) (hN : 0 < N) : |
| 54 | densityEulerProduct N 1 * (C2 : ℂ) = |
| 55 | ∏ p ∈ N.primeFactors.filter (fun p => 2 < p), ((1 + liuBaseDeviation p : ℝ) : ℂ) := by |
| 56 | have he : HasProd (fun p => 1 + densityEulerTerm N p 1) (densityEulerProduct N 1) := by |
| 57 | rw [densityEulerProduct_eq_tprod] |
| 58 | exact (multipliable_one_add_of_summable (densityEulerTerm_summable_norm N (by norm_num))).hasProd |
| 59 | have hb : HasProd (fun p => ((1 + liuBaseDeviation p : ℝ) : ℂ)) (C2 : ℂ) := |
| 60 | multipliable_one_add_liuBaseDeviation.hasProd.map Complex.ofRealHom Complex.continuous_ofReal |
| 61 | have hp := he.mul hb |
| 62 | have heq := hp.tprod_eq |
| 63 | rw [← heq] |
| 64 | simp_rw [densityEuler_factor_at_one N _ hN] |
| 65 | rw [tprod_eq_prod (s := N.primeFactors.filter (fun p => 2 < p)) |
| 66 | (fun p hp => ite_eq_right hp)] |
| 67 | apply Finset.prod_congr rfl |
| 68 | intro p hp |
| 69 | simp only [hp, ite_true] |
| 70 | |
| 71 | lemma singularSeries_mul_densityEuler_one (N : ℕ) (hN : Even N) (hpos : 0 < N) : |
| 72 | (singularSeries N : ℂ) * densityEulerProduct N 1 = (N : ℂ)/N.totient := by |
| 73 | have he : liuCorrection N * |
| 74 | (∏ p ∈ N.primeFactors.filter (fun p => 2 < p), (1 + liuBaseDeviation p)) = |
| 75 | ∏ p ∈ N.primeFactors.filter (fun p => 2 < p), (p : ℝ)/(p-1) := by |
| 76 | unfold liuCorrection |
| 77 | rw [← Finset.prod_mul_distrib] |
| 78 | apply Finset.prod_congr rfl |
| 79 | intro p hp |
| 80 | have hp2 := (Finset.mem_filter.mp hp).2 |
| 81 | have hprime := Nat.prime_of_mem_primeFactors (Finset.mem_filter.mp hp).1 |
| 82 | rw [one_add_liuBaseDeviation_eq_baseFactor hprime hp2, liuCorrectionFactor, |
| 83 | ← liuLocalFactor_of_dvd hp2 (Nat.dvd_of_mem_primeFactors (Finset.mem_filter.mp hp).1)] |
| 84 | simp [liuLocalFactor, Nat.dvd_of_mem_primeFactors (Finset.mem_filter.mp hp).1] |
| 85 | have hreal : 2 * (liuCorrection N * |
| 86 | (∏ p ∈ N.primeFactors.filter (fun p => 2 < p), (1 + liuBaseDeviation p))) = |
| 87 | (N : ℝ)/N.totient := by rw [he, totient_ratio_odd_prod N hN hpos] |
| 88 | have heuler := densityEuler_at_one_mul_C2 N hpos |
| 89 | unfold singularSeries liuSingularSeries |
| 90 | push_cast |
| 91 | calc |
| 92 | _ = 2 * (liuCorrection N : ℂ) * (densityEulerProduct N 1 * (C2 : ℂ)) := by dsimp only [C2]; ring |
| 93 | _ = _ := by |
| 94 | rw [heuler] |
| 95 | have hc := congrArg Complex.ofReal hreal |
| 96 | push_cast at hc |
| 97 | simpa only [mul_assoc, Complex.ofReal_add, Complex.ofReal_one] using hc |
| 98 | |
| 99 | lemma continuedDensity_residue_one (N : ℕ) (hN : Even N) (hpos : 0 < N) : |
| 100 | Tendsto (fun w : ℂ => (w-1)*continuedDensity N w) (𝓝[≠] 1) |
| 101 | (𝓝 ((N : ℂ)/N.totient)) := by |
| 102 | have ho : IsOpen {w : ℂ | 0 < w.re} := isOpen_lt continuous_const Complex.continuous_re |
| 103 | have hd : ContinuousAt (densityEulerProduct N) 1 := |
| 104 | ((densityEulerProduct_differentiableOn N).differentiableAt |
| 105 | (ho.mem_nhds (by norm_num))).continuousAt |
| 106 | have h := (riemannZeta_residue_one.mul hd.continuousWithinAt.tendsto).const_mul (singularSeries N : ℂ) |
| 107 | simp only [one_mul, singularSeries_mul_densityEuler_one N hN hpos] at h |
| 108 | convert h using 1 |
| 109 | funext w |
| 110 | unfold continuedDensity |
| 111 | ring |
| 112 | |
| 113 | lemma riemannZeta_meromorphicAt_re_pos {w : ℂ} (hw : 0 < w.re) : |
| 114 | MeromorphicAt riemannZeta w := by |
| 115 | have ho : IsOpen {z : ℂ | 0 < z.re} := isOpen_lt continuous_const Complex.continuous_re |
| 116 | have hΓ : AnalyticAt ℂ Gamma (w/2) := |
| 117 | (show DifferentiableOn ℂ Gamma {z | 0 < z.re} from |
| 118 | fun z hz => (Complex.hasDerivAt_Gamma_of_re_pos hz).differentiableAt.differentiableWithinAt).analyticAt |
| 119 | (ho.mem_nhds (by simp; linarith)) |
| 120 | have hG : AnalyticAt ℂ (fun z : ℂ => Gamma (z/2)) w := AnalyticAt.comp (g := Gamma) (f := fun z : ℂ => z/2) hΓ (by fun_prop) |
| 121 | have hP : Differentiable ℂ (fun z : ℂ => (Real.pi : ℂ)^(-z/2)) := by |
| 122 | intro z |
| 123 | exact (show DifferentiableAt ℂ (fun z : ℂ => -z/2) z from by fun_prop).const_cpow |
| 124 | (Or.inl (Complex.ofReal_ne_zero.mpr Real.pi_ne_zero)) |
| 125 | have hm : MeromorphicAt (fun z : ℂ => |
| 126 | (completedRiemannZeta₀ z - 1/z - 1/(1-z)) / |
| 127 | ((Real.pi : ℂ)^(-z/2) * Gamma (z/2))) w := by |
| 128 | apply MeromorphicAt.div |
| 129 | · apply MeromorphicAt.sub |
| 130 | · exact (differentiable_completedZeta₀.analyticAt w).meromorphicAt.sub |
| 131 | ((MeromorphicAt.const 1 w).div (analyticAt_id.meromorphicAt)) |
| 132 | · exact (MeromorphicAt.const 1 w).div |
| 133 | ((show AnalyticAt ℂ (fun z : ℂ => 1-z) w from by fun_prop).meromorphicAt) |
| 134 | · exact ((hP.analyticAt w).mul hG).meromorphicAt |
| 135 | apply hm.congr |
| 136 | have hn : w ≠ 0 := by intro he; simp [he] at hw |
| 137 | have he : ∀ᶠ z in 𝓝 w, z ≠ (0 : ℂ) := eventually_ne_nhds hn |
| 138 | filter_upwards [he.filter_mono nhdsWithin_le_nhds] with z hz |
| 139 | exact (riemannZeta_eq_completedRiemannZeta₀ hz).symm |
| 140 | |
| 141 | lemma continuedDensity_meromorphicOn (N : ℕ) : |
| 142 | MeromorphicOn (continuedDensity N) {w | 0 < w.re} := by |
| 143 | intro w hw |
| 144 | have ho : IsOpen {w : ℂ | 0 < w.re} := isOpen_lt continuous_const Complex.continuous_re |
| 145 | have hD : DifferentiableAt ℂ (densityEulerProduct N) w := |
| 146 | (densityEulerProduct_differentiableOn N).differentiableAt (ho.mem_nhds hw) |
| 147 | exact ((MeromorphicAt.const (singularSeries N : ℂ) w).mul |
| 148 | (riemannZeta_meromorphicAt_re_pos hw)).mul |
| 149 | ((densityEulerProduct_differentiableOn N).analyticAt (ho.mem_nhds hw)).meromorphicAt |
| 150 | |
| 151 | lemma continuedDensity_differentiableOn (N : ℕ) : |
| 152 | DifferentiableOn ℂ (continuedDensity N) {w | 0 < w.re ∧ w ≠ 1} := by |
| 153 | intro w hw |
| 154 | have ho : IsOpen {w : ℂ | 0 < w.re} := isOpen_lt continuous_const Complex.continuous_re |
| 155 | have hD : DifferentiableAt ℂ (densityEulerProduct N) w := |
| 156 | (densityEulerProduct_differentiableOn N).differentiableAt (ho.mem_nhds hw.1) |
| 157 | exact (((differentiableAt_riemannZeta hw.2).const_mul (singularSeries N : ℂ)).mul hD).differentiableWithinAt |
| 158 | |
| 159 | end ConditionalGoldbach |
