module import TauCeti.AlgebraicGeometry.Morphisms.FinitePresentation.Basic import TauCeti.AlgebraicGeometry.Morphisms.Flat.Descent import TauCeti.RingTheory.Ideal.MinimalPrime.Localization import TauCeti.RingTheory.Ideal.TensorProduct public import Aesop.BuiltinRules public import Mathlib.AlgebraicGeometry.Morphisms.QuasiFinite import Mathlib.AlgebraicGeometry.Morphisms.WeaklyEtale import Mathlib.AlgebraicGeometry.QuasiAffine import Mathlib.AlgebraicGeometry.ZariskisMainTheorem import Mathlib.CategoryTheory.Limits.Shapes.Connected import Mathlib.RingTheory.Etale.Weakly import Mathlib.RingTheory.Finiteness.ModuleFinitePresentation import Mathlib.RingTheory.TotallySplit import TauCeti.AlgebraicGeometry.Morphisms.Smooth.GeometricallyReduced public import Lib.Shimura.AbelianScheme.Basic import Lib.General.Geometry.PointsOfProperSchemes /-! # Isogenies: factorisation of homomorphisms, finiteness and flatness Two facts on isogenies. Over an Artinian ring, a homomorphism that kills the kernel of an isogeny factors through it. Over a local ring, a quasi-finite surjective homomorphism of abelian schemes is an isogeny. * `New.Variety.exists_isAdditive_comp_eq_of_isIsogeny`: over an Artinian ring, a homomorphism that kills the kernel of an isogeny `f`, tested on finite local algebras, factors through `f`. * `New.Variety.isIsogeny_of_locallyQuasiFinite`: over a local ring, a locally quasi-finite surjective homomorphism of abelian schemes is finite and flat. Notions from other files: * `New.specOver`: The spectrum of an R-algebra B, as a scheme over Spec R. * `New.IsAbelianScheme`: A commutative group scheme that is smooth and proper over the base, and on which multiplication by every m ≠ 0 is surjective. * `New.IsIsogeny`: A homomorphism that is finite, flat and surjective. ## Relation to the literature Known result: Factorisation through an isogeny, and quasi-finite surjective homomorphisms of abelian schemes are finite flat. Here an abelian scheme means a smooth and proper commutative group scheme on which multiplication by every m ≠ 0 is surjective; the base is an Artinian ring for the first result and a local ring for the second. Source: B. Edixhoven, G. van der Geer, B. Moonen, Abelian Varieties (draft), ch. IV §3; The Stacks project, Section 0BF9; EGA IV and S. Bosch, W. Lütkebohmert, M. Raynaud, Néron Models (1990) 7.3, 8.1. -/ @[expose] public section open CategoryTheory Category AlgebraicGeometry Limits MonoidalCategory CartesianMonoidalCategory Algebra TensorProduct HasRingHomProperty MorphismProperty RingHom Module Flat LinearMap IsLocalRing Over CommRingCat Ideal Scheme Spec IsLocalization AtPrime AddMonObj /-- Let R be a local ring with maximal ideal 𝔪, and L an R-algebra such that L ⧸ 𝔪L is reduced. For a minimal prime q over 𝔪L, the ideal 𝔪 generates the maximal ideal of the localisation of L at q. -/ lemma Ideal.map_maximalIdeal_eq_maximalIdeal_of_mem_minimalPrimes {R L : Type} [CommRing R] [IsLocalRing R] [CommRing L] [Algebra R L] {q : Ideal L} [q.IsPrime] (hq : q ∈ ((maximalIdeal R).map (algebraMap R L)).minimalPrimes) (h_red : IsReduced (L ⧸ (maximalIdeal R).map (algebraMap R L))) : (maximalIdeal R).map (algebraMap R (Localization.AtPrime q)) = maximalIdeal (Localization.AtPrime q) := by have h := IsLocalization.AtPrime.map_eq_maximalIdeal_of_mem_minimalPrimes (Localization.AtPrime q) ((isRadical_iff_quotient_reduced _).2 h_red) hq rwa [Ideal.map_map] at h namespace New.Variety /-- Let `A` be a commutative group scheme and `B`, `C` abelian schemes over an Artinian ring `k`. Let `f : A ⟶ B` be an isogeny and `g : A ⟶ C` a homomorphism that kills every point of the kernel of `f` with values in a finite local Noetherian `k`-algebra `S`. Then `g` factors through `f` by a homomorphism. -/ lemma exists_isAdditive_comp_eq_of_isIsogeny {k : Type} [CommRing k] [IsArtinianRing k] {A B C : Over (Spec (of k))} [AddObj A] [IsAbelianScheme B] [IsAbelianScheme C] (f : A ⟶ B) [f_isog : IsIsogeny f] (g : A ⟶ C) [IsAdditive g] (h_loc : ∀ (S : Type) [CommRing S] [IsLocalRing S] [Algebra k S] [Module.Finite k S] [IsNoetherianRing S] (y : specOver k S ⟶ A), y ≫ f = 0 → y ≫ g = 0) : ∃ j : B ⟶ C, IsAdditive j ∧ f ≫ j = g := by -- The kernel of `f`: a closed subscheme `ι : Spec S ⟶ A` with `S` finite over `k`. obtain ⟨S, ι, S_fin, -, ι_closed, ι_ker, ι_lift⟩ := exists_finite_kernel_ring (f := f) inferInstance -- `g` kills the kernel: the ideal `I` cutting out `ι ≫ g = 0` is zero in each -- localisation at a maximal ideal. have g_ker : ι ≫ g = 0 := by obtain ⟨I, -, hI⟩ := exists_ideal_le_ker_iff_factors ζ[C].left (ι ≫ g).left have I_zero : I ≤ RingHom.ker (RingHom.id S) := by refine fun s hs ↦ eq_zero_of_localization s fun J _ ↦ ?_ -- Over the Artinian ring `k` the localisation `S_J` is again finite, so `h_loc` applies. have J_fin : Module.Finite k (Localization.AtPrime J) := .of_quasiFinite have J_noeth : IsNoetherianRing (Localization.AtPrime J) := EssFiniteType.isNoetherianRing k _ let y : specOver k (Localization.AtPrime J) ⟶ A := specOver.map ⟨algebraMap S _, fun _ ↦ rfl⟩ ≫ ι exact (hI _).mpr (eq_zero_iff_factors_zero_section.mp (h_loc _ y (by simp [y, ι_ker]))) hs simpa [eq_zero_iff_factors_zero_section] using (hI (.id S)).mp I_zero have g_zero {T : Over (Spec (of k))} (a : T ⟶ A) (ha : a ≫ f = 0) : a ≫ g = 0 := by obtain ⟨z, rfl⟩ := ι_lift a ha simp [g_ker] -- Descend `g` along the fpqc cover `f`; the relation, the graph `a ≫ f = b`, is stable. have h_nat {T' T : Over (Spec (of k))} {a : T ⟶ A} {b : T ⟶ B} (t : T' ⟶ T) (h_ab : a ≫ f = b) : (t ≫ a) ≫ f = t ≫ b := by rw [assoc, h_ab] have h_sub {T : Over (Spec (of k))} {a a' : T ⟶ A} {b b' : T ⟶ B} (h_ab : a ≫ f = b) (h_ab' : a' ≫ f = b') : (a - a') ≫ f = b - b' := by rw [AddGrpObj.sub_comp, h_ab, h_ab'] have h_cover : Presieve.singleton f.left ∈ Scheme.fpqcPrecoverage B.left := by simp obtain ⟨j, j_add, hj⟩ := exists_hom_of_rel g (fun a b ↦ a ≫ f = b) h_nat h_sub g_zero (.singleton f.left) h_cover fun Z a h_mem ↦ by cases h_mem; exact ⟨homMk (𝟙 _), rfl⟩ -- Applied to the point `𝟙 A`, related to `f`, the factorisation gives `f ≫ j = g`. exact ⟨j, j_add, (hj A (𝟙 A) f (id_comp f)).trans (id_comp g)⟩ /-- For a commutative group scheme B over S, with x : T → B and y : Y → B, the sum map T × Y → B, `(a, t) ↦ x a + y t`, inherits from `x` and from the structure map of `Y` every multiplicative property that is stable under base change. -/ lemma fst_comp_add_snd_comp_left_mem {S : Scheme.{0}} {B T Y : Over S} [AddObj B] {Q : MorphismProperty Scheme} [IsMultiplicative Q] [Q.IsStableUnderBaseChange] {x : T ⟶ B} (y : Y ⟶ B) (hx : Q x.left) (hY : Q Y.hom) : Q (SemiCartesianMonoidalCategory.fst T Y ≫ x + SemiCartesianMonoidalCategory.snd T Y ≫ y).left := by -- The map is `x ▷ Y`, then a shear of `B ⊗ Y` (an isomorphism), then the projection to `B`. let shear (s : Y ⟶ B) : B ⊗ Y ⟶ B ⊗ Y := lift (fst B Y + snd B Y ≫ s) (snd B Y) -- the shear by `y` has the shear by `-y` as inverse have h_iso : IsIso (shear y) := ⟨shear (-y), by aesop (add simp [AddGrpObj.comp_neg, comp_add])⟩ have h_comp : Q (x ▷ Y ≫ shear y ≫ SemiCartesianMonoidalCategory.fst B Y).left := by apply_rules [pullback_fst, overPullbackMap, RespectsIso.precomp, comp_mem] simpa [shear, comp_add] using h_comp /-- Translation by the first factor identifies the pull-back of a homomorphism f : A → B along v : A ⊗ Z → B with its pull-back along the map m (a, z) = f a + v (a, z). -/ lemma isPullback_fst_comp_add {S : Scheme.{0}} {A B Z : Over S} [AddObj A] [AddObj B] (f : A ⟶ B) [IsAdditive f] (v : A ⊗ Z ⟶ B) : IsPullback (pullback.snd f v) (pullback.snd f v ≫ fst A Z + pullback.fst f v) (fst A Z ≫ f + v) f := by have square : IsPullback (pullback.fst f v) (pullback.snd f v) f v := .of_hasPullback f v -- the square commutes, as `pullback.fst f v ≫ f = pullback.snd f v ≫ v` have h_w : pullback.snd f v ≫ (fst A Z ≫ f + v) = (pullback.snd f v ≫ fst A Z + pullback.fst f v) ≫ f := by simp [square.w, comp_add, add_comp] -- a point of the pull-back is fixed by its images in `A ⊗ Z` and in `A` have h_ext : ∀ ⦃T : Over S⦄ ⦃φ φ' : T ⟶ pullback f v⦄, φ ≫ pullback.snd f v = φ' ≫ pullback.snd f v → φ ≫ (pullback.snd f v ≫ fst A Z + pullback.fst f v) = φ' ≫ (pullback.snd f v ≫ fst A Z + pullback.fst f v) → φ = φ' := by simp_all [pullback.hom_ext_iff, ← assoc, comp_add] refine .mk' h_w h_ext fun T c b h_eq ↦ ?_ -- the lift of `(c, b)` is the point `(b - c ≫ fst, c)` of the pull-back along `v` have h_sq : (b - c ≫ fst A Z) ≫ f = c ≫ v := by simp [← h_eq, AddGrpObj.sub_comp, comp_add] exact ⟨square.lift (b - c ≫ fst A Z) c h_sq, by simp [comp_add]⟩ /-- Let f : A → B be a surjective homomorphism of abelian schemes over Spec R, and u : Spec D → B a flat map over Spec R, where D is an R-algebra and Spec D → Spec R is surjective. If the pull-back g : X → Spec D of f along u is flat, then f is flat, by descent along the fpqc cover m (a, d) = f a + u d of B. -/ lemma flat_left_of_isPullback_flat {R : Type} [CommRing R] {A B : Over (Spec ⟨R⟩)} [IsAbelianScheme A] [IsAbelianScheme B] (f : A ⟶ B) [IsAdditive f] (hf_surj : Surjective f.left) {D : Type} [CommRing D] [Algebra R D] (u : specOver R D ⟶ B) (u_flat : Flat u.left) (D_surj : Surjective (specOver R D).hom) {X : Scheme.{0}} {j : X ⟶ A.left} {g : X ⟶ (specOver R D).left} (h_pb : IsPullback j g f.left u.left) (hg : Flat g) : Flat f.left := by let v : A ⊗ specOver R D ⟶ B := snd A (specOver R D) ≫ u let m : A ⊗ specOver R D ⟶ B := fst A (specOver R D) ≫ f + v have m_surj : Surjective m.left := fst_comp_add_snd_comp_left_mem u hf_surj D_surj have m_flat : Flat m.left := by -- `↓`: `comp_left` must fire before simp unfolds the braiding simpa [m, v, add_comm, ↓← comp_left, comp_add] using comp (β_ A _).hom.left _ (hg := fst_comp_add_snd_comp_left_mem f u_flat inferInstance) have m_qc : QuasiCompact m.left := fst_comp_add_snd_comp_left_mem u (inferInstance : QuasiCompact f.left) (quasiCompact_of_compactSpace (map _)) -- Translation by the first factor identifies the pull-backs of `f` along `v` and along `m`. have translated : IsPullback (pullback.snd f v) (pullback.snd f v ≫ fst A (specOver R D) + pullback.fst f v) m f := isPullback_fst_comp_add f v -- `v` factors through `u`, so the pull-back along `v` is a base change of `g`. have base_flat : Flat (pullback.snd f v).left := of_isPullback (((IsPullback.of_hasPullback f v).map (Over.forget _)).of_right' h_pb) hg -- Descend along the fpqc cover `m`. exact AlgebraicGeometry.Flat.descendsAlong_surjective_inf_flat_inf_quasicompact.of_isPullback (translated.map (Over.forget _)) ⟨⟨m_surj, m_flat⟩, m_qc⟩ base_flat /-- Let f : A → B be a finite morphism of abelian schemes over the local ring R, and u : Spec D → B a flat map, where D is a local R-algebra whose maximal ideal is generated by that of R. If Spec P → Spec D, given by φ : D → P, is the pull-back of f along u, then φ is flat. -/ lemma flat_of_isPullback_of_map_maximalIdeal_eq {R D : Type} [CommRing R] [IsLocalRing R] [CommRing D] [IsLocalRing D] [Algebra R D] {A B : Over (Spec ⟨R⟩)} [IsAbelianScheme A] [IsAbelianScheme B] (f : A ⟶ B) (f_fin : IsFinite f.left) (u : specOver R D ⟶ B) (u_flat : Flat u.left) (max_eq : (maximalIdeal R).map (algebraMap R D) = maximalIdeal D) {P : CommRingCat} {φ : of D ⟶ P} {j : Spec P ⟶ A.left} (h_pb : IsPullback j (Spec.map φ) f.left u.left) : φ.hom.Flat := by algebraize [φ.hom, φ.hom.comp (algebraMap R D)] -- `P` is finitely presented over the local ring `D`, so free once `𝔪_D ⊗ P → P` is injective. have : LocallyOfFinitePresentation (f.left ≫ B.hom) := by rw [f.w] infer_instance have h_f_pres := locallyOfFinitePresentation_of_comp f.left B.hom apply_rules +allowSynthFailures [of_free, free_of_maximalIdeal_rTensor_injective, h_f_pres, FinitePresentation.of_finite_of_finitePresentation, (IsFinite.SpecMap_iff φ).1, of_isPullback, (LocallyOfFinitePresentation.SpecMap_iff φ).1] -- `P` is flat over `R`: `j` is a base change of the flat `u`, and `A` is flat over `R` have P_flat : Flat (Spec.map (ofHom (algebraMap R D) ≫ φ)) := by have h_eq : j ≫ f.left ≫ B.hom = Spec.map φ ≫ u.left ≫ B.hom := h_pb.w_assoc B.hom simpa [(of_isPullback h_pb.flip u_flat).comp j A.hom] using congrArg (fun g ↦ AlgebraicGeometry.Flat g) h_eq have : Module.Flat R P := SpecMap_iff.1 P_flat rw [← max_eq] exact Module.Flat.map_subtype_rTensor_injective (maximalIdeal R) /-- For a smooth scheme `B` over a local ring `R` with a section `s`, there exists an affine open chart `i : specOver R L ⟶ B` such that `𝔪_R L ≠ ⊤` and the special fibre `L ⧸ 𝔪_R L` is reduced, where `𝔪_R` is the maximal ideal of `R`. -/ private lemma exists_isOpenImmersion_specOver_ne_top_isReduced {R : Type} [CommRing R] [IsLocalRing R] {B : Over (Spec ⟨R⟩)} [Smooth B.hom] (s : 𝟙_ (Over (Spec ⟨R⟩)) ⟶ B) : ∃ (L : Type) (_ : CommRing L) (_ : Algebra R L) (i : specOver R L ⟶ B), IsOpenImmersion i.left ∧ (maximalIdeal R).map (algebraMap R L) ≠ ⊤ ∧ IsReduced (L ⧸ (maximalIdeal R).map (algebraMap R L)) := by -- Take an affine open `i : Spec L ⟶ B` around the point `y` of the special fibre given by `s`, -- and let `τ : R ⟶ L` be the ring map that induces `i ≫ B.hom`. obtain ⟨L, i, i_open, y, hy⟩ := exists_Spec_apply_eq (s.left (closedPoint R)) obtain ⟨τ, hτ⟩ := map_surjective (i ≫ B.hom) algebraize [τ.hom] -- The special fibre `L ⧸ 𝔪` of the chart is nonzero, and reduced since `B` is smooth. let 𝔪 : Ideal L := (maximalIdeal R).map (algebraMap R L) have y_over : Spec.map τ y = closedPoint R := by -- `s` is a section of `B.hom` rw [hτ, Scheme.Hom.comp_apply, hy] exact congrArg (fun g ↦ g (closedPoint R)) s.w have proper : 𝔪 ≠ ⊤ := -- `𝔪` lies in the prime ideal of `y`, which lies over the maximal ideal of `R` ne_top_of_le_ne_top y.isPrime.ne_top (map_le_of_le_comap (congrArg PrimeSpectrum.asIdeal y_over).ge) have reduced : IsReduced (L ⧸ 𝔪) := by have geom : GeometricallyReduced (Spec.map τ) := by rw [hτ]; infer_instance have fibre : IsReduced (L ⊗[R] (R ⧸ maximalIdeal R)) := (affine_isReduced_iff _).1 <| geom.geometrically_isReduced (K := ResidueField R) _ _ _ (isPullback_SpecMap_of_isPushout (h := isPushout_tensorProduct R L (R ⧸ maximalIdeal R))) exact isReduced_of_injective _ (quotIdealMapEquivTensorQuot L (maximalIdeal R)).injective exact ⟨L, inferInstance, inferInstance, homMk i hτ.symm, i_open, proper, reduced⟩ /-- For an abelian scheme `B` over a local ring `R`, there exists a local `R`-algebra `D` with a flat morphism `u : specOver R D ⟶ B` such that the maximal ideal of `R` generates the maximal ideal of `D` and the structure map `Spec D ⟶ Spec R` is surjective. -/ private lemma exists_flat_specOver_map_maximalIdeal_eq {R : Type} [CommRing R] [IsLocalRing R] (B : Over (Spec ⟨R⟩)) [IsAbelianScheme B] : ∃ (D : Type) (_ : CommRing D) (_ : IsLocalRing D) (_ : Algebra R D) (u : specOver R D ⟶ B), Flat u.left ∧ (maximalIdeal R).map (algebraMap R D) = maximalIdeal D ∧ Surjective (specOver R D).hom := by -- Take an affine open chart around the origin section `ζ[B]` of the special fibre. obtain ⟨L, _, _, i, i_open, proper, reduced⟩ := exists_isOpenImmersion_specOver_ne_top_isReduced ζ[B] -- `q` is a generic point of the special fibre; as that is reduced, the maximal ideal of `R` -- generates that of `D`. obtain ⟨q, hq⟩ : Nonempty ((maximalIdeal R).map (algebraMap R L)).minimalPrimes := nonempty_minimalPrimes proper have q_prime : q.IsPrime := Ideal.IsMinimalPrime.isPrime hq let D := Localization.AtPrime q have max_eq : (maximalIdeal R).map (algebraMap R D) = maximalIdeal D := Ideal.map_maximalIdeal_eq_maximalIdeal_of_mem_minimalPrimes hq reduced -- The algebra map `R → D` is `algebraMap R L` followed by `algebraMap L D`. let u : specOver R D ⟶ B := specOver.map ⟨algebraMap L D, fun _ ↦ rfl⟩ ≫ i have h_D_flat : Flat (Spec.map (ofHom (algebraMap L D))) := SpecMap_iff.2 (flat_algebraMap_iff.2 inferInstance) have u_flat : Flat u.left := inferInstanceAs (Flat (Spec.map (ofHom (algebraMap L D)) ≫ i.left)) -- The image of `Spec D` in `Spec R` is stable under generalisation and has the closed point. have D_surj : Surjective (specOver R D).hom := by have lifts : GeneralizingMap (specOver R D).hom := by rw [← u.w] exact generalizingMap (u.left ≫ B.hom) exact ⟨fun x ↦ lifts.stableUnderGeneralization_range (specializes_closedPoint x) ⟨closedPoint D, top_unique (α := PrimeSpectrum R) (le_comap_of_map_le max_eq.le)⟩⟩ exact ⟨D, inferInstance, inferInstance, inferInstance, u, u_flat, max_eq, D_surj⟩ /-- A locally quasi-finite surjective homomorphism of abelian schemes over a local ring is finite and flat, that is, an isogeny. -/ lemma isIsogeny_of_locallyQuasiFinite {R : Type} [CommRing R] [IsLocalRing R] {A B : Over (Spec ⟨R⟩)} [IsAbelianScheme A] [IsAbelianScheme B] (f : A ⟶ B) [IsAdditive f] (hf_quasi : LocallyQuasiFinite f.left) (hf_surj : Surjective f.left) : IsIsogeny f := by -- Localise `B` at a generic point of its special fibre: `u : Spec D ⟶ B` is flat, and the maximal -- ideal of `R` generates that of `D`. The pull-back of `f` along `u` is flat by the local -- criterion. The translates of `u` by the image of `f` form an fpqc cover of `B`, over which `f` -- becomes a base change of that pull-back; so `f` is flat by descent. have f_fin : IsFinite f.left := .of_isProper_of_locallyQuasiFinite f.left obtain ⟨D, _, _, _, u, u_flat, max_eq, D_surj⟩ := exists_flat_specOver_map_maximalIdeal_eq B -- `Spec.map φ : Spec P ⟶ Spec D` is the pull-back of `f` along `u`. obtain ⟨P, φ, j, h_pb⟩ := exists_isPullback_SpecMap f.left u.left have φ_flat : φ.hom.Flat := flat_of_isPullback_of_map_maximalIdeal_eq f f_fin u u_flat max_eq h_pb -- Descend along the cover of `B` by the translates of `u`. have f_flat : Flat f.left := flat_left_of_isPullback_flat f hf_surj u u_flat D_surj h_pb (Spec_iff.2 φ_flat) -- `IsIsogeny f` collects the instances: `f` additive, finite (`f_fin`), flat and surjective exact .mk end New.Variety