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.UpperBound.Seesaw.AdmissibleCombinations |
| 4 | |
| 5 | /-! |
| 6 | # Congruence levels inside the stabilizer of a glued lattice |
| 7 | |
| 8 | A grading `Y` of a hermitian space `V` (a choice of basis vectors with a fixed Gram matrix) embeds |
| 9 | the finite adelic unitary group on `X ⊕ Unit` into that of `V`. When the lattice of `V` is the glued |
| 10 | lattice of `Y`, this file gives congruences on an element of the small group that put its image |
| 11 | into the stabilizer of the lattice, or into a congruence level of it. |
| 12 | |
| 13 | Notions from other files: |
| 14 | * `Grading V N (X ⊕ Unit) s` splits the index set `ι` of the basis of `V` into `X ⊕ Unit`, on |
| 15 | which the Gram matrix is `1`, and a string of `s` vectors, orthogonal to it and with a fixed Gram |
| 16 | matrix that depends on `N`; `Y.inclXFin` is the resulting map on finite adelic unitary groups. |
| 17 | * The glued lattice of `Y` is the `Ô`-span of the columns of |
| 18 | `gradedLatticeBasis Y.indexEquiv a π u`. For odd `s` it glues the last vector of `X ⊕ Unit` to |
| 19 | the middle vector of the string. |
| 20 | * `Y.SpansLattice a π u`: the frame `V.xFin` of `V` spans the glued lattice. So in coordinates of |
| 21 | this frame the glued lattice is the standard lattice `Ô^ι`. |
| 22 | * `IsSplitSquarefree P N π`: `N = π π̄`, the idele `π` is a uniformizer at the places in `P` and a |
| 23 | unit elsewhere, and `P` contains no place together with its conjugate. |
| 24 | * `congruenceGL M e`: the integral invertible matrices whose rows `e i` agree with those of `1` |
| 25 | modulo `M`. |
| 26 | * `stdLevel E ι` is the stabilizer of `Ô^ι` in the finite adelic unitary group `Gf E ι`, and |
| 27 | `levelOf w ⊥` is the subgroup of its elements congruent to `1` at every place `w i`. |
| 28 | |
| 29 | ## Relation to the literature |
| 30 | |
| 31 | Related work: `Grading.inclXFin_mem_stdLevel` is related to Nikulin's criterion for extending |
| 32 | isometries to an overlattice: the congruence on `h` plays the part of the condition that an isometry |
| 33 | preserve the gluing. |
| 34 | -/ |
| 35 | |
| 36 | @[expose] public section |
| 37 | |
| 38 | namespace New |
| 39 | |
| 40 | open Filling Matrix Seesaw Space |
| 41 | variable {E X ι : Type _} [Field E] [CMType E] [Fintype ι] [DecidableEq ι] [Fintype X] |
| 42 | [DecidableEq X] {ε : ι → ℤˣ} {s : ℕ} {N : E} {V : Space E ι ε} (Y : Grading V N (X ⊕ Unit) s) |
| 43 | {a π : (𝔸f E)ˣ} |
| 44 | |
| 45 | /-- Let the grading `Y` split the index set `ι` of a basis of the hermitian space `V` over `E` into |
| 46 | `X ⊕ Unit` and a string of `s` vectors with a fixed Gram matrix depending on `N`. It gives the map |
| 47 | `Y.inclXFin` from the finite adelic unitary group `Gf E (X ⊕ Unit)` to `Gf E ι`, that of `V` in the |
| 48 | coordinates of its frame `V.xFin`. Assume that this frame spans the glued lattice of `Y`, that is, |
| 49 | the `Ô`-span of the basis `gradedLatticeBasis Y.indexEquiv a π u`, with ideles `a`, `π` and a |
| 50 | unitary adele `u` as parameters (`SpansLattice`). |
| 51 | |
| 52 | Then there is an integral matrix `R` such that the image of every `h` is the matrix `1 + Rᴴ M R`. |
| 53 | Here `M = h - 1` if `s` is even; if `s` is odd, the last row (index `Sum.inr ()`) of `h - 1` is |
| 54 | divided by `π` and its last column by `star π` (`scaleAt p o` is the diagonal matrix with `p` at |
| 55 | `o` and `1` elsewhere). -/ |
| 56 | lemma Grading.exists_inclXFin_sub_one_eq {u : unitary (𝔸f E)} (hL : Y.SpansLattice a π u) : |
| 57 | ∃ R : Matrix (X ⊕ Unit) ι (𝔸f E), IsIntMatrix (Ô E) R ∧ ∀ h : Gf E (X ⊕ Unit), |
| 58 | (Y.inclXFin h).val.val - 1 = Rᴴ * ((if Odd s then |
| 59 | scaleAt π⁻¹.val (Sum.inr ()) * ((h.val.val - 1) * scaleAt (star π⁻¹.val) (Sum.inr ())) |
| 60 | else h.val.val - 1) * R) := by |
| 61 | -- In rational coordinates the element acts as `h` on `X ⊕ Unit` and as `1` on the string, so its |
| 62 | -- matrix is `1 + Aᴴ (h - 1) A`, with `A` the rows of `V.xFin = gradedLatticeBasis · k` indexed by |
| 63 | -- `X ⊕ Unit`. These are the rows `R` of `k`, the last divided by `star π` when `s` is odd. |
| 64 | obtain ⟨k, hk, xFin_eq⟩ := hL |
| 65 | set e : (X ⊕ Unit) ⊕ Fin s ≃ ι := Y.indexEquiv with he |
| 66 | set R : Matrix (X ⊕ Unit) ι (𝔸f E) := of fun x ↦ k.val (e (Sum.inl x)) with hR |
| 67 | refine ⟨R, fun x ↦ hk.isIntMatrix _, fun h ↦ ?_⟩ |
| 68 | have h_conj : (Y.inclXFin h).val.val - 1 = |
| 69 | V.xFin⁻¹ * (V.ratCoordMatrixFin (Y.inclXFin h) - 1) * V.xFin := by |
| 70 | simp [ratCoordMatrixFin, sub_mul, mul_sub, mul_assoc] |
| 71 | set D : Matrix (X ⊕ Unit) (X ⊕ Unit) (𝔸f E) := |
| 72 | if Odd s then scaleAt (star π⁻¹.val) (Sum.inr ()) else 1 with hD |
| 73 | -- The Gram matrix times `(h ⊕ 1) - 1` lives on the block `X ⊕ Unit`, where it is `h - 1`. |
| 74 | have h_block : V.J.map (↑) * (gradedBlocks e e h.val.val 1 - 1) = |
| 75 | reindex e e (fromBlocks (h.val.val - 1) 0 0 0) := by |
| 76 | ext i j |
| 77 | obtain ⟨⟨i, rfl⟩, ⟨j, rfl⟩⟩ := e.surjective i, e.surjective j |
| 78 | rcases i with i | i <;> rcases j with j | j <;> |
| 79 | simp [Y.gram_eq, ← he, gradedGram, gradedBlocks, Matrix.mul_apply, (reindex_equiv e).2, |
| 80 | Matrix.one_apply, mul_sub] |
| 81 | -- The rows of `V.xFin` in that block are those of `R`, the last divided by `star π` for odd `s`. |
| 82 | have h_rows : V.xFin.val.submatrix (e ∘ Sum.inl) id = D * R := by |
| 83 | ext (x | x) j <;> by_cases hs : Odd s <;> |
| 84 | simp [xFin_eq, hD, hR, hs, Matrix.mul_apply, gradedLatticeBasis, diagonal, |
| 85 | (reindex_equiv e).2] |
| 86 | have h_restrict (A : Matrix (X ⊕ Unit) (X ⊕ Unit) (𝔸f E)) : |
| 87 | V.xFin.valᴴ * reindex e e (fromBlocks A 0 0 0) * V.xFin.val = (D * R)ᴴ * A * (D * R) := by |
| 88 | rw [← h_rows] |
| 89 | ext i j |
| 90 | simp [Matrix.mul_apply, (reindex_equiv e).2] |
| 91 | rw [h_conj, Units.inv_eq_of_mul_eq_one_left gram_xFin, Y.ratCoordMatrixFin_inclXFin, |
| 92 | Matrix.mul_assoc _ (V.J.map _), h_block, h_restrict, hD] |
| 93 | split <;> simp [conjTranspose_mul, Matrix.mul_assoc, Pi.star_def, apply_ite star] |
| 94 | |
| 95 | /-- Suppose that the frame `V.xFin` of `V` spans the glued lattice, the `Ô`-span of the explicit |
| 96 | basis `gradedLatticeBasis Y.indexEquiv a π u` (`SpansLattice`). Suppose also that `N = π π̄` and |
| 97 | that the idele `π` is a uniformizer at the places of `P`, a set without conjugate pairs, and a unit |
| 98 | elsewhere (`IsSplitSquarefree`). |
| 99 | |
| 100 | If a unitary `h` on `X ⊕ Unit` is integral and its last row (index `Sum.inr ()`) is that of `1` |
| 101 | modulo `π` (`congruenceGL`), then its image `Y.inclXFin h` in `Gf E ι` stabilizes the glued lattice: |
| 102 | in the coordinates of `V.xFin` this is `Ô^ι`, with stabilizer `stdLevel E ι`. -/ |
| 103 | lemma Grading.inclXFin_mem_stdLevel {P : Finset (FinPlace E)} {u : unitary (𝔸f E)} |
| 104 | {h : Gf E (X ⊕ Unit)} (hL : Y.SpansLattice a π u) (hπ : IsSplitSquarefree P N π) |
| 105 | (h_cong : h.val ∈ congruenceGL (Ô E ∙ π.val) Sum.inr) : |
| 106 | Y.inclXFin h ∈ stdLevel E ι := by |
| 107 | obtain ⟨R, R_int, h_eq⟩ := Y.exists_inclXFin_sub_one_eq hL |
| 108 | rw [mem_stdLevel, sub_eq_iff_eq_add.mp (h_eq h)] |
| 109 | suffices M_int : IsIntMatrix (Ô E) (if Odd s then |
| 110 | scaleAt π⁻¹.val (Sum.inr ()) * ((h.val.val - 1) * scaleAt (star π⁻¹.val) (Sum.inr ())) |
| 111 | else h.val.val - 1) from |
| 112 | (R_int.conjTranspose.mul (M_int.mul R_int)).add .one |
| 113 | -- At every place `π` or its conjugate is a unit. |
| 114 | have h_unit (w : FinPlace E) : Valued.v (π.val w) = 1 ∨ Valued.v (π.val (star w)) = 1 := by |
| 115 | by_cases hw : w ∈ P <;> simp [hπ.v_apply, hw, hπ.star_notMem w] |
| 116 | -- For odd `s`, as `h` is unitary, the congruence on its last row absorbs both divisions. |
| 117 | split |
| 118 | · exact isIntMatrix_scaleAt_mul_sub_one_mul_scaleAt π (Sum.inr ()) h_unit h_cong |
| 119 | · exact h_cong.1.isIntMatrix.sub .one |
| 120 | |
| 121 | omit [CMType E] in |
| 122 | /-- An element of the finite adelic unitary group lies in `levelOf w ⊥`, the integral elements whose |
| 123 | reduction modulo every place `w i` is trivial, if and only if it is integral (`stdLevel`) and each |
| 124 | entry of its matrix minus `1` has valuation less than `1` in the completion at each `w i` (taken by |
| 125 | `evalAt`). -/ |
| 126 | lemma mem_levelOf_bot [NumberField E] [NumberField.IsCMField E] {I : Type} {w : I → FinPlace E} |
| 127 | {g : Gf E ι} : |
| 128 | g ∈ levelOf w ⊥ ↔ g ∈ stdLevel E ι ∧ |
| 129 | ∀ (i : I) (b c : ι), Valued.v (evalAt (w i) ((g.val.val - 1) b c)) < 1 := by |
| 130 | simp only [mem_levelOf, ← exists_prop, Subgroup.mem_bot, funext_iff] |
| 131 | exact exists_congr fun hg ↦ forall_congr' fun i ↦ |
| 132 | (stdLevel.map_eq_one ι).trans (forall₂_congr fun b c ↦ reduceAt_eq_zero) |
| 133 | |
| 134 | /-- Suppose that the frame `V.xFin` of `V` spans the glued lattice, the `Ô`-span of the explicit |
| 135 | basis `gradedLatticeBasis Y.indexEquiv a π u` (`SpansLattice`), that `N = π π̄` with `π` a |
| 136 | uniformizer at the places of `P` and a unit elsewhere, `P` being without conjugate pairs |
| 137 | (`IsSplitSquarefree`), and that the places `w i` and their conjugates lie outside `P`. |
| 138 | |
| 139 | If a unitary `h` on `X ⊕ Unit` is integral, its last row (index `Sum.inr ()`) is that of `1` modulo |
| 140 | `π` (`congruenceGL`) and it is congruent to `1` at every `w i`, then so is its image `Y.inclXFin h` |
| 141 | in the coordinates of `V.xFin`: it is integral and congruent to `1` at every `w i`. -/ |
| 142 | lemma Grading.inclXFin_mem_levelOf {P : Finset (FinPlace E)} {u : unitary (𝔸f E)} |
| 143 | {h : Gf E (X ⊕ Unit)} {I : Type} {w : I → FinPlace E} (hL : Y.SpansLattice a π u) |
| 144 | (hπ : IsSplitSquarefree P N π) (h_cong : h.val ∈ congruenceGL (Ô E ∙ π.val) Sum.inr) |
| 145 | (hw : ∀ i : I, w i ∉ P) (hw_star : ∀ i : I, star (w i) ∉ P) (h_level : h ∈ levelOf w ⊥) : |
| 146 | Y.inclXFin h ∈ levelOf w ⊥ := by |
| 147 | obtain ⟨R, R_int, h_eq⟩ := Y.exists_inclXFin_sub_one_eq hL |
| 148 | refine mem_levelOf_bot.mpr ⟨Y.inclXFin_mem_stdLevel hL hπ h_cong, fun i b c ↦ ?_⟩ |
| 149 | obtain ⟨-, h_small⟩ := mem_levelOf_bot.mp h_level |
| 150 | rw [h_eq h] |
| 151 | set M : Matrix (X ⊕ Unit) (X ⊕ Unit) (𝔸f E) := if Odd s then |
| 152 | scaleAt π⁻¹.val (Sum.inr ()) * ((h.val.val - 1) * scaleAt (star π⁻¹.val) (Sum.inr ())) |
| 153 | else h.val.val - 1 with hM |
| 154 | have M_small (x x' : X ⊕ Unit) : Valued.v (evalAt (w i) (M x x')) < 1 := by |
| 155 | rw [hM] |
| 156 | split |
| 157 | · -- An entry is multiplied by some of `π⁻¹` and `star π⁻¹`, which are units at `w i`. |
| 158 | simp only [scaleAt, diagonal_mul, mul_diagonal] |
| 159 | split_ifs <;> |
| 160 | simpa [idele_inv_apply_and_ne_zero, hπ.v_apply, hw, hw_star] using h_small i x x' |
| 161 | · exact h_small i x x' |
| 162 | -- Each entry of `Rᴴ M R` is a sum of products of an entry of `M` with two integral elements. |
| 163 | simp only [Matrix.mul_apply, Finset.mul_sum, map_sum, map_mul] |
| 164 | refine Valued.v.map_sum_lt one_ne_zero fun x _ ↦ Valued.v.map_sum_lt one_ne_zero fun x' _ ↦ ?_ |
| 165 | rw [map_mul, map_mul] |
| 166 | exact (mul_le_of_le_one_left' (mem_Ô.1 (R_int.conjTranspose b x) (w i))).trans_lt |
| 167 | ((mul_le_of_le_one_right' (mem_Ô.1 (R_int x' c) (w i))).trans_lt (M_small x x')) |
| 168 | |
| 169 | end New |