Lean formalization of the Riemann Hypothesis (Alpöge, 2026-11-20) being cleaned up by members of the Lean community.
Python
module
public import Aesop.BuiltinRules
import Mathlib.Data.Set.Finite.Monad
import Mathlib.FieldTheory.Galois.Profinite
import Mathlib.Topology.Algebra.ClopenNhdofOne
import Mathlib.Topology.Algebra.Group.Units
import Mathlib.Topology.Connected.Separation
public import Lib.Adelic.Adeles.Basic
public import Lib.ClassField.Places.GaloisDefs
import Lib.ClassField.Global.AlbertBrauerHasseNoether
import Lib.ClassField.Global.ArtinMap
import Lib.ClassField.Global.ArtinReciprocity
import Lib.ClassField.Global.NormTheorems
/-!
# Chebotarev: Frobenii at primes of degree one in every nonempty open set
The qualitative form of Chebotarev's theorem used in the proof: `New.chebotarev`. It is reduced to a
cyclic extension, where it follows from the second inequality `New.second_inequality`.
Notions from other files:
* `New.IsFrob`: `σ` stabilises the valuation subring `A` and `σ • x ≡ x ^ q` modulo the maximal
ideal for all `x ∈ A`.
* `New.IsPlaceOver`: `IsPlaceOver A v` says that the valuation subring `A` of `Ω` lies over the
prime `v` of `K`: an integer of `K` is in the maximal ideal of `A` exactly when it lies in `v`.
## Relation to the literature
Known result: Chebotarev's density theorem, existence form. Only existence is proved, namely that
Frobenius elements at primes of degree one outside a finite set are dense in the absolute Galois
group, and no density value is given. Source: J. S. Milne, Class Field Theory, VIII 7.4 (Deuring's
reduction); Stevenhagen–Lenstra, Chebotarëv and his density theorem, Math. Intelligencer 18 (1996).
-/
@[expose] public section
open QuotientGroup Subgroup New QZChar Nat
/-- Let `N` be a normal subgroup of a group `G` and `g ∈ G`. Then the subgroup `⟨g⟩ N` generated by
`g` and `N` is cyclic modulo `N`: by the second isomorphism theorem `⟨g⟩ N / N` is isomorphic to
`⟨g⟩ / (⟨g⟩ ∩ N)`, a quotient of the cyclic group `⟨g⟩`. -/
lemma New.isCyclic_zpowers_sup_quotient {G : Type*} [Group G] (g : G) (N : Subgroup G) [N.Normal] :
IsCyclic ((zpowers g ⊔ N : Subgroup G) ⧸ N.subgroupOf (zpowers g ⊔ N)) := by
have h_quot : IsCyclic (zpowers g ⧸ N.subgroupOf (zpowers g)) :=
isCyclic_of_surjective _ (mk'_surjective _)
exact (quotientInfEquivProdNormalQuotient (zpowers g) N).isCyclic.mp h_quot
/-- Let `w` be a finite place of a finite extension `L` of the number field `K`. If the norm `w.q`
(the size of the residue field at `w`) is prime, it equals the norm of the place of `K` below `w`:
`w.q` is a power of `(w.below K).q` with the inertia degree as exponent, and a prime power that is
prime has exponent one. -/
lemma New.FinPlace.q_eq_q_below_of_prime {K L : Type*} [Field K] [NumberField K] [Field L]
[NumberField L] [Algebra K L] {w : FinPlace L} (hw : w.q.Prime) : w.q = (w.below K).q := by
have h_pow : (w.below K).q ^ w.asIdeal.inertiaDeg (NumberField.RingOfIntegers K) = w.q :=
(w.below K).asIdeal.absNorm_pow_inertiaDeg w.asIdeal
rw [← h_pow] at hw ⊢
rw [Nat.Prime.eq_one_of_pow hw, pow_one]
/-- Frobenius elements are well defined modulo `N` at a place whose inertia lies in `N`. Let `σ` and
`τ` be Frobenius elements for `q` at the valuation subring `A`, and suppose the inertia group of `A`
lies in the subgroup `N`. If `σ` lies in the coset `g N`, so does `τ`: the two differ by inertia
(`New.IsFrob.inv_mul_mem_inertiaGroup`). -/
lemma New.IsFrob.inv_mul_mem_of_inertiaGroup_le {Γ Ω : Type*} [Group Γ] [Field Ω]
[MulSemiringAction Γ Ω] {A : ValuationSubring Ω} {q : ℕ} {σ τ g : Γ} {N : Subgroup Γ}
(hσ : IsFrob A q σ) (hτ : IsFrob A q τ) (h_inert : inertiaGroup Γ A ≤ N)
(hσN : g⁻¹ * σ ∈ N) : g⁻¹ * τ ∈ N := by
simpa [mul_assoc] using mul_mem hσN (h_inert (hσ.inv_mul_mem_inertiaGroup hτ))
/-- Chebotarev's theorem, existence form (no density is given). Let `W` be a nonempty open subset of
the absolute Galois group `Gal(Ω/K)` of the number field `K`, and `S` a finite set of finite places
of `K`. Then (a) some place `v ∉ S` has prime norm `v.q` (the size of its residue field), with a
place `A` of `Ω` over it (a valuation subring, `New.IsPlaceOver`); (b) some arithmetic Frobenius
at `A` for `v.q` lies in `W`; (c) every arithmetic Frobenius at `A` for `v.q` lies in `W`. -/
lemma New.chebotarev {K : Type} [Field K] [NumberField K] [Algebra K Ω] {W : Set Gal(Ω/K)}
(hW : IsOpen W) (hW_ne : W.Nonempty) {S : Set (FinPlace K)} (hS : S.Finite) :
-- (a)
∃ v : FinPlace K, v ∉ S ∧
v.q.Prime ∧
∃ A : ClosurePlace,
IsPlaceOver A v ∧
-- (b)
∃ σ ∈ W,
IsFrob A v.q σ ∧
-- (c)
∀ τ : Gal(Ω/K), IsFrob A v.q τ → τ ∈ W := by
-- Take `g ∈ W`, an open normal `U` with `g U ⊆ W`, and the fixed field `L` of `H = ⟨g⟩ U`. Over
-- `L` the extension cut out by `U` is cyclic, and the second inequality gives primes `w` of `L`
-- of prime norm whose Frobenius is `g` modulo `U`. The prime of `K` below `w` has the same norm.
obtain ⟨g, hg_mem⟩ : ∃ g : Gal(Ω/K), g ∈ W := hW_ne
have h_one_mem : (1 : Gal(Ω/K)) ∈ (fun x : Gal(Ω/K) ↦ g * x) ⁻¹' W := by simpa using hg_mem
obtain ⟨⟨U, hU_normal⟩, hU : ∀ x ∈ U.toSubgroup, g * x ∈ W⟩ :=
ProfiniteGrp.exist_openNormalSubgroup_sub_open_nhds_of_one
(hW.preimage (continuous_const_mul g)) h_one_mem
let H : Subgroup Gal(Ω/K) := zpowers g ⊔ U.toSubgroup
have hH_open : Fact H.IsOpen := ⟨isOpen_mono le_sup_right U.isOpen'⟩
let L : IntermediateField K Ω := fixedFieldOf H
let g' : H := ⟨g, mem_sup_left (mem_zpowers g)⟩
-- `H / U` is a quotient of `⟨g⟩`, so `U` is the kernel of a character `χ` of `H`.
have h_cyclic : IsCyclic (H ⧸ U.toSubgroup.subgroupOf H) :=
isCyclic_zpowers_sup_quotient g U.toSubgroup
obtain ⟨χ, hχ⟩ : ∃ χ : QZChar H, ker χ = U.toSubgroup.subgroupOf H :=
exists_ker_eq_of_isCyclic ⟨_, H.subgroupOf_isOpen _ U.isOpen'⟩ h_cyclic
obtain ⟨a, ha⟩ : ∃ a : (𝔸f L)ˣ, artinMap H a = mk g' := artinMap_surjective H (mk g')
-- The kernel of `χ ∘ artinMap` is open and holds the totally positive elements and the norms from
-- the field cut out by `χ`. By the last part of the second inequality
-- (`frequently_prime_uniformizer_div_mem_of_adeleNorm_mem`), `ϖ_w a` lies in it for infinitely
-- many `w` of prime norm (`ϖ_w` is the uniformiser idele at `w`).
have h_ker_open : ((abelianLift χ).comp (artinMap H)).ker.IsOpen :=
continuous_iff_forall_isOpen_ker_comp.mp continuous_artinMap χ
have h_ker_pos (x : Lˣ) (hx : IsTotallyPositive x.val) :
principalIdele x ∈ ((abelianLift χ).comp (artinMap H)).ker := by
simp [artinMap_principalIdele_eq_one_of_isTotallyPositive hx]
have h_often : ∃ᶠ w : FinPlace L in .cofinite, w.q.Prime ∧
locIdele w (uniformizer w) / a⁻¹ ∈ ((abelianLift χ).comp (artinMap H)).ker :=
frequently_prime_uniformizer_div_mem_of_adeleNorm_mem _ h_ker_open h_ker_pos
abelianLift_artinMap_adeleNorm a⁻¹
-- Almost all `w` lie over a prime of `K` outside `S` at which all inertia groups lie in `U`; take
-- one of them with `ϖ_w a ∈ ker (χ ∘ artinMap)`.
have h_almost : ∀ᶠ w : FinPlace L in .cofinite, w.below K ∉ S ∧
∀ A : ClosurePlace, IsPlaceOver A (w.below K) → inertiaGroup Gal(Ω/K) A ≤ U.toSubgroup :=
tendsto_place_comap_cofinite (algebraMap K L)
(hS.eventually_cofinite_notMem.and (finite_ramified U.isOpen'))
obtain ⟨w, ⟨hw_prime, hw_ker⟩, hw_notMem, hw_unram⟩ := (h_often.and_eventually h_almost).exists
have hA : IsPlaceOver (placeOver w) (w.below K) := w.isPlaceOver_placeOver.isPlaceOver_below
have h_norm : w.q = (w.below K).q := FinPlace.q_eq_q_below_of_prime hw_prime
-- The symbol of `ϖ_w` is the inverse of a Frobenius `σ`, so `χ σ = χ g` and `g⁻¹ σ ∈ U`.
obtain ⟨σ, hσ, hσ_art⟩ :=
w.isPlaceOver_placeOver.exists_isFrob_localArtin_eq_inv (Γ := H) (v_uniformizer w)
have h_symbol : artinAt H w (uniformizer w) = ↑σ⁻¹ :=
w.isPlaceOver_placeOver.artinAt_eq_of_localArtin_eq hσ_art
have hσg : (χ : H → QZ) σ = (χ : H → QZ) g' := by
simpa [h_symbol, inv_mul_eq_one, ha] using hw_ker
have hσU : g⁻¹ * σ ∈ U.toSubgroup := hχ.le ((toHom χ).eq_iff.mp hσg)
rw [h_norm] at hσ hw_prime
have hσ_frob : IsFrob (placeOver w) (w.below K).q ((σ : H) : Gal(Ω/K)) := hσ
-- Any other Frobenius differs from `σ` by inertia, which lies in `U`.
have h_all (τ : Gal(Ω/K)) (hτ : IsFrob (placeOver w) (w.below K).q τ) : τ ∈ W := by
simpa using hU _ (hσ_frob.inv_mul_mem_of_inertiaGroup_le hτ (hw_unram _ hA) hσU)
exact ⟨w.below K, hw_notMem, hw_prime, placeOver w, hA, ((σ : H) : Gal(Ω/K)), h_all _ hσ_frob,
hσ_frob, h_all⟩
/-- Choose distinct finite primes outside `S` whose Frobenius elements lie in prescribed nonempty
open subsets of the absolute Galois group, one prime for each index in a finite family. -/
lemma New.chebotarev_family {K ι : Type} [Field K] [NumberField K] [Algebra K Ω] [Finite ι]
{W : ι → Set Gal(Ω/K)} (hW : ∀ i, IsOpen (W i)) (hW_ne : ∀ i, (W i).Nonempty)
{S : Set (FinPlace K)} (hS : S.Finite) :
∃ (v : ι → FinPlace K) (A : ι → ClosurePlace) (σ : ι → Gal(Ω/K)),
Function.Injective v ∧ ∀ i, v i ∉ S ∧ IsPlaceOver (A i) (v i) ∧ σ i ∈ W i ∧
IsFrob (A i) (v i).q (σ i) := by
classical
-- Make a sequence of choices, each avoiding every prime in the earlier families.
have h_choose (T : Set (ι → FinPlace K)) (hT : T.Finite) :
∃ v : ι → FinPlace K, ∀ i,
(v i ∉ S ∧ v i ∉ T.seq Set.univ) ∧
∃ A : ClosurePlace, IsPlaceOver A (v i) ∧ ∃ σ ∈ W i, IsFrob A (v i).q σ := by
choose v hv _hprime A hA σ hσ hfrob _hall using fun i ↦
chebotarev (hW i) (hW_ne i) (hS.union (hT.seq Set.finite_univ))
exact ⟨v, fun i ↦ ⟨not_or.mp (hv i), A i, hA i, σ i, hσ i, hfrob i⟩⟩
obtain ⟨u, hu⟩ := Set.seq_of_forall_finite_exists h_choose
-- Take each index from a different family in the sequence.
obtain ⟨e, he⟩ := exists_injective_nat ι
choose hv A hA σ hσ hfrob using fun i : ι ↦ hu (e i) i
have h_avoid (i : ι) : ∀ n < e i, ∀ j : ι, u n j ≠ u (e i) i := by
simpa [Set.mem_seq_iff] using (hv i).2
exact ⟨fun i ↦ u (e i) i, A, σ, by grind [Function.Injective],
fun i ↦ ⟨(hv i).1, hA i, hσ i, hfrob i⟩⟩