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 Mathlib.Algebra.AffineMonoid.UniqueSums |
| 4 | import Mathlib.RingTheory.PiTensorProduct |
| 5 | import TauCeti.LinearAlgebra.Matrix.Polynomial |
| 6 | public import Lib.Adelic.Reduction.FirstMinimumShortBases |
| 7 | import TauCeti.LinearAlgebra.Matrix.Charpoly.Inverse |
| 8 | import Lib.General.LinearAlgebra.MatrixPolynomials |
| 9 | |
| 10 | /-! |
| 11 | # The stabiliser of an isotropic subspace |
| 12 | |
| 13 | Let `J` be a nondegenerate hermitian form and `A` an isotropic subspace, spanned by the columns of |
| 14 | a matrix `X`. An isometry that keeps `A ≠ 0` has a reducible characteristic polynomial. If an |
| 15 | isometry keeps `A`, its characteristic polynomial does not change under left multiplication by the |
| 16 | unipotent radical of the stabiliser of `A`. |
| 17 | |
| 18 | Notions from other files: |
| 19 | * `U J` is the unitary group of `J`: the invertible matrices `g` with `gᴴ * J * g = J`. |
| 20 | * `dilationGroup X` consists of the pairs `(g, c)` of an isometry and a unit such that |
| 21 | `g * X = c • X` and `g` is the identity on `A^⊥` modulo its radical. Its members with `c = 1` |
| 22 | form the unipotent radical. |
| 23 | -/ |
| 24 | |
| 25 | @[expose] public section |
| 26 | |
| 27 | open Matrix Polynomial |
| 28 | |
| 29 | namespace New |
| 30 | |
| 31 | variable {E n : Type} [Field E] [Fintype n] [DecidableEq n] |
| 32 | |
| 33 | /-- If `γ * A = A * r` and `s * A = 0`, then `γ + A * s` has the characteristic polynomial of |
| 34 | `γ`. In words: `γ` keeps the span of the columns of `A`, and the added matrix has values in this |
| 35 | span and maps it to `0`. -/ |
| 36 | lemma charpoly_add_mul_of_mul_eq_zero {γ A r s : Matrix n n E} (h_keeps : γ * A = A * r) |
| 37 | (h_zero : s * A = 0) : (γ + A * s).charpoly = γ.charpoly := by |
| 38 | -- The two products of the same two block matrices are block triangular, with the diagonal |
| 39 | -- blocks `r`, `γ + A * s` and `r`, `γ`. |
| 40 | have h_left : fromBlocks 1 0 A 1 * fromBlocks r s (-(A * r)) γ |
| 41 | = fromBlocks r s 0 (γ + A * s) := by simp [fromBlocks_multiply, add_comm] |
| 42 | have h_right : fromBlocks r s (-(A * r)) γ * fromBlocks 1 0 A 1 = fromBlocks r s 0 γ := by |
| 43 | simp [fromBlocks_multiply, h_keeps, h_zero] |
| 44 | have h_eq : r.charpoly * (γ + A * s).charpoly = r.charpoly * γ.charpoly := by |
| 45 | rw [← charpoly_fromBlocks_zero₂₁ r s, ← charpoly_fromBlocks_zero₂₁ r s, ← h_left, ← h_right, |
| 46 | charpoly_mul_comm] |
| 47 | exact mul_left_cancel₀ r.charpoly_monic.ne_zero h_eq |
| 48 | |
| 49 | /-- An invertible matrix `γ` with `γ * X = X * r`, where `X ≠ 0` and `r` is singular, has a |
| 50 | reducible characteristic polynomial. -/ |
| 51 | lemma not_irreducible_charpoly_of_mul_eq_mul {γ X r : Matrix n n E} (hγ : γ.det ≠ 0) (hX : X ≠ 0) |
| 52 | (h_keeps : γ * X = X * r) (hr : r.det = 0) : ¬Irreducible γ.charpoly := by |
| 53 | intro h_irred |
| 54 | -- The polynomial of `r`, taken at `γ`, kills `X`. So it has a common factor with the |
| 55 | -- polynomial of `γ`, hence equals it, and then `γ` is singular. |
| 56 | have h_kills : aeval γ r.charpoly * X = 0 := by |
| 57 | rw [← aeval_semiconj h_keeps.symm, aeval_self_charpoly, mul_zero] |
| 58 | have h_dvd : γ.charpoly ∣ r.charpoly := by |
| 59 | by_contra h_not_dvd |
| 60 | have h_unit : IsUnit (aeval γ r.charpoly) := |
| 61 | isUnit_aeval_iff_isCoprime.2 (h_irred.coprime_iff_not_dvd.2 h_not_dvd) |
| 62 | exact hX (h_unit.mul_right_eq_zero.1 h_kills) |
| 63 | have h_eq : r.charpoly = γ.charpoly := |
| 64 | eq_of_monic_of_dvd_of_natDegree_le γ.charpoly_monic r.charpoly_monic h_dvd (by simp) |
| 65 | exact hγ (by rw [det_eq_sign_charpoly_coeff, ← h_eq, ← det_eq_sign_charpoly_coeff, hr]) |
| 66 | |
| 67 | variable [StarRing E] |
| 68 | |
| 69 | /-- The stabiliser in the unitary group `U J` of the span of the columns of `X`: the isometries |
| 70 | `γ` of `J` with `γ * X = X * r` for some matrix `r`. -/ |
| 71 | def spanStabilizer (J X : Matrix n n E) : Subgroup (U J) where |
| 72 | carrier := {γ : U J | ∃ r : Matrix n n E, γ * X = X * r} |
| 73 | one_mem' := ⟨1, by simp⟩ |
| 74 | mul_mem' := by |
| 75 | rintro γ δ ⟨r, hr⟩ ⟨t, ht⟩ |
| 76 | exact ⟨r * t, by |
| 77 | rw [Subgroup.coe_mul, Units.val_mul, mul_assoc, ht, ← mul_assoc, hr, mul_assoc]⟩ |
| 78 | inv_mem' {γ} hγ := by |
| 79 | obtain ⟨r, hr⟩ := hγ |
| 80 | -- The inverse of γ is a polynomial in γ, and the same polynomial in r acts on the columns. |
| 81 | obtain ⟨p, hp⟩ : (γ : Matrix n n E)⁻¹ ∈ (aeval (R := E) (γ : Matrix n n E)).range := |
| 82 | nonsing_inv_mem ⟨Polynomial.X, aeval_X _⟩ |
| 83 | refine ⟨aeval r p, ?_⟩ |
| 84 | rw [Subgroup.coe_inv, ← Matrix.inv_eq_left_inv γ.val.inv_mul, ← hp] |
| 85 | exact Matrix.aeval_mul_eq_mul_aeval hr p |
| 86 | |
| 87 | variable {J X Y : Matrix n n E} |
| 88 | |
| 89 | /-- An isometry `γ : U J` lies in `spanStabilizer J X` if and only if |
| 90 | `γ * X = X * r` for some matrix `r`. -/ |
| 91 | lemma mem_spanStabilizer {γ : U J} : |
| 92 | γ ∈ spanStabilizer J X ↔ ∃ r : Matrix n n E, γ * X = X * r := .rfl |
| 93 | |
| 94 | /-- If `(ν, 1)` lies in the dilation group of `X`, whose members `(g, c)` satisfy `g * X = c • X`, |
| 95 | then `ν` fixes the columns of `X`. -/ |
| 96 | lemma mul_eq_self_of_mem_dilationGroup {ν : U J} (hν : (ν, 1) ∈ dilationGroup X) : |
| 97 | ν * X = X := by |
| 98 | obtain ⟨h_dilates, -⟩ := hν |
| 99 | simpa using h_dilates |
| 100 | |
| 101 | /-- If `(ν, 1)` lies in the dilation group of `X`, whose members act as the identity on the |
| 102 | orthogonal of `X` modulo its radical, then `wᴴ J (ν v) = wᴴ J v` for all `v` and `w` orthogonal to |
| 103 | the columns of `X`. -/ |
| 104 | lemma gram_mul_eq_of_mem_dilationGroup {ν : U J} (hν : (ν, 1) ∈ dilationGroup X) |
| 105 | {v w : Matrix n n E} (hv : Xᴴ * (J * v) = 0) (hw : Xᴴ * (J * w) = 0) : |
| 106 | wᴴ * (J * (ν * v)) = wᴴ * (J * v) := by |
| 107 | obtain ⟨-, h_gram⟩ := hν |
| 108 | exact h_gram v w hv hw |
| 109 | |
| 110 | /-- An isometry `ν` with `(ν, 1)` in the dilation group of `X` fixes the columns of `X`, so it lies |
| 111 | in the stabiliser of their span. -/ |
| 112 | lemma mem_spanStabilizer_of_mem_dilationGroup {ν : U J} (hν : (ν, 1) ∈ dilationGroup X) : |
| 113 | ν ∈ spanStabilizer J X := |
| 114 | mem_spanStabilizer.2 ⟨1, by rw [mul_eq_self_of_mem_dilationGroup hν, mul_one]⟩ |
| 115 | |
| 116 | /-- For a nondegenerate hermitian form `J`, the columns of `X` span an isotropic subspace `A` and |
| 117 | the columns of `Y` span its orthogonal `A^⊥`. -/ |
| 118 | structure IsIsotropicFrame (J X Y : Matrix n n E) : Prop where |
| 119 | /-- The form is hermitian. -/ |
| 120 | isHermitian : J.IsHermitian |
| 121 | /-- The form is nondegenerate. -/ |
| 122 | isUnit : IsUnit J |
| 123 | /-- The subspace `A` is isotropic. -/ |
| 124 | isotropic : Xᴴ * (J * X) = 0 |
| 125 | /-- The columns of `Y` lie in `A^⊥`. -/ |
| 126 | orthogonal : Xᴴ * (J * Y) = 0 |
| 127 | /-- There are matrices `e` and `b` with `Y * e + b * (Xᴴ * J) = 1`. So every `v` in `A^⊥` is |
| 128 | `Y * (e * v)`, that is, the columns of `Y` span `A^⊥`. -/ |
| 129 | spans : ∃ e b : Matrix n n E, Y * e + b * (Xᴴ * J) = 1 |
| 130 | |
| 131 | namespace IsIsotropicFrame |
| 132 | |
| 133 | /-- In an isotropic frame `(J, X, Y)`, every vector orthogonal to the columns of `X` is a |
| 134 | combination of those of `Y`, with coefficients given by one matrix `e`: `Xᴴ J v = 0` implies |
| 135 | `Y * (e * v) = v`. -/ |
| 136 | lemma exists_mul_mul_eq_of_orthogonal_left (h : IsIsotropicFrame J X Y) : |
| 137 | ∃ e : Matrix n n E, ∀ v : Matrix n n E, Xᴴ * (J * v) = 0 → Y * (e * v) = v := by |
| 138 | obtain ⟨e, b, h_one⟩ := h.spans |
| 139 | refine ⟨e, fun v hv ↦ ?_⟩ |
| 140 | calc Y * (e * v) = (Y * e + b * (Xᴴ * J)) * v := by simp [add_mul, mul_assoc, hv] |
| 141 | _ = v := by rw [h_one, one_mul] |
| 142 | |
| 143 | /-- In an isotropic frame `(J, X, Y)`, every vector orthogonal to the columns of `Y` is a |
| 144 | combination of those of `X`, with coefficients given by one matrix `c`: `Yᴴ J v = 0` implies |
| 145 | `X * (c * v) = v`. -/ |
| 146 | lemma exists_mul_mul_eq_of_orthogonal_right (h : IsIsotropicFrame J X Y) : |
| 147 | ∃ c : Matrix n n E, ∀ v : Matrix n n E, Yᴴ * (J * v) = 0 → X * (c * v) = v := by |
| 148 | obtain ⟨e, b, h_one⟩ := h.spans |
| 149 | have h_adjoint : eᴴ * Yᴴ + J * X * bᴴ = 1 := by |
| 150 | simpa [h.isHermitian.eq] using congrArg conjTranspose h_one |
| 151 | refine ⟨bᴴ * J, fun v hv ↦ h.isUnit.mul_left_cancel ?_⟩ |
| 152 | calc J * (X * (bᴴ * J * v)) = (eᴴ * Yᴴ + J * X * bᴴ) * (J * v) := by |
| 153 | simp [add_mul, mul_assoc, hv] |
| 154 | _ = J * v := by rw [h_adjoint, one_mul] |
| 155 | |
| 156 | /-- In an isotropic frame `(J, X, Y)`, where `X` spans `A` and `Y` spans `A^⊥`, an isometry `γ` |
| 157 | keeps `A` exactly if it maps `A` into the orthogonal of `A^⊥`, because `A = (A^⊥)^⊥`. -/ |
| 158 | lemma mem_spanStabilizer_iff (h : IsIsotropicFrame J X Y) {γ : U J} : |
| 159 | γ ∈ spanStabilizer J X ↔ Yᴴ * (J * (γ * X)) = 0 := by |
| 160 | refine mem_spanStabilizer.trans ⟨?_, ?_⟩ |
| 161 | · rintro ⟨r, hr⟩ |
| 162 | rw [hr, ← mul_assoc J, ← mul_assoc, gram_eq_zero_symm h.isHermitian h.orthogonal, zero_mul] |
| 163 | · obtain ⟨c, hc⟩ := h.exists_mul_mul_eq_of_orthogonal_right |
| 164 | exact fun h_orth ↦ ⟨c * (γ * X), (hc _ h_orth).symm⟩ |
| 165 | |
| 166 | /-- In an isotropic frame `(J, X, Y)`, where `X` spans `A` and `Y` spans `A^⊥`, an isometry `γ` |
| 167 | that keeps `A` also keeps `A^⊥`: it maps the columns of `Y` into the orthogonal of `A`. -/ |
| 168 | lemma orthogonal_mul (h : IsIsotropicFrame J X Y) {γ : U J} (hγ : γ ∈ spanStabilizer J X) : |
| 169 | Xᴴ * (J * (γ * Y)) = 0 := by |
| 170 | -- Apply the isometry `γ⁻¹`, which keeps the span, to both arguments of the form. |
| 171 | let β : U J := γ⁻¹ |
| 172 | obtain ⟨r, hr⟩ : ∃ r : Matrix n n E, β * X = X * r := mem_spanStabilizer.1 (inv_mem hγ) |
| 173 | calc Xᴴ * (J * (γ * Y)) = ((β : Matrix n n E) * X)ᴴ * J * (β * (γ * Y)) := by |
| 174 | rw [U.gram_invariant, mul_assoc] |
| 175 | _ = rᴴ * (Xᴴ * (J * Y)) := by rw [hr]; simp [β, mul_assoc] |
| 176 | _ = 0 := by rw [h.orthogonal, mul_zero] |
| 177 | |
| 178 | /-- In an isotropic frame `(J, X, Y)`, the matrix `X ≠ 0` is singular, since its columns span an |
| 179 | isotropic subspace for the nondegenerate form `J`. -/ |
| 180 | lemma det_eq_zero (h : IsIsotropicFrame J X Y) (hX : X ≠ 0) : X.det = 0 := by |
| 181 | by_contra h_ne |
| 182 | have h_unit : IsUnit Xᴴ := ((isUnit_iff_isUnit_det X).2 (Ne.isUnit h_ne)).star |
| 183 | have h_zero : J * X = 0 := h_unit.mul_right_eq_zero.1 h.isotropic |
| 184 | exact hX (h.isUnit.mul_right_eq_zero.1 h_zero) |
| 185 | |
| 186 | /-- In an isotropic frame `(J, X, Y)` with `X ≠ 0`, an isometry that keeps the isotropic subspace |
| 187 | spanned by the columns of `X` has a reducible characteristic polynomial. -/ |
| 188 | lemma not_irreducible_charpoly (h : IsIsotropicFrame J X Y) (hX : X ≠ 0) {γ : U J} |
| 189 | (hγ : γ ∈ spanStabilizer J X) : ¬Irreducible (γ : Matrix n n E).charpoly := by |
| 190 | obtain ⟨c, hc⟩ := h.exists_mul_mul_eq_of_orthogonal_right |
| 191 | have h_keeps : γ * X = X * (c * (γ * X)) := (hc _ (h.mem_spanStabilizer_iff.1 hγ)).symm |
| 192 | have h_singular : (c * (γ * X)).det = 0 := by simp [h.det_eq_zero hX] |
| 193 | exact not_irreducible_charpoly_of_mul_eq_mul (GeneralLinearGroup.det_ne_zero (γ : GL n E)) |
| 194 | hX h_keeps h_singular |
| 195 | |
| 196 | /-- In an isotropic frame `(J, X, Y)` (a nondegenerate hermitian `J`, the columns of `X` spanning |
| 197 | an isotropic subspace `A` and those of `Y` its orthogonal `A^⊥`), let the isometry `γ` keep `A` |
| 198 | and let the isometry `ν` lie in the unipotent radical of the stabiliser of `A`, that is, `(ν, 1)` |
| 199 | is in the dilation group of `X`: `ν` fixes `A` and is the identity on `A^⊥` modulo `A`. Then |
| 200 | `ν * γ` has the characteristic polynomial of `γ`. -/ |
| 201 | lemma charpoly_radical_mul (h : IsIsotropicFrame J X Y) {ν γ : U J} |
| 202 | (hν : (ν, 1) ∈ dilationGroup X) (hγ : γ ∈ spanStabilizer J X) : |
| 203 | ((ν * γ : U J) : Matrix n n E).charpoly = (γ : Matrix n n E).charpoly := by |
| 204 | -- The matrix `N = ν - 1` maps the space into `A^⊥`, `A^⊥` into `A` and `A` to `0`. With the |
| 205 | -- projection `Y * e` on `A^⊥` and `P = 1 - Y * e`, add `N γ` to `γ` in two steps: first `N γ P`, |
| 206 | -- which maps into `A^⊥` and kills `A^⊥`, then `N γ Y e`, which maps into `A` and kills `A`. |
| 207 | obtain ⟨e, he⟩ := h.exists_mul_mul_eq_of_orthogonal_left |
| 208 | obtain ⟨c, hc⟩ := h.exists_mul_mul_eq_of_orthogonal_right |
| 209 | obtain ⟨r, hr⟩ : ∃ r : Matrix n n E, γ * X = X * r := mem_spanStabilizer.1 hγ |
| 210 | set N : Matrix n n E := ν - 1 with hN |
| 211 | have h_fix : ν * X = X := mul_eq_self_of_mem_dilationGroup hν |
| 212 | have h_kills : N * (γ * X) = 0 := by simp [hN, hr, sub_mul, ← mul_assoc, h_fix] |
| 213 | have h_gram : Xᴴ * J * ν = Xᴴ * J := by |
| 214 | simpa only [h_fix, mul_one] using U.gram_invariant ν X (1 : Matrix n n E) |
| 215 | have h_into_perp : Xᴴ * (J * N) = 0 := by simp [hN, ← mul_assoc, mul_sub, h_gram] |
| 216 | have h_perp_into : Yᴴ * (J * (N * (γ * Y))) = 0 := by |
| 217 | rw [hN, sub_mul, one_mul, mul_sub, mul_sub, |
| 218 | gram_mul_eq_of_mem_dilationGroup hν (h.orthogonal_mul hγ) h.orthogonal, sub_self] |
| 219 | set P : Matrix n n E := 1 - Y * e with hP |
| 220 | have hP_perp {v : Matrix n n E} (hv : Xᴴ * (J * v) = 0) : P * v = 0 := by |
| 221 | rw [hP, sub_mul, one_mul, mul_assoc, he v hv, sub_self] |
| 222 | -- The first step, from `γ` to `δ`. |
| 223 | set δ : Matrix n n E := γ + Y * (e * (N * (γ * P))) with hδ |
| 224 | have h_first : δ.charpoly = (γ : Matrix n n E).charpoly := by |
| 225 | have h_keeps : γ * Y = Y * (e * (γ * Y)) := (he _ (h.orthogonal_mul hγ)).symm |
| 226 | have h_zero : e * (N * (γ * P)) * Y = 0 := by simp [mul_assoc, hP_perp h.orthogonal] |
| 227 | exact charpoly_add_mul_of_mul_eq_zero h_keeps h_zero |
| 228 | -- The second step, from `δ` to `ν * γ`. |
| 229 | have h_second : (δ + X * (c * (N * (γ * Y)) * e)).charpoly = δ.charpoly := by |
| 230 | have h_keeps : δ * X = X * r := by simp [hδ, add_mul, mul_assoc, hP_perp h.isotropic, hr] |
| 231 | have h_zero : c * (N * (γ * Y)) * e * X = 0 := by |
| 232 | simp only [mul_assoc, he X h.isotropic, h_kills, mul_zero] |
| 233 | exact charpoly_add_mul_of_mul_eq_zero h_keeps h_zero |
| 234 | have h_sum : δ + X * (c * (N * (γ * Y)) * e) = (ν : Matrix n n E) * γ := by |
| 235 | have h_perp : Xᴴ * (J * (N * (γ * P))) = 0 := by |
| 236 | rw [← mul_assoc J, ← mul_assoc, h_into_perp, zero_mul] |
| 237 | have h_part : X * (c * (N * (γ * Y)) * e) = N * (γ * Y) * e := by |
| 238 | rw [← mul_assoc X, hc _ h_perp_into] |
| 239 | rw [hδ, he _ h_perp, h_part, hN, hP] |
| 240 | noncomm_ring |
| 241 | rw [← h_first, ← h_second, h_sum, Subgroup.coe_mul, Units.val_mul] |
| 242 | |
| 243 | end IsIsotropicFrame |
| 244 | |
| 245 | end New |