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: separate countability from factorization through residue fields

alkor200064711569ecc0
diff --git a/src/Lib/General/Geometry/GaloisCovers.lean b/src/Lib/General/Geometry/GaloisCovers.lean
index c2fc83dd19e..a6f2c74154a 100644
--- a/src/Lib/General/Geometry/GaloisCovers.lean
+++ b/src/Lib/General/Geometry/GaloisCovers.lean
@@ -150,6 +150,18 @@ lemma countable_sections {X : Scheme} {R : CommRingCat} (s : X ⟶ Spec R) [Coun
have := (MvPolynomial.basisMonomials (Fin n) R).repr.injective.countable
exact hf.countable
+/-- Every residue field of a scheme locally of finite type over a countable ring is countable. -/
+lemma countable_residueField {X : Scheme} {R : CommRingCat} (s : X ⟶ Spec R) [Countable R]
+ [LocallyOfFiniteType s] (z : X) : Countable (X.residueField z) := by
+ -- In an affine neighbourhood of z, its stalk is a localisation of the ring of sections.
+ obtain ⟨_, ⟨W, hW, rfl⟩, hz, -⟩ :=
+ X.isBasis_affineOpens.exists_subset_of_mem_open (Set.mem_univ z) isOpen_univ
+ have : Countable Γ(X, W) := countable_sections s hW
+ let z' : W := ⟨z, hz⟩
+ let := X.presheaf.algebra_section_stalk z'
+ have : Countable (X.presheaf.stalk z) := (hW.isLocalization_stalk z').mk'_surjective.countable
+ exact (residue_surjective (R := X.presheaf.stalk z)).countable
+
/-- Let `X` be locally of finite type over a countable ring. Every point `t : Spec K ⟶ X` with
values in a field `K` factors through the residue field of a point `z` of `X`, as `Spec` of a ring
map `φ` (written `specMap φ`) followed by the canonical map to `X`, and this residue field is
@@ -159,15 +171,8 @@ lemma exists_countable_residue_point {X : Scheme} {R : CommRingCat} (s : X ⟶ S
∃ z : X, ∃ φ : X.residueField z →+* K,
specMap φ ≫ X.fromSpecResidueField z = t ∧ Countable (X.residueField z) := by
let z : X := t (closedPoint K)
- refine ⟨z, (X.SpecToEquivOfField K t).2.hom, (X.SpecToEquivOfField K).left_inv t, ?_⟩
- -- The stalk at the image `z` of `t` is a localisation of the countable ring of sections over an
- -- affine open `W ∋ z`, and it surjects onto the residue field.
- obtain ⟨W, hW, ht⟩ := exists_isAffineOpen_landsIn t
- have : Countable Γ(X, W) := countable_sections s hW
- let z' : W := ⟨z, landsIn_iff_mem.1 ht⟩
- let := X.presheaf.algebra_section_stalk z'
- have : Countable (X.presheaf.stalk z) := (hW.isLocalization_stalk z').mk'_surjective.countable
- exact (residue_surjective (R := X.presheaf.stalk z)).countable
+ exact ⟨z, (X.SpecToEquivOfField K t).2.hom, (X.SpecToEquivOfField K).left_inv t,
+ countable_residueField s z⟩
/-- For countably many analytic functions on a connected open set `N` and an open set `V` meeting
`N`, some point of `N ∩ V` is a zero only of those functions that vanish on all of `N`. -/
diff --git a/src/Lib/Shimura/IntegralModel/TowerExistence.lean b/src/Lib/Shimura/IntegralModel/TowerExistence.lean
index 294f1bda57f..824a65fe281 100644
--- a/src/Lib/Shimura/IntegralModel/TowerExistence.lean
+++ b/src/Lib/Shimura/IntegralModel/TowerExistence.lean
@@ -148,7 +148,10 @@ lemma New.Variety.UniversalFamily.GraphClosure.congruenceRelation {E : Type} [Fi
-- `x` comes from the residue field of a point `z`, and `z` is the centre of an arc `α` over a
-- valuation ring `V` of `ℂ`. By `along`, a map that sends the complex point of `b` to that of
-- `a` sends `α` to the `V`-point of `a`.
- obtain ⟨z, ρ, rfl, -⟩ := exists_countable_residue_point C.scheme.hom x
+ obtain ⟨⟨z, ψ⟩, hψ⟩ := (Scheme.SpecToEquivOfField k C.scheme.left).symm.surjective x
+ let ρ := ψ.hom
+ change specMap ρ ≫ C.scheme.left.fromSpecResidueField z = x at hψ
+ subst x
obtain ⟨V, α, b, ρ', centre, along⟩ := C.exists_arc z
have hz_charP : CharP (C.scheme.left.residueField z) l := ρ.charP ρ.injective l
have hV_charP : CharP (ResidueField V) l := charP_of_injective_ringHom ρ'.injective l