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 New.Spanning.RemainingTerms.BorderedDeterminant |
| 4 | public import New.Spanning.RemainingTerms.Discriminants |
| 5 | public import New.Spanning.RemainingTerms.OrbitSize |
| 6 | |
| 7 | /-! |
| 8 | # The data of a term and of a pair of terms |
| 9 | |
| 10 | The lattice `L_γ` of a term, the common lattice `L₁₂` of two terms, the gauge `𝗀*` with the factor |
| 11 | due to the level, the size of a term, and the terms and pairs that are counted. |
| 12 | |
| 13 | We write `X₀` for the definite hermitian space with coordinates `𝔰.κ`, and `z` for the vector that |
| 14 | spans the rest of the middle part. |
| 15 | |
| 16 | Here a term is a rational element `γ`, taken with two classes `c` and `c'`, `A` is the span of |
| 17 | `e₁, …, e_ϱ`, `Λ` is the lattice of the class `c`, `M = S.M` is the level and `f` is the number of |
| 18 | infinite places. A term in the cell `j` has `rk A / (A ∩ γ A) = min ϱ j`. |
| 19 | |
| 20 | Notions from other files: |
| 21 | * `S.classCoordX₀ c`: the matrix of a basis of `X₀` in the coordinates of `Λ`; it is orthonormal |
| 22 | for the Gram matrix `S.latticeMiddle` of the middle part of `Λ`. |
| 23 | * `S.translateByClassReps c c' γ`: the adelic element `h_c⁻¹ γ h_c'`, where `h_c` represents `c`. |
| 24 | * `S.HasCellRank j γ`: `γ` lies in the cell `j ≤ ϱ + 1`; there is at most one such `j`. |
| 25 | * `New.link γ`: the pairs of middle coordinates (in `X₀ ⊕ E z`) of `t` and `γ⁻¹ t`, for `t` |
| 26 | orthogonal to `A` and `γ A`. `New.commonLink γ γ'`: the vectors `x` of `X₀` such that some pair |
| 27 | `(x, y)` lies in both links, with `x` and `y` orthogonal to `z`. |
| 28 | * `S.maxGauge j c c' γ`: the larger of the gauge `𝗀♯` and `Nm 𝗀`, for a term in the cell `j`. |
| 29 | -/ |
| 30 | |
| 31 | @[expose] public section |
| 32 | |
| 33 | noncomputable section |
| 34 | |
| 35 | namespace New.Filling |
| 36 | |
| 37 | open NumberField Matrix Module Pointwise |
| 38 | |
| 39 | variable {E : Type} [Field E] [CMType E] [HasPrimitiveRoot5040 E] {𝔰 : Shape} (S : Filling E 𝔰) |
| 40 | (j : Fin (𝔰.ϱ + 2)) (c c' : S.Classes) (γ γ' : S.G E) |
| 41 | |
| 42 | /-- The lattice `Λ ∩ X₀` of the class `c`, in rational coordinates: the vectors that |
| 43 | `S.classCoordX₀ c` sends to integral vectors. -/ |
| 44 | def classLatticeX₀ : Submodule (Ô E) (𝔰.κ → 𝔸f E) := preimageLattice (Ô E) (S.classCoordX₀ c) |
| 45 | |
| 46 | /-- The lattice `L_γ` of a term: the vectors `v` of `Λ ∩ X₀` such that some vector of |
| 47 | `v + M (Λ ∩ A)` is orthogonal to the frame of `γ`, taken in the lattice coordinates of `c` and `c'` |
| 48 | (the frame of `S.translateByClassReps c c' γ`). The condition says that the products of `v` with |
| 49 | this frame are `M` times the products of some vector of `Λ ∩ A` with it. -/ |
| 50 | def termLattice : Submodule (Ô E) (𝔰.κ → 𝔸f E) := |
| 51 | S.classLatticeX₀ c ⊓ |
| 52 | (S.ideleM • colLattice (Ô E) |
| 53 | (isotropicRows ((S.latticeMiddle (𝔸f E)).frameGram (S.translateByClassReps c c' γ)))ᴴ).comap |
| 54 | (((frameMiddle (S.translateByClassReps c c' γ).val.val)ᴴ * S.latticeMiddle (𝔸f E) * |
| 55 | S.classCoordX₀ c).mulVecLin.restrictScalars (Ô E)) |
| 56 | |
| 57 | /-- The part of the lattice `L_γ` of the term `γ` in `commonLink γ γ'`, the vectors of `X₀` that |
| 58 | are the first entry of a pair, orthogonal to `z`, lying in both links. -/ |
| 59 | def commonPart : Submodule (Ô E) (𝔰.κ → 𝔸f E) := |
| 60 | saturatedLattice (S.gram_classCoordX₀ c) (commonLink γ γ') ⊓ S.termLattice c c' γ |
| 61 | |
| 62 | /-- The common lattice `L₁₂` of two terms: the part of `L_γ ∩ L_γ'` in `commonLink γ γ'`, the |
| 63 | vectors of `X₀` that are the first entry of a pair, orthogonal to `z`, lying in both links. -/ |
| 64 | def pairLattice : Submodule (Ô E) (𝔰.κ → 𝔸f E) := |
| 65 | saturatedLattice (S.gram_classCoordX₀ c) (commonLink γ γ') ⊓ |
| 66 | (S.termLattice c c' γ ⊓ S.termLattice c c' γ') |
| 67 | |
| 68 | /-- The discriminant of the common lattice `L₁₂` of two terms, a lattice in `commonLink γ γ'`. -/ |
| 69 | def pairDiscriminant : ℝ := discriminant (finrank E (commonLink γ γ')) (S.pairLattice c c' γ γ') |
| 70 | |
| 71 | /-- The corank `c⁺` of two links: the codimension of their intersection in each of them, a link |
| 72 | having the dimension `k + 1`. -/ |
| 73 | def linkCorank : ℕ := 𝔰.k + 1 - finrank E ↥(link γ ⊓ link γ') |
| 74 | |
| 75 | /-- The gauge `𝗀*` of a term in the cell `j`: `S.maxGauge` times the factor `M ^ (2 j' f)`, |
| 76 | `j' = min ϱ j`, that is due to the congruence level `M`. Here `f` is the number of infinite |
| 77 | places. -/ |
| 78 | def levelGauge : ℝ := S.M ^ (2 * min 𝔰.ϱ j * numInfPlaces E) * S.maxGauge j c c' γ |
| 79 | |
| 80 | /-- The bound `b ^ (n³ f)` for the gauges of near terms and for the discriminants of the pairs |
| 81 | that are counted, where `f` is the number of infinite places. -/ |
| 82 | def discriminantBound : ℝ := S.b ^ (𝔰.n ^ 3 * numInfPlaces E) |
| 83 | |
| 84 | /-- The cell rank of a rational element: the index `j` with `S.HasCellRank j γ`, or an unspecified |
| 85 | index if there is none. For an element with a cell rank, `min ϱ (cellRank γ)` is the rank of |
| 86 | `A / (A ∩ γ A)`. -/ |
| 87 | def cellRank : Fin (𝔰.ϱ + 2) := Classical.epsilon fun j ↦ S.HasCellRank j γ |
| 88 | |
| 89 | /-- The term is near, is the chosen element of its orbit `U⁰_c γ U⁰_c'`, where |
| 90 | `U⁰_c = S.classUnipotent₀ c`, and has a cell rank. -/ |
| 91 | def IsNearRepresentativeAtCellRank : Prop := |
| 92 | S.IsNearRepresentative c c' γ ∧ S.HasCellRank (S.cellRank γ) γ |
| 93 | |
| 94 | /-- Two near representatives over one block `(c, s, c')` (see `S.termsOver`) whose `s` agrees (see |
| 95 | `S.Agrees`). -/ |
| 96 | def IsNearPairOverAgreeingBlock (q : S.G E × S.G E) : Prop := |
| 97 | S.IsNearRepresentativeAtCellRank c c' q.1 ∧ S.IsNearRepresentativeAtCellRank c c' q.2 ∧ |
| 98 | ∃ s : S.ResidueGL, S.Agrees s ∧ q.1 ∈ S.termsOver c s c' ∧ q.2 ∈ S.termsOver c s c' |
| 99 | |
| 100 | /-- The size of a term: `S.orbitBound` at the cell rank and the gauge `S.maxGauge` of the term. -/ |
| 101 | def termSize : ℝ := |
| 102 | S.orbitBound (S.cellRank γ) (S.maxGauge (S.cellRank γ) c c' γ) |
| 103 | |
| 104 | /-- The near representatives of `T` over the block `(c, s, c')`, that is, with `h_c⁻¹ γ h_c'` |
| 105 | integral and of reduction `s`; there are none unless `s` agrees. -/ |
| 106 | def nearRepresentativesOver (T : Set (S.G E)) (c : S.Classes) (s : S.ResidueGL) (c' : S.Classes) : |
| 107 | Set (S.G E) := |
| 108 | {γ : S.G E | γ ∈ T ∩ S.termsOver c s c' ∧ S.Agrees s ∧ S.IsNearRepresentativeAtCellRank c c' γ} |
| 109 | |
| 110 | variable {S c} |
| 111 | |
| 112 | omit [HasPrimitiveRoot5040 E] in |
| 113 | /-- If the rational element `γ` lies in some cell `j` (`S.HasCellRank j γ`: |
| 114 | `New.NormOnePairOccursFrom` `j` holds, the leading minor `D_j` of `S.frameProducts γ` is nonzero, |
| 115 | and `S.termDisc γ ≠ 0` exactly for `j = ϱ + 1`), then it lies in the cell of the index |
| 116 | `S.cellRank γ` chosen among these `j`. -/ |
| 117 | lemma HasCellRank.hasCellRank_cellRank {j : Fin (𝔰.ϱ + 2)} {γ : S.G E} |
| 118 | (h : S.HasCellRank j γ) : S.HasCellRank (S.cellRank γ) γ := |
| 119 | Classical.epsilon_spec (p := fun i : Fin (𝔰.ϱ + 2) ↦ S.HasCellRank i γ) ⟨j, h⟩ |
| 120 | |
| 121 | /-- For a subspace `V` of the definite space `X₀` and the lattice `Λ` of the class `c`, the real |
| 122 | number `S.latticeDisc c V` is at least `1`. It is the square root of the generalised index |
| 123 | (`New.genIndex`) of the Gram determinant of a basis of `Λ ∩ V` over `Ô E`: for an integral |
| 124 | determinant this is the square root of the norm of the ideal that it generates, which is at least |
| 125 | `1`. -/ |
| 126 | lemma one_le_latticeDisc (V : Submodule E (𝔰.κ → E)) : 1 ≤ S.latticeDisc c V := |
| 127 | one_le_sublatticeDiscriminant (S.gram_classCoordX₀ c) V |
| 128 | fun _m hm ↦ isIntMatrix_conjTranspose_mul_of_classCoordX₀ hm hm |
| 129 | |
| 130 | end New.Filling |
| 131 | |
| 132 | end |