Riemann hypothesis: the Lean proof, cleaned up together
The 2026 Lean proof of the Riemann hypothesis and GRH, machine-checked by others, not refereed, no word from Clay; cleaned up together: more readable, faster to build, the theorems unchanged

| 1 | module |
| 2 | |
| 3 | public import Lib.General.NumberTheory.PadicLimitsValuation |
| 4 | import Lib.General.NumberTheory.GaussValuation |
| 5 | |
| 6 | /-! |
| 7 | # Coefficient rings inside the ring of all integral elements |
| 8 | |
| 9 | Elementary facts on the inclusion of a coefficient ring into `ℤ̄_ℓ`, and a divisibility statement |
| 10 | for geometric sums in a ring with a divisibility-reflecting map to `ℤ̄_ℓ`. |
| 11 | |
| 12 | * `New.CoeffRing.toIntQpBar`: the inclusion, which reflects divisibility |
| 13 | (`New.CoeffRing.dvd_of_toIntQpBar_dvd`). |
| 14 | * `New.Selmer.pow_dvd_geom_sum`: for `α` near `1`, a high power of `ℓ` divides `∑ i < ℓ ^ N, α ^ i`. |
| 15 | |
| 16 | Notions from other files: |
| 17 | * `New.CoeffRing`: rings of integers of finite Galois extensions of `ℚ_ℓ` inside `ℚ̄_ℓ`; |
| 18 | `New.CoeffRing.normLength` rescales `ℕ∞`-valued lengths over such a ring, a uniformiser `ϖ` having |
| 19 | length `v(ϖ)`, so that lengths over different rings are comparable. |
| 20 | * `New.ellVal`: the valuation `v` on `ℚ̄_ℓ` with `v ℓ = 1`, cut off below at `0`; `New.intQpBar ℓ` |
| 21 | is the ring `ℤ̄_ℓ` of integral elements; throughout, the instance `ThePrime ℓ` fixes `ℓ` as the |
| 22 | prime in play. |
| 23 | -/ |
| 24 | |
| 25 | @[expose] public section |
| 26 | |
| 27 | noncomputable section |
| 28 | |
| 29 | namespace New |
| 30 | |
| 31 | open Finset IsDiscreteValuationRing |
| 32 | |
| 33 | open scoped NNReal NNRat |
| 34 | |
| 35 | variable {ℓ : ℕ} [ThePrime ℓ] |
| 36 | |
| 37 | /-- The inclusion of a coefficient ring `O` (the ring of integers of a finite Galois extension of |
| 38 | `ℚ_ℓ` inside `ℚ̄_ℓ`) into the ring `ℤ̄_ℓ` of all integral elements. -/ |
| 39 | def CoeffRing.toIntQpBar (O : CoeffRing ℓ) : O.val →+* intQpBar ℓ := |
| 40 | (Subalgebra.val O.val).toRingHom.codRestrict (intQpBar ℓ) |
| 41 | fun x : O.val ↦ CoeffRing.norm_le_one x |
| 42 | |
| 43 | @[simp] lemma CoeffRing.coe_toIntQpBar {O : CoeffRing ℓ} (x : O.val) : |
| 44 | (O.toIntQpBar x).val = x.val := rfl |
| 45 | |
| 46 | /-- For coefficient rings `O ≤ O'`, including `O` into `O'` and then into `ℤ̄_ℓ` is the inclusion |
| 47 | of `O` into `ℤ̄_ℓ`. -/ |
| 48 | lemma CoeffRing.toIntQpBar_comp_inclusion {O O' : CoeffRing ℓ} (hO : O ≤ O') : |
| 49 | O'.toIntQpBar.comp (Subalgebra.inclusion hO).toRingHom = O.toIntQpBar := rfl |
| 50 | |
| 51 | /-- In a coefficient ring `O`, `x` divides `y` if and only if `ellVal x.val ≤ ellVal y.val`. -/ |
| 52 | lemma CoeffRing.dvd_iff_ellVal_le {O : CoeffRing ℓ} {x y : O.val} : |
| 53 | x ∣ y ↔ ellVal x.val ≤ ellVal y.val := by |
| 54 | rw [dvd_iff_norm_le, ellVal_le_ellVal_iff, min_eq_left (norm_le_one y)] |
| 55 | |
| 56 | /-- The inclusion `toIntQpBar` of a coefficient ring (the integers of a finite Galois extension of |
| 57 | `ℚ_ℓ`) into the ring `ℤ̄_ℓ` of integral elements of `ℚ̄_ℓ` reflects divisibility. -/ |
| 58 | lemma CoeffRing.dvd_of_toIntQpBar_dvd (O : CoeffRing ℓ) (z z' : O.val) |
| 59 | (h_dvd : O.toIntQpBar z ∣ O.toIntQpBar z') : z ∣ z' := by |
| 60 | rwa [Selmer.dvd_iff_ellVal_le, coe_toIntQpBar, coe_toIntQpBar, ← dvd_iff_ellVal_le] at h_dvd |
| 61 | |
| 62 | /-- Let `O ≤ O'` be coefficient rings, `P` a polynomial over `O` and `x` a point with coordinates |
| 63 | in `O'`. The exponent of a uniformiser `ϖ` in `P(x) ∈ O'`, rescaled by `normLength` (that is, |
| 64 | multiplied by `v(ϖ)`), is the normalised valuation `v = ellVal` of the value in `ℤ̄_ℓ` that is |
| 65 | obtained by mapping `P` and `x` there with the inclusions `toIntQpBar`. -/ |
| 66 | lemma CoeffRing.normLength_addVal_eval₂ {O O' : CoeffRing ℓ} (hO : O ≤ O') {σ : Type} |
| 67 | (P : MvPolynomial σ O.val) (x : σ → O'.val) : |
| 68 | O'.normLength (addVal O'.val (P.eval₂ (Subalgebra.inclusion hO).toRingHom x)) = |
| 69 | ellVal (MvPolynomial.eval (fun j : σ ↦ O'.toIntQpBar (x j)) (P.map O.toIntQpBar)).val := by |
| 70 | rw [normLength_addVal, ← coe_toIntQpBar, MvPolynomial.eval₂_comp_left, toIntQpBar_comp_inclusion, |
| 71 | MvPolynomial.eval_map, Function.comp_def] |
| 72 | |
| 73 | /-- Finitely many elements of `ℤ̄_ℓ` lie in all sufficiently large coefficient rings `O` (rings of |
| 74 | integers of finite Galois extensions of `ℚ_ℓ` in `ℚ̄_ℓ`, ordered by inclusion), that is, they are |
| 75 | in the image of the inclusion `O.toIntQpBar`. -/ |
| 76 | lemma CoeffRing.eventually_exists_toIntQpBar_eq {σ : Type} [Finite σ] (x : σ → intQpBar ℓ) : |
| 77 | ∀ᶠ O : CoeffRing ℓ in Filter.atTop, |
| 78 | ∃ x' : σ → O.val, ∀ j : σ, O.toIntQpBar (x' j) = x j := by |
| 79 | have h_norm (j : σ) : ‖(x j).val‖ ≤ 1 := |
| 80 | (Valuation.mem_valuationSubring_iff _ _).1 (x j).property |
| 81 | have h_mem : ∀ᶠ O : CoeffRing ℓ in Filter.atTop, ∀ j : σ, (x j).val ∈ O.val := |
| 82 | Filter.eventually_all.2 fun j : σ ↦ eventually_mem (h_norm j) |
| 83 | filter_upwards [h_mem] with O hO |
| 84 | exact ⟨fun j : σ ↦ ⟨(x j).val, hO j⟩, fun j : σ ↦ Subtype.ext (coe_toIntQpBar _)⟩ |
| 85 | |
| 86 | namespace Selmer |
| 87 | |
| 88 | /-- Let `f` be a ring map from `O` to `ℤ̄_ℓ = intQpBar ℓ`, the integral elements of `ℚ̄_ℓ`, that |
| 89 | reflects divisibility. If `r ≤ 1`, `v(f(α - 1)) ≥ r` for the valuation `v = ellVal` with |
| 90 | `v(ℓ) = 1`, and `M ≤ N r`, then `ℓ ^ M` divides `∑ i < ℓ ^ N, α ^ i`. -/ |
| 91 | lemma pow_dvd_geom_sum {O : Type*} [Ring O] (f : O →+* intQpBar ℓ) |
| 92 | (hf : ∀ z z' : O, f z ∣ f z' → z ∣ z') {r : ℚ≥0} {M N : ℕ} (hr : r ≤ 1) |
| 93 | (hMN : (M : ℚ≥0) ≤ N * r) {α : O} (hα : (r : ℝ≥0) ≤ ellVal (f (α - 1)).val) : |
| 94 | (ℓ ^ M : O) ∣ ∑ i ∈ range (ℓ ^ N), α ^ i := by |
| 95 | rw [map_sub, map_one] at hα |
| 96 | apply hf |
| 97 | rw [dvd_iff_ellVal_le] |
| 98 | calc |
| 99 | ellVal (f (ℓ ^ M)).val = M := by simp |
| 100 | _ ≤ N * (r : ℝ≥0) := by exact_mod_cast hMN |
| 101 | _ ≤ ellVal (∑ i ∈ range (ℓ ^ N), f α ^ i).val := le_ellVal_geom_sum hr hα N |
| 102 | _ = ellVal (f (∑ i ∈ range (ℓ ^ N), α ^ i)).val := by simp only [map_pow, map_sum] |
| 103 | |
| 104 | end Selmer |
| 105 | |
| 106 | end New |
| 107 | |
| 108 | end |