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.GroupTheory.Nilpotent |
| 4 | import Mathlib.RingTheory.Coalgebra.IsFrobenius |
| 5 | public import Lib.Cohomology.Etale.FilteredLimits |
| 6 | public import Lib.PadicComparison.Completion |
| 7 | |
| 8 | /-! |
| 9 | # ℓ-adic cohomology with its Galois action; finiteness and bijectivity from coefficients mod ℓ |
| 10 | |
| 11 | `ℓ`-adic cohomology is defined as `Ext` on test rings, with coefficients in the Witt vectors of the |
| 12 | locally constant `𝔽_ℓ`-valued functions on the spectrum. |
| 13 | |
| 14 | * `New.Variety.ellAdicCoeff`: the coefficient `ℤ_ℓ`; `New.Variety.ellAdicPull`: pull-back on |
| 15 | cohomology, over `ℚ_ℓ`. |
| 16 | * `New.Variety.ellAdicCohom`, `New.Variety.ellAdicCohom.galoisAction`: cohomology of the base change |
| 17 | to `Ω`, and the action of `Γ`. |
| 18 | * `New.Variety.exists_ellAdicCoeff_modShortExact_pow`, |
| 19 | `New.Variety.exists_ellAdicCoeff_modShortExact`: reduction modulo `ℓ ^ k` and `ℓ`; completeness. |
| 20 | * `New.Variety.finite_H_ellAdicCoeff`, `New.Variety.IsCohomEquiv.bijective_ellAdicPull`: finiteness |
| 21 | and bijectivity lift from `𝔽_ℓ`. |
| 22 | |
| 23 | Notions from other files: |
| 24 | * `New.Variety.ModShortExact`: `ModShortExact a q` says that `0 → Φ → Φ → G → 0`, formed by |
| 25 | multiplication by `a` and by `q`, is short exact. |
| 26 | * `New.Variety.TestRing`: The category of test rings (`New.Variety.IsTest`), as a full subcategory |
| 27 | of commutative rings; `New.Variety.testIncl` is its inclusion functor. |
| 28 | |
| 29 | ## Relation to the literature |
| 30 | |
| 31 | Known; see `Lib.Cohomology.Etale.FilteredLimits`, `Lib.PadicComparison.Completion` and |
| 32 | `Lib.PadicComparison.Primitive.ComparisonTheorem` for sources. |
| 33 | -/ |
| 34 | |
| 35 | @[expose] public section |
| 36 | |
| 37 | noncomputable section |
| 38 | |
| 39 | namespace New.Variety |
| 40 | |
| 41 | open CategoryTheory AlgebraicGeometry CommRingCat LocallyConstant WittVector Function AddCommGrpCat |
| 42 | TensorProduct Pi |
| 43 | |
| 44 | variable {ℓ : ℕ} [ThePrime ℓ] {n : ℕ} (R : CommRingCat) |
| 45 | (Ω : Type) [CommRing Ω] [Algebra R Ω] |
| 46 | (Γ : Type*) [Group Γ] [MulSemiringAction Γ Ω] [SMulCommClass Γ R Ω] |
| 47 | |
| 48 | /-! ### Definitions -/ |
| 49 | |
| 50 | /-- The coefficient `ℤ_ℓ`: a test ring `A` goes to the Witt vectors of the ring of locally constant |
| 51 | functions `Spec A → 𝔽_ℓ`. -/ |
| 52 | abbrev ellAdicCoeff : AbFunctor TestRing := |
| 53 | moduleCoeff (asModules ((testIncl ⋙ locConstAlg) ⋙ wittFunctor ℤ_[ℓ])) |
| 54 | |
| 55 | /-- Pull-back along `α : M ⟶ N` on `ℚ_ℓ ⊗ Ext^n(-, ℤ_ℓ)`, as an additive function of `α`. -/ |
| 56 | def ellAdicPull (n : ℕ) {M N : AbFunctor TestRing} : |
| 57 | (M ⟶ N) →+ ℚ_[ℓ] ⊗[ℤ_[ℓ]] H N ellAdicCoeff n →ₗ[ℚ_[ℓ]] ℚ_[ℓ] ⊗[ℤ_[ℓ]] H M ellAdicCoeff n := |
| 58 | AddMonoidHom.mk' (fun α : M ⟶ N ↦ (H.mapₗ ℤ_[ℓ] ellAdicCoeff α n).baseChange ℚ_[ℓ]) |
| 59 | fun α β ↦ LinearMap.restrictScalars_injective ℤ_[ℓ] <| TensorProduct.ext' fun r x ↦ by |
| 60 | change r ⊗ₜ H.map ellAdicCoeff (α + β) n x = |
| 61 | r ⊗ₜ H.map ellAdicCoeff α n x + r ⊗ₜ H.map ellAdicCoeff β n x |
| 62 | rw [← tmul_add] |
| 63 | exact congrArg (r ⊗ₜ ·) |
| 64 | (DFunLike.congr_fun ((H.mapHom ellAdicCoeff M N n).map_add α β) x) |
| 65 | |
| 66 | /-- Pulling back along `β` and then along `α` is pulling back along `α ≫ β`. -/ |
| 67 | lemma ellAdicPull.comp {M N K : AbFunctor TestRing} (α : M ⟶ N) (β : N ⟶ K) |
| 68 | (x : ℚ_[ℓ] ⊗[ℤ_[ℓ]] H K ellAdicCoeff n) : |
| 69 | ellAdicPull (ℓ := ℓ) n α (ellAdicPull n β x) = ellAdicPull n (α ≫ β) x := by |
| 70 | induction x with |
| 71 | | tmul r y => simp [ellAdicPull, H.mapₗ, H.map_comp] |
| 72 | | add x y hx hy => simp [hx, hy] |
| 73 | |
| 74 | /-- The functor of points (a functor from commutative rings to types, `PointFunctor`) of the base |
| 75 | change `X ×_R Ω` of a scheme `X` over `R`. -/ |
| 76 | def geomPoints : Over (Spec R) ⥤ PointFunctor where |
| 77 | obj X := baseChangeOf (pointsToBase X.hom) (ofHom (algebraMap R Ω)) |
| 78 | -- a point is a pair (point of `X`, ring map out of `Ω`); compose the first with `f` |
| 79 | map {X Y} f := |
| 80 | { app B := |
| 81 | ↾fun x ↦ |
| 82 | ⟨(ULift.up (x.1.1.1 ≫ f.1), x.1.2), by |
| 83 | -- `f` is a map over `Spec R`, so the new point lies over the same map out of `R` |
| 84 | have h_over : (x.1.1.1 ≫ f.1) ≫ Y.hom = x.1.1.1 ≫ X.hom := |
| 85 | (Category.assoc ..).trans (congrArg (x.val.1.down ≫ ·) f.w) |
| 86 | exact (congrArg (fun h ↦ ULift.up (Spec.preimage h)) h_over).trans x.property⟩ |
| 87 | naturality _ _ _ := by |
| 88 | ext x |
| 89 | exact baseChangeOf.ext (congrArg ULift.up (Category.assoc ..)) fun _ ↦ rfl } |
| 90 | map_id _ := by |
| 91 | ext B x |
| 92 | exact baseChangeOf.ext (congrArg ULift.up (Category.comp_id _)) fun _ ↦ rfl |
| 93 | map_comp _ _ := by |
| 94 | ext B x |
| 95 | exact baseChangeOf.ext (congrArg ULift.up (Category.assoc ..).symm) fun _ ↦ rfl |
| 96 | |
| 97 | /-- Geometric `ℓ`-adic cohomology in degree `n`: `X ↦ ℚ_ℓ ⊗ H^n(X ×_R Ω, ℤ_ℓ)`. -/ |
| 98 | def ellAdicCohom (n : ℕ) : (Over (Spec R))ᵒᵖ ⥤ ModuleCat ℚ_[ℓ] := |
| 99 | (geomPoints R Ω).op ⋙ |
| 100 | { obj X := ModuleCat.of ℚ_[ℓ] (ℚ_[ℓ] ⊗[ℤ_[ℓ]] H (freeAb.obj (testIncl ⋙ X.unop)) ellAdicCoeff n) |
| 101 | map u := ModuleCat.ofHom (ellAdicPull n (freeAb.map (mapOnTests u.unop))) |
| 102 | map_id X := ModuleCat.hom_ext <| LinearMap.restrictScalars_injective ℤ_[ℓ] <| |
| 103 | TensorProduct.ext' fun r x ↦ by |
| 104 | change r ⊗ₜ H.map ellAdicCoeff (freeAb.map (mapOnTests (𝟙 X.unop))) n x = r ⊗ₜ x |
| 105 | rw [show mapOnTests (𝟙 X.unop) = 𝟙 _ from Functor.whiskerLeft_id testIncl, |
| 106 | freeAb.map_id, H.map_id] |
| 107 | map_comp f g := ModuleCat.hom_ext <| LinearMap.ext fun x ↦ |
| 108 | (congrArg (fun u ↦ ellAdicPull n u x) <| by |
| 109 | dsimp only [mapOnTests] |
| 110 | rw [unop_comp, Functor.whiskerLeft_comp, freeAb.map_comp]).trans |
| 111 | (ellAdicPull.comp _ _ x).symm } |
| 112 | |
| 113 | /-- The action on `H^n(X ×_R Ω)` of a group `Γ` acting on `Ω` by `R`-algebra automorphisms. -/ |
| 114 | def ellAdicCohom.galoisAction (X : Over (Spec R)) (n : ℕ) : |
| 115 | Representation ℚ_[ℓ] Γ (ellAdicCohom R Ω n ⟨X⟩) := |
| 116 | -- an `R`-automorphism `g` of `Ω` acts on the points over `Ω`, hence on their cohomology |
| 117 | MonoidHom.comp |
| 118 | { toFun (g : Ω ≃ₐ[R] Ω) := |
| 119 | ellAdicPull n (freeAb.map (mapOnTests (baseChangeTransition _ (CommRingCat.ofHom g) |
| 120 | (by ext r; exact g.commutes r)))) |
| 121 | map_one' := congr($((ellAdicCohom R Ω n).map_id (Opposite.op X)).hom) |
| 122 | map_mul' g g' := LinearMap.ext fun x ↦ by |
| 123 | let tr (h : Ω ≃ₐ[R] Ω) : |
| 124 | ((geomPoints R Ω).op.obj ⟨X⟩).unop ⟶ ((geomPoints R Ω).op.obj ⟨X⟩).unop := |
| 125 | baseChangeTransition (pointsToBase X.hom) (CommRingCat.ofHom h) |
| 126 | (by ext r; exact h.commutes r) |
| 127 | have h_tr : tr g ≫ tr g' = tr (g * g') := by |
| 128 | ext B z |
| 129 | exact baseChangeOf.ext rfl fun _ ↦ rfl |
| 130 | have h_free : freeAb.map (mapOnTests (tr (g * g'))) = |
| 131 | freeAb.map (mapOnTests (tr g)) ≫ freeAb.map (mapOnTests (tr g')) := by |
| 132 | dsimp only [mapOnTests] |
| 133 | rw [← freeAb.map_comp, ← Functor.whiskerLeft_comp, h_tr] |
| 134 | exact (congrArg (fun u ↦ ellAdicPull n u x) h_free).trans |
| 135 | (ellAdicPull.comp (freeAb.map (mapOnTests (tr g))) |
| 136 | (freeAb.map (mapOnTests (tr g'))) x).symm } |
| 137 | (MulSemiringAction.toAlgAut Γ R Ω) |
| 138 | |
| 139 | /-- Pull-back along a map `f : X ⟶ Y` of `R`-schemes commutes with the action of `Γ`. -/ |
| 140 | lemma ellAdicCohom.map_galoisAction {X Y : Over (Spec R)} (f : X ⟶ Y) (g : Γ) |
| 141 | (x : ((ellAdicCohom R Ω n).obj (Opposite.op Y))) : |
| 142 | (ellAdicCohom R Ω n).map f.op (galoisAction R Ω Γ Y n g x) = |
| 143 | galoisAction R Ω Γ X n g ((ellAdicCohom R Ω n).map f.op x) := by |
| 144 | -- both sides are pull-backs along a composite, and the two composites are the same map |
| 145 | let g_aut := MulSemiringAction.toAlgAut Γ R Ω g |
| 146 | let fm : ((geomPoints R Ω).op.obj ⟨X⟩).unop ⟶ ((geomPoints R Ω).op.obj ⟨Y⟩).unop := |
| 147 | ((geomPoints R Ω).op.map f.op).unop |
| 148 | let tr (Z : Over (Spec R)) : |
| 149 | ((geomPoints R Ω).op.obj ⟨Z⟩).unop ⟶ ((geomPoints R Ω).op.obj ⟨Z⟩).unop := |
| 150 | baseChangeTransition (pointsToBase Z.hom) (CommRingCat.ofHom g_aut) |
| 151 | (by ext r; exact g_aut.commutes r) |
| 152 | have h_comm : fm ≫ tr Y = tr X ≫ fm := by |
| 153 | ext B z |
| 154 | exact baseChangeOf.ext rfl fun _ ↦ rfl |
| 155 | have h_free : freeAb.map (mapOnTests fm) ≫ freeAb.map (mapOnTests (tr Y)) = |
| 156 | freeAb.map (mapOnTests (tr X)) ≫ freeAb.map (mapOnTests fm) := by |
| 157 | dsimp only [mapOnTests] |
| 158 | rw [← freeAb.map_comp, ← freeAb.map_comp, ← Functor.whiskerLeft_comp, |
| 159 | ← Functor.whiskerLeft_comp, h_comm] |
| 160 | exact (ellAdicPull.comp (freeAb.map (mapOnTests fm)) (freeAb.map (mapOnTests (tr Y))) x).trans <| |
| 161 | (congrArg (fun u ↦ ellAdicPull n u x) h_free).trans |
| 162 | (ellAdicPull.comp (freeAb.map (mapOnTests (tr X))) (freeAb.map (mapOnTests fm)) x).symm |
| 163 | |
| 164 | /-! ### Comparison with finite coefficients -/ |
| 165 | |
| 166 | /-- There is an exact sequence `0 → ℤ_ℓ → ℤ_ℓ → W_k(𝔽_ℓ) → 0` of coefficients whose first map is |
| 167 | `ℓ ^ k`, where the third term is the locally constant functions with values in `W_k(𝔽_ℓ)`, the |
| 168 | Witt vectors of length `k`. -/ |
| 169 | lemma exists_ellAdicCoeff_modShortExact_pow (k : ℕ) : |
| 170 | ∃ q : ellAdicCoeff ⟶ locConstCoeff ⟨TruncatedWittVector ℓ k (ZMod ℓ)⟩, |
| 171 | ModShortExact ↑(ℓ ^ k) q := by |
| 172 | -- A truncated Witt vector of locally constant functions is a locally constant function with |
| 173 | -- values in truncated Witt vectors (`unflip`); `q` is truncation followed by this. |
| 174 | let C (A : TestRing) := LocallyConstant (PrimeSpectrum (testIncl.obj A)) (ZMod ℓ) |
| 175 | let tr (A : TestRing) : WittVector ℓ (C A) →+ |
| 176 | LocallyConstant (PrimeSpectrum (testIncl.obj A)) (TruncatedWittVector ℓ k (ZMod ℓ)) := |
| 177 | .mk' (fun x ↦ unflip (truncate k x)) fun x y ↦ LocallyConstant.ext fun a ↦ |
| 178 | ((truncate k).comp (map (evalRingHom a : C A →+* ZMod ℓ))).map_add x y |
| 179 | refine ⟨_, |
| 180 | modShortExact_of_isReductionMod (q := .mk fun A ↦ AddCommGrpCat.ofHom (tr A)) fun A ↦ ?_⟩ |
| 181 | -- `W(C A)` has no `ℓ`-torsion (`h_torsion_free`), and the first `k` coordinates of a Witt vector |
| 182 | -- vanish exactly when it is a multiple of `ℓ ^ k` (`h_coeff_iff`) |
| 183 | obtain ⟨-, h_torsion_free, -, h_coeff_iff⟩ := |
| 184 | isReductionMod_constantCoeff_and_isCompleteTorsionFree (p := ℓ) (ZMod ℓ) |
| 185 | (locConstAlg.obj (testIncl.obj A)) |
| 186 | -- to show: no `ℓ ^ k`-torsion, `tr A` is onto, and its kernel is the multiples of `ℓ ^ k` |
| 187 | refine ⟨h_torsion_free.regular.pow k, fun y ↦ ?_, fun x ↦ Iff.trans ?_ (h_coeff_iff k x)⟩ |
| 188 | · obtain ⟨x, hx⟩ := truncate_surjective ℓ k (C A) y.flip |
| 189 | exact ⟨x, congrArg unflip hx⟩ |
| 190 | · -- `tr A x = 0` says that the first `k` coordinates of `x` vanish |
| 191 | have h_tr_zero : tr A x = 0 ↔ truncate k x = 0 := by |
| 192 | simpa only [map_zero] using |
| 193 | (⟨congrArg LocallyConstant.flip, congrArg unflip⟩ : |
| 194 | tr A x = tr A 0 ↔ truncate k x = truncate k 0) |
| 195 | exact h_tr_zero.trans (mem_ker_truncate k x) |
| 196 | |
| 197 | /-- Two facts on the coefficient `ℤ_ℓ`: (a) there is a map `q` to `𝔽_ℓ` with |
| 198 | `0 → ℤ_ℓ → ℤ_ℓ → 𝔽_ℓ → 0` exact, the first map being `ℓ`; (b) every `Ext^n(N, ℤ_ℓ)` is derived |
| 199 | `ℓ`-complete (`IsDerivedComplete`; `ℓ`-adic completeness implies it, and it allows solving by |
| 200 | successive approximation) (this does not involve `q`). -/ |
| 201 | lemma exists_ellAdicCoeff_modShortExact : |
| 202 | ∃ q : ellAdicCoeff ⟶ locConstCoeff ⟨ZMod ℓ⟩, |
| 203 | ModShortExact ↑ℓ q ∧ |
| 204 | ∀ (N : AbFunctor TestRing) (n : ℕ), IsDerivedComplete (ℓ : ℤ_[ℓ]) (H N ellAdicCoeff n) := by |
| 205 | -- `q` is the zeroth Witt coordinate; both claims are checked at each test ring. |
| 206 | let C (A : TestRing) : CommAlg (ZMod ℓ) := (locConstAlg (p := ℓ)).obj (testIncl.obj A) |
| 207 | refine ⟨_, modShortExact_of_isReductionMod |
| 208 | (q := .mk fun _ ↦ AddCommGrpCat.ofHom constantCoeff.toAddMonoidHom) fun A ↦ ?_, ?_⟩ |
| 209 | · -- at a test ring `A`, the zeroth coordinate is reduction modulo `ℓ` on an `ℓ`-torsion-free ring |
| 210 | obtain ⟨h_red, h_complete, -, -⟩ := isReductionMod_constantCoeff_and_isCompleteTorsionFree |
| 211 | (ZMod ℓ) (C A) |
| 212 | exact ⟨h_complete.regular, h_red⟩ |
| 213 | · -- the coefficients are `ℓ`-adically complete and `ℓ`-torsion-free at every test ring, hence |
| 214 | -- derived `ℓ`-complete, and so their cohomology is derived `ℓ`-complete |
| 215 | refine IsDerivedComplete.cohomology fun A ↦ ?_ |
| 216 | obtain ⟨-, h_complete, -, -⟩ := isReductionMod_constantCoeff_and_isCompleteTorsionFree (ZMod ℓ) |
| 217 | (C A) |
| 218 | exact IsCompleteTorsionFree.isDerivedComplete (B := (wittFunctor _).obj _) h_complete |
| 219 | |
| 220 | /-- If `Ext^n(N, 𝔽_ℓ)` is finite, then `Ext^n(N, ℤ_ℓ)` is a finitely generated `ℤ_ℓ`-module. -/ |
| 221 | lemma finite_H_ellAdicCoeff {N : AbFunctor TestRing} |
| 222 | (h_finite : Finite (H N (locConstCoeff ⟨ZMod ℓ⟩) n)) : |
| 223 | Module.Finite ℤ_[ℓ] (H N ellAdicCoeff n) := by |
| 224 | -- Write `H = Ext^n(N, ℤ_ℓ)` and `q` for its reduction modulo `ℓ`. Choose lifts (`invFun q`) of |
| 225 | -- the classes in the image of `q`: they give a map `f` to `H` from the free module on the finite |
| 226 | -- set `Ext^n(N, 𝔽_ℓ)` with `H = im f + ℓ H`, and completeness of both sides makes `f` onto. |
| 227 | obtain ⟨c, h_exact, h_complete⟩ := exists_ellAdicCoeff_modShortExact (ℓ := ℓ) |
| 228 | let q : H N ellAdicCoeff n →+ H N (locConstCoeff ⟨ZMod ℓ⟩) n := H.push N c n |
| 229 | let b := basisFun ℤ_[ℓ] (H N (locConstCoeff ⟨ZMod ℓ⟩) n) |
| 230 | let f : (H N (locConstCoeff ⟨ZMod ℓ⟩) n → ℤ_[ℓ]) →ₗ[ℤ_[ℓ]] H N ellAdicCoeff n := |
| 231 | b.constr ℕ (invFun q) |
| 232 | have hZ : IsDerivedComplete (ℓ : ℤ_[ℓ]) ℤ_[ℓ] := .of_isAdicComplete <| by |
| 233 | rw [← PadicInt.maximalIdeal_eq_span_p] |
| 234 | infer_instance |
| 235 | -- successive approximation: it is enough to write each `y` as an element of `im f` plus `ℓ • z` |
| 236 | refine .of_surjective f ((h_complete N n).exists_apply_eq_of_approx hZ.pi f id fun y ↦ ?_) |
| 237 | -- `y` and the chosen lift of `q y` have the same reduction, so they differ by a multiple of `ℓ` |
| 238 | have h_push_zero : H.push N c n (y - invFun q (q y)) = 0 := by simp [q, invFun_eq] |
| 239 | obtain ⟨z, hz⟩ := h_exact.exists_smul_eq_of_push_eq_zero (y - invFun q (q y)) h_push_zero |
| 240 | have h_approx : y = f (b (q y)) + (ℓ : ℤ_[ℓ]) • z := by simp [f, hz] |
| 241 | exact ⟨b (q y), z, h_approx⟩ |
| 242 | |
| 243 | /-- An equivalence for `𝔽_ℓ`-coefficients induces bijections on `ℓ`-adic cohomology. -/ |
| 244 | lemma IsCohomEquiv.bijective_ellAdicPull {M N : AbFunctor TestRing} {α : M ⟶ N} |
| 245 | (h_equiv : IsCohomEquiv (locConstCoeff ⟨ZMod ℓ⟩) α) : |
| 246 | Bijective (ellAdicPull (ℓ := ℓ) n α) := by |
| 247 | obtain ⟨q, h_exact, h_complete⟩ := exists_ellAdicCoeff_modShortExact (ℓ := ℓ) |
| 248 | -- Bijective modulo `ℓ` and derived `ℓ`-complete on both sides, so bijective over `ℤ_ℓ`: `of_mod` |
| 249 | -- applied to the identity map of coefficients. |
| 250 | have hZ : IsCohomEquiv ellAdicCoeff α := |
| 251 | (h_equiv.bij.of_mod (β := 𝟙 (𝟭 _ ⋙ _)) h_exact h_exact rfl (fun m _ ↦ h_complete N m) |
| 252 | (h_complete M)).eqv |
| 253 | -- `ellAdicPull` is the base change of this map to `ℚ_ℓ` |
| 254 | exact map_bijective (f := 1) bijective_id (hZ n) |
| 255 | |
| 256 | end New.Variety |
| 257 | |
| 258 | end |