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.LinearAlgebra.Determinant.Basic |
| 4 | public import Mathlib.Data.Matrix.ColumnRowPartitioned |
| 5 | import Mathlib.Order.CompletePartialOrder |
| 6 | import Mathlib.RingTheory.Coalgebra.IsFrobenius |
| 7 | import Mathlib.RingTheory.Etale.Weakly |
| 8 | import Mathlib.RingTheory.HopfAlgebra.Basic |
| 9 | import Mathlib.RingTheory.OrderOfVanishing.Noetherian |
| 10 | import Mathlib.RingTheory.RegularLocalRing.Defs |
| 11 | import Mathlib.RingTheory.TotallySplit |
| 12 | public import Lib.General.Algebra.FittingIdealsAndLengths |
| 13 | |
| 14 | /-! |
| 15 | # Maximal minors and lengths |
| 16 | |
| 17 | Let `A` be a matrix over a discrete valuation ring `O` and let `a ≠ 0`. The length of the kernel of |
| 18 | `A` on `(O / a) ^ k` is the least valuation of a maximal minor of the matrix formed by the rows of |
| 19 | `A` and of `a • 1`. Each selected matrix kills the kernel modulo `a`, so its determinant valuation |
| 20 | bounds the kernel length. Conversely, the lattice bound supplies a square matrix with rows in this |
| 21 | span and determinant valuation at most the kernel length. A minor of least valuation divides that |
| 22 | determinant. |
| 23 | |
| 24 | * `New.Selmer.maximalMinors`, `New.Selmer.matrixKernel`: the minors and the kernel. |
| 25 | * `New.Selmer.isLeast_length_matrixKernel`: the statement for a matrix over a commutative ring `Λ` |
| 26 | and a ring homomorphism `ev : Λ →+* O` with `ev a ≠ 0`. |
| 27 | |
| 28 | Notions from other files: |
| 29 | |
| 30 | * `New.QuotSpan a`: the quotient ring `O / a O`. |
| 31 | |
| 32 | ## Relation to the literature |
| 33 | |
| 34 | Known result: Length of a matrix kernel modulo `a` over a discrete valuation ring via maximal |
| 35 | minors. A consequence of the theorem on elementary divisors. |
| 36 | -/ |
| 37 | |
| 38 | @[expose] public section |
| 39 | |
| 40 | noncomputable section |
| 41 | |
| 42 | namespace New.Selmer |
| 43 | |
| 44 | open Matrix Module Submodule IsDiscreteValuationRing |
| 45 | |
| 46 | variable {Λ O r k : Type*} [CommRing Λ] [CommRing O] [Fintype k] [DecidableEq k] |
| 47 | |
| 48 | /-- The minors of size `card k` of the matrix formed by the rows of `A` and of `a • 1`, where `k` |
| 49 | indexes the columns. The family of rows of `A` may be infinite. A choice of rows with a repetition |
| 50 | is allowed; it contributes the minor `0`. -/ |
| 51 | def maximalMinors (A : Matrix r k Λ) (a : Λ) : Set Λ := |
| 52 | Set.range fun f : k → r ⊕ k ↦ ((A.fromRows (a • 1)).submatrix f id).det |
| 53 | |
| 54 | /-- The kernel of `A` on `B ^ k`, for an `O`-module `B`: the vectors `w` such that |
| 55 | `∑ j, A i j • w j = 0` for every row index `i`. -/ |
| 56 | def matrixKernel (A : Matrix r k O) (B : Type*) [AddCommMonoid B] [Module O B] : |
| 57 | Submodule O (k → B) := |
| 58 | ⨅ i : r, LinearMap.ker (∑ j : k, A i j • LinearMap.proj j : (k → B) →ₗ[O] B) |
| 59 | |
| 60 | /-- A ring homomorphism `ev` maps the maximal minors of the rows of `A` and `a • 1` onto those of |
| 61 | the rows of `A.map ev` and `ev a • 1`. -/ |
| 62 | lemma image_maximalMinors (A : Matrix r k Λ) (a : Λ) (ev : Λ →+* O) : |
| 63 | ev '' maximalMinors A a = maximalMinors (A.map ev) (ev a) := by |
| 64 | have h_map : (A.fromRows (a • (1 : Matrix k k Λ))).map ev = (A.map ev).fromRows (ev a • 1) := by |
| 65 | ext (i | i) j <;> simp [Matrix.one_apply, apply_ite ev] |
| 66 | simp [maximalMinors, ← Set.range_comp, Function.comp_def, ev.map_det, ← h_map, submatrix_map] |
| 67 | |
| 68 | omit [DecidableEq k] in |
| 69 | /-- A vector lies in `matrixKernel A B` exactly if every row of `A` sends it to `0`. -/ |
| 70 | lemma mem_matrixKernel {A : Matrix r k O} {B : Type*} [AddCommMonoid B] [Module O B] {w : k → B} : |
| 71 | w ∈ matrixKernel A B ↔ ∀ i : r, ∑ j : k, A i j • w j = 0 := by |
| 72 | simp [matrixKernel] |
| 73 | |
| 74 | variable [DVR O] |
| 75 | |
| 76 | private lemma isLeast_length_matrixKernel_dvr (A : Matrix r k O) {a : O} (ha : a ≠ 0) : |
| 77 | IsLeast (addVal O '' maximalMinors A a) (length O (matrixKernel A (QuotSpan a))) := by |
| 78 | let M : Matrix (r ⊕ k) k O := A.fromRows (a • 1) |
| 79 | let v (f : k → r ⊕ k) := addVal O (M.submatrix f id).det |
| 80 | -- Every vector in the kernel is killed by every selected row, including the rows of `a • 1`. |
| 81 | have h_lower (f : k → r ⊕ k) : length O (matrixKernel A (QuotSpan a)) ≤ v f := by |
| 82 | refine le_trans (length_mono (T := LinearMap.ker (M.submatrix f id • 1 : |
| 83 | End O (k → QuotSpan a))) ?_) (length_ker_le_addVal_det _ _) |
| 84 | intro w hw |
| 85 | ext i |
| 86 | change ∑ j : k, M (f i) j • w j = 0 |
| 87 | rcases f i with l | l |
| 88 | · exact mem_matrixKernel.1 hw l |
| 89 | · exact Finset.sum_eq_zero fun j _ ↦ smul_quot_eq_zero_of_dvd (dvd_mul_right a _) (w j) |
| 90 | -- The row lattice contains `a • x` for every `x`. The lattice determinant bound gives a |
| 91 | -- submodule of the kernel because it annihilates every row of `A`. |
| 92 | have h_smul (x : k → O) : a • x ∈ span O (Set.range M.row) := by |
| 93 | refine span_mono ?_ ((range_vecMulLinear (a • (1 : Matrix k k O))).le ⟨x, by simp⟩) |
| 94 | exact Set.range_subset_iff.2 fun j ↦ ⟨.inr j, rfl⟩ |
| 95 | obtain ⟨N, S, hN, horth, hdet⟩ := |
| 96 | exists_matrix_addVal_det_le_length _ ha h_smul |
| 97 | have hS : S ≤ matrixKernel A (QuotSpan a) := fun w hw ↦ |
| 98 | mem_matrixKernel.2 fun i ↦ (horth (A i)).1 (subset_span ⟨.inl i, rfl⟩) w hw |
| 99 | have : Nonempty (k → r ⊕ k) := ⟨.inr⟩ |
| 100 | let f₀ := Function.argmin v |
| 101 | have h_dvd : (M.submatrix f₀ id).det ∣ N.det := Ideal.mem_span_singleton.1 <| |
| 102 | TauCeti.det_mem_of_mem_span LinearMap.proj hN fun B hB ↦ by |
| 103 | choose f hf using hB |
| 104 | obtain rfl : B = M.submatrix f id := (funext hf).symm |
| 105 | exact Ideal.mem_span_singleton.2 (addVal_le_iff_dvd.1 (Function.argmin_le v f)) |
| 106 | have h_upper : v f₀ ≤ length O (matrixKernel A (QuotSpan a)) := |
| 107 | (addVal_le_iff_dvd.2 h_dvd).trans (hdet.trans (length_mono hS)) |
| 108 | exact ⟨⟨_, ⟨f₀, rfl⟩, h_upper.antisymm (h_lower f₀)⟩, |
| 109 | Set.forall_mem_image.2 (Set.forall_mem_range.2 h_lower)⟩ |
| 110 | |
| 111 | /-- Let `A` be a matrix over `Λ` with columns indexed by `k`, let `ev : Λ →+* O` be a ring |
| 112 | homomorphism to a discrete valuation ring (`[DVR O]`), and let `ev a ≠ 0`. The length of |
| 113 | `matrixKernel (A.map ev) (QuotSpan (ev a))`, the kernel of `A.map ev` on `(O / ev a) ^ k`, is the |
| 114 | least `addVal (ev P)`, where `P` runs over `maximalMinors A a`, the maximal minors of the matrix |
| 115 | formed by the rows of `A` and of `a • 1`. -/ |
| 116 | theorem isLeast_length_matrixKernel (A : Matrix r k Λ) (a : Λ) (ev : Λ →+* O) (ha : ev a ≠ 0) : |
| 117 | IsLeast ((fun P : Λ ↦ addVal O (ev P)) '' maximalMinors A a) |
| 118 | (length O (matrixKernel (A.map ev) (QuotSpan (ev a)))) := by |
| 119 | rw [← Set.image_image (addVal O) ev, image_maximalMinors] |
| 120 | exact isLeast_length_matrixKernel_dvr _ ha |
| 121 | |
| 122 | end New.Selmer |
| 123 | |
| 124 | end |