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 | import ConditionalGoldbach |
| 2 | |
| 3 | /-! |
| 4 | Independent finite enumeration check for the Appendix B count. |
| 5 | This is NOT a certificate for the stored character integrals, their RMS error, |
| 6 | or the interval obtained by applying Lemma B.3 to those integral values. |
| 7 | Only kernel-checked propositional computation is used; no native_decide. |
| 8 | -/ |
| 9 | set_option autoImplicit false |
| 10 | set_option maxRecDepth 200000 |
| 11 | set_option maxHeartbeats 4000000 |
| 12 | |
| 13 | namespace TexAuditAB.Numeric |
| 14 | |
| 15 | def trialPrime (n : ℕ) : Bool := |
| 16 | decide (2 ≤ n) && (List.range (Nat.sqrt n + 1)).all |
| 17 | (fun d => decide (d < 2 ∨ ¬d ∣ n)) |
| 18 | |
| 19 | theorem trialPrime_iff (n : ℕ) : trialPrime n = true ↔ Nat.Prime n := by |
| 20 | rw [Nat.prime_def_le_sqrt] |
| 21 | simp only [trialPrime, Bool.and_eq_true, decide_eq_true_eq, |
| 22 | List.all_eq_true, List.mem_range] |
| 23 | constructor |
| 24 | · rintro ⟨hn, hall⟩ |
| 25 | refine ⟨hn, fun d hd hds => ?_⟩ |
| 26 | exact (hall d (by omega)).resolve_left (by omega) |
| 27 | · rintro ⟨hn, hall⟩ |
| 28 | refine ⟨hn, fun d hd => ?_⟩ |
| 29 | by_cases hd2 : d < 2 |
| 30 | · exact Or.inl hd2 |
| 31 | · exact Or.inr (hall d (by omega) (by omega)) |
| 32 | |
| 33 | def computedPairs : Finset ℕ := (Finset.range 30031).filter |
| 34 | (fun p => p ≤ 30030 - p ∧ trialPrime p = true ∧ trialPrime (30030 - p) = true) |
| 35 | |
| 36 | theorem computedPairs_card : computedPairs.card = 905 := by |
| 37 | decide +kernel |
| 38 | |
| 39 | theorem unorderedPrimePairs_eq_905 : ConditionalGoldbach.unorderedPrimePairs = 905 := by |
| 40 | have heq : ConditionalGoldbach.unorderedPrimePairs = computedPairs.card := by |
| 41 | unfold ConditionalGoldbach.unorderedPrimePairs computedPairs |
| 42 | apply congrArg Finset.card |
| 43 | ext p |
| 44 | simp only [Finset.mem_filter, Finset.mem_range, ConditionalGoldbach.experimentN, |
| 45 | trialPrime_iff] |
| 46 | tauto |
| 47 | exact heq.trans computedPairs_card |
| 48 | |
| 49 | #print axioms unorderedPrimePairs_eq_905 |
| 50 | |
| 51 | end TexAuditAB.Numeric |
