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.Analysis.Matrix.LDL |
| 4 | import TauCeti.Analysis.Matrix.PosDef |
| 5 | import Mathlib.Analysis.Matrix.Order |
| 6 | import Mathlib.Analysis.SpecialFunctions.ContinuousFunctionalCalculus.ExpLog.Basic |
| 7 | import Mathlib.RingTheory.Etale.Weakly |
| 8 | import Mathlib.RingTheory.Finiteness.ModuleFinitePresentation |
| 9 | import Mathlib.RingTheory.TotallySplit |
| 10 | public import Lib.Weil.Construction.WeilData |
| 11 | public import Lib.DiscreteSeries.FlenstedJensen.Defs |
| 12 | public import Lib.General.Analysis.GaussianIntegral |
| 13 | import Lib.DiscreteSeries.Holomorphic.MaximalCompactMinors |
| 14 | |
| 15 | /-! |
| 16 | # Gram–Schmidt, tight frames, polar decomposition in U(p,q), forms representing one |
| 17 | |
| 18 | This file collects four topics of linear algebra. The first is a Gram–Schmidt process |
| 19 | whose change of basis is block triangular for a weight on the columns. The second concerns tight |
| 20 | frames of `ℂ^Φ` made of vectors of the lattice `𝔞₀` attached to a CM field. The third is the polar |
| 21 | decomposition in the unitary group of a diagonal sign form, with properties of accretive matrices. |
| 22 | The last gives a condition under which a Hermitian form takes the value `1` on a subspace. |
| 23 | |
| 24 | ## Main definitions and results |
| 25 | |
| 26 | * `New.exists_orthonormal_mul`: the columns of a real or complex matrix with a left inverse |
| 27 | (`New.HasLeftInv`) become orthonormal after right multiplication by an invertible matrix `b` that |
| 28 | is block triangular for a given weight `wt` on the columns: `b i j = 0` whenever `wt j < wt i`. |
| 29 | * `New.IsTightFrame`: vectors of `𝔞₀`, with multiplicities, that form a tight frame of `ℂ^Φ`. |
| 30 | * `New.exists_polar`: `g = k * z` with `k` unitary and `z` positive definite and an exponential. |
| 31 | * `New.isAccretive_blockDiagPart_inv_mul`: the block diagonal part of `g` is invertible and |
| 32 | `(blockDiagPart ε g)⁻¹ * g` is accretive. |
| 33 | * `New.exists_mem_dotProduct_mulVec_eq_one`: a Hermitian form on `ℂ^m` that is not negative |
| 34 | semidefinite on a subspace takes the value `1` on that subspace. |
| 35 | |
| 36 | Notions from other files: |
| 37 | * `New.signMatrix ε`: the diagonal matrix of the signs `ε`; `New.USign ε` is its unitary group, the |
| 38 | invertible complex matrices `g` with `gᴴ * signMatrix ε * g = signMatrix ε`. |
| 39 | * `New.unitaryLie J`: the Lie algebra of this group for `J = signMatrix ε`: the real vector space |
| 40 | of complex matrices `X` with `Xᴴ * J + J * X = 0`; `New.expU X` is `exp X` in the group. |
| 41 | * `Matrix.IsAccretive z`: the matrix `z + zᴴ` is positive definite. |
| 42 | * `New.WeilData E`: data on a CM field `E`; only its finite idele `α` is used here. |
| 43 | -/ |
| 44 | |
| 45 | @[expose] public section |
| 46 | |
| 47 | /-! ## Gram–Schmidt with a block triangular change of basis -/ |
| 48 | |
| 49 | section GramSchmidt |
| 50 | |
| 51 | open Matrix InnerProductSpace ComplexOrder |
| 52 | |
| 53 | /-- Gram–Schmidt: if a real or complex n × k matrix X has a left inverse and wt is a weight on its |
| 54 | columns with values in a linear order, then there is an invertible matrix b, block upper triangular |
| 55 | for wt, such that the columns of X b are orthonormal. -/ |
| 56 | lemma New.exists_orthonormal_mul {n k α 𝕜 : Type*} [RCLike 𝕜] [Fintype n] [Fintype k] |
| 57 | [DecidableEq k] [LinearOrder α] (wt : k → α) {X : Matrix n k 𝕜} (hX : HasLeftInv X) : |
| 58 | ∃ b : GL k 𝕜, b.val.BlockTriangular wt ∧ (X * b.val)ᴴ * (X * b.val) = 1 := by |
| 59 | -- Refine `wt` to a linear order on `k` and normalise the positive-definite Gram matrix `Xᴴ * X` |
| 60 | -- by an upper-triangular change of basis. |
| 61 | let _ : LinearOrder k := |
| 62 | .lift' (fun i : k ↦ toLex (wt i, embeddingToCardinal i)) (fun _ _ _ ↦ by simp_all) |
| 63 | have hS : (Xᴴ * X).PosDef := PosDef.conjTranspose_mul_self X hX.injective_mulVec |
| 64 | obtain ⟨G, hG_tri, hG_orth⟩ := hS.exists_isUpperTriangular_conjTranspose_mul_mul_eq_one |
| 65 | have h_orth : (X * G)ᴴ * (X * G) = 1 := by |
| 66 | simpa only [conjTranspose_mul, Matrix.mul_assoc] using |
| 67 | (show Gᴴ * (Xᴴ * X) * G = 1 by convert hG_orth) |
| 68 | have h_tri : G.BlockTriangular wt := fun _ _ hij ↦ hG_tri (Prod.Lex.toLex_lt_toLex.2 (.inl hij)) |
| 69 | exact ⟨(Units.mkOfMulEqOne ((X * G)ᴴ * X) G (by rw [Matrix.mul_assoc, h_orth]))⁻¹, h_tri, h_orth⟩ |
| 70 | |
| 71 | end GramSchmidt |
| 72 | |
| 73 | /-! |
| 74 | ## Tight frames in the lattice 𝔞₀ |
| 75 | |
| 76 | For a CM field `E` with CM type `Φ` (`New.CMType`) and the finite idele `α` of `New.WeilData`, |
| 77 | `𝔞₀ = E ∩ α Ô` is a lattice in `ℂ^Φ`; `New.Ô` is the ring of integral finite adeles. |
| 78 | -/ |
| 79 | |
| 80 | namespace New |
| 81 | |
| 82 | variable {E I : Type} [Field E] [CMType E] [WeilData E] (w : I → E) [Fintype I] |
| 83 | |
| 84 | /-- The finite image of a family w of elements of E: the finite adelic vector α⁻¹w, with α the |
| 85 | idele of the Weil data. -/ |
| 86 | noncomputable def finiteImage : (I → E) →ₗ[E] I → 𝔸f E := |
| 87 | ((WeilData.α (E := E))⁻¹.val • Algebra.linearMap E (𝔸f E)).compLeft I |
| 88 | |
| 89 | /-- The w_i lie in the lattice E ∩ αÔ and, taken m_i times, form a tight frame with frame bound M. |
| 90 | That is, ∑ m_i Φσ(w_i)·conj(Φτ(w_i)) = Mδ_{στ} for all infinite places σ, τ of E, with Φ the CM |
| 91 | type. -/ |
| 92 | structure IsTightFrame (m : I → ℕ) (M : ℕ) : Prop where |
| 93 | /-- Each w_i lies in the lattice E ∩ αÔ. -/ |
| 94 | finiteImage_mem : ∀ i : I, finiteImage w i ∈ Ô E |
| 95 | /-- The matrix ∑ m_i Φσ(w_i)·conj(Φτ(w_i)) is M times the identity. -/ |
| 96 | sum_mul_conj : ∀ σ τ : NumberField.InfinitePlace E, |
| 97 | ∑ i : I, m i * (Φ σ (w i) * starRingEnd ℂ (Φ τ (w i))) = if σ = τ then (M : ℂ) else 0 |
| 98 | |
| 99 | /-- Let E be a CM field with CM type Φ and Weil data. If the w_i, taken with multiplicities m_i, are |
| 100 | a tight frame with bound M (they lie in the lattice E ∩ αÔ and ∑ m_i Φσ(w_i)·conj(Φτ(w_i)) = Mδ_στ), |
| 101 | then so is the family with each w_i repeated m_i times, all with multiplicity one. -/ |
| 102 | lemma IsTightFrame.repeat_vectors {m : I → ℕ} {M : ℕ} (hw : IsTightFrame w m M) : |
| 103 | IsTightFrame (fun x : Σ i : I, Fin (m i) ↦ w x.1) 1 M := |
| 104 | ⟨fun x ↦ hw.finiteImage_mem x.1, fun σ τ ↦ by simpa [Fintype.sum_sigma] using hw.sum_mul_conj σ τ⟩ |
| 105 | |
| 106 | end New |
| 107 | |
| 108 | /-! ## Polar decomposition in U(p,q) and accretive matrices -/ |
| 109 | |
| 110 | section PolarDecomposition |
| 111 | |
| 112 | open New Matrix Norms.L2Operator ComplexOrder MatrixOrder CFC IsHermitianInvolution U |
| 113 | |
| 114 | variable {n : Type _} [Fintype n] [DecidableEq n] |
| 115 | |
| 116 | /-- Polar decomposition in `USign ε = U(diag ε)`, the unitary group of the diagonal form with signs |
| 117 | ε: every g is kz with k in `maxCompactU ε`, the subgroup of unitary matrices, and z positive |
| 118 | definite and in the range of `expU`, the exponential map on the Lie algebra of the group. -/ |
| 119 | theorem New.exists_polar {ε : n → ℤˣ} (g : USign ε) : |
| 120 | ∃ (k : maxCompactU ε) (z : USign ε), z.val.val.PosDef ∧ g = k * z ∧ z ∈ Set.range expU := by |
| 121 | -- Put `P = gᴴ g`, `L = log P`, `J = signMatrix ε`. The map `X ↦ -J⁻¹ Xᴴ J` fixes `L`, as |
| 122 | -- `x ↦ (J⁻¹ xᴴ J)⁻¹` fixes `P`; so `L` is in the Lie algebra. Take `z = exp (L / 2)` and |
| 123 | -- `k = g z⁻¹`. |
| 124 | let P : Matrix n n ℂ := g.val.valᴴ * g.val.val |
| 125 | let L : Matrix n n ℂ := log P |
| 126 | have exp_L : NormedSpace.exp L = P := exp_log P ⟨star_mul_self_nonneg _, by simp [P]⟩ |
| 127 | have L_herm : Lᴴ = L := IsSelfAdjoint.log |
| 128 | have J_inv : (signMatrix ε)⁻¹ = signMatrix ε := inv_eq_left_inv IsHermitianInvolution.mul_self |
| 129 | -- `g⁻¹ = J gᴴ J` and `J² = 1` give `(J⁻¹ P J)⁻¹ = P`. |
| 130 | have P_fixed : ((signMatrix ε)⁻¹ * Pᴴ * signMatrix ε)⁻¹ = P := by |
| 131 | simp [P, J_inv, ← conjTranspose_nonsing_inv, isHermitian.eq, Matrix.mul_inv_rev, |
| 132 | inv_coe_eq_mul_conjTranspose_mul, |
| 133 | ← mul_assoc (signMatrix ε) (signMatrix ε), IsHermitianInvolution.mul_self, mul_assoc] |
| 134 | have L_fixed : -((signMatrix ε)⁻¹ * Lᴴ * signMatrix ε) = L := by |
| 135 | -- The left side is hermitian, hence the logarithm of its exponential. |
| 136 | have h_selfAdjoint : IsSelfAdjoint (-((signMatrix ε)⁻¹ * Lᴴ * signMatrix ε)) := by |
| 137 | simp [J_inv, star, IsSelfAdjoint, isHermitian.eq, L_herm, mul_assoc] |
| 138 | rw [← log_exp _ h_selfAdjoint, exp_neg, exp_conj' _ _ isUnit, exp_conjTranspose, exp_L, P_fixed] |
| 139 | have L_mem : Lᴴ * signMatrix ε + signMatrix ε * L = 0 := by |
| 140 | nth_rw 2 [← L_fixed] |
| 141 | simp [IsHermitianInvolution.det_ne_zero, mul_assoc] |
| 142 | let z : USign ε := expU ((⅟2 : ℝ) • (⟨L, L_mem⟩ : unitaryLie (signMatrix ε))) |
| 143 | have z_pos : z.val.val.PosDef := |
| 144 | (z.val.isStrictlyPositive_of_le (show 0 ≤ z.val.val by cfc_tac)).posDef |
| 145 | -- `invOf_eq_inv` is excluded so that `⅟2 • L + ⅟2 • L` simplifies to `L`. |
| 146 | have z_sq : z.val.val * z.val.val = P := by |
| 147 | simp [z, ← exp_add_of_commute, -invOf_eq_inv, exp_L] |
| 148 | -- `z² = gᴴ g` and `z` is hermitian, so `g z⁻¹` is unitary. |
| 149 | have g_adj : g.val.valᴴ = z * z * g⁻¹ := by simp [z_sq, P] |
| 150 | have k_mem : g * z⁻¹ ∈ maxCompactU ε := |
| 151 | mem_unitaryGroupOf_iff.2 (by simp [star_eq_conjTranspose, z_pos.inv.isHermitian.eq, g_adj, |
| 152 | mul_assoc]) |
| 153 | exact ⟨⟨g * z⁻¹, k_mem⟩, z, z_pos, by simp, Set.mem_range_self _⟩ |
| 154 | |
| 155 | /-- The accretive matrices, those with `z + zᴴ` positive definite, form a neighbourhood of each |
| 156 | accretive matrix `z`. -/ |
| 157 | theorem Matrix.IsAccretive.setOf_mem_nhds {n : Type*} [Finite n] |
| 158 | {z : Matrix n n ℂ} (hz : z.IsAccretive) : |
| 159 | {y : Matrix n n ℂ | y.IsAccretive} ∈ nhds z := by |
| 160 | let hermitianSum (y : Matrix n n ℂ) : selfAdjoint (Matrix n n ℂ) := |
| 161 | ⟨y + star y, IsSelfAdjoint.add_star_self y⟩ |
| 162 | have hcont : Continuous hermitianSum := |
| 163 | (continuous_id.add continuous_star).subtype_mk _ |
| 164 | exact (Matrix.isOpen_setOfPred_posDef_selfAdjoint.preimage hcont).mem_nhds hz |
| 165 | |
| 166 | /-- If `z` is accretive (`z + zᴴ` positive definite) and `w` assigns integer weights to the indices, |
| 167 | then `weightMinors w z` is non-zero. Here `weightMinors w z` is the product over `t : ℤ` of the |
| 168 | principal minor of `z` on `{i | t ≤ w i}`, each factor with `t ≤ 0` divided by `det z`. -/ |
| 169 | @[simp] |
| 170 | theorem Matrix.IsAccretive.weightMinors_ne_zero {z : Matrix n n ℂ} (hz : z.IsAccretive) |
| 171 | (w : n → ℤ) : weightMinors w z ≠ 0 := by |
| 172 | have h_minor (t : ℤ) : principalMinor z (fun i ↦ t ≤ w i) ≠ 0 := |
| 173 | det_ne_zero (hz.submatrix (by simp)) |
| 174 | have h_denom (t : ℤ) : (if t ≤ 0 then z.det else 1) ≠ 0 := by grind [det_ne_zero] |
| 175 | exact finprod_ne_zero fun t ↦ div_ne_zero (h_minor t) (h_denom t) |
| 176 | |
| 177 | /-- If `z` is accretive (`z + zᴴ` positive definite) and `k` has non-zero determinant, then |
| 178 | `kᴴ * z * k` is accretive. -/ |
| 179 | @[simp] |
| 180 | lemma Matrix.IsAccretive.conjTranspose_mul_mul {z k : Matrix n n ℂ} (hz : z.IsAccretive) |
| 181 | (hk : k.det ≠ 0) : (kᴴ * z * k).IsAccretive := by |
| 182 | simpa [IsAccretive, mul_assoc, mul_add, add_mul] using |
| 183 | PosDef.conjTranspose_mul_mul_same hz (mulVec_injective_of_det_ne_zero hk) |
| 184 | |
| 185 | /-- If `k⁻¹ * z` is accretive (its sum with its conjugate transpose is positive definite), then `z` |
| 186 | has non-zero determinant and `z⁻¹ * k` is accretive. -/ |
| 187 | theorem Matrix.IsAccretive.det_ne_zero_and_inv_mul {z k : Matrix n n ℂ} |
| 188 | (h_accr : (k⁻¹ * z).IsAccretive) : z.det ≠ 0 ∧ (z⁻¹ * k).IsAccretive := by |
| 189 | obtain ⟨hk_det, hz_det⟩ : k.det ≠ 0 ∧ z.det ≠ 0 := by simpa using h_accr.det_ne_zero |
| 190 | -- With `y = z⁻¹ * k` the inverse of `k⁻¹ * z`, the accretive `yᴴ * (k⁻¹ * z) * y` equals `yᴴ`, |
| 191 | -- and `yᴴ` has the same hermitian part as `y`. |
| 192 | have h_adj : (z⁻¹ * k)ᴴ.IsAccretive := by |
| 193 | simpa [hk_det, hz_det, mul_assoc] using |
| 194 | h_accr.conjTranspose_mul_mul (k := z⁻¹ * k) (by simp [hk_det, hz_det]) |
| 195 | exact ⟨hz_det, by simpa [IsAccretive, add_comm] using h_adj⟩ |
| 196 | |
| 197 | /-- For g in `USign ε`, the unitary group of the diagonal form with signs ε, the block diagonal |
| 198 | part B of g (the entries g_ij with ε_i = ε_j) is invertible and B⁻¹ g is accretive: the sum of |
| 199 | B⁻¹ g and its conjugate transpose is positive definite. -/ |
| 200 | @[simp] |
| 201 | theorem New.isAccretive_blockDiagPart_inv_mul {ε : n → ℤˣ} (g : USign ε) : |
| 202 | (blockDiagPart ε g).det ≠ 0 ∧ ((blockDiagPart ε g)⁻¹ * g).IsAccretive := by |
| 203 | -- With `J = signMatrix ε` the block diagonal part is `(g + J g J) / 2` and `J g J = g⁻¹ᴴ`, so |
| 204 | -- `g⁻¹ * blockDiagPart ε g = (1 + g⁻¹ g⁻¹ᴴ) / 2` is positive definite; now invert it. |
| 205 | have h_pos : ((1 / 2 : ℂ) • (1 + g.val.val⁻¹ * g.val.val⁻¹ᴴ)).PosDef := |
| 206 | (PosDef.one.add_posSemidef (posSemidef_self_mul_conjTranspose _)).smul one_half_pos |
| 207 | have h_conj : signMatrix ε * g.val.val * signMatrix ε = g.val.val⁻¹ᴴ := by |
| 208 | simp [inv_coe_eq_mul_conjTranspose_mul, isHermitian.eq, mul_assoc] |
| 209 | exact IsAccretive.det_ne_zero_and_inv_mul |
| 210 | (PosDef.isAccretive (by simpa [blockDiagPart_eq, h_conj, mul_add] using h_pos)) |
| 211 | |
| 212 | end PolarDecomposition |
| 213 | |
| 214 | /-! ## Hermitian forms that represent one -/ |
| 215 | |
| 216 | section HermitianRepresentsOne |
| 217 | |
| 218 | open Matrix ComplexOrder |
| 219 | |
| 220 | /-- If the form `v ↦ star v ⬝ᵥ β *ᵥ v` of a Hermitian matrix `β` is not negative semidefinite on a |
| 221 | subspace `S`, then it takes the value `1` on `S`. -/ |
| 222 | lemma New.exists_mem_dotProduct_mulVec_eq_one {m : Type*} [Fintype m] {β : Matrix m m ℂ} |
| 223 | (hβ : β.IsHermitian) (S : Submodule ℂ (m → ℂ)) (hS : ¬∀ v ∈ S, star v ⬝ᵥ β *ᵥ v ≤ 0) : |
| 224 | ∃ v ∈ S, star v ⬝ᵥ β *ᵥ v = 1 := by |
| 225 | -- Some `v` has a real, positive value `c`; rescale it by `(√c)⁻¹`. |
| 226 | obtain ⟨v, hv, h_not_le⟩ := not_forall₂.1 hS |
| 227 | have h_real : (star v ⬝ᵥ β *ᵥ v).im = 0 := hβ.im_star_dotProduct_mulVec_self v |
| 228 | have h_pos : 0 < (star v ⬝ᵥ β *ᵥ v).re := by simpa [Complex.le_def, h_real] using h_not_le |
| 229 | set c : ℝ := (star v ⬝ᵥ β *ᵥ v).re with hc |
| 230 | have h_scale : (√c)⁻¹ * ((√c)⁻¹ * c) = 1 := by simp [field, Real.sq_sqrt h_pos.le] |
| 231 | exact ⟨((√c)⁻¹ : ℂ) • v, S.smul_mem _ hv, by |
| 232 | simp [Complex.ext_iff, h_real, mulVec_smul, ← hc, h_scale]⟩ |
| 233 | |
| 234 | end HermitianRepresentsOne |