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 | import Mathlib.RingTheory.Etale.Weakly |
| 4 | import Mathlib.RingTheory.Regular.IsSMulRegular |
| 5 | import Mathlib.RingTheory.TotallySplit |
| 6 | public import Lib.Cohomology.Etale.Basic |
| 7 | public import Lib.PadicHodge.PeriodRings.Ainf |
| 8 | |
| 9 | /-! |
| 10 | # Divided power ideal, p-adic test rings, tilt, Witt vectors and reduction modulo p |
| 11 | |
| 12 | This file sets up basic objects of the p-adic and crystalline comparison, for a prime p. |
| 13 | O_C = `New.OC` is the ring of integers of ℂ_p, O♭ = `New.Period.OFlat` is its tilt, and |
| 14 | ξ = `New.Period.xi` generates ker θ in A_inf = W(O♭). The prime p is implicit in `New.Period.OFlat` |
| 15 | and `New.Period.xi`. The file defines the ideal 𝔡(S) of the x with n! ∣ x^n for all n, and |
| 16 | categories of p-complete p-torsion-free test rings. Finally, it collects the commutative algebra of |
| 17 | flatness, reduction modulo an element and Witt vectors that is used throughout the p-adic |
| 18 | comparison. |
| 19 | |
| 20 | ## Main definitions and results |
| 21 | |
| 22 | * `New.Variety.pdIdeal`: the ideal 𝔡(S) of the x with n! ∣ x^n for all n. |
| 23 | `New.Variety.pdIdeal_le_comap`: ring maps send 𝔡(B) into 𝔡(k). |
| 24 | * `New.Variety.IsCompleteTorsionFree` and `New.Variety.CrysTest`: p-torsion-free p-complete rings, |
| 25 | and the category of such S-algebras. `New.Variety.CrysTest.restrictScalars` restricts scalars. |
| 26 | * `New.Variety.baseChangeMap`, `New.Variety.HasFlatBaseChange`: the map M ⊗ H^n(N, Φ) → H^n(N, |
| 27 | M ⊗ Φ), and the statement that it is bijective for flat M. |
| 28 | * `New.Variety.IsCell`, `New.Variety.PadicTest`: cells, and p-adic tests, which are non-empty |
| 29 | products S of cells with a map from O_C = `New.OC`. |
| 30 | * `New.Variety.PadicTest.tilt`, `New.Variety.algCompletion`, `New.Variety.wittFunctor`, |
| 31 | `New.Variety.periodAlg`: tilt, p-adic completion, Witt vectors, and the completion of T ⊗ W(b) |
| 32 | over A_inf. |
| 33 | |
| 34 | Notions from other files: |
| 35 | * `New.Variety.Comparison`: A comparison from F on C to F' on C': a functor φ: C' → C with a natural |
| 36 | transformation β: F∘φ → F'. |
| 37 | |
| 38 | ## Relation to the literature |
| 39 | |
| 40 | Known; see `Lib.PadicComparison.Crystalline.ComparisonMap`, `Lib.PadicComparison.Completion`, |
| 41 | `Lib.PadicComparison.Descent.AlmostDescent` and `Lib.PadicComparison.HodgeTate.PeriodMap` for |
| 42 | sources. |
| 43 | -/ |
| 44 | |
| 45 | @[expose] public section |
| 46 | |
| 47 | noncomputable section |
| 48 | |
| 49 | namespace New.Variety |
| 50 | |
| 51 | /-! |
| 52 | ## The divided power ideal and p-complete p-torsion-free test rings |
| 53 | |
| 54 | No divided power structure is chosen. |
| 55 | -/ |
| 56 | |
| 57 | section CrystallineTests |
| 58 | |
| 59 | open CategoryTheory ObjectProperty Ideal Nat Finset Adic |
| 60 | |
| 61 | variable {p : ℕ} [ThePrime p] (S : Type) [CommRing.{0} S] |
| 62 | {B k : Type} [CommRing B] [CommRing k] (f : B →+* k) |
| 63 | |
| 64 | /-- The ideal 𝔡(S) of the elements x of S such that n! divides x^n for every n. -/ |
| 65 | def pdIdeal : Ideal S where |
| 66 | carrier := {x : S | ∀ n : ℕ, ↑n ! ∣ x ^ n} |
| 67 | add_mem' {x y : S} hx hy n := by |
| 68 | rw [add_pow] |
| 69 | refine dvd_sum fun j hj ↦ ?_ |
| 70 | -- Each term of the binomial expansion is divisible by `n ! = j ! * (n - j)! * n.choose j`. |
| 71 | have h_fact : (n ! : S) = j ! * (n - j)! * n.choose j := by |
| 72 | rw [← choose_mul_factorial_mul_factorial (mem_range_succ_iff.mp hj), cast_mul, cast_mul, |
| 73 | mul_assoc, mul_comm] |
| 74 | rw [h_fact] |
| 75 | exact mul_dvd_mul_right (mul_dvd_mul (hx j) (hy (n - j))) _ |
| 76 | zero_mem' n := by cases n <;> simp |
| 77 | smul_mem' (c : S) {x : S} hx n := by |
| 78 | simpa [mul_pow] using dvd_mul_of_dvd_right (hx n) (c ^ n) |
| 79 | |
| 80 | /-- A ring map `f : B → k` sends the ideal `pdIdeal B` of the `x` with `n! ∣ x ^ n` for all `n` |
| 81 | into `pdIdeal k`. -/ |
| 82 | lemma pdIdeal_le_comap : pdIdeal B ≤ comap f (pdIdeal k) := |
| 83 | fun x hx n ↦ by simpa using map_dvd f (hx n) |
| 84 | |
| 85 | /-- The quotient map S → S/𝔡(S), where 𝔡(S) = `New.Variety.pdIdeal` S is the ideal of the x with n! |
| 86 | dividing x^n for all n. -/ |
| 87 | abbrev pdQuotientMk : S →+* S ⧸ pdIdeal S := Ideal.Quotient.mk (pdIdeal S) |
| 88 | |
| 89 | /-- For a ring homomorphism f: B → k, the induced homomorphism B/𝔡(B) → k/𝔡(k), where 𝔡 is the ideal |
| 90 | `New.Variety.pdIdeal`. -/ |
| 91 | abbrev pdQuotientMap : B ⧸ pdIdeal B →+* k ⧸ pdIdeal k := |
| 92 | quotientMap (pdIdeal k) f (pdIdeal_le_comap f) |
| 93 | |
| 94 | /-- The ring S is p-torsion-free and p-adically complete. -/ |
| 95 | structure IsCompleteTorsionFree [ThePrime p] where |
| 96 | /-- `S` is `p`-torsion-free: multiplication by `p` is injective. -/ |
| 97 | regular : IsSMulRegular S p |
| 98 | /-- `S` is `p`-adically complete. -/ |
| 99 | complete : IsAdicComplete (span {(p : S)}) S |
| 100 | |
| 101 | /-- The full subcategory of commutative S-algebras that are p-torsion-free and p-adically |
| 102 | complete. -/ |
| 103 | abbrev CrysTest : Type 1 := FullSubcategory fun A : CommAlg S ↦ IsCompleteTorsionFree A |
| 104 | |
| 105 | /-- For a ring map r: k → B/𝔡(B), the functor A ↦ A/𝔡(A) from p-torsion-free p-complete B-algebras |
| 106 | to k-algebras, with 𝔡 the ideal `New.Variety.pdIdeal`. -/ |
| 107 | def pdReduction (r : k →+* B ⧸ pdIdeal B) : CrysTest B ⥤ CommAlg k := by |
| 108 | -- `A ⧸ pdIdeal A` is a `k`-algebra through `k → B ⧸ pdIdeal B → A ⧸ pdIdeal A`. |
| 109 | let (A : CrysTest B) := ((pdQuotientMap (algebraMap B A.obj)).comp r).toAlgebra |
| 110 | refine |
| 111 | { obj A := .of k (A.obj.carrier ⧸ pdIdeal A.obj.carrier) |
| 112 | map f := |
| 113 | ConcreteCategory.ofHom ⟨pdQuotientMap f.hom.hom'.toRingHom, fun a ↦ by |
| 114 | -- On a representative `b : B` of `r a` this says that `f` is a `B`-algebra map. |
| 115 | change pdQuotientMap _ (pdQuotientMap _ (r a)) = pdQuotientMap _ (r a) |
| 116 | obtain ⟨b⟩ := r a |
| 117 | exact congrArg (pdQuotientMk _) (f.hom.hom'.commutes' b)⟩ |
| 118 | map_id _ := ?_ |
| 119 | map_comp _ _ := ?_ } |
| 120 | -- Both functor laws hold on representatives. |
| 121 | all_goals |
| 122 | ext ⟨⟩ |
| 123 | rfl |
| 124 | |
| 125 | /-- Restriction of scalars along S → B, from p-torsion-free p-complete B-algebras to p-torsion-free |
| 126 | p-complete S-algebras. -/ |
| 127 | def CrysTest.restrictScalars [Algebra S B] : CrysTest B ⥤ CrysTest S := |
| 128 | lift _ (ι _ ⋙ restrictAlg S B) fun A ↦ A.property |
| 129 | |
| 130 | /-- If `p` is a non-zero-divisor on `B`, the `p`-adic completion `PrincipalCompletion B p` is |
| 131 | `p`-torsion-free and `p`-adically complete. -/ |
| 132 | lemma isCompleteTorsionFree_completion (h_reg : IsSMulRegular B p) : |
| 133 | IsCompleteTorsionFree (PrincipalCompletion B p) where |
| 134 | regular := isSMulRegular_completion h_reg |
| 135 | complete := isAdicComplete |
| 136 | |
| 137 | end CrystallineTests |
| 138 | |
| 139 | /-! |
| 140 | ## The test category and coefficient functors |
| 141 | |
| 142 | The test category and the coefficient functors of the p-adic comparison theorems. Cohomology |
| 143 | `New.Variety.H` N F n is an Ext group of functors C → Ab, and `New.Variety.moduleCoeff` makes a |
| 144 | functor to modules into coefficients. |
| 145 | -/ |
| 146 | |
| 147 | section PadicTests |
| 148 | |
| 149 | open CategoryTheory Functor CommAlgCat TensorProduct Ideal AdicCompletion Period WittVector |
| 150 | ModuleCat H |
| 151 | |
| 152 | variable {C C' : Type 1} [Category C] [Category C'] {S : Type} [CommRing S] (p : ℕ) [ThePrime p] |
| 153 | (T M : Type) [CommRing T] [Algebra S T] [AddCommGroup M] [Module S M] [Module T M] |
| 154 | [IsScalarTower S T M] (m : M) (φ : C' ⥤ C) (N : AbFunctor C) (Φ : C ⥤ ModuleCat S) |
| 155 | |
| 156 | /-! ### Tensor products of coefficients -/ |
| 157 | |
| 158 | /-- For a functor Φ to commutative S-algebras, the functor of underlying S-modules. -/ |
| 159 | abbrev asModules (Φ : C ⥤ CommAlg S) : C ⥤ ModuleCat S := |
| 160 | Φ ⋙ forget₂ (CommAlg S) (AlgCat S) ⋙ forget₂ (AlgCat S) (ModuleCat S) |
| 161 | |
| 162 | /-- For a module M over the S-algebra T, the functor X ↦ M ⊗_S X from S-modules to T-modules. -/ |
| 163 | def tensorWith : ModuleCat.{0} S ⥤ ModuleCat T where |
| 164 | obj X := ModuleCat.of T (M ⊗[S] X) |
| 165 | map f := ModuleCat.ofHom (AlgebraTensorModule.lTensor T M f.hom) |
| 166 | |
| 167 | instance : (tensorWith (S := S) T M).Additive where |
| 168 | map_add {X Y : ModuleCat S} {f g : X ⟶ Y} := |
| 169 | Hom.ext (map_add (AlgebraTensorModule.lTensor T M) f.hom g.hom) |
| 170 | |
| 171 | variable {M} in |
| 172 | /-- For m in M and a functor Φ to S-modules, the natural map of abelian-group-valued coefficient |
| 173 | functors Φ → M ⊗_S Φ sending x to m ⊗ x. -/ |
| 174 | def tensorWith.mk : moduleCoeff Φ ⟶ moduleCoeff (Φ ⋙ tensorWith T M) := |
| 175 | whiskerRight {app A := AddCommGrpCat.ofHom (TensorProduct.mk S M (Φ A) m).toAddMonoidHom} |
| 176 | AddCommGrpCat.uliftFunctor |
| 177 | |
| 178 | variable {M} in |
| 179 | /-- The map `x ↦ m ⊗ x` is additive in `m`. -/ |
| 180 | lemma tensorWith.mk_add (a b : M) : |
| 181 | tensorWith.mk T (a + b) Φ = tensorWith.mk T a Φ + tensorWith.mk T b Φ := by |
| 182 | ext |
| 183 | exact ULift.down_injective (add_tmul ..) |
| 184 | |
| 185 | variable {M} in |
| 186 | /-- Scalars from `S` pass through the tensor sign, where `End.asHom (CoeffAction.act s)` is |
| 187 | multiplication by `s` on the coefficient functor `moduleCoeff Φ`: `(s • m) ⊗ x = m ⊗ (s • x)`. -/ |
| 188 | lemma tensorWith.mk_smul (s : S) : |
| 189 | tensorWith.mk T (s • m) Φ = End.asHom (CoeffAction.act s) ≫ tensorWith.mk T m Φ := by |
| 190 | ext |
| 191 | exact ULift.down_injective (smul_tmul ..) |
| 192 | |
| 193 | /-- The canonical T-linear map M ⊗_S H^n(N, Φ) → H^n(N, M ⊗_S Φ), sending m ⊗ z to the image of |
| 194 | z under x ↦ m ⊗ x. -/ |
| 195 | def baseChangeMap (n : ℕ) : |
| 196 | M ⊗[S] H N (moduleCoeff Φ) n →ₗ[T] H N (moduleCoeff (Φ ⋙ tensorWith T M)) n where |
| 197 | toAddHom := AddMonoidHom.toAddHom <| |
| 198 | liftAddHom |
| 199 | ((pushHom N (moduleCoeff Φ) (moduleCoeff (Φ ⋙ tensorWith T M)) n).comp |
| 200 | (AddMonoidHom.mk' (tensorWith.mk T · Φ) (tensorWith.mk_add T Φ))) |
| 201 | fun (s : S) m x ↦ by |
| 202 | change push N (tensorWith.mk T (s • m) Φ) n x = _ |
| 203 | rw [tensorWith.mk_smul, push_comp] |
| 204 | rfl |
| 205 | map_smul' t x := by |
| 206 | induction x with |
| 207 | | add x y hx hy => simp_all |
| 208 | | tmul m x => |
| 209 | -- By `push_comp`, as `tensorWith.mk T (t • m) Φ` is `tensorWith.mk T m Φ` followed by `t`. |
| 210 | exact .symm (push_comp ..).symm |
| 211 | |
| 212 | /-- The abelian-group-valued functor N : `New.Variety.AbFunctor` C on C has flat base change: M ⊗_S |
| 213 | H^n(N, Φ) → H^n(N, M ⊗_S Φ) is bijective for all n, all functors Φ to S-modules and all S-flat M. -/ |
| 214 | def HasFlatBaseChange : Prop := |
| 215 | ∀ (S T M : Type) [CommRing S] [CommRing T] [Algebra S T] [AddCommGroup M] [Module S M] |
| 216 | [Module T M] [IsScalarTower S T M] [Module.Flat S M] (Φ : C ⥤ ModuleCat S) (n : ℕ), |
| 217 | Function.Bijective (baseChangeMap T M N Φ n) |
| 218 | |
| 219 | variable {Φ} |
| 220 | |
| 221 | /-- For a natural map β: Φ → Ψ of functors to S-modules, the induced map of abelian-group-valued |
| 222 | coefficient functors. -/ |
| 223 | def coeffMap {Ψ : C ⥤ ModuleCat S} (β : Φ ⟶ Ψ) : moduleCoeff Φ ⟶ moduleCoeff Ψ := |
| 224 | whiskerRight (whiskerRight β (forget₂ (ModuleCat S) Ab)) AddCommGrpCat.uliftFunctor |
| 225 | |
| 226 | /-- The cohomological comparison datum along a functor φ: C' → C whose coefficient map comes |
| 227 | from a natural transformation Φ∘φ → Φ' of module-valued functors. -/ |
| 228 | abbrev Comparison.ofModuleHom {Φ' : C' ⥤ ModuleCat S} (β : φ ⋙ Φ ⟶ Φ') : |
| 229 | Comparison (moduleCoeff Φ) (moduleCoeff Φ') := |
| 230 | of (F := moduleCoeff Φ) φ (coeffMap β) |
| 231 | |
| 232 | /-- The cohomological comparison datum along a functor φ: C' → C from an abelian-group-valued |
| 233 | functor N to N∘φ, with identity coefficient map. -/ |
| 234 | abbrev Comparison.restrict : Comparison N (φ ⋙ N) := of φ (𝟙 (φ ⋙ N)) |
| 235 | |
| 236 | /-- Base change along S → T: the functor B ↦ T ⊗_S B from commutative S-algebras to commutative |
| 237 | T-algebras. -/ |
| 238 | def algBaseChange : CommAlg S ⥤ CommAlg T where |
| 239 | obj A := CommAlgCat.of T (T ⊗[S] A) |
| 240 | map f := CommAlgCat.ofHom (Algebra.TensorProduct.lTensor T f.hom') |
| 241 | |
| 242 | /-- In a nontrivial ring that is `p`-adically complete, `p` is not a unit. -/ |
| 243 | instance not_isUnit_p [Nontrivial S] [IsAdicComplete (span {(p : S)}) S] : Fact ¬IsUnit (p : S) := |
| 244 | -- if `p` is a unit, all its powers divide `0 - 1`, so `0 = 1` by separatedness |
| 245 | ⟨fun h ↦ zero_ne_one (eq_of_forall_pow_dvd_sub (p : S) fun n ↦ (h.pow n).dvd)⟩ |
| 246 | |
| 247 | variable (S) [Algebra Ainf T] |
| 248 | |
| 249 | /-! ### Cells and p-adic tests -/ |
| 250 | |
| 251 | /-- A cell: a p-adically complete, absolutely integrally closed valuation ring T (a domain) in which |
| 252 | p is not zero. By `New.Variety.not_isUnit_p`, p is then not a unit in T. -/ |
| 253 | class IsCell extends IsDomain T, ValuationRing T, IsAdicComplete (span {(p : T)}) T, |
| 254 | IsAbsIntegrallyClosed T where |
| 255 | /-- `p` is not zero in `T`. -/ |
| 256 | p_ne_zero : (p : T) ≠ 0 |
| 257 | |
| 258 | /-- A p-adic test: a non-empty family of cells (`New.Variety.IsCell`) with a ring map from O_C to |
| 259 | their product. -/ |
| 260 | structure PadicTest {p : ℕ} [ThePrime p] where |
| 261 | /-- The index set of the product. -/ |
| 262 | Index : Type |
| 263 | /-- The factors of the product, as types. -/ |
| 264 | Cell : Index → Type |
| 265 | /-- There is at least one factor. -/ |
| 266 | [nonempty : Nonempty Index] |
| 267 | /-- The ring structure of each factor. -/ |
| 268 | [commRing (i : Index) : CommRing (Cell i)] |
| 269 | /-- Each factor is a cell. -/ |
| 270 | [isCell (i : Index) : IsCell p (Cell i)] |
| 271 | /-- The structure map from O_C to the product of the factors. -/ |
| 272 | structureMap : OC →+* ∀ i : Index, Cell i |
| 273 | |
| 274 | namespace PadicTest |
| 275 | |
| 276 | variable {p} (c : PadicTest) |
| 277 | |
| 278 | attribute [instance] nonempty commRing isCell |
| 279 | |
| 280 | /-- The ring S underlying a p-adic test, namely the product of its family of valuation rings. -/ |
| 281 | abbrev ProdRing : Type := ∀ i : c.Index, c.Cell i |
| 282 | |
| 283 | instance : Algebra OC c.ProdRing := c.structureMap.toAlgebra |
| 284 | |
| 285 | instance : Category PadicTest := |
| 286 | {Hom := (·.ProdRing →ₐ[OC] ·.ProdRing), id c := .id .., comp f := (·.comp f)} |
| 287 | |
| 288 | instance : Nontrivial c.ProdRing := Pi.nontrivial_at c.nonempty.some |
| 289 | |
| 290 | /-- The ring S of a p-adic test is p-adically complete, since each of its factors is. -/ |
| 291 | instance isAdicComplete_prodRing : IsAdicComplete (span {(p : c.ProdRing)}) c.ProdRing := |
| 292 | IsAdicComplete.pi_span_natCast p |
| 293 | |
| 294 | /-- The tilt S^♭ of the ring S of a p-adic test, the inverse limit of S/p along Frobenius. -/ |
| 295 | abbrev TiltRing : Type := PreTilt c.ProdRing p |
| 296 | |
| 297 | instance : Algebra OFlat c.TiltRing := (PreTilt.map p c.structureMap).toAlgebra |
| 298 | |
| 299 | /-- For g in the Galois group `New.Gp` p, which acts on O_C by ring automorphisms, the endofunctor |
| 300 | of p-adic tests that keeps the ring S and precomposes its structure map O_C → S with the action of |
| 301 | g. -/ |
| 302 | def twist (g : Gp p) : PadicTest ⥤ PadicTest where |
| 303 | obj c := ⟨c.Index, c.Cell, c.structureMap.comp (MulSemiringAction.toRingHom (Gp p) OC g)⟩ |
| 304 | map f := ⟨f.toRingHom, fun x ↦ f.commutes' (g • x)⟩ |
| 305 | |
| 306 | /-- The functor from p-adic tests to commutative O_C-algebras sending a test to its product ring |
| 307 | S with its structure map. -/ |
| 308 | def algFunctor : PadicTest ⥤ CommAlg OC where |
| 309 | obj c := CommAlgCat.of OC c.ProdRing |
| 310 | map := CommAlgCat.ofHom |
| 311 | |
| 312 | /-- The functor from p-adic tests to commutative rings sending a test to its underlying product |
| 313 | ring S. -/ |
| 314 | abbrev ringFunctor : PadicTest ⥤ CommRingCat := algFunctor ⋙ forget₂ (CommAlg OC) CommRingCat |
| 315 | |
| 316 | /-- The functor from p-adic tests to commutative O^♭-algebras sending a test S to its tilt S^♭. -/ |
| 317 | def tilt : PadicTest ⥤ CommAlg OFlat where |
| 318 | obj c := CommAlgCat.of OFlat c.TiltRing |
| 319 | map {c c'} f := |
| 320 | CommAlgCat.ofHom ⟨PreTilt.map p (RingHomClass.toRingHom (F := c.ProdRing →ₐ[OC] c'.ProdRing) f), |
| 321 | fun a ↦ by |
| 322 | have h_comp : f.toRingHom.comp c.structureMap = c'.structureMap := f.comp_algebraMap |
| 323 | exact (RingHom.congr_fun (PreTilt.map_comp p _ c.structureMap) a).symm.trans |
| 324 | (congrArg (fun g ↦ PreTilt.map p g a) h_comp)⟩ |
| 325 | map_id _ := CommAlgCat.hom_ext (AlgHom.ext fun a ↦ RingHom.congr_fun (PreTilt.map_id p) a) |
| 326 | map_comp _ _ := |
| 327 | CommAlgCat.hom_ext (AlgHom.ext fun a ↦ RingHom.congr_fun (PreTilt.map_comp p _ _) a) |
| 328 | |
| 329 | end PadicTest |
| 330 | |
| 331 | open PadicTest Int |
| 332 | |
| 333 | /-! ### Completion, Witt vectors and functors of points -/ |
| 334 | |
| 335 | /-- The functor sending a commutative S-algebra to its p-adic completion. -/ |
| 336 | def algCompletion : CommAlg S ⥤ CommAlg S where |
| 337 | obj A := CommAlgCat.of S (AdicCompletion (span {(p : A)}) A) |
| 338 | map {A B} f := |
| 339 | CommAlgCat.ofHom ⟨adicMap (I := span {(p : A)}) (J := span {(p : B)}) f.hom.toRingHom |
| 340 | (by simp), fun s ↦ ext_evalₐ (by simp [evalₐ_adicMap])⟩ |
| 341 | -- The functor laws are checked in each quotient by a power of `p`. |
| 342 | map_id _ := by |
| 343 | ext x : 2 |
| 344 | cases x using induction_on |
| 345 | exact ext_evalₐ (by simp [evalₐ_adicMap]) |
| 346 | map_comp _ _ := by |
| 347 | ext x : 2 |
| 348 | cases x using induction_on |
| 349 | exact ext_evalₐ (by simp [evalₐ_adicMap]) |
| 350 | |
| 351 | variable {p S} |
| 352 | |
| 353 | instance : IsCell p OC := ⟨NeZero.out⟩ |
| 354 | |
| 355 | instance : Algebra Ainf OFlat := constantCoeff.toAlgebra |
| 356 | |
| 357 | instance : Algebra Ainf OC := (fontaineTheta ..).toAlgebra |
| 358 | |
| 359 | /-- For a ring S with a map to W(k), by default S = W(k), the functor sending a k-algebra b to |
| 360 | its p-typical Witt vectors W(b), as an S-algebra. -/ |
| 361 | def wittFunctor {k : Type} [CommRing k] (S : Type := WittVector p k) [CommRing S] |
| 362 | [Algebra S (WittVector p k)] : CommAlg k ⥤ CommAlg S where |
| 363 | -- `W(b)` is an `S`-algebra through `S → W(k) → W(b)`. |
| 364 | obj b := @CommAlgCat.of S _ (WittVector p b) _ |
| 365 | ((WittVector.map (algebraMap k b)).comp (algebraMap S (WittVector p k))).toAlgebra |
| 366 | map f := by |
| 367 | use map f.hom |
| 368 | exact fun s ↦ WittVector.ext fun n ↦ f.hom.commutes' _ |
| 369 | |
| 370 | /-- For an A_inf-algebra T, the functor sending an O^♭-algebra b to the p-adic completion of T |
| 371 | ⊗_{A_inf} W(b). -/ |
| 372 | abbrev periodAlg : CommAlg OFlat ⥤ CommAlg T := |
| 373 | wittFunctor (k := OFlat) ⋙ algBaseChange T ⋙ algCompletion T p |
| 374 | |
| 375 | /-- For R → O_C, the functor sending an R-scheme X to the functor S ↦ X(S) of its points over R |
| 376 | in p-adic tests. -/ |
| 377 | def testPoints {R : CommRingCat} [Algebra R OC] : |
| 378 | Over (AlgebraicGeometry.Spec R) ⥤ PadicTest ⥤ Type 1 := |
| 379 | algPoints R R ⋙ restrictAlong (algFunctor ⋙ restrictAlg R OC) |
| 380 | |
| 381 | /-- If S is absolutely integrally closed, then for every unit x of S there is a homomorphism χ from |
| 382 | ℚ to Sˣ with χ(1) = x, that is, a compatible system of roots of x. -/ |
| 383 | lemma exists_compatible_roots {S : Type} [CommRing S] [h : IsAbsIntegrallyClosed S] |
| 384 | (x : Additive Sˣ) : ∃ χ : ℚ →+ Additive Sˣ, χ 1 = x := by |
| 385 | -- The instance from `exists_nsmul_unit` makes `Sˣ` divisible, hence an injective ℤ-module. |
| 386 | -- Extend `n ↦ n • x` from `ℤ` to `ℚ`. |
| 387 | obtain ⟨χ, hχ⟩ : ∃ χ : ℚ →+ Additive Sˣ, χ.comp (Int.castAddHom ℚ) = zmultiplesHom _ x := |
| 388 | (Module.Baer.of_divisible _).extension_property_addMonoidHom _ Int.cast_injective _ |
| 389 | exact ⟨χ, by simpa using DFunLike.congr_fun hχ 1⟩ |
| 390 | |
| 391 | end PadicTests |
| 392 | |
| 393 | /-! |
| 394 | ## Flatness, reduction modulo an element and Witt vectors |
| 395 | |
| 396 | * `New.Variety.pFlat`: the nonzero nonunit p♭ = ξ mod p of O♭. `New.Variety.IsPerfectTorsionFree` is |
| 397 | the class of perfect, p♭-torsion-free O♭-algebras. |
| 398 | -/ |
| 399 | |
| 400 | section ReductionModP |
| 401 | |
| 402 | open PrimeSpectrum CategoryTheory TensorProduct Period Ideal Function Module LinearMap WittVector |
| 403 | Flat Ainf AlgebraTensorModule LocallyConstant Nat ZMod IsSMulRegular |
| 404 | AlgebraicGeometry.StructureSheaf |
| 405 | |
| 406 | variable (M S : Type _) {S' Λ : Type*} [CommRing M] [CommRing S] [CommRing S'] [Algebra M S] |
| 407 | [AddCommGroup Λ] {f : S →+* S'} {p : ℕ} [ThePrime p] |
| 408 | |
| 409 | /-! ### Locally constant functions on the prime spectrum -/ |
| 410 | |
| 411 | /-- For an M-algebra S there is a ring map f from the locally constant functions Spec S → M to S |
| 412 | such that, for every prime q, f(x) and x(q) have the same image in the localisation S_q. -/ |
| 413 | lemma exists_ringHom_of_locallyConstant : |
| 414 | ∃ f : LocallyConstant (PrimeSpectrum S) M →+* S, |
| 415 | ∀ (x : LocallyConstant (PrimeSpectrum S) M) (q : PrimeSpectrum S), |
| 416 | algebraMap S (Localization.AtPrime q.asIdeal) (f x) = |
| 417 | algebraMap M (Localization.AtPrime q.asIdeal) (x q) := by |
| 418 | -- A locally constant `x` gives the section `q ↦ x q` of the structure sheaf, and global sections |
| 419 | -- come from `S`. |
| 420 | have h_sec (x : LocallyConstant (PrimeSpectrum S) M) : |
| 421 | ∃ s : S, ∀ q : PrimeSpectrum S, toPiLocalization S s q = algebraMap M _ (x q) := by |
| 422 | obtain ⟨s, hs⟩ := toOpenₗ_top_bijective.surjective |
| 423 | ⟨fun q ↦ algebraMap M (Localizations S q.val) (x q.val), fun q ↦ by |
| 424 | -- On the open fibre `U` of `x` through `q` the section is the fraction `x q / 1`. |
| 425 | let U : TopologicalSpace.Opens (PrimeSpectrum S) := |
| 426 | ⟨x ⁻¹' {x q.val}, x.isLocallyConstant {x q.val}⟩ |
| 427 | have hq : q.val ∈ U := rfl |
| 428 | refine ⟨U, hq, homOfLE le_top, algebraMap M S (x q.val), 1, fun q' ↦ |
| 429 | ⟨(ne_top_iff_one _).mp q'.val.isPrime.ne_top, ?_⟩⟩ |
| 430 | have h_fibre : x q'.val = x q.val := q'.property |
| 431 | rw [← h_fibre] |
| 432 | rfl⟩ |
| 433 | exact ⟨s, fun q ↦ congrArg (fun σ ↦ σ.val ⟨q, trivial⟩) hs⟩ |
| 434 | choose toFun hf using h_sec |
| 435 | -- Each ring map axiom is checked after the injective map `toPiLocalization S`, that is, in |
| 436 | -- every localisation, where it holds by `hf`. |
| 437 | refine ⟨{ toFun, map_one' := ?_, map_mul' := ?_, map_zero' := ?_, map_add' := ?_ }, hf⟩ |
| 438 | all_goals simp [← (toPiLocalization_injective S).eq_iff, funext_iff, hf] |
| 439 | |
| 440 | /-- Let f : S → S' be a ring map such that any two elements of S' become comparable for divisibility |
| 441 | after the partition given by f(e), for an idempotent e of S (`New.Variety.IsComparableRing`). Then |
| 442 | pull-back of locally constant Λ-valued functions from Spec S to Spec S' is onto. -/ |
| 443 | lemma comapAddMonoidHom_surjective_of_isComparableRing (h_comparable : IsComparableRing f) : |
| 444 | Surjective (comapAddMonoidHom (Z := Λ) ⟨PrimeSpectrum.comap f, continuous_comap f⟩) := by |
| 445 | -- It suffices to hit the function equal to `a` on the locus of an idempotent `y`. |
| 446 | refine locallyConstant_mem_of_indicator (S := AddMonoidHom.range _) fun a y hy ↦ ?_ |
| 447 | obtain ⟨e, he, h₁, h₂⟩ : ∃ e : S, IsIdempotentElem e ∧ |
| 448 | y ∣ f e * (1 - y) ∧ 1 - y ∣ (1 - f e) * y := h_comparable y (1 - y) |
| 449 | -- Multiply `h₁` by `1 - y` and `h₂` by `y`: both `f e (1 - y)` and `(1 - f e) y` vanish. |
| 450 | have h_fe_mul : f e * (1 - y) = 0 := by grind [dvd_def, IsIdempotentElem] |
| 451 | have h_mul_y : (1 - f e) * y = 0 := by grind [dvd_def, IsIdempotentElem] |
| 452 | obtain rfl : f e = y := by linear_combination h_fe_mul - h_mul_y |
| 453 | exact ⟨indicator (LocallyConstant.const _ a) (isClopen_iff.2 ⟨e, he, rfl⟩), rfl⟩ |
| 454 | |
| 455 | /-- The functor sending a commutative ring S to the ℤ/p-algebra of locally constant functions Spec |
| 456 | S → ℤ/p. -/ |
| 457 | def locConstAlg : CommRingCat ⥤ CommAlg (ZMod p) where |
| 458 | obj A := CommAlgCat.of (ZMod p) (LocallyConstant (PrimeSpectrum A) (ZMod p)) |
| 459 | map f := CommAlgCat.ofHom (comapₐ (ZMod p) ⟨_, continuous_comap f.hom⟩) |
| 460 | |
| 461 | instance : Algebra (ZMod p) OFlat := algebra .. |
| 462 | |
| 463 | deriving instance Algebra (ZMod p), IsScalarTower (ZMod p) OFlat for @CFlat p _ |
| 464 | |
| 465 | /-- For every commutative ring A, the algebra of locally constant functions Spec A → ℤ/p |
| 466 | (`New.Variety.locConstAlg`) is perfect. -/ |
| 467 | instance perfectRing_locConstAlg (A : CommRingCat) : PerfectRing (locConstAlg A) p := by |
| 468 | -- Frobenius is the identity, by Fermat's little theorem at each point. |
| 469 | have h_frob : (fun x : locConstAlg A ↦ x ^ p) = _root_.id := |
| 470 | funext fun x ↦ ext fun _ ↦ pow_card _ |
| 471 | exact ⟨by simpa only [h_frob] using bijective_id⟩ |
| 472 | |
| 473 | /-! ### The element p♭ -/ |
| 474 | |
| 475 | /-- The element p♭ = ξ mod p of O^♭ = A_inf/p, the zeroth Witt coefficient of ξ. -/ |
| 476 | def pFlat : OFlat := constantCoeff xi |
| 477 | |
| 478 | /-- The O^♭-algebra b is perfect and p♭-torsion-free, where p♭ = ξ mod p (`New.Variety.pFlat`). -/ |
| 479 | abbrev IsPerfectTorsionFree (b : CommAlg OFlat) : Prop := PerfectRing b p ∧ IsSMulRegular b pFlat |
| 480 | |
| 481 | /-! ### Reduction modulo an integer, flatness and torsion -/ |
| 482 | |
| 483 | /-- The map f: A → B is surjective, and f(x) = 0 exactly when x = m·y for some y. -/ |
| 484 | def IsReductionMod {R A B : Type*} [SMul R A] [Zero B] (m : R) (f : A → B) : Prop := |
| 485 | Surjective f ∧ Exact (m • ·) f |
| 486 | |
| 487 | /-- A reduction map modulo `m` (`New.Variety.IsReductionMod`) is onto. -/ |
| 488 | lemma IsReductionMod.surjective {R A B : Type*} [SMul R A] [Zero B] {m : R} {g : A → B} |
| 489 | (h_red : IsReductionMod m g) : Surjective g := h_red.left |
| 490 | |
| 491 | /-- For a reduction map `g` modulo `m` (`New.Variety.IsReductionMod`), `g x = 0` exactly when |
| 492 | `x = m • y` for some `y`. -/ |
| 493 | lemma IsReductionMod.exact {R A B : Type*} [SMul R A] [Zero B] {m : R} {g : A → B} |
| 494 | (h_red : IsReductionMod m g) : Exact (m • ·) g := h_red.right |
| 495 | |
| 496 | private lemma subsingleton_or_charP [IsDomain M] [CharP M p] : |
| 497 | Subsingleton (WittVector p S) ∨ CharP S p := by |
| 498 | cases subsingleton_or_nontrivial S |
| 499 | · exact .inl ⟨fun x y ↦ WittVector.ext fun n ↦ Subsingleton.elim (x.coeff n) (y.coeff n)⟩ |
| 500 | · exact .inr (.of_ringHom_of_ne_zero (algebraMap M S) p NeZero.out) |
| 501 | |
| 502 | /-- For a perfect algebra `S` over a domain `M` of characteristic `p`, a Witt vector is a multiple |
| 503 | of `p ^ k` exactly when its first `k` coefficients vanish. -/ |
| 504 | lemma coeff_lt_eq_zero_iff_exists_p_pow_smul_eq [IsDomain M] [CharP M p] [PerfectRing S p] |
| 505 | (k : ℕ) (x : WittVector p S) : |
| 506 | (∀ i < k, x.coeff i = 0) ↔ ∃ y : WittVector p S, p ^ k • y = x := by |
| 507 | obtain _ | _ := subsingleton_or_charP (p := p) M S |
| 508 | · simp [Subsingleton.elim x 0] |
| 509 | · simp [mul_comm, ← mem_span_singleton', mem_span_p_pow_iff_le_coeff_eq_zero] |
| 510 | |
| 511 | /-- For a perfect algebra `S` over a domain `M` of characteristic `p`, the zeroth Witt coefficient |
| 512 | `W(S) → S` is reduction modulo `p` (`New.Variety.IsReductionMod`). -/ |
| 513 | lemma isReductionMod_constantCoeff [IsDomain M] [CharP M p] [PerfectRing S p] : |
| 514 | IsReductionMod p (constantCoeff : WittVector p S →+* S) := |
| 515 | ⟨constantCoeff_surjective p, fun x ↦ by |
| 516 | simpa using coeff_lt_eq_zero_iff_exists_p_pow_smul_eq M S 1 x⟩ |
| 517 | |
| 518 | /-- For a perfect algebra `S` over a domain `M` of characteristic `p`, the Witt vectors `W(S)` have |
| 519 | no `p`-torsion and are `p`-adically complete. -/ |
| 520 | lemma isCompleteTorsionFree_wittVector [IsDomain M] [CharP M p] [PerfectRing S p] : |
| 521 | IsCompleteTorsionFree (WittVector p S) := by |
| 522 | obtain _ | _ := subsingleton_or_charP (p := p) M S |
| 523 | · exact ⟨.of_right_eq_zero_of_smul (by simp [nontriviality]), inferInstance⟩ |
| 524 | · exact ⟨.of_right_eq_zero_of_smul (by simpa [mul_comm] using eq_zero_of_p_mul_eq_zero), |
| 525 | inferInstance⟩ |
| 526 | |
| 527 | /-- For a perfect algebra `S` over a domain of characteristic `p`, the zeroth Witt coefficient is |
| 528 | reduction modulo `p` and its kernel is `(p)`. The Witt vectors are `p`-adically complete and |
| 529 | `p`-torsion-free, with divisibility by powers of `p` detected by the initial coefficients. -/ |
| 530 | lemma isReductionMod_constantCoeff_and_isCompleteTorsionFree [IsDomain M] [CharP M p] |
| 531 | [PerfectRing S p] : |
| 532 | IsReductionMod p (constantCoeff : WittVector p S →+* S) ∧ |
| 533 | IsCompleteTorsionFree (WittVector p S) ∧ |
| 534 | RingHom.ker (constantCoeff : WittVector p S →+* S) = span {↑p} ∧ |
| 535 | ∀ (k : ℕ) (x : WittVector p S), |
| 536 | (∀ i < k, x.coeff i = 0) ↔ ∃ y : WittVector p S, p ^ k • y = x := |
| 537 | ⟨isReductionMod_constantCoeff M S, isCompleteTorsionFree_wittVector M S, |
| 538 | by |
| 539 | ext x |
| 540 | simpa [mem_span_singleton', mul_comm] using (isReductionMod_constantCoeff M S).exact x, |
| 541 | coeff_lt_eq_zero_iff_exists_p_pow_smul_eq M S⟩ |
| 542 | |
| 543 | variable {S M M' L : Type} [CommRing S] [AddCommGroup M] [Module S M] [AddCommGroup M'] |
| 544 | [Module S M'] [AddCommGroup L] [Module S L] (f : M →ₗ[S] M') {m : ℕ} |
| 545 | |
| 546 | /-- The element `p♭ = ξ mod p` of `O^♭` is nonzero, since `p` does not divide `ξ` in `A_inf`. -/ |
| 547 | lemma pFlat_ne_zero : pFlat ≠ 0 := constantCoeff_xi_ne_zero |
| 548 | |
| 549 | /-- The element `p♭ = ξ mod p` of `O^♭` is not a unit, since `ξ` is prime in `A_inf` and a Witt |
| 550 | vector is a unit exactly when its zeroth coefficient is. -/ |
| 551 | lemma not_isUnit_pFlat : ¬IsUnit pFlat := prime_xi.not_isUnit ∘ isUnit_iff_isUnit_constantCoeff.mpr |
| 552 | |
| 553 | /-- Reduction modulo `m` is kept by tensoring on the left: if `f : M → M'` is reduction modulo `m` |
| 554 | (`New.Variety.IsReductionMod`: onto, with kernel `m M`), then so is `L ⊗ f`. -/ |
| 555 | lemma IsReductionMod.lTensor (h_red : IsReductionMod m f) : IsReductionMod m (f.lTensor L) := by |
| 556 | -- Tensoring is right exact, and `L ⊗ (m • –)` is multiplication by `m`. |
| 557 | have h_exact : Exact ((m : End S M).lTensor L) (f.lTensor L) := |
| 558 | lTensor_exact L h_red.exact h_red.surjective |
| 559 | have h_smul : (m : End S M).lTensor L = m := map_natCast (End.lTensorAlgHom S M L) m |
| 560 | exact ⟨lTensor_surjective L h_red.surjective, by rwa [h_smul] at h_exact⟩ |
| 561 | |
| 562 | /-- If `f : M → M'` is reduction modulo `m` (`New.Variety.IsReductionMod`) and `m` kills `L`, then |
| 563 | `f ⊗ L` is bijective. -/ |
| 564 | lemma IsReductionMod.bijective_rTensor (h_red : IsReductionMod m f) (h_kills : ∀ y : L, m • y = 0) : |
| 565 | Bijective (f.rTensor L) := by |
| 566 | -- The kernel is the image of `(m • –) ⊗ L`, which vanishes as `m` kills `L`. |
| 567 | have h_exact : Exact ((m : End S M).rTensor L) (f.rTensor L) := |
| 568 | rTensor_exact L h_red.exact h_red.surjective |
| 569 | have h_zero : (m : End S M).rTensor L = 0 := ext' fun x y ↦ by simp [smul_tmul, h_kills] |
| 570 | exact ⟨(injective_iff_eq_zero_of_exact h_exact).mpr h_zero, rTensor_surjective L h_red.surjective⟩ |
| 571 | |
| 572 | /-- Two additive maps out of `M ⊗[S] L`, bundled in any type `F` of additive maps, are equal if |
| 573 | they agree on pure tensors. -/ |
| 574 | lemma tmul_ext {P F : Type*} [AddCommGroup P] [FunLike F (M ⊗[S] L) P] |
| 575 | [AddMonoidHomClass F (M ⊗[S] L) P] {f g : F} |
| 576 | (h_tmul : ∀ (m : M) (x : L), f (m ⊗ₜ x) = g (m ⊗ₜ x)) : f = g := by |
| 577 | refine DFunLike.ext f g fun y ↦ ?_ |
| 578 | induction y with |
| 579 | | tmul m x => exact h_tmul m x |
| 580 | | add y z hy hz => rw [map_add, map_add, hy, hz] |
| 581 | |
| 582 | /-- Over a Bézout domain, a torsion-free module is flat. -/ |
| 583 | instance [IsDomain S] [IsBezout S] [IsTorsionFree S L] : Flat S L := by |
| 584 | rwa [flat_iff_torsion_eq_bot_of_isBezout, ← Submodule.isTorsionFree_iff_torsion_eq_bot] |
| 585 | |
| 586 | /-- Let `S` be a domain and `π` an element such that every nonzero element of `S` divides some power |
| 587 | of `π`. Then an `S`-module without `π`-torsion is torsion-free. -/ |
| 588 | lemma isTorsionFree_of_dvd_pow [IsDomain S] {π : S} (hπ_reg : IsSMulRegular L π) |
| 589 | (h_dvd : ∀ {t : S}, t ≠ 0 → ∃ n : ℕ, t ∣ π ^ n) : IsTorsionFree S L := by |
| 590 | -- A nonzero `t` divides some `π ^ n`, which is regular on `L`; so is every factor of it. |
| 591 | refine ⟨fun t ht ↦ ?_⟩ |
| 592 | obtain ⟨n, s, hs⟩ := h_dvd ht.ne_zero |
| 593 | have h_reg : IsSMulRegular L (s * t) := by simpa only [hs, mul_comm] using hπ_reg.pow n |
| 594 | exact h_reg.of_mul |
| 595 | |
| 596 | /-- Let O = S/m and M' = M/m (`New.Variety.IsReductionMod`), with M' flat over O. If the S-modules M |
| 597 | and L have no m-torsion, then L ⊗_S M has no m-torsion either. -/ |
| 598 | lemma isSMulRegular_tensor_of_flat_mod {O : Type} [CommRing O] [Algebra S O] [Module O M'] |
| 599 | [IsScalarTower S O M'] [Flat O M'] (hO_red : IsReductionMod m (Algebra.linearMap S O)) |
| 600 | (hf_red : IsReductionMod m f) (hM_reg : IsSMulRegular M m) (hL_reg : IsSMulRegular L m) : |
| 601 | IsSMulRegular (L ⊗[S] M) m := by |
| 602 | -- Present `L` as a quotient `π` of a free module, with `ι` the inclusion of its kernel. The lemma |
| 603 | -- `lTensor_injective_of_exact_of_exact_of_rTensor_injective` is the balancing of `Tor₁`: |
| 604 | -- it is used to get `Tor₁(O, L) = 0`, and then to pass from `Tor₁(L, M') = 0` to the claim. |
| 605 | obtain ⟨hO_surj, hO_exact⟩ := hO_red |
| 606 | obtain ⟨hf_surj, hf_exact⟩ := hf_red |
| 607 | simp only [← cast_smul_eq_nsmul S, IsSMulRegular] at hO_exact hf_exact hM_reg hL_reg ⊢ |
| 608 | let π : (L →₀ S) →ₗ[S] L := Finsupp.linearCombination S _root_.id |
| 609 | let ι : LinearMap.ker π →ₗ[S] L →₀ S := (LinearMap.ker π).subtype |
| 610 | have hπ : Surjective π := Finsupp.linearCombination_id_surjective S L |
| 611 | have h_exact : Exact ι π := exact_subtype_ker_map π |
| 612 | -- `O = S / m` and `L` has no `m`-torsion. |
| 613 | have hO_inj : Function.Injective (ι.lTensor O) := |
| 614 | lTensor_injective_of_exact_of_exact_of_rTensor_injective (f₁ := .mul S S m) hO_exact hO_surj |
| 615 | h_exact hπ (IsSMulRegular.lTensor _ hL_reg) (by simp [ι]) |
| 616 | -- `M' ⊗ – = M' ⊗[O] (O ⊗ –)` by `cancelBaseChange`, and `M'` is flat over `O`. |
| 617 | have hM'_inj : Function.Injective (ι.lTensor M') := by |
| 618 | have h_comp : Function.Injective |
| 619 | ((cancelBaseChange S O O M' _).toLinearMap ∘ₗ lTensor O M' (lTensor O O ι)) := |
| 620 | (cancelBaseChange S O O M' _).injective.comp |
| 621 | (lTensor_preserves_injective_linearMap (ι.baseChange O) hO_inj) |
| 622 | rwa [← lTensor_comp_cancelBaseChange, coe_comp, LinearEquiv.coe_coe, |
| 623 | EquivLike.injective_comp] at h_comp |
| 624 | -- `M' = M / m`, `M` has no `m`-torsion, and free modules are flat. |
| 625 | have h_smul_inj : Function.Injective ((DistribSMul.toLinearMap S M (m : S)).lTensor L) := |
| 626 | lTensor_injective_of_exact_of_exact_of_rTensor_injective h_exact hπ hf_exact hf_surj |
| 627 | ((lTensor_inj_iff_rTensor_inj M' ι).mp hM'_inj) |
| 628 | (lTensor_preserves_injective_linearMap _ hM_reg) |
| 629 | rwa [lTensor_smul_action] at h_smul_inj |
| 630 | |
| 631 | end ReductionModP |
| 632 | |
| 633 | end New.Variety |
| 634 | |
| 635 | end |