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.PrimePowers |
| 4 | public import Mathlib.Data.Nat.Prime.Int |
| 5 | |
| 6 | @[expose] public section |
| 7 | |
| 8 | set_option autoImplicit false |
| 9 | noncomputable section |
| 10 | open scoped BigOperators |
| 11 | namespace ConditionalGoldbach |
| 12 | attribute [local instance] Classical.propDecidable |
| 13 | |
| 14 | lemma prime_power_parameter_bounds {p k : ℕ} (hp : p.Prime) (hk : 0<k) : |
| 15 | p≤p^k ∧ k≤p^k := by |
| 16 | constructor |
| 17 | · obtain ⟨j,rfl⟩ := Nat.exists_eq_succ_of_ne_zero hk.ne' |
| 18 | have hh : 1≤p^j := one_le_pow₀ hp.one_lt.le |
| 19 | rw [pow_succ] |
| 20 | nlinarith |
| 21 | · induction k with |
| 22 | | zero => simp |
| 23 | | succ k ih => |
| 24 | have ih' : k≤p^k := by |
| 25 | by_cases hk0 : k=0 |
| 26 | · simp [hk0] |
| 27 | · exact ih (Nat.pos_of_ne_zero hk0) |
| 28 | have hh : 1≤p^k := one_le_pow₀ hp.one_lt.le |
| 29 | rw [pow_succ] |
| 30 | have := hp.two_le |
| 31 | nlinarith |
| 32 | |
| 33 | def primePowerIndex (N : ℕ) : Finset (ℕ×ℕ) := |
| 34 | ((Finset.range (N+1))×ˢ(Finset.range (N+1))).filter |
| 35 | (fun z => z.1.Prime ∧ 0<z.2 ∧ z.1^z.2≤N) |
| 36 | |
| 37 | lemma primePowerIndex_image (N : ℕ) : |
| 38 | (primePowerIndex N).image (fun z => z.1^z.2) = (Finset.range (N+1)).filter IsPrimePow := by |
| 39 | ext n |
| 40 | simp only [Finset.mem_image,Finset.mem_filter,Finset.mem_range,Nat.lt_succ_iff] |
| 41 | constructor |
| 42 | · rintro ⟨⟨p,k⟩,hz,rfl⟩ |
| 43 | have hz' := (Finset.mem_filter.mp hz).2 |
| 44 | exact ⟨hz'.2.2,(isPrimePow_nat_iff _).mpr ⟨p,k,hz'.1,hz'.2.1,rfl⟩⟩ |
| 45 | · rintro ⟨hn,hpow⟩ |
| 46 | obtain ⟨p,k,hp,hk,rfl⟩ := (isPrimePow_nat_iff _).mp hpow |
| 47 | have hh := prime_power_parameter_bounds hp hk |
| 48 | refine ⟨(p,k),?_,rfl⟩ |
| 49 | simp only [primePowerIndex,Finset.mem_filter,Finset.mem_product,Finset.mem_range,Nat.lt_succ_iff] |
| 50 | exact ⟨⟨hh.1.trans hn,hh.2.trans hn⟩,hp,hk,hn⟩ |
| 51 | |
| 52 | lemma primePowerIndex_injective (N : ℕ) : |
| 53 | Set.InjOn (fun z : ℕ×ℕ => z.1^z.2) (primePowerIndex N) := by |
| 54 | intro x hx y hy he |
| 55 | have hx' := (Finset.mem_filter.mp hx).2 |
| 56 | have hy' := (Finset.mem_filter.mp hy).2 |
| 57 | obtain ⟨hp,hk⟩ := hx'.1.pow_inj' hy'.1 hx'.2.1.ne' hy'.2.1.ne' he |
| 58 | exact Prod.ext hp hk |
| 59 | |
| 60 | lemma mangoldt_log_ratio_prime_power {p k : ℕ} (hp : p.Prime) (hk : 0<k) : |
| 61 | mangoldt (p^k)/Real.log ((p^k:ℕ):ℝ)=(k:ℝ)⁻¹ := by |
| 62 | change ArithmeticFunction.vonMangoldt (p^k)/Real.log ((p^k:ℕ):ℝ)=_ |
| 63 | rw [ArithmeticFunction.vonMangoldt_apply_pow hk.ne',ArithmeticFunction.vonMangoldt_apply_prime hp, |
| 64 | Nat.cast_pow,Real.log_pow] |
| 65 | have hlog : Real.log (p:ℝ)≠0 := (Real.log_pos (by exact_mod_cast hp.one_lt)).ne' |
| 66 | have hk0 : (k:ℝ)≠0 := by exact_mod_cast hk.ne' |
| 67 | field_simp |
| 68 | |
| 69 | lemma sum_mangoldt_log_reindex (N : ℕ) (F : ℕ → ℝ) : |
| 70 | (∑ n ∈ Finset.range (N+1), mangoldt n/Real.log n*F n) = |
| 71 | ∑ p ∈ Finset.range (N+1), ∑ k ∈ Finset.range (N+1), |
| 72 | if p.Prime ∧ 0<k ∧ p^k≤N then F (p^k)/(k:ℝ) else 0 := by |
| 73 | have hfilter : (∑ n ∈ Finset.range (N+1), mangoldt n/Real.log n*F n) = |
| 74 | ∑ n ∈ (Finset.range (N+1)).filter IsPrimePow, mangoldt n/Real.log n*F n := by |
| 75 | rw [Finset.sum_filter] |
| 76 | apply Finset.sum_congr rfl |
| 77 | intro n hn |
| 78 | by_cases hp : IsPrimePow n |
| 79 | · simp [hp] |
| 80 | · have hz : mangoldt n=0 := ArithmeticFunction.vonMangoldt_eq_zero_iff.mpr hp |
| 81 | simp [hp,hz] |
| 82 | rw [hfilter,← primePowerIndex_image N,Finset.sum_image (primePowerIndex_injective N)] |
| 83 | calc |
| 84 | _ = ∑ z ∈ primePowerIndex N, F (z.1^z.2)/(z.2:ℝ) := by |
| 85 | apply Finset.sum_congr rfl |
| 86 | intro z hz |
| 87 | have hh := (Finset.mem_filter.mp hz).2 |
| 88 | rw [mangoldt_log_ratio_prime_power hh.1 hh.2.1] |
| 89 | ring |
| 90 | _ = _ := by |
| 91 | unfold primePowerIndex |
| 92 | rw [Finset.sum_filter,Finset.sum_product] |
| 93 | |
| 94 | end ConditionalGoldbach |
