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.RingTheory.PiTensorProduct |
| 4 | public import Lib.CM.GoodReduction |
| 5 | import Lib.CM.Sigma.ThetaSections |
| 6 | import Lib.General.NumberTheory.SUnitsAndClassNumber |
| 7 | |
| 8 | /-! |
| 9 | # Finitely many CM lattices |
| 10 | |
| 11 | * `New.CMLattice.finite_range_latticeModule`: for a prime `d ≡ 7 mod 8`, only finitely many lattices |
| 12 | in `ℂ` underlie a CM lattice for `K = ℚ(√-d)`. |
| 13 | * `New.CMLattice.theta_eq_of_latticeModule_eq`: the theta function `θ` depends only on the lattice; |
| 14 | in particular it does not depend on the representative `t` of the point of order two. |
| 15 | * `New.CMLattice.exists_norm_twistedTranslate_theta_le`: the values `(T_u θ)(0)` are bounded |
| 16 | uniformly in the CM lattice and in `u`. |
| 17 | |
| 18 | Each CM lattice is a multiple of one of finitely many ideals, and the scaling `℘''(t) = 2` fixes the |
| 19 | factor up to a fourth root of unity. |
| 20 | |
| 21 | Notions from other files: |
| 22 | * `C : CMLattice d`: a lattice `C.Λ` in `ℂ` stable under `𝓞_K`, with a point `C.t` of order two |
| 23 | modulo `C.Λ` such that neither `ω t` nor `ω̄ t` lies in `C.Λ` (`ω = quadGen d = (1 + √-d) / 2`), |
| 24 | scaled so that `℘''(C.t) = 2`. |
| 25 | * `C.latticeModule`: the lattice `C.Λ` as an `𝓞_K`-submodule of `ℂ`. |
| 26 | * `QuadField.scaledIdeal d (u, 𝔞)`: the submodule `u 𝔞` of `ℂ`, for a fractional ideal `𝔞` of `K`. |
| 27 | * `C.twistedTranslate 1 u f`: the function `(T_u f)(z) = exp(-π (z ū + |u|² / 2) / C.area) |
| 28 | f(z + u)`. |
| 29 | * `C.θ`: the translate `T_t σ` of the sigma function, normalised to `1` at `0`. |
| 30 | |
| 31 | ## Relation to the literature |
| 32 | |
| 33 | Known result: lattices with complex multiplication by `𝓞_K` up to homothety correspond to the ideal |
| 34 | classes. Source: Silverman, Advanced topics in the arithmetic of elliptic curves, Chapter II. |
| 35 | -/ |
| 36 | |
| 37 | @[expose] public section |
| 38 | |
| 39 | open NumberField PeriodPair ComplexConjugate nonZeroDivisors |
| 40 | |
| 41 | namespace New |
| 42 | |
| 43 | /-- If multiplication by `c` identifies the two lattices and `z` is congruent to `c * y` modulo |
| 44 | `L'.lattice`, the inverse-power sum of degree `r` at `z` is `c⁻ʳ` times that at `y`. -/ |
| 45 | lemma sumInvPow_of_mul_mem_iff {L L' : PeriodPair} (r : ℕ) {c y z : ℂ} (hc : c ≠ 0) |
| 46 | (hL' : ∀ x : ℂ, c * x ∈ L'.lattice ↔ x ∈ L.lattice) (hz : c * y - z ∈ L'.lattice) : |
| 47 | L'.sumInvPow z r = L.sumInvPow y r / c ^ r := by |
| 48 | -- The affine map takes lattice points to lattice points and sends the centre `y` to `z`. |
| 49 | have hshift : z - c * y ∈ L'.lattice := by simpa only [neg_sub] using L'.lattice.neg_mem hz |
| 50 | let e : L.lattice ≃ L'.lattice := |
| 51 | ((Equiv.mulLeft₀ c hc).trans (Equiv.addRight (z - c * y))).subtypeEquiv fun x ↦ |
| 52 | (hL' x).symm.trans (add_mem_cancel_right hshift).symm |
| 53 | rw [sumInvPow, ← e.tsum_eq, sumInvPow, ← tsum_div_const] |
| 54 | refine tsum_congr fun x ↦ ?_ |
| 55 | change (((c * x.val + (z - c * y)) - z) ^ r)⁻¹ = ((x.val - y) ^ r)⁻¹ / c ^ r |
| 56 | rw [show c * x.val + (z - c * y) - z = c * (x.val - y) by ring] |
| 57 | simp [mul_pow, div_eq_mul_inv] |
| 58 | |
| 59 | namespace CMLattice |
| 60 | |
| 61 | variable {d : ℕ} {C D : CMLattice d} |
| 62 | |
| 63 | /-- The normalisation `℘''(t) = 2` of a CM lattice `C` at its point `t = C.t` of order two (a field |
| 64 | of `C` fixes `g₂` accordingly), written with the series `℘''(t) = 6 ∑ (l - t)⁻⁴`, where `l` runs |
| 65 | over the lattice. -/ |
| 66 | lemma six_mul_sumInvPow_t (C : CMLattice d) : 6 * C.sumInvPow C.t 4 = 2 := by |
| 67 | rw [← deriv_derivWeierstrassP_eq_sumInvPow C.t_notMem, deriv_derivWeierstrassP _ C.t_notMem, |
| 68 | C.g₂_eq] |
| 69 | ring |
| 70 | |
| 71 | variable [PrimeSevenModEight d] |
| 72 | |
| 73 | /-- Let `d` be a prime `≡ 7 mod 8` and let `C`, `D` be CM lattices for `ℚ(√-d)`. If multiplication |
| 74 | by `c` maps the lattice `C.Λ` onto `D.Λ`, then it takes the marked point `C.t` of order two to |
| 75 | `D.t` modulo `D.Λ`: the marked point is the only point of order two that neither |
| 76 | `ω = quadGen d = (1 + √-d) / 2` nor `ω̄` multiplies into the lattice. -/ |
| 77 | lemma mul_t_sub_t_mem {c : ℂ} (h_mem : ∀ x : ℂ, c * x ∈ D.Λ ↔ x ∈ C.Λ) : |
| 78 | c * C.t - D.t ∈ D.Λ := by |
| 79 | have h_two : c * C.t + c * C.t ∈ D.Λ := by simpa [← mul_add, h_mem] using C.two_t_mem |
| 80 | have h_mul {a : ℂ} (ha : a = quadGen d ∨ a = conj (quadGen d)) (hat : a * C.t ∉ C.Λ) : |
| 81 | a * (c * C.t - D.t) ∈ D.Λ := |
| 82 | (D.mul_mem_or_mul_sub_t_mem ha (c * C.t) h_two).resolve_left |
| 83 | (by rwa [mul_left_comm, h_mem]) |
| 84 | obtain ⟨hω, hω_conj⟩ := C.quadGen_mul_t_notMem |
| 85 | -- Conclude with `ω + ω̄ = 1`. |
| 86 | simpa [← add_mul, conj_quadGen] using add_mem (h_mul (.inl rfl) hω) (h_mul (.inr rfl) hω_conj) |
| 87 | |
| 88 | /-- Let `d` be a prime `≡ 7 mod 8`. If multiplication by `c` maps the lattice `C.Λ` of one CM |
| 89 | lattice onto the lattice `D.Λ` of another, then `c` is a fourth root of unity, as both are scaled |
| 90 | so that `℘''(t) = 2` at their marked points `t` of order two. -/ |
| 91 | lemma pow_four_eq_one_of_mul_mem_iff {c : ℂ} (h_mem : ∀ x : ℂ, c * x ∈ D.Λ ↔ x ∈ C.Λ) : |
| 92 | c ^ 4 = 1 := by |
| 93 | have hc : c ≠ 0 := fun h ↦ C.t_notMem ((h_mem C.t).1 (by simp [h])) |
| 94 | have h_scale : D.sumInvPow D.t 4 = C.sumInvPow C.t 4 / c ^ 4 := |
| 95 | sumInvPow_of_mul_mem_iff 4 hc h_mem (mul_t_sub_t_mem h_mem) |
| 96 | rw [eq_div_iff (pow_ne_zero 4 hc)] at h_scale |
| 97 | have hC : 6 * C.sumInvPow C.t 4 = 2 := C.six_mul_sumInvPow_t |
| 98 | have hD : 6 * D.sumInvPow D.t 4 = 2 := D.six_mul_sumInvPow_t |
| 99 | linear_combination 3 * h_scale + (hC - c ^ 4 * hD) / 2 |
| 100 | |
| 101 | /-- If `C` and `D` lie in the same ideal class `𝒞` (their lattices are complex multiples of ideals |
| 102 | in `𝒞`), then the lattice of `C` is `c` times that of `D` for a fourth root of unity `c`. -/ |
| 103 | lemma IsInClass.exists_pow_four_eq_one_and_eq_scaledIdeal_mul {𝒞 : ClassGroup (𝓞 (QuadField d))} |
| 104 | (hC : C.IsInClass 𝒞) (hD : D.IsInClass 𝒞) : |
| 105 | ∃ c : ℂˣ, c ^ 4 = 1 ∧ C.latticeModule = QuadField.scaledIdeal d (c, 1) * D.latticeModule := by |
| 106 | obtain ⟨c, hc⟩ : ∃ c : ℂˣ, C.latticeModule = QuadField.scaledIdeal d (c, 1) * D.latticeModule := |
| 107 | hD.exists_eq_scaledIdeal_mul (by rwa [map_one, one_mul]) |
| 108 | obtain ⟨v, 𝔞, -, hv⟩ := hD |
| 109 | have h_mem (x : ℂ) : c * x ∈ C.Λ ↔ x ∈ D.Λ := by |
| 110 | change c * x ∈ C.latticeModule ↔ x ∈ D.latticeModule |
| 111 | rw [hc, hv, ← map_mul, Prod.mk_mul_mk, one_mul] |
| 112 | simp only [QuadField.mem_scaledIdeal, Units.val_mul, mul_assoc, Units.mul_right_inj] |
| 113 | exact ⟨c, Units.ext (by simpa using pow_four_eq_one_of_mul_mem_iff h_mem), hc⟩ |
| 114 | |
| 115 | /-- For a prime `d ≡ 7 mod 8`, only finitely many `𝓞_K`-submodules of `ℂ` are the lattice |
| 116 | `C.latticeModule` of a CM lattice `C` for `K = ℚ(√-d)`. -/ |
| 117 | lemma finite_range_latticeModule : |
| 118 | (Set.range fun C : CMLattice d ↦ C.latticeModule).Finite := by |
| 119 | -- Take a representative CM lattice `B 𝒞` in each ideal class `𝒞`; every CM lattice |
| 120 | -- is a 4th root of unity times one of these. |
| 121 | obtain ⟨C₀, -⟩ := QuadField.exists_cmLattice_latticeModule_eq_scaledIdeal (d := d) 1 |
| 122 | obtain ⟨B, hB, -⟩ := C₀.exists_forall_isInClass |
| 123 | refine (Set.finite_range fun p : rootsOfUnity 4 ℂ × ClassGroup (𝓞 (QuadField d)) ↦ |
| 124 | QuadField.scaledIdeal d (p.1.val, 1) * (B p.2).latticeModule).subset ?_ |
| 125 | rintro _ ⟨C, rfl⟩ |
| 126 | obtain ⟨⟨u, 𝔟⟩, hC⟩ := C.exists_latticeModule_eq_scaledIdeal |
| 127 | obtain ⟨c, hc_pow, hc⟩ := |
| 128 | IsInClass.exists_pow_four_eq_one_and_eq_scaledIdeal_mul ⟨u, 𝔟, rfl, hC⟩ (hB _) |
| 129 | exact ⟨⟨⟨c, (mem_rootsOfUnity 4 c).2 hc_pow⟩, _⟩, hc.symm⟩ |
| 130 | |
| 131 | /-- Two CM lattices with the same underlying lattice have the same area of a period |
| 132 | parallelogram. -/ |
| 133 | lemma area_eq_of_latticeModule_eq (h : C.latticeModule = D.latticeModule) : C.area = D.area := by |
| 134 | obtain ⟨x, hx⟩ := D.exists_latticeModule_eq_scaledIdeal |
| 135 | rw [QuadField.area_eq_of_eq_scaledIdeal hx, QuadField.area_eq_of_eq_scaledIdeal (h.trans hx)] |
| 136 | |
| 137 | /-- The theta function `θ` of a CM lattice depends only on the underlying lattice. -/ |
| 138 | lemma theta_eq_of_latticeModule_eq (h : C.latticeModule = D.latticeModule) : C.θ = D.θ := by |
| 139 | -- Both are sections of degree one for `C`, which form a line, and both have value `1` at `0`. |
| 140 | have h_isog : C.IsIsogeny D.periodPair 1 1 := |
| 141 | ⟨fun x hx ↦ show 1 * x ∈ D.latticeModule by rwa [one_mul, ← h], |
| 142 | by simp [area_eq_of_latticeModule_eq h]⟩ |
| 143 | have hD : D.θ ∈ C.sections 1 := by |
| 144 | simpa only [one_mul] using C.comp_mul_mem_sections h_isog D.theta_mem |
| 145 | have hθ_ne : C.θ ≠ 0 := Function.ne_iff.2 ⟨0, by simp [theta_zero]⟩ |
| 146 | have h_rank : Module.finrank ℂ (C.sections 1) = 1 := IsAppellHumbert.finrank_thetaSpace_nsmul |
| 147 | have h_span : C.sections 1 = ℂ ∙ C.θ := |
| 148 | eq_span_singleton_of_mem_of_finrank_eq_one h_rank C.theta_mem hθ_ne |
| 149 | obtain ⟨c, hc⟩ : ∃ c : ℂ, c • C.θ = D.θ := Submodule.mem_span_singleton.1 (h_span.le hD) |
| 150 | have hc_one : c = 1 := by simpa [theta_zero] using congrFun hc 0 |
| 151 | simpa [hc_one] using hc |
| 152 | |
| 153 | variable (d) in |
| 154 | /-- For a prime `d ≡ 7 mod 8`, the values `(T_u θ)(0) = exp(-π |u|² / (2 A)) θ(u)` are bounded |
| 155 | uniformly in the CM lattice `C` and in `u : ℂ`. Here `θ = C.θ` is the theta function of `C`, |
| 156 | `A = C.area`, and `T_u = C.twistedTranslate 1 u` is the twisted translation of degree one. -/ |
| 157 | lemma exists_norm_twistedTranslate_theta_le : |
| 158 | ∃ M : ℝ, ∀ (C : CMLattice d) (u : ℂ), ‖C.twistedTranslate 1 u C.θ 0‖ ≤ M := by |
| 159 | -- For one lattice the modulus is continuous and periodic in `u`, so bounded; it depends only |
| 160 | -- on the lattice, and there are finitely many. |
| 161 | have : Finite (Set.range fun C : CMLattice d ↦ C.latticeModule) := |
| 162 | finite_range_latticeModule.to_subtype |
| 163 | obtain ⟨M, hM⟩ := (isCompact_iUnion fun x : Set.range fun C : CMLattice d ↦ C.latticeModule ↦ |
| 164 | IsAppellHumbert.isCompact_range_norm_thetaShift x.property.choose.theta_mem).bddAbove |
| 165 | refine ⟨M, fun C u ↦ hM (Set.mem_iUnion.2 ⟨⟨C.latticeModule, C, rfl⟩, u, ?_⟩)⟩ |
| 166 | have h := (⟨C, rfl⟩ : ∃ D : CMLattice d, D.latticeModule = C.latticeModule).choose_spec |
| 167 | simp [thetaShift_apply, hermitianForm_apply, theta_eq_of_latticeModule_eq h, |
| 168 | area_eq_of_latticeModule_eq h] |
| 169 | |
| 170 | end CMLattice |
| 171 | |
| 172 | end New |