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 Mathlib.Analysis.CStarAlgebra.Module.Constructions |
| 4 | public import Mathlib.Analysis.InnerProductSpace.NormDet |
| 5 | public import Aesop.BuiltinRules |
| 6 | import Mathlib.RingTheory.Coalgebra.IsFrobenius |
| 7 | import Mathlib.RingTheory.HopfAlgebra.Basic |
| 8 | import Mathlib.RingTheory.RegularLocalRing.Defs |
| 9 | import Mathlib.RingTheory.SimpleRing.Principal |
| 10 | public import Lib.Speed |
| 11 | import Lib.General.LinearAlgebra.MinorProducts |
| 12 | import TauCeti.LinearAlgebra.Matrix.AbsoluteValue |
| 13 | |
| 14 | /-! |
| 15 | # Gram determinants |
| 16 | |
| 17 | * `New.exists_extend_basis_of_span_eq_top`: an independent family is completed to a basis by members |
| 18 | of a spanning set. |
| 19 | * `New.det_gram_comp`: `det ⟨u x_i, u x_k⟩ = (normDet u)² det ⟨x_i, x_k⟩` for a family `x` of as |
| 20 | many vectors as the dimension of the source of `u`; here `(normDet u)² = det (u* u)`. |
| 21 | * `New.norm_det_mul_det_gram_mul_det_le_one`: a bound on a Gram determinant times `conj (det u')` |
| 22 | and `det u` in a nonarchimedean field when the inner products of the families transformed by `u'` |
| 23 | and `u` have norm at most `1`. |
| 24 | * `New.formGram`, `New.norm_det_formGram_le`: Gram matrices for a form given by a matrix and |
| 25 | Hadamard's inequality for a positive semidefinite form. |
| 26 | |
| 27 | Notions from other files: |
| 28 | |
| 29 | * `Matrix.gram ℂ x`: the matrix of the inner products `⟨x_i, x_k⟩`. |
| 30 | -/ |
| 31 | |
| 32 | @[expose] public section |
| 33 | |
| 34 | open Module Submodule Real LinearMap Matrix Fintype NormedField InnerProductSpace |
| 35 | |
| 36 | open scoped ComplexOrder |
| 37 | |
| 38 | namespace New |
| 39 | |
| 40 | section Basis |
| 41 | |
| 42 | variable {F V : Type*} [Field F] [AddCommGroup V] [Module F V] [Module.Finite F V] |
| 43 | |
| 44 | /-- A linearly independent family `y` in a finite-dimensional space is completed to a basis by |
| 45 | finitely many members `z` of a given spanning set `S`. -/ |
| 46 | lemma exists_extend_basis_of_span_eq_top {n : ℕ} {S : Set V} {y : Fin n → V} |
| 47 | (hy : LinearIndependent F y) (hS : span F S = ⊤) : |
| 48 | ∃ (n' : ℕ) (z : Fin n' → V), |
| 49 | (∀ i : Fin n', z i ∈ S) ∧ |
| 50 | LinearIndependent F (Sum.elim y z) ∧ |
| 51 | finrank F V = n + n' := by |
| 52 | -- Choose a basis `w` of `V ⧸ span y` among the images of members of `S`, and lift it to `z`. |
| 53 | let Y : Submodule F V := span F (Set.range y) |
| 54 | obtain ⟨w, hw, -, w_indep⟩ := exists_fun_fin_finrank_span_eq F (Y.mkQ '' S) |
| 55 | choose z hz hzw using fun i ↦ (Set.mem_image _ _ _).mp (hw i) |
| 56 | have z_indep : LinearIndependent F (Y.mkQ ∘ z) := by rwa [← funext hzw] at w_indep |
| 57 | refine ⟨_, z, hz, (linearIndependent_span hy).sumElim_of_quotient z z_indep, ?_⟩ |
| 58 | have image_spans : span F (Y.mkQ '' S) = ⊤ := by simp [span_image, hS, range_mkQ] |
| 59 | rw [image_spans, finrank_top, ← Y.finrank_quotient_add_finrank, finrank_span_eq_card hy, |
| 60 | Fintype.card_fin, add_comm] |
| 61 | |
| 62 | end Basis |
| 63 | |
| 64 | section Gram |
| 65 | |
| 66 | variable {W H S : Type} [NormedAddCommGroup W] [InnerProductSpace ℂ W] [Module.Finite ℂ W] |
| 67 | [NormedAddCommGroup H] [InnerProductSpace ℂ H] [Fintype S] [DecidableEq S] |
| 68 | |
| 69 | /-- For a linear map `u` and a family `x` of `dim W` vectors of `W`, the Gram determinant of |
| 70 | `u ∘ x` is that of `x` times `(normDet u) ^ 2`, where `normDet u` is the square root of |
| 71 | `det (u* u)`. -/ |
| 72 | lemma det_gram_comp (u : W →ₗ[ℂ] H) (x : S → W) (h_card : finrank ℂ W = card S) : |
| 73 | (gram ℂ (u ∘ x)).det = u.normDet ^ 2 * (gram ℂ x).det := by |
| 74 | -- With `X` sending the standard basis to `x`, the two Gram determinants are the squared volumes |
| 75 | -- of `u ∘ X` and of `X`. |
| 76 | let e : OrthonormalBasis S ℂ (EuclideanSpace ℂ S) := EuclideanSpace.basisFun S ℂ |
| 77 | let X : EuclideanSpace ℂ S →ₗ[ℂ] W := e.toBasis.constr ℂ x |
| 78 | have hX (i : S) : X (e i) = x i := e.toBasis.constr_basis ℂ x i |
| 79 | have h_comp : (gram ℂ (u ∘ x)).det = (u ∘ₗ X).normDet ^ 2 := by |
| 80 | simpa [hX, Function.comp_def] using ((u ∘ₗ X).normDet_sq_eq_det_gram e).symm |
| 81 | have h_id : (gram ℂ x).det = X.normDet ^ 2 := by |
| 82 | simpa [hX] using (X.normDet_sq_eq_det_gram e).symm |
| 83 | rw [h_comp, h_id, normDet_comp_of_finrank_eq X u (by simp [h_card]), Complex.ofReal_mul, mul_pow] |
| 84 | |
| 85 | /-- Let `φ` be a family of vectors, `u'` and `u` square matrices, and `ι` a ring homomorphism from |
| 86 | `ℂ` to a nonarchimedean normed field. If the inner products of the transformed families |
| 87 | `∑ c, u' a c • φ c` and `∑ c, u b c • φ c` all have norm at most `1` under `ι`, then so does |
| 88 | `conj (det u') · det ⟨φ_i, φ_k⟩ · det u`, the determinant of these products. -/ |
| 89 | lemma norm_det_mul_det_gram_mul_det_le_one {F : Type} [NormedField F] [IsUltrametricDist F] |
| 90 | (ι : ℂ →+* F) {φ : S → H} {u u' : Matrix S S ℂ} |
| 91 | (h_inner : ∀ a b : S, ‖ι ⟪∑ c : S, u' a c • φ c, ∑ c : S, u b c • φ c⟫_ℂ‖ ≤ 1) : |
| 92 | ‖ι (starRingEnd ℂ u'.det)‖ * ‖ι (gram ℂ φ).det‖ * ‖ι u.det‖ ≤ 1 := by |
| 93 | have h_entry (a b : S) : |
| 94 | (u'ᴴᵀ * (gram ℂ φ * uᵀ)) a b = ⟪∑ c : S, u' a c • φ c, ∑ c : S, u b c • φ c⟫_ℂ := by |
| 95 | simp only [← star_dotProduct_gram_mulVec, Matrix.mul_apply, dotProduct, mulVec, |
| 96 | Matrix.transpose_apply, Matrix.conjTranspose_apply, Pi.star_apply] |
| 97 | have h_det : ‖(ι.mapMatrix (u'ᴴᵀ * (gram ℂ φ * uᵀ))).det‖ ≤ 1 := |
| 98 | Matrix.abv_det_le_one_of_isNonarchimedean (abv := NormedField.toAbsoluteValue F) |
| 99 | IsUltrametricDist.isNonarchimedean_norm fun a b ↦ by |
| 100 | simpa only [NormedField.toAbsoluteValue_apply, RingHom.mapMatrix_apply, Matrix.map_apply, |
| 101 | h_entry] using h_inner a b |
| 102 | rw [← ι.map_det] at h_det |
| 103 | simpa [mul_assoc] using h_det |
| 104 | |
| 105 | end Gram |
| 106 | |
| 107 | section FormGram |
| 108 | |
| 109 | variable {I S : Type} [Fintype I] {G : Matrix I I ℂ} |
| 110 | |
| 111 | /-- The matrix of the products `star (v i) ⬝ᵥ G *ᵥ v k` of a family `v` for the form `G`. -/ |
| 112 | noncomputable def formGram (G : Matrix I I ℂ) (v : S → I → ℂ) : Matrix S S ℂ := |
| 113 | of fun i k ↦ star (v i) ⬝ᵥ G *ᵥ v k |
| 114 | |
| 115 | /-- The matrix `formGram G v` of a positive semidefinite form is positive semidefinite. -/ |
| 116 | lemma posSemidef_formGram (hG : G.PosSemidef) (v : S → I → ℂ) : |
| 117 | (formGram G v).PosSemidef := by |
| 118 | have h_eq : formGram G v = (of v)ᵀᴴ * G * (of v)ᵀ := by |
| 119 | exact Matrix.ext fun i k ↦ (Matrix.mul_mul_apply (of v)ᵀᴴ G (of v)ᵀ i k).symm |
| 120 | rw [h_eq] |
| 121 | exact hG.conjTranspose_mul_mul_same _ |
| 122 | |
| 123 | /-- For a positive semidefinite form `G`, if each diagonal product `star (v i) ⬝ᵥ G *ᵥ v i` of a |
| 124 | family `v` of `n` vectors is at most `exp h`, then `‖det (formGram G v)‖ ≤ exp (n * h)` |
| 125 | (Hadamard's inequality). -/ |
| 126 | lemma norm_det_formGram_le (hG : G.PosSemidef) {n : ℕ} {v : Fin n → I → ℂ} {h : ℝ} |
| 127 | (hv : ∀ i : Fin n, (star (v i) ⬝ᵥ G *ᵥ v i).re ≤ exp h) : |
| 128 | ‖(formGram G v).det‖ ≤ exp (n * h) := by |
| 129 | calc ‖(formGram G v).det‖ ≤ ∏ i : Fin n, ‖formGram G v i i‖ := |
| 130 | hadamard_det_inequality (posSemidef_formGram hG v) |
| 131 | _ ≤ ∏ _i : Fin n, exp h := by |
| 132 | gcongr with i |
| 133 | simpa [formGram, Complex.re_eq_norm.mpr (hG.dotProduct_mulVec_nonneg (v i))] using hv i |
| 134 | _ = exp (n * h) := by rw [Fin.prod_const, exp_natCast_mul] |
| 135 | |
| 136 | end FormGram |
| 137 | |
| 138 | end New |