import OAI.ArithmeticGeometry.Models.CommonStage import OAI.ArithmeticGeometry.Models.FiniteEquations import OAI.ArithmeticGeometry.Models.ModelFiniteness /-! # Isomorphisms -/ namespace OAI.ArithmeticGeometry.Models.Isomorphisms.Constructions.Foundations /-! Isomorphisms of generic fibers descend with their inverse identities. -/ open _root_.CategoryTheory _root_.CategoryTheory.Limits _root_.AlgebraicGeometry open scoped _root_.NumberField universe u theorem isomorphism_between_models_descends {K : Type u} [Field K] {s : Finset K} {X Y : Over (Spec (CommRingCat.of K))} (Xโ‚€ Yโ‚€ : Over (CoefficientSystem.Constructions.Foundations.coefficientBase (๐“ž K) K s)) (hXโ‚€ : Scheme.Constructions.Foundations.FinitePresentationMorphism Xโ‚€.hom) (hYโ‚€ : Scheme.Constructions.Foundations.FinitePresentationMorphism Yโ‚€.hom) (pX : X.left โŸถ Xโ‚€.left) (pY : Y.left โŸถ Yโ‚€.left) (hX : IsPullback pX X.hom Xโ‚€.hom (CoefficientSystem.Constructions.Foundations.genericBaseMap (๐“ž K) K s)) (hY : IsPullback pY Y.hom Yโ‚€.hom (CoefficientSystem.Constructions.Foundations.genericBaseMap (๐“ž K) K s)) (e : X โ‰… Y) : โˆƒ (t : Finset K) (h : s โІ t) (eโ‚€ : (Over.pullback (CoefficientSystem.Constructions.Foundations.coefficientBaseMap (๐“ž K) K h)).obj Xโ‚€ โ‰… (Over.pullback (CoefficientSystem.Constructions.Foundations.coefficientBaseMap (๐“ž K) K h)).obj Yโ‚€), ModelMorphisms.Constructions.Foundations.genericModelLift Xโ‚€ pX hX.w h โ‰ซ eโ‚€.hom.left = e.hom.left โ‰ซ ModelMorphisms.Constructions.Foundations.genericModelLift Yโ‚€ pY hY.w h := by let Z : Bool โ†’ Over (Spec (CommRingCat.of K)) | false => X | true => Y let Zโ‚€ : Bool โ†’ Over (CoefficientSystem.Constructions.Foundations.coefficientBase (๐“ž K) K s) | false => Xโ‚€ | true => Yโ‚€ let p : โˆ€ i, (Z i).left โŸถ (Zโ‚€ i).left | false => pX | true => pY have hZโ‚€ : โˆ€ i, Scheme.Constructions.Foundations.FinitePresentationMorphism (Zโ‚€ i).hom | false => hXโ‚€ | true => hYโ‚€ have hp : โˆ€ i, IsPullback (p i) (Z i).hom (Zโ‚€ i).hom (CoefficientSystem.Constructions.Foundations.genericBaseMap (๐“ž K) K s) | false => hX | true => hY let a : โˆ€ i, Z i โŸถ Z (!i) | false => e.hom | true => e.inv obtain โŸจt, hst, b, hbโŸฉ := CommonStage.Constructions.Foundations.finite_morphisms_descend id Bool.not Z Zโ‚€ hZโ‚€ p hp a let B := Over.pullback (CoefficientSystem.Constructions.Foundations.coefficientBaseMap (๐“ž K) K hst) let Zโ‚ : Bool โ†’ Over (CoefficientSystem.Constructions.Foundations.coefficientBase (๐“ž K) K t) := fun i โ†ฆ B.obj (Zโ‚€ i) let pโ‚ : โˆ€ i, (Z i).left โŸถ (Zโ‚ i).left := fun i โ†ฆ ModelMorphisms.Constructions.Foundations.genericModelLift (Zโ‚€ i) (p i) (hp i).w hst have hZโ‚ : โˆ€ i, Scheme.Constructions.Foundations.FinitePresentationMorphism (Zโ‚ i).hom := fun i โ†ฆ ModelFiniteness.Constructions.Foundations.baseChange_finitePresentation _ _ (hZโ‚€ i) have hpโ‚ : โˆ€ i, IsPullback (pโ‚ i) (Z i).hom (Zโ‚ i).hom (CoefficientSystem.Constructions.Foundations.genericBaseMap (๐“ž K) K t) := fun i โ†ฆ ModelMorphisms.Constructions.Foundations.genericModelLift_cartesian (Zโ‚€ i) (p i) (hp i) hst let c : โˆ€ i, Zโ‚ i โŸถ Zโ‚ i | false => b false โ‰ซ b true | true => b true โ‰ซ b false let d : โˆ€ i, Zโ‚ i โŸถ Zโ‚ i := fun i โ†ฆ ๐Ÿ™ _ have hc : โˆ€ i, pโ‚ i โ‰ซ (c i).left = pโ‚ i โ‰ซ (d i).left := by intro i cases i ยท change pโ‚ false โ‰ซ ((b false).left โ‰ซ (b true).left) = pโ‚ false โ‰ซ ๐Ÿ™ _ erw [โ† Category.assoc, hb false, Category.assoc, hb true, โ† Category.assoc, Over.hom_left_inv_left, Category.id_comp] ยท change pโ‚ true โ‰ซ ((b true).left โ‰ซ (b false).left) = pโ‚ true โ‰ซ ๐Ÿ™ _ erw [โ† Category.assoc, hb true, Category.assoc, hb false, โ† Category.assoc, Over.inv_left_hom_left, Category.id_comp] obtain โŸจz, htz, hzโŸฉ := FiniteEquations.Constructions.Foundations.finite_equations_descend id id Z Zโ‚ hZโ‚ pโ‚ hpโ‚ c d hc let C := Over.pullback (CoefficientSystem.Constructions.Foundations.coefficientBaseMap (๐“ž K) K htz) let eโ‚ : C.obj (Zโ‚ false) โ‰… C.obj (Zโ‚ true) := { hom := C.map (b false) inv := C.map (b true) hom_inv_id := by rw [โ† C.map_comp] exact (hz false).trans (C.map_id _) inv_hom_id := by rw [โ† C.map_comp] exact (hz true).trans (C.map_id _) } let eโ‚€ := (BaseChange.Constructions.Foundations.coefficientBaseChangeTrans hst htz Xโ‚€).symm โ‰ชโ‰ซ eโ‚ โ‰ชโ‰ซ BaseChange.Constructions.Foundations.coefficientBaseChangeTrans hst htz Yโ‚€ refine โŸจz, hst.trans htz, eโ‚€, ?_โŸฉ exact CommonStage.Constructions.Foundations.descendedMorphismAtLargerBase_compatibility Xโ‚€ Yโ‚€ pX pY hX.w hY.w e.hom hst htz (b false) (hb false) end OAI.ArithmeticGeometry.Models.Isomorphisms.Constructions.Foundations