module public import Aesop.BuiltinRules public import Mathlib.CategoryTheory.SingleObj public import Mathlib.CategoryTheory.Monoidal.Cartesian.FunctorCategory import Mathlib.Algebra.AddConstMap.Basic import Mathlib.Algebra.Category.Grp.Ulift import Mathlib.Algebra.Category.Grp.Zero import Mathlib.Algebra.Order.Star.Rat public import Lib.PadicComparison.Descent.AlmostDescent import Lib.PadicComparison.Descent.TestCovers public import TauCeti.Data.Nat.Factorial.Basic /-! # Wang sequence on C × Bℕ, lines, and root systems of units via periodic sequences Write Bℕ for the one-object category of the monoid ℕ. A functor on C × Bℕ (`New.Variety.TimesBNat`) is a functor Y on C with an endomorphism γ. Its cohomology plays the part of that of the homotopy quotient by γ. Cohomology is Hⁿ(Y, F) = Extⁿ(ℤ[Y], F) in functors to abelian groups. Y is a line over a functor U on C (`New.Variety.IsLine`) if a map from Y to U is bijective on cohomology. Root systems of a unit are defined on O_C-algebras, twisted by the character s ↦ (ε^s)^♯. For a unit `v` of a `p`-adic test (`New.Variety.PadicTest`: its ring `ProdRing` is a product of cells `Cell j`, `TiltRing` is its tilt, and `algFunctor` sends it to `ProdRing` as an O_C-algebra), they form a line for the coefficients `tilt ⋙ moduleCoeff (tensorCoeff M)`, provided `moduleCoeff (tensorCoeff M)` is acyclic on perfect rings (`New.Variety.IsAcyclicOnPerfect`). This is proved by representing them, through tilting, by the ring of periodic sequences. There the twist becomes the shift. ## Main definitions and results * `New.Variety.TimesBNat.shortExact_wangComplex`: the short exact sequence 0 → ℤ[Y × ℕ] → ℤ[Y × ℕ] → ℤ[Y] → 0 (`New.Variety.TimesBNat.wangComplex`; `New.Variety.TimesBNat.shortExact_induced` is the same with the two maps written out). Its long exact sequence is the Wang sequence, since Y × ℕ on C × Bℕ has the cohomology of Y on C (`New.Variety.TimesBNat.isLine_fst`). * `New.Variety.IsLine.of_acyclic`: a criterion for Y to be a line over a representable functor Hom(A, −), in terms of the kernel and cokernel of γ - 1 on coefficients (`New.Variety.KoszulExact`). * `New.Variety.compatibleRoots`: A ↦ characters ℚ≥0 → A, that is, elements with a compatible system of n-th roots for all n ≥ 1. * `New.Variety.CompatibleRootsAreLines`: the property of coefficients F and a functor ψ to O_C-algebras that the root systems of every unit of every ψ(A) form a line (`New.Variety.IsLine`) over Hom(A, −). * `New.Variety.periodicSeq.koszulExact_shift`: in characteristic `p`, the constants contain the kernel of the shift minus the identity, and this map is onto (`New.Variety.KoszulExact`). This also holds after tensoring with a module. * `New.Variety.PadicTest.isLine_compatibleRoots`: if `moduleCoeff (tensorCoeff M)` is acyclic on perfect rings (`New.Variety.IsAcyclicOnPerfect`), root systems of `v` have flat base change (`New.Variety.HasFlatBaseChange`) and form a line (`New.Variety.IsLine`) for the coefficients `tilt ⋙ moduleCoeff (tensorCoeff M)`. Notions from other files: * `New.Variety.freeAb`: The functor sending a set-valued functor Y to ℤ[Y], whose value at A is the free abelian group on Y(A). * `New.OC`: The ring of integers O_C of the field C_p of p-adic complex numbers. * `New.Period.OFlat`: The ring O^♭, the inverse limit of O_C/p along x ↦ x^p, where O_C is the ring of integers of C_p. ## Relation to the literature Known result: Faltings' toric towers and their Koszul complexes. Here the variables are treated one at a time, and the discrete monoid generated by one automorphism replaces continuous cohomology of Z_p^d, so that Wang sequences replace the Koszul complex. Source: P. Scholze, p-adic Hodge theory for rigid-analytic varieties, Forum Math. Pi 1 (2013), Lemmas 4.5 and 5.5; Bhatt, Morrow, Scholze 2018, Lemma 7.3; Stacks project, tag 0EBS; G. Faltings, p-adic Hodge theory, J. Amer. Math. Soc. 1 (1988). -/ @[expose] public section noncomputable section /-! ## Homotopy quotients on C × Bℕ, the Wang sequence and lines `IsBijective (.restrict φ F) (freeAbMap u)` says that Hⁿ(Y, F) → Hⁿ(Y', F ∘ φ) along u : Y' → Y ∘ φ is bijective for all n. -/ section WangSequence open CategoryTheory Function FreeAddCommGroup AddCommGrpCat namespace New.Variety variable (C : Type 1) {C' : Type 1} [Category C] [Category C'] {F : AbFunctor C} {F' : AbFunctor C'} {U : C ⥤ Type 1} /-- For a category C, the product category C × Bℕ, where Bℕ is the one-object category whose endomorphism monoid is the additive natural numbers. -/ abbrev TimesBNat : Type 1 := C × SingleObj (Multiplicative ℕ) /-- The projection functor from the product category C × Bℕ to its first factor C. -/ abbrev TimesBNat.fst : TimesBNat C ⥤ C := .mk (·.1) (·.1) /-- The functor C → C × Bℕ sending an object A to (A, ∗) and a morphism f to (f, identity). -/ abbrev TimesBNat.incl : C ⥤ TimesBNat C where obj X := (X, ⟨⟩) map f := (f, 𝟙 _) open TimesBNat Abelian.Ext Comparison freeAb ShortComplex LongExactSeq MonoidalCategory CartesianMonoidalCategory AddChar variable {C} (Y : TimesBNat C ⥤ Type 1) /-- The set-valued functor on C × Bℕ with value ℕ at every object, on which morphisms of C act trivially and k in Bℕ acts by adding k. -/ abbrev TimesBNat.natWithShift : TimesBNat C ⥤ Type 1 := { obj X := X.2, map f := f.2 } ⋙ uliftCoyoneda ⟨⟨⟩⟩ /-- For a set-valued functor Y on C × Bℕ, the additive character of ℕ sending k to the endomorphism of the restriction of Y to C given at A by Y(id_A, k). -/ def TimesBNat.shiftEnd : AddChar ℕ (End (incl C ⋙ Y)) := toMonoidHomEquiv.invFun ((Y.curryObj.flip.mapEnd _).comp (SingleObj.toEnd _).toMonoidHom) /-! ### Criteria for a bijection on cohomology -/ variable {Y} (F) in /-- For Y on C × Bℕ, U on C and a map a from Y to U (with ℕ acting trivially on U), the property that Hⁿ(U, F) → Hⁿ(Y, F) is bijective for all n, the coefficients F being pulled back to C × Bℕ. -/ abbrev IsLine (a : Y ⟶ TimesBNat.fst C ⋙ U) : Prop := IsBijective (.restrict _ F) (freeAbMap a) /-- For a set-valued functor X on C, the projection X(A) × ℕ → X(A) induces bijections from Hⁿ(X, F) to the cohomology of X × ℕ on C × Bℕ, ℕ acting by translation, with coefficients F pulled back. -/ lemma TimesBNat.isLine_fst {X : C ⥤ Type 1} : IsLine F (SemiCartesianMonoidalCategory.fst (fst C ⋙ X) natWithShift) := by -- Above a point `y` of `X` at `A`, the point `(y, 0)` of `X × ℕ` at `(A, ⋆)` is universal: -- a point `(x, k)` above `X.map f y` is its image under `(f, k)` and under no other map over `f`. refine HasUniversalPoints.isBijective fun (A : C) (y : X.obj A) ↦ ⟨(A, ⟨⟩), (y, ⟨.zero⟩), 𝟙 A, (X.map_id_apply A y).symm, ?_, ?_⟩ · rintro D ⟨x, ⟨k⟩⟩ f hf refine ⟨(f, k), ⟨Prod.ext hf.symm rfl, Category.id_comp f⟩, ?_⟩ rintro ⟨g₁, g₂⟩ ⟨h_image, h_comp⟩ -- the second coordinate of the image of `(y, 0)` is `0` shifted by `g₂`, which is `g₂` have h_snd : g₂ = k := congrArg (fun p ↦ p.snd.down) h_image have h_fst : g₁ = f := by simpa using h_comp rw [h_fst, h_snd] · -- the coefficients are pulled back along the identity of `A` simpa [Function.id_def] using bijective_id /-- The retraction in the Wang sequence at one object, for a map `t` of a set `X` to itself: it sends `(x, 0)` to `0` and `(x, k + 1)` to its value at `(t x, k)` minus `(x, k)`. -/ private def wangRetraction {X : Type 1} (t : X → X) : ℕ → X → FreeAddCommGroup (X × ULift.{1} ℕ) | 0, _ => 0 | k + 1, x => wangRetraction t k (t x) - of (x, ⟨k⟩) /-- The maps `(x, k) ↦ γ^k x` from `Y × ℕ` to `Y`, with `γ = shiftEnd Y 1`, are natural on C × Bℕ: a map `(f, j)` sends `(x, k)` to `(Y(f, 0) x, k + j)`, and `Y(f, j) ∘ γ^k` is `γ^(k + j) ∘ Y(f, 0)`. -/ private lemma TimesBNat.shiftEnd_naturality {D D' : TimesBNat C} (f : D ⟶ D') : (fst C ⋙ incl C ⋙ Y ⊗ natWithShift).map f ≫ (↾fun x ↦ (shiftEnd Y x.2.down).asHom.app D'.1 x.1 : (fst C ⋙ incl C ⋙ Y ⊗ natWithShift).obj D' ⟶ Y.obj D') = (↾fun x ↦ (shiftEnd Y x.2.down).asHom.app D.1 x.1 : (fst C ⋙ incl C ⋙ Y ⊗ natWithShift).obj D ⟶ Y.obj D) ≫ Y.map f := by ext ⟨x, ⟨k⟩⟩ -- `Y` maps the commuting square `(f.1, 𝟙) ≫ (𝟙, k ≫ f.2) = (𝟙, k) ≫ f` of C × Bℕ to a commuting -- square of maps; at the point `x` it is the claim. have h_sq : CommSq ((f.1, 𝟙 _) : (D.1, ⟨⟩) ⟶ (D'.1, ⟨⟩)) ((𝟙 D.1, k) : (D.1, ⟨⟩) ⟶ D) ((𝟙 D'.1, k ≫ f.2) : (D'.1, ⟨⟩) ⟶ D') f := ⟨Prod.ext (by simp) (Category.id_comp _)⟩ exact ConcreteCategory.congr_hom (Y.map_commSq h_sq).w x /-- For Y on C × Bℕ with endomorphism γ, the sequence 0 → ℤ[Y × ℕ] → ℤ[Y × ℕ] → ℤ[Y] → 0 is short exact. Here Y × ℕ is the product of the restriction of Y to C, pulled back to C × Bℕ, with `New.Variety.TimesBNat.natWithShift`; the first map is (x, k) ↦ (γ x, k) - (x, k + 1), the second is (x, k) ↦ γ^k x, and `w` is the proof that their composite is zero. -/ lemma TimesBNat.shortExact_induced : ∃ w, ShortExact (ShortComplex.mk (X₂ := freeAb.obj ((fst C ⋙ incl C ⋙ Y) ⊗ natWithShift)) (X₃ := freeAb.obj Y) -- the first map, `(x, k) ↦ (γ x, k) - (x, k + 1)` (Sub.sub (freeAb.map ((fst C).whiskerLeft (shiftEnd Y 1).asHom ▷ natWithShift)) (freeAb.map ((fst C ⋙ incl C ⋙ Y) ◁ { app _ := ↾ULift.map.{_, _, 1, 1} Nat.succ }))) -- the second map, `(x, k) ↦ γ^k x` (freeAb.map ⟨fun D : TimesBNat C ↦ ↾fun x ↦ (shiftEnd Y x.2.down).asHom.app D.1 x.1, fun _ _ f ↦ by exact shiftEnd_naturality Y f⟩) w) := by -- With `t = shiftEnd Y 1` the maps are `(x, k) ↦ (t x, k) - (x, k + 1)` and `(x, k) ↦ tᵏ x`. The -- sequence splits at each object `A`. have h_at (A : C) : ∃ w, ShortExact ⟨ofHom (map (Prod.map ((shiftEnd Y 1).asHom.app A) id) - map (Prod.map id (ULift.map.{_, _, 1, 1} .succ))), ofHom (map fun (x, ⟨k⟩) ↦ (shiftEnd Y k).asHom.app A x), w⟩ := by -- The retraction is `(x, k) ↦ wangRetraction t k x`; the section is `x ↦ (x, 0)`. refine ⟨?_, Splitting.shortExact { r := ofHom (lift fun (x, ⟨k⟩) ↦ wangRetraction ((shiftEnd Y 1).asHom.app A) k x) s := ofHom (map fun x ↦ (x, ⟨0⟩)), f_r := ?_, s_g := ?_, id := ?_ }⟩ · -- the composite of the two maps is zero ext ⟨x, ⟨k⟩⟩ simp [map_add_eq_mul] · -- the retraction is a left inverse of the first map ext ⟨x, ⟨k⟩⟩ simp [wangRetraction] · -- the section is a right inverse of the second map ext simp · -- the retraction and the section split the middle term ext ⟨x, ⟨k⟩⟩ induction k generalizing x with | zero => simp [wangRetraction] | succ k ih => -- The claim at `(x, k + 1)` is the claim at `(t x, k)`, rearranged. simp [wangRetraction, map_add_eq_mul] at ih ⊢ linear_combination (norm := abel1) ih ((shiftEnd Y 1).asHom.app A x) -- Exactness of functors is tested object by object. choose w h_short using h_at exact shortExact_of_app (fun A ↦ (h_short A.1).ab_injective_f) (fun A ↦ exact_of_shortComplex_exact (h_short A.1).exact) fun A ↦ (h_short A.1).ab_surjective_g /-- The first map of the Wang sequence, ℤ[Y × ℕ] → ℤ[Y × ℕ], `(x, k) ↦ (γ x, k) - (x, k + 1)` with `γ = shiftEnd Y 1`. Here Y × ℕ is the restriction of Y to C, pulled back to C × Bℕ, times `New.Variety.TimesBNat.natWithShift`. -/ def TimesBNat.wangSub : freeAb.obj ((fst C ⋙ incl C ⋙ Y) ⊗ natWithShift) ⟶ freeAb.obj ((fst C ⋙ incl C ⋙ Y) ⊗ natWithShift) := freeAb.map ((fst C).whiskerLeft (shiftEnd Y 1).asHom ▷ natWithShift) - freeAb.map ((fst C ⋙ incl C ⋙ Y) ◁ ({ app _ := ↾ULift.map.{_, _, 1, 1} Nat.succ } : (natWithShift : TimesBNat C ⥤ Type 1) ⟶ natWithShift)) /-- The second map of the Wang sequence, ℤ[Y × ℕ] → ℤ[Y], `(x, k) ↦ γ^k x` with `γ = shiftEnd Y 1`. -/ def TimesBNat.wangPow : freeAb.obj ((fst C ⋙ incl C ⋙ Y) ⊗ natWithShift) ⟶ freeAb.obj Y := freeAb.map ⟨fun D ↦ ↾fun x ↦ (shiftEnd Y x.2.down).asHom.app D.1 x.1, fun _ _ f ↦ by exact shiftEnd_naturality Y f⟩ /-- The two maps of the Wang sequence compose to zero, as `γ^k (γ x) = γ^(k + 1) x`. -/ lemma TimesBNat.wangSub_comp_wangPow : wangSub Y ≫ wangPow Y = 0 := (shortExact_induced Y).fst /-- The Wang sequence ℤ[Y × ℕ] → ℤ[Y × ℕ] → ℤ[Y] (`wangSub`, then `wangPow`), a short complex of functors from C × Bℕ to abelian groups. -/ abbrev TimesBNat.wangComplex : ShortComplex (TimesBNat C ⥤ AddCommGrpCat.{1}) := .mk (wangSub Y) (wangPow Y) (wangSub_comp_wangPow Y) /-- For Y on C × Bℕ with endomorphism γ, the Wang sequence 0 → ℤ[Y × ℕ] → ℤ[Y × ℕ] → ℤ[Y] → 0 is short exact (`wangComplex`): the first map is `(x, k) ↦ (γ x, k) - (x, k + 1)`, the second `(x, k) ↦ γ^k x`. -/ lemma TimesBNat.shortExact_wangComplex : (wangComplex Y).ShortExact := (shortExact_induced Y).snd /-- The map i is injective, every fixed point of g lies in its image, and z ↦ g(z) − z is onto. -/ abbrev KoszulExact {A : Sort*} {B : Type*} [Sub B] (i : A → B) (g : B → B) : Prop := Injective i ∧ fixedPoints g ⊆ Set.range i ∧ Surjective (g - id) /-- For `e : ψ ⋙ reprBy E ≅ incl C ⋙ Y`, the projection `Y × ℕ → Y` composed with `e⁻¹` on `C × Bℕ`, giving a map `(Y × ℕ) ⟶ Hom(E, ψ ∘ fst −)`. -/ private abbrev TimesBNat.wangProj {Y : TimesBNat C ⥤ Type 1} {ψ : C ⥤ C'} {E : C'} (e : ψ ⋙ reprBy E ≅ incl C ⋙ Y) : (TimesBNat.fst C ⋙ incl C ⋙ Y) ⊗ natWithShift ⟶ TimesBNat.fst C ⋙ ψ ⋙ reprBy E := SemiCartesianMonoidalCategory.fst _ natWithShift ≫ (TimesBNat.fst C).whiskerLeft e.inv /-- If `ψ` is acyclic at `E` for `F'` (`IsAcyclicAt ψ F' E`), then pulling back along `TimesBNat.wangProj e : Y × ℕ ⟶ Hom(E, ψ ∘ fst −)` is bijective on cohomology. -/ private lemma TimesBNat.isBijective_wangProj {Y : TimesBNat C ⥤ Type 1} {ψ : C ⥤ C'} {E : C'} (e : ψ ⋙ reprBy E ≅ incl C ⋙ Y) (hψ : IsAcyclicAt ψ F' E) : (Comparison.restrict (TimesBNat.fst C ⋙ ψ) F').IsBijective (freeAbMap (Y := reprBy E) (wangProj e)) := by refine (hψ.precomp_of_bijective _ rfl fun D ↦ (e.app D).toEquiv.symm.bijective).trans isLine_fst ?_ exact freeAb.hom_ext fun _ _ ↦ rfl /-- Under `z ↦ homOfValue … (wangProj e) z`, precomposition with `wangSub Y` (the map `(x, k) ↦ (γ x, k) - (x, k + 1)`) acts as `F'(g) - 1`. -/ private lemma TimesBNat.wangSub_comp_homOfValue_wangProj {Y : TimesBNat C ⥤ Type 1} {ψ : C ⥤ C'} {E : C'} (e : ψ ⋙ reprBy E ≅ incl C ⋙ Y) {g : E ⟶ E} (h_shift_square : CommSq (ψ.whiskerLeft (reprMap g)) e.hom e.hom (shiftEnd Y 1).asHom) (z : F'.obj E) : wangSub Y ≫ homOfValue (.restrict (TimesBNat.fst C ⋙ ψ) F') (wangProj e) z = homOfValue (.restrict (TimesBNat.fst C ⋙ ψ) F') (wangProj e) (F'.map g z - z) := by let r := homOfValue (.restrict (TimesBNat.fst C ⋙ ψ) F') (wangProj e) have r_app (D : TimesBNat C) (x : (incl C ⋙ Y).obj D.1) (k : natWithShift.obj D) (w : F'.obj E) : (r w).app D (.of (x, k)) = F'.map (e.inv.app D.1 x).down w := homOfValue_app .. refine hom_ext fun D ⟨x, k⟩ ↦ ?_ -- the square `h_shift_square` at `x`: `e⁻¹ (t x) = g ≫ e⁻¹ x`, with `t = shiftEnd Y 1` have h_square : (e.inv.app D.1 ((shiftEnd Y 1).asHom.app D.1 x)).down = g ≫ (e.inv.app D.1 x).down := congrArg (fun α ↦ (α.app D.1 x).down) h_shift_square.vert_inv.w calc (wangSub Y ≫ r z).app D (.of (x, k)) = (r z).app D (.of ((shiftEnd Y 1).asHom.app D.1 x, k)) - (r z).app D (.of (x, k.map .succ)) := (congrArg ((r z).app D) (congrArg₂ HSub.hSub (freeAb.map_of _ _ _) (freeAb.map_of _ _ _))).trans (map_sub ((r z).app D).hom _ _) _ = (r (F'.map g z - z)).app D (.of (x, k)) := by refine (congrArg₂ HSub.hSub (r_app D _ k z) (r_app D x (k.map .succ) z)).trans ?_ rw [r_app, h_square, map_sub, F'.map_comp_apply] /-- Pulling a section `y ∈ F'(ψ A)` back along `q : Y ⟶ Hom(A, −)` and then along `wangPow Y : ℤ[Y × ℕ] ⟶ ℤ[Y]` gives the section on `ℤ[Y × ℕ]` associated to `F'(i) y` via `wangProj e`. -/ private lemma TimesBNat.wangPow_comp_homOfValue {Y : TimesBNat C ⥤ Type 1} {ψ : C ⥤ C'} {A : C} {E : C'} {q : Y ⟶ TimesBNat.fst C ⋙ reprBy A} (e : ψ ⋙ reprBy E ≅ incl C ⋙ Y) {i : ψ.obj A ⟶ E} (hq_eq_comp : ∀ (D : C) (f : (ψ ⋙ reprBy E).obj D), ψ.map (q ((incl C).obj D) (e.hom D f)).down = i ≫ f.down) (y : (ψ ⋙ F').obj A) : wangPow Y ≫ homOfValue (.restrict _ (ψ ⋙ F')) q y = homOfValue (.restrict (TimesBNat.fst C ⋙ ψ) F') (wangProj e) (F'.map i y) := by refine hom_ext fun D ⟨x, k⟩ ↦ (homOfValue_app (c := .restrict ..) q y D _).trans ?_ let shift : (incl C).obj D.1 ⟶ D := (𝟙 D.1, k.down) have h_shift : q.app D ((shiftEnd Y k.down).asHom.app D.1 x) = q.app ((incl C).obj D.1) x := by change q.app D (Y.map shift x) = q.app ((incl C).obj D.1) x simp [shift] have h_comp : ψ.map (q.app ((incl C).obj D.1) x).down = i ≫ (e.inv.app D.1 x).down := by simpa using hq_eq_comp D.1 (e.inv.app D.1 x) have r_app : (homOfValue (.restrict (TimesBNat.fst C ⋙ ψ) F') (wangProj e) (F'.map i y)).app D (.of (x, k)) = F'.map (e.inv.app D.1 x).down (F'.map i y) := homOfValue_app .. change F'.map (ψ.map (q.app D ((shiftEnd Y k.down).asHom.app D.1 x)).down) y = _ calc _ = F'.map (i ≫ (e.inv.app D.1 x).down) y := by rw [h_shift, h_comp] _ = _ := (F'.map_comp_apply _ _ _).trans r_app.symm /-- For a short exact sequence `0 → S.X₁ → S.X₂ → S.X₃ → 0` and coefficients `G`, if all higher cohomology of `S.X₁` vanishes, `H^{n+1}(S.X₂, G)` vanishes, and precomposition with `S.f` is surjective on `Hom(S.X₂, G) → Hom(S.X₁, G)`, then `H^{n+1}(S.X₃, G)` vanishes. -/ private lemma subsingleton_H_succ_of_shortExact {D : Type 1} [Category D] {S : ShortComplex (AbFunctor D)} (hS : S.ShortExact) (G : AbFunctor D) (h_high₁ : ∀ m : ℕ, Subsingleton (H S.X₁ G (m + 1))) (h_surj₀ : Surjective fun φ : S.X₂ ⟶ G ↦ S.f ≫ φ) {n : ℕ} (h_high₂ : Subsingleton (H S.X₂ G (n + 1))) : Subsingleton (H S.X₃ G (n + 1)) := by have hf_surj : ∀ m : ℕ, Surjective (H.map G S.f m) | 0, x => by obtain ⟨φ, rfl⟩ : ∃ φ, mk₀ φ = x := (mk₀_bijective ..).surjective x obtain ⟨ψ, rfl⟩ := h_surj₀ φ exact ⟨mk₀ ψ, mk₀_comp_mk₀ _ _⟩ | m + 1, x => ⟨0, (h_high₁ m).elim _ x⟩ have hg_inj : Injective (H.map G S.g (n + 1)) := (contravariant hS _).f_injective_of_g_surjective fun m _ ↦ hf_surj m exact ⟨fun _ _ ↦ hg_inj (h_high₂.elim _ _)⟩ /-- Let `Y` be a set-valued functor on `C × Bℕ`, let `ψ : C ⥤ C'`, `A : C` and `E : C'`, and let `F'` be an abelian-group-valued functor on `C'`. Let `e` identify the restriction of `Y` to `C` with `Hom(E, ψ −)`, let `q : Y → Hom(A, −)` be induced by `i : ψ A → E` (`hq_eq_comp`), and let the generator of ℕ act on `Y` by `g : E → E` (`h_shift_square`: through `e` it is `reprMap g`, precomposition with `g` on `reprBy E = Hom(E, −)`). Suppose that restriction along `ψ` is bijective on the cohomology of `Hom(E, −)` with coefficients `F'` (`New.Variety.IsAcyclicAt`), and that `F'(i)` and `F'(g)` satisfy `New.Variety.KoszulExact`: `F'(i)` is injective, every fixed point of `F'(g)` lies in the image of `F'(i)`, and `z ↦ F'(g) z − z` is onto. Then `q` is a line: for every `n`, the map `Hⁿ(Hom(A, −), F' ∘ ψ) → Hⁿ(Y, F' ∘ ψ)` is bijective. -/ lemma IsLine.of_acyclic {Y : TimesBNat C ⥤ Type 1} {ψ : C ⥤ C'} {A : C} {E : C'} {q : Y ⟶ TimesBNat.fst C ⋙ reprBy A} (e : ψ ⋙ reprBy E ≅ incl C ⋙ Y) (hψ : IsAcyclicAt ψ F' E) (i : ψ.obj A ⟶ E) (g : E ⟶ E) (hq_eq_comp : ∀ (D : C) (f : (ψ ⋙ reprBy E).obj D), ψ.map (q ((incl C).obj D) (e.hom D f)).down = i ≫ f.down) (h_shift_square : CommSq (ψ.whiskerLeft (reprMap g)) e.hom e.hom (shiftEnd Y 1).asHom) (h_koszul : KoszulExact (F'.map i) (F'.map g)) : IsLine (ψ ⋙ F') q := by -- Use the Wang sequence `0 → S.X₁ → S.X₂ → freeAb.obj Y → 0` (`wangComplex`). Its first two terms -- have cohomology `F'.obj E` in degree `0` only, and `S.f` acts there as `F'.map g - 1`; so -- `h_koszul` gives the cohomology of `Y`. let S : ShortComplex (TimesBNat C ⥤ AddCommGrpCat.{1}) := wangComplex Y have hS : S.ShortExact := shortExact_wangComplex Y -- `r z` is the section `(x, k) ↦ F'(e⁻¹ x) z` on `S.X₂`. By `isBijective_reprBy_iff`, a -- comparison from `reprBy E` is bijective iff this map is and the higher cohomology vanishes. let r : F'.obj E →+ (S.X₂ ⟶ TimesBNat.fst C ⋙ ψ ⋙ F') := homOfValue (.restrict (TimesBNat.fst C ⋙ ψ) F') (wangProj e) obtain ⟨hr_bij, h_high⟩ : Bijective r ∧ ∀ n : ℕ, Subsingleton (H S.X₂ (TimesBNat.fst C ⋙ ψ ⋙ F') (n + 1)) := isBijective_reprBy_iff.mp (isBijective_wangProj e hψ) have hf (z : F'.obj E) : S.f ≫ r z = r (F'.map g z - z) := wangSub_comp_homOfValue_wangProj e h_shift_square z have hq (y : (ψ ⋙ F').obj A) : S.g ≫ homOfValue (.restrict _ (ψ ⋙ F')) q y = r (F'.map i y) := wangPow_comp_homOfValue e hq_eq_comp y obtain ⟨h_inj, h_ker, h_surj⟩ : Injective (F'.map i) ∧ fixedPoints (F'.map g) ⊆ Set.range (F'.map i) ∧ Surjective fun z : F'.obj E ↦ F'.map g z - z := h_koszul refine isBijective_reprBy_iff.mpr ⟨⟨fun y y' hy ↦ ?_, fun φ ↦ ?_⟩, fun n ↦ ?_⟩ · -- Injective: pulled back along `S.g`, the section of `y` is `r (F'.map i y)`. exact h_inj (hr_bij.injective (by rw [← hq, ← hq, hy])) · -- A section `φ` on `Y` pulls back to some `r z` that `S.f` kills, so `z` is fixed by `g`. obtain ⟨z, hz⟩ : ∃ z : F'.obj E, r z = S.g ≫ φ := hr_bij.surjective (S.g ≫ φ) have hz_fixed : F'.map g z - z = 0 := hr_bij.injective (by rw [← hf, hz, S.zero_assoc, Limits.zero_comp, map_zero]) obtain ⟨y, rfl⟩ : z ∈ Set.range (F'.map i) := h_ker (sub_eq_zero.mp hz_fixed) exact ⟨y, hS.epi_g.left_cancellation _ _ ((hq y).trans hz)⟩ · -- `S.f` is onto on cohomology in all degrees, so that of `Y` embeds in that of `S.X₂`. refine subsingleton_H_succ_of_shortExact hS _ h_high (fun φ ↦ ?_) (h_high n) -- a class of degree `0` is some `r (F'.map g z - z)`, the image of `r z` obtain ⟨z, rfl⟩ : ∃ z : F'.obj E, r (F'.map g z - z) = φ := hr_bij.surjective.comp h_surj φ exact ⟨r z, hf z⟩ end New.Variety end WangSequence namespace New.Variety /-! ## Compatible root systems twisted by ε `New.Period.epsPow` is the chosen homomorphism s ↦ ε^s from ℚ to the tilt O^♭ of O_C. The symbol ♯ is Mathlib's `PreTilt.untilt`. * `New.Variety.compatibleRoots.atOne`: the value at 1. The twist does not change it, since ε^♯ = 1. -/ section RootSystems open TimesBNat CategoryTheory Period PreTilt MonoidHom SingleObj variable {p : ℕ} [ThePrime p] /-- The character s ↦ ε^s of ℚ≥0 with values in O^♭, the restriction of the chosen character `New.Period.epsPow` of ℚ. -/ abbrev epsPowNNRat : Multiplicative ℚ≥0 →* OFlat := epsPow.comp NNRat.coeHom.toAddMonoidHom.toMultiplicative /-- The functor sending a commutative O_C-algebra to its underlying set, lifted to an arbitrary universe. -/ abbrev underlyingSet.{u} : CommAlg OC ⥤ Type u := forget (CommAlg OC) ⋙ uliftFunctor.{u} /-- The functor on (O_C-algebras) × Bℕ sending A to the monoid homomorphisms χ from (ℚ≥0, +) to (A, ·). A map (f, k) from A to B sends χ to η^k · (f ∘ χ), where η is the character s ↦ (ε^s)^♯ read in B. -/ def compatibleRoots : TimesBNat (CommAlg OC) ⥤ Type 1 where obj A := ULift (Multiplicative ℚ≥0 →* A.1) -- a map `(f, k)` pushes a character forward along `f`, then multiplies it `k` times by -- the character `a ↦ (ε ^ a)^♯` map {_ B} f := ↾fun χ ↦ ⟨(fun φ ↦ (algebraMap OC B.1).toMonoidHom.comp (untilt.comp epsPowNNRat) * φ)^[f.2.toAdd] (MonoidHom.comp f.1.hom χ.down)⟩ map_id _ := by ext simp [id_as_one] map_comp _ _ := by ext simp [comp_as_mul, toAdd_mul (α := ℕ), pow_add, mul_assoc] /-- The natural map, on O_C-algebras times Bℕ, sending a character ℚ≥0 → A to its value at 1. -/ def compatibleRoots.atOne : compatibleRoots ⟶ TimesBNat.fst (CommAlg OC) ⋙ underlyingSet where app _ := ↾fun χ ↦ ⟨χ.down (Multiplicative.ofAdd 1)⟩ naturality A B f := by -- the twist `η` does not change the value at `1`: there it is the untilt of `ε`, which is `1` ext χ let η : Multiplicative ℚ≥0 →* B.1 := (algebraMap OC B.1).1.comp (untilt.comp epsPowNNRat) change ULift.up ((η * ·)^[f.2.toAdd] (MonoidHom.comp f.1.hom χ.down) (.ofAdd 1)) = ⟨f.1.hom (χ.down (.ofAdd 1))⟩ simp [η] variable {C : Type 1} [Category C] (F : AbFunctor C) (ψ : C ⥤ CommAlg OC) /-- Let ψ be a functor from C to O_C-algebras and y a point of ψ(A). This is the functor on C × Bℕ, the fibre product (`fiberProd`) of `compatibleRoots.atOne` along ψ with the point `pointMap y`, sending B to the pairs of a character w : ℚ≥0 → ψ(B) and a map f : A → B with w(1) = ψ(f)(y). Such a w is a system of roots of the image of y. -/ abbrev compatibleRootsAt {A : C} (y : (ψ ⋙ underlyingSet).obj A) : C × SingleObj (Multiplicative ℕ) ⥤ Type 1 := fiberProd ((ψ.prod (𝟭 (SingleObj (Multiplicative ℕ)))).whiskerLeft compatibleRoots.atOne) ((TimesBNat.fst C).whiskerLeft (pointMap (Y := ψ ⋙ underlyingSet) (A := A) y)) /-- For every object A and unit y of ψ(A), the root systems of y (`New.Variety.compatibleRootsAt`) form a line over Hom(A, −). That is, the projection to Hom(A, −) is bijective on cohomology with coefficients F. -/ abbrev CompatibleRootsAreLines : Prop := ∀ (A : C) (y : (ψ ⋙ underlyingSet) A), IsUnit y.down → IsLine F (Y := compatibleRootsAt ψ y) (fiberProd.snd ..) end RootSystems /-! ## Periodic sequences and root systems of a unit of a test A root system of a unit `v` of a `p`-adic test (`New.Variety.PadicTest`) is a character of `ℚ≥0` with value `v` at `1`. * `New.Variety.periodicSeq.koszulExact_shift`: the constants contain the kernel of the shift minus the identity, and this map is onto. * `New.Variety.periodicSeq.existsUnique_hom`: the universal property, over one domain. * `New.Variety.PadicTest.isLine_compatibleRoots`: the root systems of a unit have flat base change and form a line. -/ section KummerTorsor open CategoryTheory Function CommAlgCat Filter Period Finset Pi IsScalarTower Fin ShortComplex ModuleCat PreTilt Nat AddConstMapClass variable {p : ℕ} [ThePrime p] (R : Type _) [CommRing R] [Algebra OFlat R] /-- The `R`-algebra of periodic sequences `ℕ → R`. A sequence has a positive period if and only if `n !` is a period for all large `n`; the latter form is the one that is visibly closed under sums and products. -/ def periodicSeq : Subalgebra R (ℕ → R) where carrier := {f : ℕ → R | ∀ᶠ n : ℕ in atTop, Periodic f n !} mul_mem' hf hg := (hf.and hg).mono fun _ h ↦ h.1.mul h.2 add_mem' hf hg := (hf.and hg).mono fun _ h ↦ h.1.add h.2 algebraMap_mem' _ := Eventually.of_forall fun _ _ ↦ rfl /-- The shift of periodic sequences, `(γ f) k = f (k + 1)`. -/ @[local simp] def periodicSeq.shift : periodicSeq R →ₐ[OFlat] periodicSeq R where toFun f := ⟨f.val ∘ Nat.succ, f.property.mono (by grind [Periodic])⟩ map_one' := by aesop map_mul' := by aesop map_zero' := by aesop map_add' := by aesop commutes' := by aesop open periodicSeq Multiplicative NeZero NNRat IsCell Submonoid Equiv MonoidalCategory variable {R} {M : ModuleCat OFlat} {D E : Type*} [CommRing D] [IsDomain D] [CommRing E] [IsDomain E] /-- A sequence `f` with a positive period `n` is periodic in the sense of `New.Variety.periodicSeq`: for `m ≥ n` the number `m !` is a multiple of `n`, hence a period. -/ lemma periodicSeq.mem_of_periodic {f : ℕ → R} (n : ℕ) (hn_pos : 0 < n) (h_periodic : Periodic f n) : f ∈ periodicSeq R := by filter_upwards [mem_atTop n] with m hm simpa [Nat.div_mul_cancel (dvd_factorial hn_pos hm)] using h_periodic.nsmul (m ! / n) /-- Let `R` be an `O^♭`-algebra, so of characteristic `p`. Let `γ` be the shift. The inclusion of the constants in the periodic sequences is injective, and its image contains the kernel of `γ - 1`. The map `γ - 1` is onto. These facts hold after tensoring with any `O^♭`-module `M`, that is, for the coefficients `moduleCoeff (tensorCoeff M)`, `B ↦ B ⊗ M`. -/ lemma periodicSeq.koszulExact_shift : KoszulExact ((moduleCoeff (tensorCoeff M)).map (CommAlgCat.ofHom (toAlgHom OFlat R (periodicSeq R)))) ((moduleCoeff (tensorCoeff M)).map (CommAlgCat.ofHom (shift R))) := by -- The partial sums `σ f` satisfy `(shift - 1) (σ f) = f` and `f = f 0 + σ ((shift - 1) f)`, so -- the sequence splits, and a split sequence stays exact after tensoring with `M`. have h_sum (f : periodicSeq R) : (fun k ↦ ∑ i ∈ range k, f.val i) ∈ periodicSeq R := by obtain ⟨n, hn⟩ : ∃ n : ℕ, Periodic f.val n ! := f.prop.exists -- a shift by the period `n !` adds a constant, so a shift by `p * n !` adds `p` times it, -- which is `0` in `R` let s (k : ℕ) : R := ∑ i ∈ range k, f.val i have h_shift (k : ℕ) : s (k + n !) = s k + s n ! := by simp_rw [s, add_comm k, sum_range_add, add_comm n !, hn _, add_comm] refine mem_of_periodic (p * n !) pos' fun k ↦ ?_ simpa [natCast_eq_zero_of_algebra_oFlat] using map_add_nsmul (AddConstMap.mk s h_shift) k p -- `ev₀` is the value at `0`, and `σ f` is the sequence of partial sums of `f` let ev₀ : periodicSeq R →ₗ[OFlat] R := { toFun f := f.val 0, map_add' f g := by simp, map_smul' a f := by simp } let σ : periodicSeq R →ₗ[OFlat] periodicSeq R := { toFun f := ⟨_, h_sum f⟩ map_add' f g := Subtype.ext (funext fun k ↦ by simp [sum_add_distrib]) map_smul' a f := Subtype.ext (funext fun k ↦ by simp [smul_sum]) } let S : ShortComplex (ModuleCat OFlat) := .mk (↟(toAlgHom _ R (periodicSeq R)).toLinearMap) (↟(shift R).toLinearMap - 𝟙 _) let split : S.Splitting := { r := ↟ev₀, s := ↟σ -- the value at `0` of a constant sequence is the constant f_r := by ext; simp [S, ev₀] -- `(shift - 1) (σ f) = f` s_g := by ext; simp [S, σ, sum_range_succ_sub_sum] -- `f = f 0 + σ ((shift - 1) f)` id := by ext; simp [S, ev₀, σ, ← sum_sub_distrib, sum_range_sub] } let G : ModuleCat OFlat ⥤ AddCommGrpCat.{1} := tensorRight M ⋙ forget₂ .. ⋙ AddCommGrpCat.uliftFunctor have h_exact : (S.map G).ShortExact := (split.map G).shortExact -- the maps of the mapped complex become those of the statement (`simp` splits the image of -- `shift - 1`) simp [S, ShortComplex.map] at h_exact exact ⟨h_exact.ab_injective_f, fun x hx ↦ (ab_exact_iff _).mp h_exact.exact x (sub_eq_zero.mpr hx), h_exact.ab_surjective_g⟩ /-- For a ring map ψ from the periodic R-valued sequences to a ring without zero divisors and finitely many sequences w_i, there is one index k with ψ(w_i) = ψ(w_i(k)) for all i, w_i(k) read as a constant sequence. -/ lemma periodicSeq.exists_eq_eval {ι : Sort*} [Finite ι] (ψ : periodicSeq R →+* D) (w : ι → periodicSeq R) : ∃ k : ℕ, ∀ i : ι, ψ (w i) = ψ (algebraMap R (periodicSeq R) ((w i).val k)) := by -- Let `N !` be a common period. If every `k` fails for some sequence `w (f k)`, then the product -- over `k < N !` of `w (f k)` minus its value at `k` is `0`, while `ψ` of each factor is not. obtain ⟨N, hN⟩ : ∃ N : ℕ, ∀ i : ι, Periodic (w i).val N ! := (eventually_all.mpr fun i ↦ (w i).prop).exists by_contra! h_bad : ∀ k : ℕ, ∃ i : ι, ψ (w i) ≠ ψ (algebraMap R (periodicSeq R) ((w i).val k)) choose f hf using h_bad have h_prod : ∏ k ∈ range N !, (w (f k) - algebraMap R (periodicSeq R) ((w (f k)).val k)) = 0 := by ext x -- at `x` the factor of index `x % N !` vanishes simp [prod_eq_zero (mem_range.mpr (x.mod_lt pos')), (hN _).map_mod_nat] simpa [prod_eq_zero_iff, sub_eq_zero, hf] using congrArg ψ h_prod /-- The Kummer torsor. Let `ζ`, `r`, `u` be characters of `ℚ≥0` in a domain `E`, with `ζ a` a primitive root of unity of order the denominator of `a` and `u 1 = r 1 ≠ 0`. Let `D` be a ring without zero divisors, `f : R →+* D`, let `s : D → E` be any map, and let the periodic sequence `x n` lift `k ↦ ζ n ^ k * r n` along `s ∘ f`. Then `f` has exactly one extension `ϕ` to periodic sequences with `s (ϕ (x n)) = u n` for all `n`. -/ lemma periodicSeq.existsUnique_hom (f : R →+* D) (s : D → E) (ζ r u : Multiplicative ℚ≥0 →* E) (x : Multiplicative ℚ≥0 → periodicSeq R) (hx : ∀ (n : Multiplicative ℚ≥0) (k : ℕ), s (f ((x n).val k)) = (ζ ^ k * r) n) (hr_ne : r (ofAdd 1) ≠ 0) (hζ : ∀ a : Multiplicative ℚ≥0, IsPrimitiveRoot (ζ a) a.toAdd.den) (hu : u (ofAdd 1) = r (ofAdd 1)) : ∃! ϕ : periodicSeq R →+* D, ϕ.comp (algebraMap R (periodicSeq R)) = f ∧ ∀ n : Multiplicative ℚ≥0, s (ϕ (x n)) = u n := by -- Write `q n = 1 / n !`. Both `u (q n)` and `r (q n)` are `n !`-th roots of `r 1`, so they differ -- by a power `a n` of the primitive root `ζ (q n)`. A periodic sequence `y` takes the same value -- at `a n` for all large `n`, and `ϕ y` is `f` of that value. let q (n : ℕ) : Multiplicative ℚ≥0 := ofAdd (n ! : ℚ≥0)⁻¹ have h_one (n : ℕ) : ofAdd 1 = q n ^ n ! := by simp [q, ← ofAdd_nsmul] have h_prim {n : ℕ} : IsPrimitiveRoot (ζ (q n)) n ! := by simpa [q, NeZero.ne, den_inv_of_ne_zero] using hζ (q n) have h_root (n : ℕ) : ∃ k ∈ range n !, ζ (q n) ^ k * r (q n) = u (q n) := by have h_pow : u (q n) ^ n ! = r (q n) ^ n ! := by simpa [h_one n] using hu rwa [← Polynomial.mem_nthRoots pos', h_prim.nthRoots_eq rfl, Multiset.mem_map] at h_pow choose a ha_lt ha using h_root -- the exponent `a n` is unique modulo `n !` have h_mod (n k : ℕ) (hk : ζ (q n) ^ k * r (q n) = u (q n)) : a n = k % n ! := by have hr : r (q n) ≠ 0 := ne_zero_pow (factorial_ne_zero n) (by rwa [← map_pow, ← h_one n]) refine h_prim.pow_inj (mem_range.mp (ha_lt n)) (mod_lt k pos') (mul_right_cancel₀ hr ?_) rw [← pow_eq_pow_mod k h_prim.pow_eq_one, ha, hk] -- so a sequence `y` of period `(N y) !` has the same value at every such exponent `k` choose N hN using fun y : periodicSeq R ↦ y.prop.exists have h_val (y : periodicSeq R) (k : ℕ) (hk : ζ (q (N y)) ^ k * r (q (N y)) = u (q (N y))) : y.val (a (N y)) = y.val k := by rw [h_mod (N y) k hk, (hN y).map_mod_nat] -- `a m` works at every `t` that is a multiple of `1 / m !`, so at a given `t` for large `m` have h_large (t : Multiplicative ℚ≥0) : ∀ᶠ m in atTop, (ζ ^ a m * r) t = u t := by filter_upwards [mem_atTop t.toAdd.den] with m hm have h_pow : q m ^ (t.toAdd.num * (m ! / t.toAdd.den)) = t := toAdd.injective (by simp [q, field, dvd_factorial, hm]) rw [← h_pow, map_pow, map_pow, ← ha m, MonoidHom.mul_apply, MonoidHom.pow_apply] have h_lim (y : periodicSeq R) : (fun _ ↦ y.val (a (N y))) =ᶠ[atTop] fun m ↦ y.val (a m) := (h_large (q (N y))).mono fun m h_m ↦ h_val y (a m) h_m -- the limit of `y (a m)` is a ring map in `y` let lim : periodicSeq R →+* R := { toFun y := y.val (a (N y)) map_one' := rfl map_zero' := rfl map_mul' y y' := eventually_const.mp ((h_lim (y * y')).trans ((h_lim y).mul (h_lim y')).symm) map_add' y y' := eventually_const.mp ((h_lim (y + y')).trans ((h_lim y).add (h_lim y')).symm) } refine ⟨f.comp lim, ⟨rfl, fun t ↦ ?_⟩, ?_⟩ · obtain ⟨m, h_eq, h_exp⟩ : ∃ m : ℕ, (x t).val (a (N (x t))) = (x t).val (a m) ∧ (ζ ^ a m * r) t = u t := ((h_lim (x t)).and (h_large t)).exists change s (f ((x t).val (a (N (x t))))) = u t rw [h_eq, hx, h_exp] · rintro ψ ⟨rfl, hψ⟩ ext y -- `ψ` is evaluation at one index `k` on both `y` and `x (q (N y))`; the latter pins `k` down obtain ⟨k, hk⟩ := exists_eq_eval ψ ![y, x (q (N y))] have hk_x : ψ (x (q (N y))) = ψ (algebraMap R (periodicSeq R) ((x (q (N y))).val k)) := hk 1 have h_exp : (ζ ^ k * r) (q (N y)) = u (q (N y)) := by rw [← hx, ← hψ, hk_x, RingHom.comp_apply] calc ψ y = ψ (algebraMap R (periodicSeq R) (y.val k)) := hk 0 _ = ψ (algebraMap R (periodicSeq R) (y.val (a (N y)))) := by rw [h_val y k h_exp] omit [ThePrime p] [Algebra OFlat R] in /-- If `R` is perfect of characteristic `p`, so is the ring of periodic sequences over `R`: Frobenius acts termwise, and a sequence is periodic exactly when its termwise image is. -/ lemma periodicSeq.perfectRing [ExpChar R p] [PerfectRing R p] : PerfectRing (periodicSeq R) p where bijective_frobenius := by let e : (ℕ → R) ≃ (ℕ → R) := (Equiv.refl ℕ).arrowCongr (frobeniusEquiv R p).toEquiv have h_mem (f : ℕ → R) : f ∈ periodicSeq R ↔ e f ∈ periodicSeq R := by -- without `-RingEquiv.toEquiv_eq_coe` simp unfolds the equivalence to `frobenius` simp [periodicSeq, e, -RingEquiv.toEquiv_eq_coe] exact (e.subtypeEquiv h_mem).bijective /-- Every ring map `g` from `O_C` to a cell `T` (`New.Variety.IsCell`: a `p`-adically complete, absolutely integrally closed valuation domain in which `p ≠ 0`) is injective. -/ lemma injective_of_isCell {T : Type} [CommRing T] [IsCell p T] (g : OC →+* T) : Function.Injective g := by -- a nonzero element of `OC` divides a power of `p`, which is nonzero in the cell refine (injective_iff_map_eq_zero _).mpr fun a ha ↦ by_contra fun h_ne ↦ ?_ obtain ⟨n, hn⟩ : ∃ n : ℕ, a ∣ p ^ n := OC.exists_dvd_pow (Fact.out : ¬IsUnit (p : OC)) h_ne have h_dvd : g a ∣ (p : T) ^ n := by simpa using map_dvd g hn rw [ha, zero_dvd_iff] at h_dvd exact pow_ne_zero n p_ne_zero h_dvd /-- The map of tests `c ⟶ D` whose tilt agrees on constant sequences with the `O^♭`-algebra map `ϕ` from the periodic sequences over the tilt of `c` to the tilt of `D`. -/ private def PadicTest.baseOfHom {c D : PadicTest} (ϕ : periodicSeq c.TiltRing →ₐ[OFlat] D.TiltRing) : c ⟶ D := tilt.preimage (X := c) (ofHom (ϕ.comp (toAlgHom OFlat c.TiltRing (periodicSeq c.TiltRing)))) /-- The tilt of `PadicTest.baseOfHom ϕ` is `ϕ` on constant sequences. -/ private lemma PadicTest.preTiltMap_baseOfHom_apply {c D : PadicTest} (ϕ : periodicSeq c.TiltRing →ₐ[OFlat] D.TiltRing) (y : c.TiltRing) : PreTilt.map p (baseOfHom ϕ).toRingHom y = ϕ (algebraMap c.TiltRing (periodicSeq c.TiltRing) y) := ConcreteCategory.congr_hom (tilt.map_preimage _) y /-- `PadicTest.baseOfHom ϕ` is the map of tests `f` whose tilt agrees with `ϕ` on constant sequences. -/ private lemma PadicTest.baseOfHom_eq_of_forall_algebraMap {c D : PadicTest} {ϕ : periodicSeq c.TiltRing →ₐ[OFlat] D.TiltRing} {f : c ⟶ D} (h_const : ∀ y : c.TiltRing, ϕ (algebraMap c.TiltRing (periodicSeq c.TiltRing) y) = PreTilt.map p f.1 y) : baseOfHom ϕ = f := tilt.map_injective <| hom_ext <| AlgHom.ext fun y ↦ (preTiltMap_baseOfHom_apply ϕ y).trans (h_const y) /-- A termwise relation between the untilts `♯` of two periodic sequences passes through `ϕ`: if `(w k)^♯ = t * (w' k)^♯` for every `k`, then `(ϕ w)^♯ = t' * (ϕ w')^♯`, where `t'` is the image of `t` under `PadicTest.baseOfHom ϕ`. -/ private lemma PadicTest.untilt_map_eq_mul_of_forall {c D : PadicTest} (ϕ : periodicSeq c.TiltRing →ₐ[OFlat] D.TiltRing) (t : c.ProdRing) (w w' : periodicSeq c.TiltRing) (hw : ∀ k : ℕ, (w.val k).untilt = t * (w'.val k).untilt) : (ϕ w).untilt = (baseOfHom ϕ).toRingHom t * (ϕ w').untilt := by -- On each cell `j`, `ϕ` agrees on `w` and on `w'` with the evaluation at one index -- (`exists_eq_eval`). funext j let ev_j : D.ProdRing →+* D.Cell j := Pi.evalRingHom D.Cell j obtain ⟨k, hk⟩ := exists_eq_eval ((PreTilt.map p ev_j).comp ϕ.toRingHom) ![w, w'] -- where `ϕ y` agrees on the cell with `ϕ` of the constant `y k`, its untilt is that of `y k` -- mapped by `baseOfHom ϕ` have h_at_k (y : periodicSeq c.TiltRing) (hy : PreTilt.map p ev_j (ϕ y) = PreTilt.map p ev_j (ϕ (algebraMap c.TiltRing (periodicSeq c.TiltRing) (y.val k)))) : (ϕ y).untilt j = (baseOfHom ϕ).toRingHom (y.val k).untilt j := by simpa [ev_j, PreTilt.untilt_natural, ← preTiltMap_baseOfHom_apply] using congrArg untilt hy rw [Pi.mul_apply, h_at_k w (hk 0), h_at_k w' (hk 1), hw, map_mul, Pi.mul_apply] /-- The character `a ↦ (ε ^ a)^♯` of `ℚ≥0` valued in the ring of a `p`-adic test `c`. -/ private def PadicTest.epsChar (c : PadicTest) : Multiplicative ℚ≥0 →* c.ProdRing := c.structureMap.toMonoidHom.comp (untilt.comp epsPowNNRat) /-- The statement on one cell: let `r` be a character of `ℚ≥0` in `c.ProdRing` with `r 1` a unit, let the periodic sequences `x n` over the tilt of `c` have untilts `k ↦ c.epsChar n ^ k * r n`, and let `f : c ⟶ D` and the character `u` in the ring of `D` satisfy `u 1 = f (r 1)`. Then for each index `j` exactly one ring map `ϕ` from the periodic sequences over the tilt of `c` to the tilt of `D.Cell j` restricts on constants to the tilt of `f` followed by the projection, and has `(ϕ (x n))^♯ = u n j` for all `n`. -/ private lemma PadicTest.existsUnique_cell_hom_untilt_eq {c D : PadicTest} (r : Multiplicative ℚ≥0 →* c.ProdRing) (hr_unit : IsUnit (r (ofAdd 1))) (x : Multiplicative ℚ≥0 → periodicSeq c.TiltRing) (hx : ∀ (n : Multiplicative ℚ≥0) (k : ℕ), ((x n).val k).untilt = c.epsChar n ^ k * r n) (f : c ⟶ D) (u : Multiplicative ℚ≥0 →* D.ProdRing) (hu : u (ofAdd 1) = f.1 (r (ofAdd 1))) (j : D.Index) : ∃! ϕ : periodicSeq c.TiltRing →+* PreTilt (D.Cell j) p, ϕ.comp (algebraMap c.TiltRing (periodicSeq c.TiltRing)) = PreTilt.map p ((Pi.evalRingHom D.Cell j).comp f.toRingHom) ∧ ∀ n : Multiplicative ℚ≥0, (ϕ (x n)).untilt = u n j := by -- This is `existsUnique_hom`; `c.epsChar` stays faithful as `OC` embeds in the cell. let g : c.ProdRing →+* D.Cell j := (Pi.evalRingHom D.Cell j).comp f.toRingHom let ζ_j : Multiplicative ℚ≥0 →* D.Cell j := g.toMonoidHom.comp c.epsChar have h_inj : Injective (g.comp c.structureMap) := injective_of_isCell _ have hx_j (n : Multiplicative ℚ≥0) (k : ℕ) : untilt (PreTilt.map p g ((x n).val k)) = (ζ_j ^ k * g.toMonoidHom.comp r) n := by simp [ζ_j, hx] have hζ_j (a : Multiplicative ℚ≥0) : IsPrimitiveRoot (ζ_j a) a.toAdd.den := (isPrimitiveRoot_untilt_epsPow (ofAdd (a.toAdd : ℚ))).map_of_injective h_inj exact existsUnique_hom (PreTilt.map p g) untilt ζ_j (g.toMonoidHom.comp r) ((Pi.evalRingHom D.Cell j).toMonoidHom.comp u) x hx_j (hr_unit.map g).ne_zero hζ_j (congrFun hu j) /-- Let `r` be a character of `ℚ≥0` in `c.ProdRing` with `r 1` a unit, and let the periodic sequences `x n` over the tilt of `c` have untilts `k ↦ c.epsChar n ^ k * r n`. For a map of tests `f : c ⟶ D` and a character `u` in the ring of `D` with `u 1 = f (r 1)`, exactly one `ϕ` from the periodic sequences to the tilt of `D` has `baseOfHom ϕ = f` and `(ϕ (x n))^♯ = u n`. -/ private lemma PadicTest.existsUnique_baseOfHom_eq_and_untilt_eq {c D : PadicTest} (r : Multiplicative ℚ≥0 →* c.ProdRing) (hr_unit : IsUnit (r (ofAdd 1))) (x : Multiplicative ℚ≥0 → periodicSeq c.TiltRing) (hx : ∀ (n : Multiplicative ℚ≥0) (k : ℕ), ((x n).val k).untilt = c.epsChar n ^ k * r n) (f : c ⟶ D) (u : Multiplicative ℚ≥0 →* D.ProdRing) (hu : u (ofAdd 1) = f.1 (r (ofAdd 1))) : ∃! ϕ : periodicSeq c.TiltRing →ₐ[OFlat] D.TiltRing, baseOfHom ϕ = f ∧ ∀ n : Multiplicative ℚ≥0, (ϕ (x n)).untilt = u n := by -- On each cell this is `existsUnique_cell_hom_untilt_eq`; the tilt of `D` is the product of the -- tilts of its cells. choose ϕ hϕ h_unique using existsUnique_cell_hom_untilt_eq r hr_unit x hx f u hu let ψ : periodicSeq c.TiltRing →+* D.TiltRing := D.tiltPiEquiv.symm.toRingHom.comp (.pi ϕ) have hψ_cell (j : D.Index) (y : periodicSeq c.TiltRing) : PreTilt.map p (Pi.evalRingHom D.Cell j) (ψ y) = ϕ j y := congrFun (D.tiltPiEquiv.right_inv fun j ↦ ϕ j y) j have hψ_const (y : c.TiltRing) : ψ (algebraMap c.TiltRing (periodicSeq c.TiltRing) y) = PreTilt.map p f.toRingHom y := D.tiltPiEquiv.symm_apply_eq.mpr (funext fun j ↦ (RingHom.congr_fun (hϕ j).left y).trans (RingHom.congr_fun (PreTilt.map_comp ..) _)) have hψ_commutes (a : OFlat) : ψ (algebraMap OFlat (periodicSeq c.TiltRing) a) = algebraMap OFlat D.TiltRing a := (hψ_const (algebraMap OFlat c.TiltRing a)).trans ((tilt.map f).hom.commutes a) refine ⟨⟨ψ, hψ_commutes⟩, ⟨baseOfHom_eq_of_forall_algebraMap hψ_const, fun n ↦ ?_⟩, ?_⟩ · funext j have h_cell_x : ((ϕ j) (x n)).untilt = u n j := (hϕ j).right n rwa [← hψ_cell, PreTilt.untilt_natural] at h_cell_x · rintro ψ' ⟨rfl, hψ'⟩ -- on constants, `ψ'` followed by the tilt of the projection to the cell `j` is the tilt of -- `baseOfHom ψ'` followed by that projection have h_const (j : D.Index) : ((PreTilt.map p (Pi.evalRingHom D.Cell j)).comp ψ'.toRingHom).comp (algebraMap c.TiltRing (periodicSeq c.TiltRing)) = PreTilt.map p ((Pi.evalRingHom D.Cell j).comp (baseOfHom ψ').toRingHom) := by ext y simp [PreTilt.map_comp, ← preTiltMap_baseOfHom_apply] have h_eq (j : D.Index) : (PreTilt.map p (Pi.evalRingHom D.Cell j)).comp ψ'.toRingHom = ϕ j := h_unique j _ ⟨h_const j, fun n ↦ (PreTilt.untilt_natural ..).trans (congrFun (hψ' n) j)⟩ exact AlgHom.ext fun y ↦ D.tiltPiEquiv.eq_symm_apply.mpr (funext fun j ↦ RingHom.congr_fun (h_eq j) y) /-- Let `v` be a unit of the ring of the test `c`. There are a root system `r` of `v` (a character of `ℚ≥0` with `r 1 = v`) and periodic sequences `x n` over the tilt of `c` whose untilts are `k ↦ c.epsChar n ^ k * r n`. -/ private lemma PadicTest.exists_rootSystem_periodicSeq (c : PadicTest) {v : c.ProdRing} (hv : IsUnit v) : ∃ (r : Multiplicative ℚ≥0 →* c.ProdRing) (x : Multiplicative ℚ≥0 → periodicSeq c.TiltRing), r (ofAdd 1) = v ∧ ∀ (n : Multiplicative ℚ≥0) (k : ℕ), ((x n).val k).untilt = c.epsChar n ^ k * r n := by have h_untilt_surj : ∀ y : c.ProdRing, ∃ b : c.TiltRing, b.untilt = y := untilt_surjective_of_isAbsIntegrallyClosed (R := c.ProdRing) (p := p) choose σ hσ using h_untilt_surj -- The ring of `c` is absolutely integrally closed, so `v` has a compatible system `s` of roots; -- `r` is its restriction to `ℚ≥0`. obtain ⟨s, hs⟩ : ∃ s : ℚ →+ _root_.Additive c.ProdRingˣ, s 1 = hv.unit := exists_compatible_roots _ let r : Multiplicative ℚ≥0 →* c.ProdRing := (Units.coeHom _).comp (s.comp coeHom.toAddMonoidHom).toMultiplicativeLeft have h_r_one : r (ofAdd 1) = v := by have h_r : r (ofAdd 1) = ((Additive.toMul hv.unit : c.ProdRingˣ) : c.ProdRing) := by simp [r, hs] exact h_r.trans hv.unit_spec -- `c.epsChar n` is a root of unity of order dividing the denominator of `n`, a period of `x n`. have hζ (n : Multiplicative ℚ≥0) : c.epsChar n ^ n.toAdd.den = 1 := by -- `(ε ^ n)^♯` is a primitive root of unity of order the denominator of `n` have h_root : c.structureMap ((epsPow (ofAdd (n.toAdd : ℚ))).untilt ^ (n.toAdd : ℚ).den) = c.structureMap 1 := congrArg c.structureMap (isPrimitiveRoot_untilt_epsPow (ofAdd (n.toAdd : ℚ))).pow_eq_one simpa [epsChar, NNRat.den_coe] using h_root have h_periodic (n : Multiplicative ℚ≥0) : Periodic (fun k ↦ σ ((c.epsChar ^ k * r) n)) n.toAdd.den := by simp [pow_add, hζ] let x (n : Multiplicative ℚ≥0) : periodicSeq c.TiltRing := ⟨fun k ↦ σ ((c.epsChar ^ k * r) n), mem_of_periodic n.toAdd.den n.toAdd.den_pos (h_periodic n)⟩ exact ⟨r, x, h_r_one, fun n k ↦ hσ _⟩ /-- Given periodic sequences `x n` lifting `k ↦ c.epsChar n ^ k * r n`, an `OFlat`-algebra map `ϕ : periodicSeq c.TiltRing →ₐ[OFlat] D.TiltRing` induces the character `n ↦ (ϕ (x n))^♯` of `ℚ≥0` in `D.ProdRing`. -/ private def PadicTest.rootSystemOfHom {c D : PadicTest} {r : Multiplicative ℚ≥0 →* c.ProdRing} {x : Multiplicative ℚ≥0 → periodicSeq c.TiltRing} (hx : ∀ (n : Multiplicative ℚ≥0) (k : ℕ), ((x n).val k).untilt = c.epsChar n ^ k * r n) (ϕ : periodicSeq c.TiltRing →ₐ[OFlat] D.TiltRing) : Multiplicative ℚ≥0 →* D.ProdRing where toFun := untilt ∘ ϕ ∘ x map_one' := by have h_x_one (k : ℕ) : ((x 1).val k).untilt = 1 * ((1 : periodicSeq c.TiltRing).val k).untilt := by simp [hx] simpa using untilt_map_eq_mul_of_forall ϕ 1 (x 1) 1 h_x_one map_mul' a b := by have h_x_mul (k : ℕ) : ((x (a * b)).val k).untilt = 1 * ((x a * x b).val k).untilt := by rw [one_mul, Subalgebra.coe_mul, Pi.mul_apply, map_mul, hx, hx, hx, map_mul, map_mul, mul_pow, mul_mul_mul_comm] simpa using untilt_map_eq_mul_of_forall ϕ 1 (x (a * b)) (x a * x b) h_x_mul /-- Given a root system `r` of a unit `r 1` of `c.ProdRing` and periodic sequences `x n` lifting `k ↦ c.epsChar n ^ k * r n`, sending `ϕ : periodicSeq c.TiltRing →ₐ[OFlat] D.TiltRing` to `(rootSystemOfHom hx ϕ, baseOfHom ϕ)` gives a natural isomorphism from `tilt ⋙ reprBy (.of _ (periodicSeq c.TiltRing))` to the functor of compatible root systems of `r 1`. -/ private def PadicTest.compatibleRootsIso (c : PadicTest) {r : Multiplicative ℚ≥0 →* c.ProdRing} (hv : IsUnit (r (ofAdd 1))) {x : Multiplicative ℚ≥0 → periodicSeq c.TiltRing} (hx : ∀ (n : Multiplicative ℚ≥0) (k : ℕ), ((x n).val k).untilt = c.epsChar n ^ k * r n) : tilt ⋙ reprBy (.of _ (periodicSeq c.TiltRing)) ≅ TimesBNat.incl PadicTest ⋙ compatibleRootsAt algFunctor ⟨r (ofAdd 1)⟩ := let toFib (D : PadicTest) (ϕ : (tilt ⋙ reprBy (.of _ (periodicSeq c.TiltRing))).obj D) : (TimesBNat.incl PadicTest ⋙ compatibleRootsAt algFunctor ⟨r (ofAdd 1)⟩).obj D := ⟨(⟨rootSystemOfHom hx ϕ.down.hom⟩, ⟨baseOfHom ϕ.down.hom⟩), congrArg ULift.up <| by -- `c.epsChar 1 = 1`, so the sequence `x 1` lifts the constant `r 1` let ϕ' : periodicSeq c.TiltRing →ₐ[OFlat] D.TiltRing := ϕ.down.hom have h_x_one (k : ℕ) : ((x (ofAdd 1)).val k).untilt = r (ofAdd 1) * ((1 : periodicSeq c.TiltRing).val k).untilt := by simp [hx, epsChar] change (ϕ' (x (ofAdd 1))).untilt = (baseOfHom ϕ').1 (r (ofAdd 1)) simpa using untilt_map_eq_mul_of_forall ϕ' (r (ofAdd 1)) (x (ofAdd 1)) 1 h_x_one⟩ -- Universality: a map `f` of tests and a system `u` of roots of `f v` come from one `ϕ`. have h_univ {D : PadicTest} (f : c ⟶ D) (u : Multiplicative ℚ≥0 →* D.ProdRing) (hu : u (ofAdd 1) = f.1 (r (ofAdd 1))) : ∃! ϕ : periodicSeq c.TiltRing →ₐ[OFlat] D.TiltRing, baseOfHom ϕ = f ∧ rootSystemOfHom hx ϕ = u := by have h_sys_eq (ϕ : periodicSeq c.TiltRing →ₐ[OFlat] D.TiltRing) : rootSystemOfHom hx ϕ = u ↔ ∀ n, (ϕ (x n)).untilt = u n := MonoidHom.ext_iff simpa only [h_sys_eq] using existsUnique_baseOfHom_eq_and_untilt_eq r hv x hx f u hu -- So `ϕ ↦ (rootSystemOfHom hx ϕ, baseOfHom ϕ)` is a bijection onto the pairs of the statement. have h_bij (D : PadicTest) : Bijective (toFib D) := by refine (bijective_iff_existsUnique _).2 fun ⟨⟨⟨u⟩, ⟨f⟩⟩, hu⟩ ↦ ?_ obtain ⟨ϕ, ⟨rfl, rfl⟩, h_unique⟩ := h_univ f u (congrArg ULift.down hu) refine ⟨⟨ofHom ϕ⟩, rfl, fun ψ hψ ↦ ?_⟩ -- `toFib D ψ = toFib D ⟨ofHom ϕ⟩` compares the maps of tests and the root systems have h_pair : (toFib D ψ).val = (toFib D ⟨ofHom ϕ⟩).val := congrArg Subtype.val hψ have h_base_eq : baseOfHom ψ.down.hom = baseOfHom ϕ := congrArg (ULift.down ∘ Prod.snd) h_pair have h_sys_eq : rootSystemOfHom hx ψ.down.hom = rootSystemOfHom hx ϕ := congrArg (ULift.down ∘ Prod.fst) h_pair rw [← h_unique ψ.down.hom ⟨h_base_eq, h_sys_eq⟩] rfl NatIso.ofComponents (fun D ↦ (Equiv.ofBijective (toFib D) (h_bij D)).toIso) fun f ↦ by -- The bijection is natural in the test `D`. ext ⟨⟨ϕ⟩⟩ have h_sys_map : rootSystemOfHom hx ((tilt.map f).hom.comp ϕ) = f.toRingHom.toMonoidHom.comp (rootSystemOfHom hx ϕ) := MonoidHom.ext fun _ ↦ PreTilt.untilt_natural f.toRingHom _ have h_base_map : baseOfHom ((tilt.map f).hom.comp ϕ) = baseOfHom ϕ ≫ f := baseOfHom_eq_of_forall_algebraMap fun y ↦ ((RingHom.congr_fun (PreTilt.map_comp p f.toRingHom (baseOfHom ϕ).toRingHom) y).trans (congrArg (PreTilt.map p f.toRingHom) (preTiltMap_baseOfHom_apply ϕ y))).symm exact Subtype.ext (Prod.ext (congrArg ULift.up h_sys_map) (congrArg ULift.up h_base_map)) /-- Let the coefficients `B ↦ B^♭ ⊗ M` make `Hom(b, (-)^♭)` acyclic for every perfect `b`, and let `v` be a unit of the ring of a test `c`. The root systems of `v` (pairs of a character `u` of `ℚ≥0` and a map of tests `f : c ⟶ D` with `u 1 = f v`, the generator of `ℕ` multiplying `u` by `a ↦ (ε ^ a)^♯`) (a) have flat base change and (b) form a line over the functor represented by `c`: the projection `(u, f) ↦ f` identifies the cohomology of the functor represented by `c` with that of the homotopy quotient. -/ lemma PadicTest.isLine_compatibleRoots (h_acyclic : IsAcyclicOnPerfect (moduleCoeff (tensorCoeff M))) (c : PadicTest) (v : (algFunctor ⋙ underlyingSet) c) (hv : IsUnit v.down) : -- (a) the systems of roots of `v` have flat base change HasFlatBaseChange (freeAb (TimesBNat.incl PadicTest ⋙ compatibleRootsAt algFunctor v)) ∧ -- (b) they form a line IsLine (tilt ⋙ moduleCoeff (tensorCoeff M)) (Y := compatibleRootsAt algFunctor v) (fiberProd.snd ..) := by -- The functor of root systems of `v` is `Hom(periodicSeq c.TiltRing, (-)^♭)`: choose one system -- `r`; the periodic sequences `x n` lifting `k ↦ (c.epsChar ^ k * r) n` along the untilt give the -- universal system. As `periodicSeq c.TiltRing` is perfect, both claims follow, `shift` acting as -- multiplication by the character `c.epsChar : a ↦ (ε ^ a)^♯`. obtain ⟨r, x, hr_one, hx⟩ := exists_rootSystem_periodicSeq c hv obtain rfl : (⟨r (ofAdd 1)⟩ : (algFunctor ⋙ underlyingSet).obj c) = v := congrArg ULift.up hr_one have h_perfect : PerfectRing (periodicSeq c.TiltRing) p := perfectRing -- The shift multiplies each root `(ϕ (x n))^♯` by `(ε ^ n)^♯`, read in `D`. have h_shift {D : PadicTest} (ϕ : periodicSeq c.TiltRing →ₐ[OFlat] D.TiltRing) (n : Multiplicative ℚ≥0) : (ϕ (shift _ (x n))).untilt = algebraMap OC D.ProdRing (untilt (epsPowNNRat n)) * rootSystemOfHom hx ϕ n := by have h_x_succ (k : ℕ) : ((shift c.TiltRing (x n)).val k).untilt = c.epsChar n * ((x n).val k).untilt := by simp [hx, _root_.pow_succ', mul_assoc] exact (untilt_map_eq_mul_of_forall ϕ (c.epsChar n) (shift c.TiltRing (x n)) (x n) h_x_succ).trans (congrArg (· * rootSystemOfHom hx ϕ n) ((baseOfHom ϕ).commutes (untilt (epsPowNNRat n)))) let e := compatibleRootsIso c hv hx -- Flat base change: by `homTiltIso` the functor is that of points of an `OC`-algebra. The line: -- `IsLine.of_acyclic` asks for acyclicity, the actions of constants and shift, and -- `koszulExact_shift`. refine ⟨hasFlatBaseChange_of_iso_reprBy (homTiltIso.symm ≪≫ e), ?_⟩ refine .of_acyclic e (h_acyclic _) _ _ (fun _ _ ↦ tilt.map_preimage _) ⟨?_⟩ koszulExact_shift -- The generator of `ℕ` multiplies a root system by `(ε ^ a)^♯`, as the shift does. ext D ⟨⟨ϕ⟩⟩ exact Subtype.ext (Prod.ext (congrArg ULift.up (MonoidHom.ext (h_shift ϕ))) rfl) end KummerTorsor end New.Variety end