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 | import TauCeti.RingTheory.DiscreteValuationRing.BlockSolutions |
| 4 | public import Mathlib.RingTheory.RegularLocalRing.Defs |
| 5 | import Mathlib.RingTheory.Coalgebra.IsFrobenius |
| 6 | import Mathlib.RingTheory.Etale.Weakly |
| 7 | import Mathlib.RingTheory.HopfAlgebra.Basic |
| 8 | import Mathlib.RingTheory.TotallySplit |
| 9 | public import Lib.General.Algebra.FittingIdealsAndLengths |
| 10 | |
| 11 | /-! |
| 12 | # A matrix of relations with small block determinant valuation |
| 13 | |
| 14 | Linear algebra over a discrete valuation ring O (written `DVR O`) with normalized valuation |
| 15 | v = `addVal O` and fraction field K. The valuation of a determinant of relations is bounded by the |
| 16 | length of a module of solutions in K/O. |
| 17 | |
| 18 | * `New.Selmer.divQuot`: the map x ↦ x/p from O/p to K/O (`New.Selmer.DivisibleQuot`). For p ≠ 0 it |
| 19 | is injective with image the p-torsion. |
| 20 | * `New.Selmer.exists_rows_addVal_det_le_of_divisible`: let ψ : A → M_d(O) be onto and N an |
| 21 | A-submodule of A^ι. If the vectors with entries in K/O killed by ψ(N) lie in a module of length |
| 22 | at most b, then some square matrix B with rows in N has v(det ψ(B)) ≤ b, with ψ(B) read as a |
| 23 | block matrix. This is the form that Ribet's lemma uses. |
| 24 | |
| 25 | `TauCeti.exists_addVal_det_eq_length_blockSolutions` gives an optimal array: its determinant |
| 26 | valuation is the length of the solution module, which is contained in Z. |
| 27 | |
| 28 | ## Relation to the literature |
| 29 | |
| 30 | General linear algebra over a discrete valuation ring (elementary divisors). |
| 31 | -/ |
| 32 | |
| 33 | @[expose] public section |
| 34 | |
| 35 | open IsDiscreteValuationRing Matrix Module Submodule Fintype Ideal LinearMap |
| 36 | |
| 37 | namespace New.Selmer |
| 38 | |
| 39 | variable {O : Type} [CommRing O] [DVR O] |
| 40 | |
| 41 | /-- Pointwise application of a coefficient map onto the elements killed by `a` identifies the |
| 42 | image of a submodule of functions with the `a`-torsion of the corresponding submodule. -/ |
| 43 | lemma range_restrict_compLeft_eq_torsionBy {O B G I : Type*} [CommRing O] [AddCommMonoid B] |
| 44 | [Module O B] {a : O} (f : QuotSpan a →ₗ[O] B) |
| 45 | (onto : ∀ y : B, a • y = 0 → ∃ x, f x = y) |
| 46 | {W : Submodule O (G → I → QuotSpan a)} {V : Submodule O (G → I → B)} |
| 47 | (mem : ∀ z, ((f.compLeft I).compLeft G) z ∈ V ↔ z ∈ W) : |
| 48 | (((f.compLeft I).compLeft G).restrict (fun z hz ↦ (mem z).2 hz)).range = torsionBy O V a := by |
| 49 | ext ⟨y, hy⟩ |
| 50 | constructor |
| 51 | · rintro ⟨z, hz⟩ |
| 52 | rw [← hz] |
| 53 | apply (mem_torsionBy_iff _ _).2 |
| 54 | ext g i |
| 55 | change a • f (z.val g i) = 0 |
| 56 | rw [← map_smul, smul_quot_eq_zero_of_dvd dvd_rfl, map_zero] |
| 57 | · intro h |
| 58 | have hz : a • y = 0 := congrArg Subtype.val ((mem_torsionBy_iff _ _).1 h) |
| 59 | choose z he using fun g i ↦ onto (y g i) (congrFun₂ hz g i) |
| 60 | have e : ((f.compLeft I).compLeft G) z = y := funext₂ he |
| 61 | exact ⟨⟨z, (mem z).1 (e ▸ hy)⟩, Subtype.ext e⟩ |
| 62 | |
| 63 | variable (O) in |
| 64 | /-- The divisible module K/O, where K = Frac(O). -/ |
| 65 | abbrev DivisibleQuot : Type := FractionRing O ⧸ (1 : Submodule O (FractionRing O)) |
| 66 | |
| 67 | /-- Division by `a`, from O/a to K/O: the class of t goes to the class of t/a. -/ |
| 68 | noncomputable def divQuot (a : O) : QuotSpan a →ₗ[O] DivisibleQuot O := |
| 69 | (Ideal.span {a}).liftQ ((1 : Submodule O (FractionRing O)).mkQ ∘ₗ |
| 70 | LinearMap.toSpanSingleton O (FractionRing O) (algebraMap O (FractionRing O) a)⁻¹) |
| 71 | (by |
| 72 | rw [Ideal.span_singleton_le_iff_mem, mem_ker, LinearMap.comp_apply] |
| 73 | rcases eq_or_ne a 0 with rfl | ha |
| 74 | · simp |
| 75 | · exact (Submodule.Quotient.mk_eq_zero _).2 (mem_one.2 ⟨1, by simp [Algebra.smul_def, ha]⟩)) |
| 76 | |
| 77 | /-- `divQuot a` sends the class of `t` in `O ⧸ (a)` to the class of `t / a` in |
| 78 | `K ⧸ O`. -/ |
| 79 | lemma divQuot_mk (a t : O) : divQuot a (Ideal.Quotient.mk _ t) = |
| 80 | Submodule.Quotient.mk (t • (algebraMap O (FractionRing O) a)⁻¹) := rfl |
| 81 | |
| 82 | /-- For `a ≠ 0` there is an `O`-linear equivalence from `QuotSpan a` onto the |
| 83 | `a`-torsion of `DivisibleQuot O` that agrees with `divQuot a`. -/ |
| 84 | private lemma exists_divQuot_torsionEquiv {a : O} (ha : a ≠ 0) : |
| 85 | ∃ e : QuotSpan a ≃ₗ[O] torsionBy O (DivisibleQuot O) a, |
| 86 | ∀ x, (e x : DivisibleQuot O) = divQuot a x := by |
| 87 | simp_rw [(Ideal.Quotient.mk_surjective (I := Ideal.span {a})).forall, divQuot_mk] |
| 88 | unfold DivisibleQuot |
| 89 | rw [Submodule.one_eq_range, ← torsionBySet_span_singleton_eq] |
| 90 | exact ⟨quotientEquivTorsionBySet ha, coe_quotientEquivTorsionBySet_apply_mk ha⟩ |
| 91 | |
| 92 | /-- `divQuot a` is injective whenever `a ≠ 0`. -/ |
| 93 | lemma divQuot_injective {a : O} (ha : a ≠ 0) : Function.Injective (divQuot a) := by |
| 94 | obtain ⟨e, he⟩ := exists_divQuot_torsionEquiv ha |
| 95 | simpa only [Function.comp_def, he] using (Subtype.val_injective.comp e.injective) |
| 96 | |
| 97 | /-- An element of K/O killed by `a ≠ 0` is the image of some x in O/a under division by `a`. -/ |
| 98 | lemma exists_divQuot_eq {a : O} (ha : a ≠ 0) {y : DivisibleQuot O} (hy : a • y = 0) : |
| 99 | ∃ x : QuotSpan a, divQuot a x = y := by |
| 100 | obtain ⟨e, he⟩ := exists_divQuot_torsionEquiv ha |
| 101 | obtain ⟨x, hx⟩ := e.surjective ⟨y, hy⟩ |
| 102 | exact ⟨x, (he x).symm.trans (congrArg Subtype.val hx)⟩ |
| 103 | |
| 104 | /-- A finite family in the fraction field modulo the ring has a common nonzero denominator. -/ |
| 105 | lemma exists_common_denominator {ι : Type*} [Finite ι] (x : ι → DivisibleQuot O) : |
| 106 | ∃ a : O, a ≠ 0 ∧ ∀ i, a • x i = 0 := by |
| 107 | choose f hf using fun i ↦ Submodule.Quotient.mk_surjective |
| 108 | (1 : Submodule O (FractionRing O)) (x i) |
| 109 | obtain ⟨a, ha⟩ := IsLocalization.exist_integer_multiples_of_finite (nonZeroDivisors O) f |
| 110 | refine ⟨a, nonZeroDivisors.coe_ne_zero a, fun i ↦ ?_⟩ |
| 111 | rw [← hf i, ← Submodule.Quotient.mk_smul] |
| 112 | exact (Submodule.Quotient.mk_eq_zero _).2 (mem_one.2 (ha i)) |
| 113 | |
| 114 | /-- A torsion element `z` over a discrete valuation ring that survives multiplication by `a` |
| 115 | gives an embedded copy of `O / a` in the `a`-torsion of its module. -/ |
| 116 | lemma exists_injective_quotSpan_torsionBy {X : Type} [AddCommGroup X] [Module O X] {a : O} |
| 117 | {z : X} (hz : a • z ≠ 0) (h_tors : ∃ d : O, d ≠ 0 ∧ d • z = 0) : |
| 118 | ∃ f : QuotSpan a →ₗ[O] torsionBy O X a, Function.Injective f := by |
| 119 | -- The annihilator of `z` is generated by some `b`, which does not divide `a`; so `b = a c`. |
| 120 | obtain ⟨b, hb⟩ : ∃ b : O, ∀ t : O, t • z = 0 ↔ b ∣ t := |
| 121 | (IsPrincipalIdealRing.principal (torsionOf O X z)).principal.imp fun b h_ann t ↦ by |
| 122 | rw [← mem_torsionOf_iff, h_ann, Ideal.mem_span_singleton] |
| 123 | obtain ⟨c, rfl⟩ : a ∣ b := (ValuationRing.dvd_total a b).resolve_right fun h ↦ hz ((hb a).2 h) |
| 124 | have hc : c ≠ 0 := by |
| 125 | rintro rfl |
| 126 | simp [hb] at h_tors |
| 127 | -- The element `w = c z` is killed exactly by the multiples of `a`, so `t ↦ t w` embeds `O / a`. |
| 128 | let w : torsionBy O X a := ⟨c • z, by simp [smul_smul, hb]⟩ |
| 129 | let mulW : O →ₗ[O] torsionBy O X a := LinearMap.toSpanSingleton O _ w |
| 130 | have h_ker : Ideal.span {a} = LinearMap.ker mulW := by |
| 131 | ext t |
| 132 | have h_smul : t • w = 0 ↔ a * c ∣ t * c := by simp [w, Subtype.ext_iff, smul_smul, hb] |
| 133 | simp [mulW, h_smul, Ideal.mem_span_singleton, mul_dvd_mul_iff_right hc] |
| 134 | let e := (quotEquivOfEq _ _ h_ker).trans mulW.quotKerEquivRange |
| 135 | exact ⟨mulW.range.subtype.comp e.toLinearMap, mulW.range.injective_subtype.comp e.injective⟩ |
| 136 | |
| 137 | /-- Let `X` be a torsion module over a discrete valuation ring. If the length of the `a`-torsion |
| 138 | is less than the valuation of `a`, then `a` kills all of `X`. -/ |
| 139 | lemma torsionBy_eq_top_of_length_lt_addVal {X : Type} [AddCommGroup X] [Module O X] {a : O} |
| 140 | (hX : ∀ z : X, ∃ d : O, d ≠ 0 ∧ d • z = 0) |
| 141 | (h : length O (torsionBy O X a) < addVal O a) : torsionBy O X a = ⊤ := by |
| 142 | by_contra h_ne |
| 143 | obtain ⟨z, hz⟩ : ∃ z : X, a • z ≠ 0 := by simpa [eq_top_iff'] using h_ne |
| 144 | obtain ⟨f, hf⟩ := exists_injective_quotSpan_torsionBy hz (hX z) |
| 145 | exact h.not_ge ((length_quot_span_eq_addVal (a := a)).symm.trans_le (length_le_of_injective f hf)) |
| 146 | |
| 147 | /-- Let O be a discrete valuation ring with normalized valuation v = `addVal O` and fraction field |
| 148 | K, and write `DivisibleQuot O` for K/O. Let ψ : A → M_d(O) be onto and N an A-submodule of A^ι. |
| 149 | If all w in ((K/O)^d)^ι with ∑ j, ψ(t j) • w_j = 0 for every t ∈ N lie in a submodule Z of length |
| 150 | at most b, then some square matrix B with rows in N has v(det ψ(B)) ≤ b, where ψ(B) is read as a |
| 151 | block matrix. A matrix acts on (K/O)^d by multiplication. -/ |
| 152 | lemma exists_rows_addVal_det_le_of_divisible {ι A d : Type} [Fintype ι] [DecidableEq ι] [Ring A] |
| 153 | [Algebra O A] [Fintype d] [DecidableEq d] (ψ : A →ₐ[O] Matrix d d O) |
| 154 | (hψ : Function.Surjective ψ) (N : Submodule A (ι → A)) {b : ℕ} |
| 155 | {Z : Submodule O (ι → d → DivisibleQuot O)} (hZ : length O Z ≤ b) |
| 156 | (hZ_mem : ∀ w : ι → d → DivisibleQuot O, (∀ t ∈ N, ∑ j : ι, ψ (t j) • w j = 0) → w ∈ Z) : |
| 157 | ∃ B : Matrix ι ι A, |
| 158 | (∀ i : ι, B i ∈ N) ∧ addVal O (Matrix.comp ι ι d d O (B.map ψ)).det ≤ b := by |
| 159 | obtain ⟨B, hB, hdet⟩ := |
| 160 | TauCeti.exists_addVal_det_eq_length_blockSolutions (K := FractionRing O) ψ N hψ |
| 161 | rw [← Submodule.one_eq_range] at hdet |
| 162 | refine ⟨B, hB, hdet.le.trans ((New.length_mono ?_).trans hZ)⟩ |
| 163 | intro w hw |
| 164 | apply hZ_mem w |
| 165 | intro t ht |
| 166 | ext i |
| 167 | simpa using (TauCeti.mem_blockSolutions ψ N).1 hw t ht i |
| 168 | |
| 169 | end New.Selmer |