Skip to content

Lean formalization of the Riemann Hypothesis (Alpöge, 2026-11-20) being cleaned up by members of the Lean community.

Python

refactor(Lib/General/NumberTheory/CMFields): extract infinite-place injectivity helper

Rohan Arun3ad09d720739
diff --git a/src/Lib/General/NumberTheory/CMFields.lean b/src/Lib/General/NumberTheory/CMFields.lean
index 7465d04744b..5411c9e9582 100644
--- a/src/Lib/General/NumberTheory/CMFields.lean
+++ b/src/Lib/General/NumberTheory/CMFields.lean
@@ -60,6 +60,20 @@ section CMCriterion
open NumberField InfinitePlace Module Fintype
+/-- For a number field `L` with a global conjugation witness `h_conj`, two infinite places of
+`L` that agree on `maximalRealSubfield L` agree on every `x : L`. -/
+private lemma infinitePlace_eq_of_comap_eq {L : Type*} [Field L] [NumberField L]
+ (h_conj : ∀ x : L, ∃ y : L, ∀ φ : L →+* ℂ, φ y = star (φ x))
+ {v w : InfinitePlace L}
+ (hvw : InfinitePlace.comap (maximalRealSubfield L).subtype v =
+ InfinitePlace.comap (maximalRealSubfield L).subtype w) :
+ v = w := by
+ ext x
+ obtain ⟨y, hy⟩ := h_conj x
+ have h_eq : v (x * y) = w (x * y) :=
+ DFunLike.congr_fun hvw ⟨x * y, fun φ ↦ by simp [hy φ, mul_comm]⟩
+ simpa [← norm_embedding_eq, hy, ← sq] using h_eq
+
/-- Let L be a number field extending a totally complex field E. If every x ∈ L has a y ∈ L with
φ(y) equal to the complex conjugate of φ(x) for all embeddings φ : L → ℂ, then L is a CM
field. -/
@@ -70,11 +84,7 @@ lemma New.isCMField_of_forall_exists_conj (E : Type*) {L : Type*} [Field E] [IsT
have : IsTotallyComplex L := isTotallyComplex_of_algebra E L
-- Places of `L` are determined by their restriction to `maximalRealSubfield L`.
have h_card : card (InfinitePlace L) = card (InfinitePlace (maximalRealSubfield L)) :=
- card_of_bijective ⟨fun v w hvw ↦ ext v w fun x ↦ by
- obtain ⟨y, hy⟩ := h_conj x
- have h_eq : v (x * y) = w (x * y) :=
- DFunLike.congr_fun hvw ⟨x * y, fun φ ↦ by simp [hy φ, mul_comm]⟩
- simpa [← norm_embedding_eq, hy, ← sq] using h_eq, comap_surjective⟩
+ card_of_bijective ⟨fun v w hvw ↦ infinitePlace_eq_of_comap_eq h_conj hvw, comap_surjective⟩
exact { is_quadratic := ⟨by
simpa [← sum_mult_eq, h_card] using finrank_mul_finrank ℚ (maximalRealSubfield L) L⟩ }