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.Algebra.AffineMonoid.Basic |
| 4 | public import Mathlib.NumberTheory.NumberField.Discriminant.Basic |
| 5 | public import Mathlib.RingTheory.DedekindDomain.Different |
| 6 | import Mathlib.NumberTheory.NumberField.Discriminant.Different |
| 7 | import Mathlib.RingTheory.Ideal.Int |
| 8 | import TauCeti.NumberTheory.NumberField.ComplexConjugation.MaximalRealSubfield |
| 9 | import TauCeti.RingTheory.Norm.Quadratic |
| 10 | public import Lib.Adelic.Adeles.AdditiveCharacter |
| 11 | import TauCeti.RingTheory.DedekindDomain.Different.Basic |
| 12 | |
| 13 | /-! |
| 14 | # Embeddings, differents and the maximal real subfield of a CM field |
| 15 | |
| 16 | The file collects general lemmas on differents and root discriminants of number fields. It then |
| 17 | compares a CM field `E` with its maximal real subfield E⁺ (`maximalRealSubfield E`), covering the |
| 18 | trace, the norm, the different and the discriminant. |
| 19 | |
| 20 | * `star` is complex conjugation on the CM field `E` and on its integers `𝓞 E`. |
| 21 | * `Φ v` is the complex embedding chosen at the infinite place `v`: by `New.PlaceEmbedding` in |
| 22 | general, and by `New.CMType`, which extends it, for CM fields. |
| 23 | * `New.volÔ E` is `2 ^ r₂ / √|disc E|`, with `r₂` the number of complex places of `E`. |
| 24 | |
| 25 | ## Main definitions and results |
| 26 | |
| 27 | * `New.differentIdeal_eq_span_of_dvd`: a criterion for `f'(x)` to generate the different and for |
| 28 | `𝓞 L = A[x]`. |
| 29 | * `New.mem_maximalRealSubfield_iff_star_eq`, `New.trace_maximalRealSubfield_eq_add_star`, |
| 30 | `New.norm_maximalRealSubfield_eq_mul_star`: E⁺ is the fixed field of conjugation, and the trace |
| 31 | and norm from `E` to E⁺ are `x + x̄` and `x x̄`. |
| 32 | * `New.differentIdeal_eq_top`, `New.abs_discr_eq_discr_maximalRealSubfield_sq`: under |
| 33 | `New.HasPrimitiveRoot5040` the relative different is trivial and |disc E| = (disc E⁺)². |
| 34 | * `New.volÔ_eq`: the mass `New.volÔ` of the integral finite adeles in terms of the root |
| 35 | discriminant. |
| 36 | * `New.exists_mixedEquiv_maximalRealSubfield`: the Minkowski space of E⁺ as real functions on the |
| 37 | infinite places of `E`. |
| 38 | * `New.Variety.prod_embeddings_eq_prod_pairs`: a product over the complex embeddings of a totally |
| 39 | complex field, grouped into conjugate pairs. |
| 40 | -/ |
| 41 | |
| 42 | @[expose] public section |
| 43 | |
| 44 | /-! ## Differents and root discriminants -/ |
| 45 | |
| 46 | namespace New |
| 47 | |
| 48 | open NumberField Polynomial Fintype Ideal Module Algebra Real InfinitePlace |
| 49 | |
| 50 | variable (K : Type*) {L A : Type*} [Field K] [Field L] [NumberField K] [NumberField L] |
| 51 | |
| 52 | /-- Let `A` be a Dedekind domain with fraction field `K`, with `𝓞 L` finite over `A`. Let `x ∈ 𝓞 L` |
| 53 | generate `L` over `K`, and let `f` be a polynomial over `A` with root `x`. If `y = f'(x)` generates |
| 54 | an ideal that divides the different of `𝓞 L` over `A`, then `y` generates the different and |
| 55 | `𝓞 L = A[x]`. -/ |
| 56 | lemma differentIdeal_eq_span_of_dvd [Algebra K L] [CommRing A] [IsDedekindDomain A] [Algebra A K] |
| 57 | [IsFractionRing A K] [Algebra A (𝓞 L)] [IsTorsionFree A (𝓞 L)] [Module.Finite A (𝓞 L)] |
| 58 | [CharZero A] [Algebra A L] [IsScalarTower A K L] [IsScalarTower A (𝓞 L) L] {x y : 𝓞 L} |
| 59 | (hx : K[(x : L)] = ⊤) (f : A[X]) (hf : aeval x f = 0) (hy : aeval x f.derivative = y) |
| 60 | (h_dvd : span {y} ∣ differentIdeal A (𝓞 L)) : |
| 61 | differentIdeal A (𝓞 L) = span {y} ∧ A[x] = ⊤ := by |
| 62 | -- Let `p` be the minimal polynomial, `𝔠` the conductor and `𝔡` the different. Then |
| 63 | -- `𝔡 ∣ 𝔠 * 𝔡 = (p'(x)) ∣ (f'(x)) = (y) ∣ 𝔡`, so all these ideals are equal and `𝔠 = 1`. |
| 64 | obtain ⟨g, rfl⟩ : minpoly A x ∣ f := minpoly.isIntegrallyClosed_dvd (.of_finite A x) hf |
| 65 | have h_deriv : y = aeval x (minpoly A x).derivative * aeval x g := by simp [← hy] |
| 66 | have h_mul_dvd : conductor A x * differentIdeal A (𝓞 L) ∣ span {y} := by |
| 67 | rw [conductor_mul_differentIdeal A K L x hx, h_deriv, ← span_singleton_mul_span_singleton] |
| 68 | exact dvd_mul_right _ _ |
| 69 | have h_cond : conductor A x * differentIdeal A (𝓞 L) = differentIdeal A (𝓞 L) := |
| 70 | (h_mul_dvd.trans h_dvd).antisymm (dvd_mul_left _ _) |
| 71 | have h_top : conductor A x = ⊤ := by simpa [differentIdeal_ne_bot] using h_cond |
| 72 | rw [h_cond] at h_mul_dvd |
| 73 | exact ⟨h_mul_dvd.antisymm h_dvd, conductor_eq_top_iff_adjoin_eq_top.1 h_top⟩ |
| 74 | |
| 75 | /-- A generator `x` of the different of `𝓞 L` over `ℤ` is nonzero. -/ |
| 76 | lemma ne_zero_of_differentIdeal_eq_span {x : 𝓞 L} (hx : differentIdeal ℤ (𝓞 L) = span {x}) : |
| 77 | x ≠ 0 := |
| 78 | fun h_zero ↦ differentIdeal_ne_bot (by simpa [h_zero] using hx) |
| 79 | |
| 80 | /-- An ideal `P` of the integers of a number field `L` whose square contains a rational prime `p` |
| 81 | divides the different of `L` over `ℚ`. -/ |
| 82 | lemma dvd_differentIdeal_of_mem_sq {P : Ideal (𝓞 L)} {p : ℕ} [Fact p.Prime] |
| 83 | (hp : (p : 𝓞 L) ∈ P ^ 2) : P ∣ differentIdeal ℤ (𝓞 L) := by |
| 84 | -- If `P ^ e` divides `p 𝓞 L`, then `P ^ (e - 1)` divides the different; take `e = 2`. |
| 85 | have h_sq_dvd : P ^ 2 ∣ (span {(p : ℤ)}).map (algebraMap ℤ (𝓞 L)) := by simp [map_span, hp] |
| 86 | simpa using pow_sub_one_dvd_differentIdeal ℤ P 2 (by simp [NeZero.ne]) h_sq_dvd |
| 87 | |
| 88 | /-- The number of infinite places of the number field `K`. -/ |
| 89 | noncomputable abbrev Core.numInfPlaces : ℕ := card (InfinitePlace K) |
| 90 | |
| 91 | lemma finrank_eq_two_mul_card_infinitePlace [IsTotallyComplex K] : |
| 92 | finrank ℚ K = 2 * Core.numInfPlaces K := by simp [← sum_mult_eq, mul_comm] |
| 93 | |
| 94 | /-- The root discriminant of a number field is at least `1`. -/ |
| 95 | lemma one_le_rootDiscr : 1 ≤ rootDiscr K := by |
| 96 | have h_one : (1 : ℝ) ≤ |(discr K : ℝ)| := mod_cast Int.one_le_abs (discr_ne_zero K) |
| 97 | rw [rootDiscr_def, Int.cast_abs] |
| 98 | exact one_le_rpow h_one (by positivity) |
| 99 | |
| 100 | /-- The root discriminant `|disc K| ^ (1 / [K : ℚ])` of a number field is positive. -/ |
| 101 | lemma rootDiscr_pos : 0 < rootDiscr K := |
| 102 | zero_lt_one.trans_le (one_le_rootDiscr K) |
| 103 | |
| 104 | /-- For a totally complex number field `K` with `r` infinite places and root discriminant `rd`, |
| 105 | the absolute discriminant is `(rd ^ r) ^ 2`. -/ |
| 106 | lemma abs_discr_eq_rootDiscr_pow [IsTotallyComplex K] : |
| 107 | (|NumberField.discr K| : ℝ) = (rootDiscr K ^ Core.numInfPlaces K) ^ 2 := by |
| 108 | simp [← pow_mul', ← finrank_eq_two_mul_card_infinitePlace, rootDiscr_def, |
| 109 | rpow_inv_natCast_pow, finrank_pos.ne'] |
| 110 | |
| 111 | end New |
| 112 | |
| 113 | /-! ## The maximal real subfield: trace, norm, different and discriminant -/ |
| 114 | |
| 115 | section RealSubfield |
| 116 | |
| 117 | open NumberField MeasureTheory Algebra InfinitePlace IsCMField IsTotallyReal Submodule Finset |
| 118 | |
| 119 | namespace New |
| 120 | |
| 121 | variable {E : Type*} [Field E] [NumberField E] [IsCMField E] |
| 122 | |
| 123 | /-- The maximal real subfield of a CM field is the fixed field of complex conjugation. -/ |
| 124 | lemma mem_maximalRealSubfield_iff_star_eq {x : E} : x ∈ maximalRealSubfield E ↔ star x = x := |
| 125 | (complexConj_eq_self_iff E x).symm |
| 126 | |
| 127 | /-- The trace from a CM field `E` to its maximal real subfield is `x + x̄`. -/ |
| 128 | lemma trace_maximalRealSubfield_eq_add_star (x : E) : |
| 129 | (trace (maximalRealSubfield E) E x : E) = x + star x := |
| 130 | IsQuadraticExtension.algebraMap_trace_eq_add _ E (complexConj_ne_one E) x |
| 131 | |
| 132 | /-- The norm from a CM field `E` to its maximal real subfield is `x * x̄`. -/ |
| 133 | lemma norm_maximalRealSubfield_eq_mul_star (x : E) : |
| 134 | (Algebra.norm (maximalRealSubfield E) x : E) = x * star x := |
| 135 | algebraMap_norm_eq_mul_complexConj x |
| 136 | |
| 137 | /-- If `x` lies in the trace dual of the integers of the CM field `E` over those of its maximal |
| 138 | real subfield, then `(y - ȳ) * x` is an algebraic integer for every integer `y` of `E`. -/ |
| 139 | lemma isIntegral_sub_star_mul_of_mem_traceDual (y : 𝓞 E) {x : E} |
| 140 | (hx : x ∈ traceDual (𝓞 (maximalRealSubfield E)) (maximalRealSubfield E) |
| 141 | (1 : Submodule (𝓞 E) E)) : |
| 142 | IsIntegral ℤ ((y - star y : 𝓞 E) * x) := by |
| 143 | have h_trace (u : 𝓞 E) : IsIntegral ℤ (trace (maximalRealSubfield E) E (x * u) : E) := |
| 144 | isIntegral_trans (A := 𝓞 (maximalRealSubfield E)) _ |
| 145 | (mem_traceDual_iff_isIntegral.1 hx u (mem_one.2 ⟨u, rfl⟩)).algebraMap |
| 146 | have h_eq : (y - star y : 𝓞 E) * x = trace (maximalRealSubfield E) E (x * y) - |
| 147 | (star y : 𝓞 E) * trace (maximalRealSubfield E) E (x * (1 : 𝓞 E)) := by |
| 148 | have h_star : ((star y : 𝓞 E) : E) = star (y : E) := by simp |
| 149 | simp only [trace_maximalRealSubfield_eq_add_star, star_mul', h_star, map_sub, map_one, mul_one] |
| 150 | ring |
| 151 | rw [h_eq] |
| 152 | exact (h_trace y).sub ((star y).isIntegral_coe.mul (h_trace 1)) |
| 153 | |
| 154 | /-- Let the integers of the CM field `E` contain `i` with `i² = -1`, `ī = -i` and `β` with |
| 155 | `β + β̄ = 1`. Then `E` has trivial different over its maximal real subfield, so it is unramified at |
| 156 | all finite places. -/ |
| 157 | lemma differentIdeal_eq_top_of_add_star_eq_one {i β : 𝓞 E} (hi_sq : i * i = -1) |
| 158 | (hi_star : star i = -i) (hβ : β + star β = 1) : |
| 159 | differentIdeal (𝓞 (maximalRealSubfield E)) (𝓞 E) = ⊤ := by |
| 160 | -- The element `i = i * β - star (i * β)` is a unit and sends the trace dual into the integers. |
| 161 | have h_sub : i * β - star (i * β) = i := by |
| 162 | rw [star_mul', hi_star] |
| 163 | linear_combination i * hβ |
| 164 | have hi_mem : i ∈ differentIdeal (𝓞 (maximalRealSubfield E)) (𝓞 E) := by |
| 165 | refine (TauCeti.mem_differentIdeal_iff_forall_mem_traceDual |
| 166 | (K := maximalRealSubfield E) (L := E)).2 fun x hx ↦ ?_ |
| 167 | have h_int : IsIntegral ℤ (x * i) := by |
| 168 | simpa only [h_sub, mul_comm] using isIntegral_sub_star_mul_of_mem_traceDual (i * β) hx |
| 169 | exact mem_one.2 ⟨⟨x * i, h_int⟩, rfl⟩ |
| 170 | exact Ideal.eq_top_of_isUnit_mem _ hi_mem (.of_mul_eq_one (-i) (by simp [hi_sq])) |
| 171 | |
| 172 | /-- A CM field that contains a primitive root of unity of order `5040` has trivial different over |
| 173 | its maximal real subfield. -/ |
| 174 | @[simp] |
| 175 | lemma differentIdeal_eq_top [HasPrimitiveRoot5040 E] : |
| 176 | differentIdeal (𝓞 (maximalRealSubfield E)) (𝓞 E) = ⊤ := by |
| 177 | -- the field contains `i` with `i² = -1`, `ī = -i` and `ω` of trace `1` over the real subfield |
| 178 | obtain ⟨i, ω, hi_sq, hi_star, hω, -⟩ := |
| 179 | HasPrimitiveRoot5040.exists_mul_self_eq_neg_one_and_mul_star_eq_two (E := E) |
| 180 | exact differentIdeal_eq_top_of_add_star_eq_one hi_sq hi_star hω |
| 181 | |
| 182 | /-- If the CM field `E` contains a primitive root of unity of order `5040`, its discriminant is, up |
| 183 | to sign, the square of that of its maximal real subfield. -/ |
| 184 | lemma abs_discr_eq_discr_maximalRealSubfield_sq [HasPrimitiveRoot5040 E] : |
| 185 | |NumberField.discr E| = NumberField.discr (maximalRealSubfield E) ^ 2 := by |
| 186 | -- the tower formula for discriminants, with trivial relative different and degree two |
| 187 | rw [Int.abs_eq_natAbs, natAbs_discr_eq_absNorm_differentIdeal_mul_natAbs_discr_pow |
| 188 | (maximalRealSubfield E) (𝓞 (maximalRealSubfield E)) E (𝓞 E), differentIdeal_eq_top, |
| 189 | IsQuadraticExtension.finrank_eq_two] |
| 190 | simp |
| 191 | |
| 192 | /-- The mass `volÔ E = 2 ^ r₂ / √|disc E|` of the integral finite adeles of a CM field `E` is |
| 193 | `(rd / 2) ^ (-r)`, with `rd` the root discriminant of `E` and `r` the number of its infinite |
| 194 | places. -/ |
| 195 | lemma volÔ_eq : (volÔ E : ℝ) = ((rootDiscr E / 2) ^ Core.numInfPlaces E)⁻¹ := by |
| 196 | have h_places : nrComplexPlaces E = Core.numInfPlaces E := by |
| 197 | simp [card_eq_nrRealPlaces_add_nrComplexPlaces] |
| 198 | have h_sqrt : √|(NumberField.discr E : ℝ)| = rootDiscr E ^ Core.numInfPlaces E := by |
| 199 | simp [abs_discr_eq_rootDiscr_pow, (rootDiscr_pos E).le] |
| 200 | simp [volÔ, Int.norm_eq_abs, h_places, h_sqrt, div_pow] |
| 201 | |
| 202 | open scoped Classical in |
| 203 | /-- Let `E` be a CM field with a chosen complex embedding `Φ v` at each infinite place `v`. There is |
| 204 | a measure-preserving real-linear isomorphism from the Minkowski space of the maximal real subfield |
| 205 | E⁺ to the real functions on the infinite places of `E` that sends the image of `a ∈ E⁺` to |
| 206 | `v ↦ Re (Φ v a)`. -/ |
| 207 | lemma exists_mixedEquiv_maximalRealSubfield {E : Type*} [Field E] [CMType E] : |
| 208 | ∃ e : mixedEmbedding.mixedSpace (maximalRealSubfield E) ≃ₗ[ℝ] InfinitePlace E → ℝ, |
| 209 | MeasurePreserving e ∧ |
| 210 | ∀ a : maximalRealSubfield E, |
| 211 | e (mixedEmbedding (maximalRealSubfield E) a) = |
| 212 | fun v : InfinitePlace E ↦ (Φ v (a : E)).re := by |
| 213 | -- The real subfield has no complex place, so its Minkowski space is the space of real functions |
| 214 | -- on its real places, and these correspond to the infinite places of `E` by restriction. |
| 215 | have h_complex : IsEmpty {w : InfinitePlace (maximalRealSubfield E) // w.IsComplex} := |
| 216 | Fintype.card_eq_zero_iff.1 (nrComplexPlaces_eq_zero _) |
| 217 | let σ : InfinitePlace E ≃ {w : InfinitePlace (maximalRealSubfield E) // w.IsReal} := |
| 218 | (equivInfinitePlace E).trans (Equiv.subtypeUnivEquiv isReal).symm |
| 219 | refine ⟨.prodUnique ≪≫ₗ .funCongrLeft ℝ ℝ σ, ?_, fun a ↦ funext fun v ↦ ?_⟩ |
| 220 | · -- dropping the trivial factor and reindexing both preserve the volume |
| 221 | have h_fst : MeasurePreserving |
| 222 | (Prod.fst : mixedEmbedding.mixedSpace (maximalRealSubfield E) → |
| 223 | {w : InfinitePlace (maximalRealSubfield E) // w.IsReal} → ℝ) := |
| 224 | ⟨measurable_fst, by simp [volume]⟩ |
| 225 | exact ((volume_measurePreserving_piCongrLeft _ σ).symm _).comp h_fst |
| 226 | · -- the restriction `φ` of `Φ v` is real, so it is the embedding of the place `σ v` below `v` |
| 227 | let φ : maximalRealSubfield E →+* ℂ := (Φ v).comp (algebraMap (maximalRealSubfield E) E) |
| 228 | have h_below : (σ v : InfinitePlace (maximalRealSubfield E)) = .mk φ := by |
| 229 | simp [φ, σ, ← comap_mk, mk_Φ] |
| 230 | have h_emb : (σ v : InfinitePlace (maximalRealSubfield E)).embedding = φ := by |
| 231 | rw [h_below, embedding_mk_eq_of_isReal (complexEmbedding_isReal φ)] |
| 232 | change embedding_of_isReal (σ v).prop a = (φ a).re |
| 233 | rw [← h_emb, ← embedding_of_isReal_apply (σ v).prop, Complex.ofReal_re] |
| 234 | |
| 235 | end New |
| 236 | |
| 237 | end RealSubfield |
| 238 | |
| 239 | /-! ## Complex embeddings of a totally complex field in conjugate pairs -/ |
| 240 | |
| 241 | section Embeddings |
| 242 | |
| 243 | open NumberField Polynomial ComplexEmbedding InfinitePlace Finset IsTotallyComplex |
| 244 | |
| 245 | namespace New.Variety |
| 246 | |
| 247 | @[simp, grind .] |
| 248 | lemma conjugate_ne_self {E : Type*} [Field E] [IsTotallyComplex E] (σ : E →+* ℂ) : |
| 249 | conjugate σ ≠ σ := |
| 250 | complexEmbedding_not_isReal _ |
| 251 | |
| 252 | /-- For a totally complex number field `E`, a product over all complex embeddings is a product over |
| 253 | the infinite places `v` of the factors at the embedding `Φ v` chosen at `v` and at its conjugate. -/ |
| 254 | @[to_additive] |
| 255 | lemma prod_embeddings_eq_prod_pairs {E : Type*} [Field E] [IsTotallyComplex E] [NumberField E] |
| 256 | [PlaceEmbedding E] {M : Type*} [CommMonoid M] (F : (E →+* ℂ) → M) : |
| 257 | ∏ σ : E →+* ℂ, F σ = ∏ v : InfinitePlace E, F (Φ v) * F (conjugate (Φ v)) := by |
| 258 | -- Group the embeddings by places: above `v` lie exactly `Φ v` and its conjugate, which differ. |
| 259 | rw [← prod_fiberwise _ mk F] |
| 260 | refine prod_congr rfl fun v _ ↦ ?_ |
| 261 | apply prod_eq_mul <;> grind [mk_Φ, mk_eq_iff] |
| 262 | |
| 263 | /-- For a polynomial `P` over a totally complex field, the roots of `P` under the conjugate of an |
| 264 | embedding `σ` are the complex conjugates of its roots under `σ`, with multiplicity. -/ |
| 265 | lemma roots_map_conjugate {E : Type*} [Field E] (P : E[X]) (σ : E →+* ℂ) : |
| 266 | (P.map (conjugate σ)).roots = (P.map σ).roots.map star := by |
| 267 | -- Conjugating the coefficients of a split polynomial conjugates its roots. |
| 268 | have h_conj : conjugate σ = (starRingEnd ℂ).comp σ := RingHom.ext (conjugate_coe_eq σ) |
| 269 | simp only [h_conj, ← Polynomial.map_map, (IsAlgClosed.splits (P.map σ)).roots_map, |
| 270 | starRingEnd_apply] |
| 271 | |
| 272 | end New.Variety |
| 273 | |
| 274 | end Embeddings |