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.SingularDensity |
| 4 | public import ConditionalGoldbach.Proofs.Elementary |
| 5 | |
| 6 | /-! Arithmetic comparison of the source singular series with N / φ(N). -/ |
| 7 | public section |
| 8 | |
| 9 | set_option autoImplicit false |
| 10 | noncomputable section |
| 11 | open scoped BigOperators ComplexConjugate Topology ContDiff |
| 12 | open MeasureTheory Filter Set Complex |
| 13 | namespace ConditionalGoldbach |
| 14 | open MathlibNt.SieveTheory.SingularSeries hiding singularSeries |
| 15 | |
| 16 | lemma totient_ratio_prod (N : ℕ) (hN : 0 < N) : |
| 17 | (N : ℝ) / N.totient = ∏ p ∈ N.primeFactors, (p : ℝ) / (p - 1) := by |
| 18 | have hφ : (N.totient : ℝ) ≠ 0 := by exact_mod_cast (Nat.totient_pos.mpr hN).ne' |
| 19 | have hp : ∀ p ∈ N.primeFactors, (p : ℝ) - 1 ≠ 0 := by |
| 20 | intro p hp |
| 21 | have hge : (2 : ℝ) ≤ p := by exact_mod_cast (Nat.prime_of_mem_primeFactors hp).two_le |
| 22 | linarith |
| 23 | have he := congrArg (fun n : ℕ => (n : ℝ)) (Nat.totient_mul_prod_primeFactors N) |
| 24 | push_cast at he |
| 25 | have he' : (N.totient : ℝ) * (∏ p ∈ N.primeFactors, (p : ℝ)) = |
| 26 | N * ∏ p ∈ N.primeFactors, ((p : ℝ)-1) := by |
| 27 | convert he using 2 |
| 28 | apply Finset.prod_congr rfl |
| 29 | intro p hp |
| 30 | rw [Nat.cast_sub (Nat.one_le_of_lt (Nat.prime_of_mem_primeFactors hp).one_lt), Nat.cast_one] |
| 31 | rw [Finset.prod_div_distrib] |
| 32 | apply (div_eq_div_iff hφ (Finset.prod_ne_zero_iff.mpr hp)).2 |
| 33 | linear_combination -he' |
| 34 | |
| 35 | lemma oddPrimeFactors_eq_erase_two (N : ℕ) : |
| 36 | N.primeFactors.filter (fun p => 2 < p) = N.primeFactors.erase 2 := by |
| 37 | ext p |
| 38 | simp only [Finset.mem_filter, Finset.mem_erase] |
| 39 | constructor |
| 40 | · rintro ⟨hp, hgt⟩ |
| 41 | exact ⟨ne_of_gt hgt, hp⟩ |
| 42 | · rintro ⟨hne, hp⟩ |
| 43 | exact ⟨hp, lt_of_le_of_ne (Nat.prime_of_mem_primeFactors hp).two_le hne.symm⟩ |
| 44 | |
| 45 | lemma totient_ratio_odd_prod (N : ℕ) (hN : Even N) (hpos : 0 < N) : |
| 46 | (N : ℝ) / N.totient = |
| 47 | 2 * ∏ p ∈ N.primeFactors.filter (fun p => 2 < p), (p : ℝ)/(p-1) := by |
| 48 | have h2 : 2 ∈ N.primeFactors := Nat.mem_primeFactors.mpr ⟨Nat.prime_two, hN.two_dvd, hpos.ne'⟩ |
| 49 | rw [totient_ratio_prod N hpos, oddPrimeFactors_eq_erase_two, |
| 50 | ← Finset.mul_prod_erase _ _ h2] |
| 51 | norm_num |
| 52 | |
| 53 | lemma liuUniversalProduct_le_primeFactors (N : ℕ) : |
| 54 | liuUniversalProduct ≤ ∏ p ∈ N.primeFactors.filter (fun p => 2 < p), |
| 55 | (1 + liuBaseDeviation p) := by |
| 56 | apply le_of_tendsto multipliable_one_add_liuBaseDeviation.hasProd |
| 57 | filter_upwards [eventually_ge_atTop (N.primeFactors.filter (fun p => 2 < p))] with s hs |
| 58 | exact Finset.prod_le_prod_of_subset_of_le_one₀ hs |
| 59 | (fun p hp => (one_add_liuBaseDeviation_pos p).le) |
| 60 | (fun p hp hnot => one_add_liuBaseDeviation_le_one p) |
| 61 | |
| 62 | lemma singularSeries_lower_totient (N : ℕ) (hN : Even N) (hpos : 0 < N) : |
| 63 | C2 * N / N.totient ≤ singularSeries N := by |
| 64 | rw [mul_div_assoc, totient_ratio_odd_prod N hN hpos] |
| 65 | unfold singularSeries liuSingularSeries liuCorrection C2 |
| 66 | have hprod : (∏ p ∈ N.primeFactors.filter (fun p => 2 < p), (p : ℝ)/(p-1)) ≤ |
| 67 | ∏ p ∈ N.primeFactors.filter (fun p => 2 < p), liuCorrectionFactor p := by |
| 68 | apply Finset.prod_le_prod₀ |
| 69 | · intro p hp |
| 70 | have hp2 : (2 : ℝ) < p := by exact_mod_cast (Finset.mem_filter.mp hp).2 |
| 71 | exact div_nonneg (by positivity) (by linarith) |
| 72 | · intro p hp |
| 73 | have hp2 : (2 : ℝ) < p := by exact_mod_cast (Finset.mem_filter.mp hp).2 |
| 74 | unfold liuCorrectionFactor |
| 75 | apply (div_le_div_iff₀ (by linarith) (by linarith)).2 |
| 76 | nlinarith |
| 77 | nlinarith [liuUniversalProduct_nonneg] |
| 78 | |
| 79 | lemma singularSeries_upper_totient (N : ℕ) (hN : Even N) (hpos : 0 < N) : |
| 80 | singularSeries N ≤ (N : ℝ)/N.totient := by |
| 81 | have hbound := mul_le_mul_of_nonneg_left (liuUniversalProduct_le_primeFactors N) |
| 82 | (liuCorrection_pos N).le |
| 83 | have he : liuCorrection N * |
| 84 | (∏ p ∈ N.primeFactors.filter (fun p => 2 < p), (1 + liuBaseDeviation p)) = |
| 85 | ∏ p ∈ N.primeFactors.filter (fun p => 2 < p), (p : ℝ)/(p-1) := by |
| 86 | unfold liuCorrection |
| 87 | rw [← Finset.prod_mul_distrib] |
| 88 | apply Finset.prod_congr rfl |
| 89 | intro p hp |
| 90 | have hp2 := (Finset.mem_filter.mp hp).2 |
| 91 | have hprime := Nat.prime_of_mem_primeFactors (Finset.mem_filter.mp hp).1 |
| 92 | rw [one_add_liuBaseDeviation_eq_baseFactor hprime hp2, liuCorrectionFactor, |
| 93 | ← liuLocalFactor_of_dvd hp2 (Nat.dvd_of_mem_primeFactors (Finset.mem_filter.mp hp).1)] |
| 94 | simp [liuLocalFactor, Nat.dvd_of_mem_primeFactors (Finset.mem_filter.mp hp).1] |
| 95 | rw [he] at hbound |
| 96 | rw [totient_ratio_odd_prod N hN hpos] |
| 97 | exact mul_le_mul_of_nonneg_left hbound (by norm_num) |
| 98 | |
| 99 | end ConditionalGoldbach |
