state
stringlengths
0
159k
srcUpToTactic
stringlengths
387
167k
nextTactic
stringlengths
3
9k
declUpToTactic
stringlengths
22
11.5k
declId
stringlengths
38
95
decl
stringlengths
16
1.89k
file_tag
stringlengths
17
73
X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace this : coequalizer.π (SheafedSpace.forgetToPresheafedSpace.map f.val) (SheafedSpace.forgetToPresheafedSpace.map g.val) ≫ (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom = SheafedSpace.forgetToPresheafedSpace.map (coequalizer.π f.val g.val) ⊢ IsLocalRingHom (((PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c.app (op U) ≫ (PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit (parallelPair (SheafedSpace.forgetToPresheafedSpace.map f.val) (SheafedSpace.forgetToPresheafedSpace.map g.val)) ((Opens.map (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.base).obj (op U).unop)).hom ≫ limit.π (PresheafedSpace.componentwiseDiagram (parallelPair (SheafedSpace.forgetToPresheafedSpace.map f.val) (SheafedSpace.forgetToPresheafedSpace.map g.val)) ((Opens.map (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.base).obj (op U).unop)) (op WalkingParallelPair.one)) ≫ Y.presheaf.map (eqToHom (_ : (Opens.map (coequalizer.π (SheafedSpace.forgetToPresheafedSpace.map f.val) (SheafedSpace.forgetToPresheafedSpace.map g.val) ≫ (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom).base).op.obj (op U) = (Opens.map (SheafedSpace.forgetToPresheafedSpace.map (coequalizer.π f.val g.val)).base).op.obj (op U))))
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added
haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _
instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.145_0.tE6q65npbp8AX2g
instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U))
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace this✝ : coequalizer.π (SheafedSpace.forgetToPresheafedSpace.map f.val) (SheafedSpace.forgetToPresheafedSpace.map g.val) ≫ (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom = SheafedSpace.forgetToPresheafedSpace.map (coequalizer.π f.val g.val) this : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c ⊢ IsLocalRingHom (((PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c.app (op U) ≫ (PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit (parallelPair (SheafedSpace.forgetToPresheafedSpace.map f.val) (SheafedSpace.forgetToPresheafedSpace.map g.val)) ((Opens.map (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.base).obj (op U).unop)).hom ≫ limit.π (PresheafedSpace.componentwiseDiagram (parallelPair (SheafedSpace.forgetToPresheafedSpace.map f.val) (SheafedSpace.forgetToPresheafedSpace.map g.val)) ((Opens.map (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.base).obj (op U).unop)) (op WalkingParallelPair.one)) ≫ Y.presheaf.map (eqToHom (_ : (Opens.map (coequalizer.π (SheafedSpace.forgetToPresheafedSpace.map f.val) (SheafedSpace.forgetToPresheafedSpace.map g.val) ≫ (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom).base).op.obj (op U) = (Opens.map (SheafedSpace.forgetToPresheafedSpace.map (coequalizer.π f.val g.val)).base).op.obj (op U))))
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _
infer_instance
instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.145_0.tE6q65npbp8AX2g
instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U))
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ⊢ ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' (imageBasicOpen f g U s).carrier) = (imageBasicOpen f g U s).carrier
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by
fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1)
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.187_0.tE6q65npbp8AX2g
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case e X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ⊢ ⇑f.val.base ≫ ⇑(coequalizer.π f.val g.val).base = ⇑g.val.base ≫ ⇑(coequalizer.π f.val g.val).base
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) ·
ext
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) ·
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.187_0.tE6q65npbp8AX2g
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case e.h X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) a✝ : (forget TopCat).obj ↑X.toPresheafedSpace ⊢ (⇑f.val.base ≫ ⇑(coequalizer.π f.val g.val).base) a✝ = (⇑g.val.base ≫ ⇑(coequalizer.π f.val g.val).base) a✝
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext
simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base]
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.187_0.tE6q65npbp8AX2g
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case e.h X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) a✝ : (forget TopCat).obj ↑X.toPresheafedSpace ⊢ (f.val ≫ coequalizer.π f.val g.val).base a✝ = (g.val ≫ coequalizer.π f.val g.val).base a✝
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base]
congr 2
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base]
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.187_0.tE6q65npbp8AX2g
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case e.h.e_a.e_self X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) a✝ : (forget TopCat).obj ↑X.toPresheafedSpace ⊢ f.val ≫ coequalizer.π f.val g.val = g.val ≫ coequalizer.π f.val g.val
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2
exact coequalizer.condition f.1 g.1
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.187_0.tE6q65npbp8AX2g
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case h X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ⊢ IsColimit (Cofork.ofπ ⇑(coequalizer.π f.val g.val).base (_ : ⇑f.val.base ≫ ⇑(coequalizer.π f.val g.val).base = ⇑g.val.base ≫ ⇑(coequalizer.π f.val g.val).base))
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 ·
apply isColimitCoforkMapOfIsColimit (forget TopCat)
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 ·
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.187_0.tE6q65npbp8AX2g
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case h.l X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ⊢ IsColimit (Cofork.ofπ (coequalizer.π f.val g.val).base ?h.w) case h.w X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ⊢ f.val.base ≫ (coequalizer.π f.val g.val).base = g.val.base ≫ (coequalizer.π f.val g.val).base
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat)
apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _)
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat)
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.187_0.tE6q65npbp8AX2g
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case h.l.l X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ⊢ IsColimit (Cofork.ofπ (coequalizer.π f.val g.val) ?h.l.w) case h.l.w X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ⊢ f.val ≫ coequalizer.π f.val g.val = g.val ≫ coequalizer.π f.val g.val
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _)
exact coequalizerIsCoequalizer f.1 g.1
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _)
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.187_0.tE6q65npbp8AX2g
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case H X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ⊢ ⇑f.val.base ⁻¹' (imageBasicOpen f g U s).carrier = ⇑g.val.base ⁻¹' (imageBasicOpen f g U s).carrier
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 ·
suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 ·
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.187_0.tE6q65npbp8AX2g
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) this : (Opens.map f.val.base).obj (imageBasicOpen f g U s) = (Opens.map g.val.base).obj (imageBasicOpen f g U s) ⊢ ⇑f.val.base ⁻¹' (imageBasicOpen f g U s).carrier = ⇑g.val.base ⁻¹' (imageBasicOpen f g U s).carrier
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by
injection this
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.187_0.tE6q65npbp8AX2g
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case H X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ⊢ (Opens.map f.val.base).obj (imageBasicOpen f g U s) = (Opens.map g.val.base).obj (imageBasicOpen f g U s)
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this
delta imageBasicOpen
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.187_0.tE6q65npbp8AX2g
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case H X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ⊢ (Opens.map f.val.base).obj (RingedSpace.basicOpen (toRingedSpace Y) (let_fun this := ((coequalizer.π f.val g.val).c.app (op U)) s; this)) = (Opens.map g.val.base).obj (RingedSpace.basicOpen (toRingedSpace Y) (let_fun this := ((coequalizer.π f.val g.val).c.app (op U)) s; this))
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen
rw [preimage_basicOpen f, preimage_basicOpen g]
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.187_0.tE6q65npbp8AX2g
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case H X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ⊢ RingedSpace.basicOpen (toRingedSpace X) ((f.val.c.app { unop := { unop := { carrier := ⇑(coequalizer.π f.val g.val).base ⁻¹' ↑(op U).unop, is_open' := (_ : IsOpen (⇑(coequalizer.π f.val g.val).base ⁻¹' ↑(op U).unop)) } }.unop }) (let_fun this := ((coequalizer.π f.val g.val).c.app (op U)) s; this)) = RingedSpace.basicOpen (toRingedSpace X) ((g.val.c.app { unop := { unop := { carrier := ⇑(coequalizer.π f.val g.val).base ⁻¹' ↑(op U).unop, is_open' := (_ : IsOpen (⇑(coequalizer.π f.val g.val).base ⁻¹' ↑(op U).unop)) } }.unop }) (let_fun this := ((coequalizer.π f.val g.val).c.app (op U)) s; this))
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g]
dsimp only [Functor.op, unop_op]
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g]
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.187_0.tE6q65npbp8AX2g
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case H X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ⊢ RingedSpace.basicOpen (toRingedSpace X) ((f.val.c.app { unop := { carrier := ⇑(coequalizer.π f.val g.val).base ⁻¹' ↑U, is_open' := (_ : IsOpen (⇑(coequalizer.π f.val g.val).base ⁻¹' ↑(op U).unop)) } }) (((coequalizer.π f.val g.val).c.app (op U)) s)) = RingedSpace.basicOpen (toRingedSpace X) ((g.val.c.app { unop := { carrier := ⇑(coequalizer.π f.val g.val).base ⁻¹' ↑U, is_open' := (_ : IsOpen (⇑(coequalizer.π f.val g.val).base ⁻¹' ↑(op U).unop)) } }) (((coequalizer.π f.val g.val).c.app (op U)) s))
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw`
erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res]
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw`
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.187_0.tE6q65npbp8AX2g
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case H X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ⊢ ((Opens.map (f.val ≫ coequalizer.π f.val g.val).base).op.obj (op U)).unop ⊓ RingedSpace.basicOpen (toRingedSpace X) (((g.val ≫ coequalizer.π f.val g.val).c.app (op U)) s) = RingedSpace.basicOpen (toRingedSpace X) (((g.val ≫ coequalizer.π f.val g.val).c.app (op U)) s)
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res]
apply inf_eq_right.mpr
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res]
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.187_0.tE6q65npbp8AX2g
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case H X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ⊢ RingedSpace.basicOpen (toRingedSpace X) (((g.val ≫ coequalizer.π f.val g.val).c.app (op U)) s) ≤ ((Opens.map (f.val ≫ coequalizer.π f.val g.val).base).op.obj (op U)).unop
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr
refine' (RingedSpace.basicOpen_le _ _).trans _
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.187_0.tE6q65npbp8AX2g
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case H X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ⊢ ((Opens.map (g.val ≫ coequalizer.π f.val g.val).base).op.obj (op U)).unop ≤ ((Opens.map (f.val ≫ coequalizer.π f.val g.val).base).op.obj (op U)).unop
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _
rw [coequalizer.condition f.1 g.1]
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.187_0.tE6q65npbp8AX2g
theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ⊢ IsOpen (⇑(coequalizer.π f.val g.val).base '' (imageBasicOpen f g U s).carrier)
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by
rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp]
theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.216_0.tE6q65npbp8AX2g
theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ⊢ IsOpen (⇑(TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget CommRingCat) f.val g.val)) ∘ ⇑(colimit.ι (parallelPair ((SheafedSpace.forget CommRingCat).map f.val) ((SheafedSpace.forget CommRingCat).map g.val)) WalkingParallelPair.one) ⁻¹' (⇑(coequalizer.π f.val g.val).base '' (imageBasicOpen f g U s).carrier))
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp]
erw [← coe_comp]
theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp]
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.216_0.tE6q65npbp8AX2g
theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ⊢ IsOpen (⇑(colimit.ι (parallelPair ((SheafedSpace.forget CommRingCat).map f.val) ((SheafedSpace.forget CommRingCat).map g.val)) WalkingParallelPair.one ≫ (PreservesCoequalizer.iso (SheafedSpace.forget CommRingCat) f.val g.val).hom) ⁻¹' (⇑(coequalizer.π f.val g.val).base '' (imageBasicOpen f g U s).carrier))
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp]
rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison]
theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp]
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.216_0.tE6q65npbp8AX2g
theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ⊢ IsOpen (⇑((SheafedSpace.forget CommRingCat).map (coequalizer.π f.val g.val)) ⁻¹' (⇑(coequalizer.π f.val g.val).base '' (imageBasicOpen f g U s).carrier))
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison]
dsimp only [SheafedSpace.forget]
theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison]
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.216_0.tE6q65npbp8AX2g
theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ⊢ IsOpen (⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' (imageBasicOpen f g U s).carrier))
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw`
erw [imageBasicOpen_image_preimage]
theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw`
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.216_0.tE6q65npbp8AX2g
theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ⊢ IsOpen (imageBasicOpen f g U s).carrier
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage]
exact (imageBasicOpen f g U s).2
theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage]
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.216_0.tE6q65npbp8AX2g
theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) x : ↑(toTopCat Y) ⊢ IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val) x)
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by
constructor
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.228_0.tE6q65npbp8AX2g
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case map_nonunit X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) x : ↑(toTopCat Y) ⊢ ∀ (a : ↑(PresheafedSpace.stalk (coequalizer f.val g.val).toPresheafedSpace ((coequalizer.π f.val g.val).base x))), IsUnit ((PresheafedSpace.stalkMap (coequalizer.π f.val g.val) x) a) → IsUnit a
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor
rintro a ha
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.228_0.tE6q65npbp8AX2g
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case map_nonunit X Y : LocallyRingedSpace f g : X ⟶ Y U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) x : ↑(toTopCat Y) a : ↑(PresheafedSpace.stalk (coequalizer f.val g.val).toPresheafedSpace ((coequalizer.π f.val g.val).base x)) ha : IsUnit ((PresheafedSpace.stalkMap (coequalizer.π f.val g.val) x) a) ⊢ IsUnit a
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha
rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.228_0.tE6q65npbp8AX2g
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case map_nonunit.intro.intro.intro X Y : LocallyRingedSpace f g : X ⟶ Y U✝ : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s✝ : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U✝)) x : ↑(toTopCat Y) U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace hU : (coequalizer.π f.val g.val).base x ∈ U s : (forget CommRingCat).obj ((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ha : IsUnit ((PresheafedSpace.stalkMap (coequalizer.π f.val g.val) x) ((TopCat.Presheaf.germ (coequalizer f.val g.val).toPresheafedSpace.presheaf { val := (coequalizer.π f.val g.val).base x, property := hU }) s)) ⊢ IsUnit ((TopCat.Presheaf.germ (coequalizer f.val g.val).toPresheafedSpace.presheaf { val := (coequalizer.π f.val g.val).base x, property := hU }) s)
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩
erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.228_0.tE6q65npbp8AX2g
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case map_nonunit.intro.intro.intro X Y : LocallyRingedSpace f g : X ⟶ Y U✝ : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s✝ : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U✝)) x : ↑(toTopCat Y) U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace hU : (coequalizer.π f.val g.val).base x ∈ U s : (forget CommRingCat).obj ((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ha : IsUnit ((TopCat.Presheaf.germ Y.presheaf { val := x, property := hU }) (((coequalizer.π f.val g.val).c.app (op U)) s)) ⊢ IsUnit ((TopCat.Presheaf.germ (coequalizer f.val g.val).toPresheafedSpace.presheaf { val := (coequalizer.π f.val g.val).base x, property := hU }) s)
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha
let V := imageBasicOpen f g U s
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.228_0.tE6q65npbp8AX2g
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case map_nonunit.intro.intro.intro X Y : LocallyRingedSpace f g : X ⟶ Y U✝ : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s✝ : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U✝)) x : ↑(toTopCat Y) U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace hU : (coequalizer.π f.val g.val).base x ∈ U s : (forget CommRingCat).obj ((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ha : IsUnit ((TopCat.Presheaf.germ Y.presheaf { val := x, property := hU }) (((coequalizer.π f.val g.val).c.app (op U)) s)) V : Opens ↑(toTopCat Y) := imageBasicOpen f g U s ⊢ IsUnit ((TopCat.Presheaf.germ (coequalizer f.val g.val).toPresheafedSpace.presheaf { val := (coequalizer.π f.val g.val).base x, property := hU }) s)
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s
have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.228_0.tE6q65npbp8AX2g
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case map_nonunit.intro.intro.intro X Y : LocallyRingedSpace f g : X ⟶ Y U✝ : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s✝ : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U✝)) x : ↑(toTopCat Y) U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace hU : (coequalizer.π f.val g.val).base x ∈ U s : (forget CommRingCat).obj ((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ha : IsUnit ((TopCat.Presheaf.germ Y.presheaf { val := x, property := hU }) (((coequalizer.π f.val g.val).c.app (op U)) s)) V : Opens ↑(toTopCat Y) := imageBasicOpen f g U s hV : ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier) = V.carrier ⊢ IsUnit ((TopCat.Presheaf.germ (coequalizer f.val g.val).toPresheafedSpace.presheaf { val := (coequalizer.π f.val g.val).base x, property := hU }) s)
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s
have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.228_0.tE6q65npbp8AX2g
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case map_nonunit.intro.intro.intro X Y : LocallyRingedSpace f g : X ⟶ Y U✝ : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s✝ : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U✝)) x : ↑(toTopCat Y) U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace hU : (coequalizer.π f.val g.val).base x ∈ U s : (forget CommRingCat).obj ((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ha : IsUnit ((TopCat.Presheaf.germ Y.presheaf { val := x, property := hU }) (((coequalizer.π f.val g.val).c.app (op U)) s)) V : Opens ↑(toTopCat Y) := imageBasicOpen f g U s hV : ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier) = V.carrier hV' : V = { carrier := ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier), is_open' := (_ : IsOpen (⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier))) } ⊢ IsUnit ((TopCat.Presheaf.germ (coequalizer f.val g.val).toPresheafedSpace.presheaf { val := (coequalizer.π f.val g.val).base x, property := hU }) s)
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm
have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.228_0.tE6q65npbp8AX2g
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case map_nonunit.intro.intro.intro X Y : LocallyRingedSpace f g : X ⟶ Y U✝ : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s✝ : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U✝)) x : ↑(toTopCat Y) U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace hU : (coequalizer.π f.val g.val).base x ∈ U s : (forget CommRingCat).obj ((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ha : IsUnit ((TopCat.Presheaf.germ Y.presheaf { val := x, property := hU }) (((coequalizer.π f.val g.val).c.app (op U)) s)) V : Opens ↑(toTopCat Y) := imageBasicOpen f g U s hV : ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier) = V.carrier hV' : V = { carrier := ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier), is_open' := (_ : IsOpen (⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier))) } V_open : IsOpen (⇑(coequalizer.π f.val g.val).base '' V.carrier) ⊢ IsUnit ((TopCat.Presheaf.germ (coequalizer f.val g.val).toPresheafedSpace.presheaf { val := (coequalizer.π f.val g.val).base x, property := hU }) s)
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s
have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _)
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.228_0.tE6q65npbp8AX2g
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case map_nonunit.intro.intro.intro X Y : LocallyRingedSpace f g : X ⟶ Y U✝ : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s✝ : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U✝)) x : ↑(toTopCat Y) U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace hU : (coequalizer.π f.val g.val).base x ∈ U s : (forget CommRingCat).obj ((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ha : IsUnit ((TopCat.Presheaf.germ Y.presheaf { val := x, property := hU }) (((coequalizer.π f.val g.val).c.app (op U)) s)) V : Opens ↑(toTopCat Y) := imageBasicOpen f g U s hV : ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier) = V.carrier hV' : V = { carrier := ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier), is_open' := (_ : IsOpen (⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier))) } V_open : IsOpen (⇑(coequalizer.π f.val g.val).base '' V.carrier) VleU : { carrier := ⇑(coequalizer.π f.val g.val).base '' V.carrier, is_open' := V_open } ≤ U ⊢ IsUnit ((TopCat.Presheaf.germ (coequalizer f.val g.val).toPresheafedSpace.presheaf { val := (coequalizer.π f.val g.val).base x, property := hU }) s)
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _)
have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _)
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.228_0.tE6q65npbp8AX2g
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case map_nonunit.intro.intro.intro X Y : LocallyRingedSpace f g : X ⟶ Y U✝ : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s✝ : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U✝)) x : ↑(toTopCat Y) U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace hU : (coequalizer.π f.val g.val).base x ∈ U s : (forget CommRingCat).obj ((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ha : IsUnit ((TopCat.Presheaf.germ Y.presheaf { val := x, property := hU }) (((coequalizer.π f.val g.val).c.app (op U)) s)) V : Opens ↑(toTopCat Y) := imageBasicOpen f g U s hV : ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier) = V.carrier hV' : V = { carrier := ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier), is_open' := (_ : IsOpen (⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier))) } V_open : IsOpen (⇑(coequalizer.π f.val g.val).base '' V.carrier) VleU : { carrier := ⇑(coequalizer.π f.val g.val).base '' V.carrier, is_open' := V_open } ≤ U hxV : x ∈ V ⊢ IsUnit ((TopCat.Presheaf.germ (coequalizer f.val g.val).toPresheafedSpace.presheaf { val := (coequalizer.π f.val g.val).base x, property := hU }) s)
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩
erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s]
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.228_0.tE6q65npbp8AX2g
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case map_nonunit.intro.intro.intro X Y : LocallyRingedSpace f g : X ⟶ Y U✝ : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s✝ : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U✝)) x : ↑(toTopCat Y) U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace hU : (coequalizer.π f.val g.val).base x ∈ U s : (forget CommRingCat).obj ((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ha : IsUnit ((TopCat.Presheaf.germ Y.presheaf { val := x, property := hU }) (((coequalizer.π f.val g.val).c.app (op U)) s)) V : Opens ↑(toTopCat Y) := imageBasicOpen f g U s hV : ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier) = V.carrier hV' : V = { carrier := ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier), is_open' := (_ : IsOpen (⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier))) } V_open : IsOpen (⇑(coequalizer.π f.val g.val).base '' V.carrier) VleU : { carrier := ⇑(coequalizer.π f.val g.val).base '' V.carrier, is_open' := V_open } ≤ U hxV : x ∈ V ⊢ IsUnit ((TopCat.Presheaf.germ (coequalizer f.val g.val).toPresheafedSpace.presheaf { val := (coequalizer.π f.val g.val).base x, property := (_ : (coequalizer.π f.val g.val).base x ∈ ⇑(coequalizer.π f.val g.val).base '' V.carrier) }) (((coequalizer f.val g.val).toPresheafedSpace.presheaf.map (homOfLE VleU).op) s))
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s]
apply RingHom.isUnit_map
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s]
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.228_0.tE6q65npbp8AX2g
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case map_nonunit.intro.intro.intro.a X Y : LocallyRingedSpace f g : X ⟶ Y U✝ : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s✝ : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U✝)) x : ↑(toTopCat Y) U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace hU : (coequalizer.π f.val g.val).base x ∈ U s : (forget CommRingCat).obj ((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ha : IsUnit ((TopCat.Presheaf.germ Y.presheaf { val := x, property := hU }) (((coequalizer.π f.val g.val).c.app (op U)) s)) V : Opens ↑(toTopCat Y) := imageBasicOpen f g U s hV : ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier) = V.carrier hV' : V = { carrier := ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier), is_open' := (_ : IsOpen (⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier))) } V_open : IsOpen (⇑(coequalizer.π f.val g.val).base '' V.carrier) VleU : { carrier := ⇑(coequalizer.π f.val g.val).base '' V.carrier, is_open' := V_open } ≤ U hxV : x ∈ V ⊢ IsUnit (((coequalizer f.val g.val).toPresheafedSpace.presheaf.map (homOfLE VleU).op) s)
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map
rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)]
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.228_0.tE6q65npbp8AX2g
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case map_nonunit.intro.intro.intro.a X Y : LocallyRingedSpace f g : X ⟶ Y U✝ : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s✝ : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U✝)) x : ↑(toTopCat Y) U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace hU : (coequalizer.π f.val g.val).base x ∈ U s : (forget CommRingCat).obj ((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ha : IsUnit ((TopCat.Presheaf.germ Y.presheaf { val := x, property := hU }) (((coequalizer.π f.val g.val).c.app (op U)) s)) V : Opens ↑(toTopCat Y) := imageBasicOpen f g U s hV : ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier) = V.carrier hV' : V = { carrier := ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier), is_open' := (_ : IsOpen (⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier))) } V_open : IsOpen (⇑(coequalizer.π f.val g.val).base '' V.carrier) VleU : { carrier := ⇑(coequalizer.π f.val g.val).base '' V.carrier, is_open' := V_open } ≤ U hxV : x ∈ V ⊢ IsUnit ((Y.presheaf.map (eqToHom hV').op) ((Y.presheaf.map ((Opens.map (coequalizer.π f.val g.val).base).op.map (homOfLE VleU).op)) (((coequalizer.π f.val g.val).c.app (op U)) s)))
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw`
erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp]
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw`
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.228_0.tE6q65npbp8AX2g
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case map_nonunit.intro.intro.intro.a X Y : LocallyRingedSpace f g : X ⟶ Y U✝ : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace s✝ : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U✝)) x : ↑(toTopCat Y) U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace hU : (coequalizer.π f.val g.val).base x ∈ U s : (forget CommRingCat).obj ((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U)) ha : IsUnit ((TopCat.Presheaf.germ Y.presheaf { val := x, property := hU }) (((coequalizer.π f.val g.val).c.app (op U)) s)) V : Opens ↑(toTopCat Y) := imageBasicOpen f g U s hV : ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier) = V.carrier hV' : V = { carrier := ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier), is_open' := (_ : IsOpen (⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier))) } V_open : IsOpen (⇑(coequalizer.π f.val g.val).base '' V.carrier) VleU : { carrier := ⇑(coequalizer.π f.val g.val).base '' V.carrier, is_open' := V_open } ≤ U hxV : x ∈ V ⊢ IsUnit (((coequalizer.π f.val g.val).c.app (op U) ≫ Y.presheaf.map ((Opens.map (coequalizer.π f.val g.val).base).op.map (homOfLE VleU).op ≫ (eqToHom hV').op)) s)
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp]
convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s)
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp]
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.228_0.tE6q65npbp8AX2g
instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
X Y : LocallyRingedSpace f g : X ⟶ Y x : ↑↑(Limits.coequalizer f.val g.val).toPresheafedSpace ⊢ LocalRing ↑(TopCat.Presheaf.stalk (Limits.coequalizer f.val g.val).toPresheafedSpace.presheaf x)
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by
obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x
/-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.260_0.tE6q65npbp8AX2g
/-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case intro X Y : LocallyRingedSpace f g : X ⟶ Y y : (forget TopCat).obj ↑Y.toPresheafedSpace ⊢ LocalRing ↑(TopCat.Presheaf.stalk (Limits.coequalizer f.val g.val).toPresheafedSpace.presheaf ((coequalizer.π f.val g.val).base y))
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x
exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing
/-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.260_0.tE6q65npbp8AX2g
/-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
X✝ Y✝ : LocallyRingedSpace f✝ g✝ : X✝ ⟶ Y✝ X Y : RingedSpace f g : X ⟶ Y H : f = g x : ↑↑X.toPresheafedSpace h : IsLocalRingHom (PresheafedSpace.stalkMap f x) ⊢ IsLocalRingHom (PresheafedSpace.stalkMap g x)
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by
rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]
theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.278_0.tE6q65npbp8AX2g
theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
X✝ Y✝ : LocallyRingedSpace f✝ g✝ : X✝ ⟶ Y✝ X Y : RingedSpace f g : X ⟶ Y H : f = g x : ↑↑X.toPresheafedSpace h : IsLocalRingHom (PresheafedSpace.stalkMap f x) ⊢ IsLocalRingHom (eqToHom (_ : PresheafedSpace.stalk Y.toPresheafedSpace (g.base x) = PresheafedSpace.stalk Y.toPresheafedSpace (f.base x)) ≫ PresheafedSpace.stalkMap f x)
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x];
infer_instance
theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x];
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.278_0.tE6q65npbp8AX2g
theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
X Y : LocallyRingedSpace f g : X ⟶ Y ⊢ IsColimit (coequalizerCofork f g)
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by
apply Cofork.IsColimit.mk'
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case create X Y : LocallyRingedSpace f g : X ⟶ Y ⊢ (s : Cofork f g) → { l // Cofork.π (coequalizerCofork f g) ≫ l = Cofork.π s ∧ ∀ {m : ((Functor.const WalkingParallelPair).obj (coequalizerCofork f g).pt).obj WalkingParallelPair.one ⟶ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one}, Cofork.π (coequalizerCofork f g) ≫ m = Cofork.π s → m = l }
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk'
intro s
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk'
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case create X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g ⊢ { l // Cofork.π (coequalizerCofork f g) ≫ l = Cofork.π s ∧ ∀ {m : ((Functor.const WalkingParallelPair).obj (coequalizerCofork f g).pt).obj WalkingParallelPair.one ⟶ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one}, Cofork.π (coequalizerCofork f g) ≫ m = Cofork.π s → m = l }
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s
have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g ⊢ f.val ≫ (Cofork.π s).val = g.val ≫ (Cofork.π s).val
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by
injection s.condition
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case create X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g e : f.val ≫ (Cofork.π s).val = g.val ≫ (Cofork.π s).val ⊢ { l // Cofork.π (coequalizerCofork f g) ≫ l = Cofork.π s ∧ ∀ {m : ((Functor.const WalkingParallelPair).obj (coequalizerCofork f g).pt).obj WalkingParallelPair.one ⟶ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one}, Cofork.π (coequalizerCofork f g) ≫ m = Cofork.π s → m = l }
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition
refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case create.refine_1 X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g e : f.val ≫ (Cofork.π s).val = g.val ≫ (Cofork.π s).val ⊢ ∀ (x : ↑↑(coequalizerCofork f g).pt.toPresheafedSpace), IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.desc (Cofork.π s).val e) x)
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ ·
intro x
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ ·
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case create.refine_1 X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g e : f.val ≫ (Cofork.π s).val = g.val ≫ (Cofork.π s).val x : ↑↑(coequalizerCofork f g).pt.toPresheafedSpace ⊢ IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.desc (Cofork.π s).val e) x)
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x
rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case create.refine_1.intro X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g e : f.val ≫ (Cofork.π s).val = g.val ≫ (Cofork.π s).val y : (forget TopCat).obj ↑Y.toPresheafedSpace ⊢ IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.desc (Cofork.π s).val e) ((coequalizer.π f.val g.val).base y))
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible
set h := _
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case create.refine_1.intro X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g e : f.val ≫ (Cofork.π s).val = g.val ≫ (Cofork.π s).val y : (forget TopCat).obj ↑Y.toPresheafedSpace h : ?m.199155 := ?m.199156 ⊢ IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.desc (Cofork.π s).val e) ((coequalizer.π f.val g.val).base y))
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _
change IsLocalRingHom h
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case create.refine_1.intro X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g e : f.val ≫ (Cofork.π s).val = g.val ≫ (Cofork.π s).val y : (forget TopCat).obj ↑Y.toPresheafedSpace h : ↑(PresheafedSpace.stalk s.pt.toPresheafedSpace ((coequalizer.desc (Cofork.π s).val e).base ((coequalizer.π f.val g.val).base y))) →+* ↑(PresheafedSpace.stalk (coequalizerCofork f g).pt.toPresheafedSpace ((coequalizer.π f.val g.val).base y)) := PresheafedSpace.stalkMap (coequalizer.desc (Cofork.π s).val e) ((coequalizer.π f.val g.val).base y) ⊢ IsLocalRingHom h
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h
suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h)
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case create.refine_1.intro X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g e : f.val ≫ (Cofork.π s).val = g.val ≫ (Cofork.π s).val y : (forget TopCat).obj ↑Y.toPresheafedSpace h : ↑(PresheafedSpace.stalk s.pt.toPresheafedSpace ((coequalizer.desc (Cofork.π s).val e).base ((coequalizer.π f.val g.val).base y))) →+* ↑(PresheafedSpace.stalk (coequalizerCofork f g).pt.toPresheafedSpace ((coequalizer.π f.val g.val).base y)) := PresheafedSpace.stalkMap (coequalizer.desc (Cofork.π s).val e) ((coequalizer.π f.val g.val).base y) this : IsLocalRingHom (RingHom.comp (PresheafedSpace.stalkMap (Cofork.π (coequalizerCofork f g)).val y) h) ⊢ IsLocalRingHom h
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) ·
apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _)
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) ·
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case this X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g e : f.val ≫ (Cofork.π s).val = g.val ≫ (Cofork.π s).val y : (forget TopCat).obj ↑Y.toPresheafedSpace h : ↑(PresheafedSpace.stalk s.pt.toPresheafedSpace ((coequalizer.desc (Cofork.π s).val e).base ((coequalizer.π f.val g.val).base y))) →+* ↑(PresheafedSpace.stalk (coequalizerCofork f g).pt.toPresheafedSpace ((coequalizer.π f.val g.val).base y)) := PresheafedSpace.stalkMap (coequalizer.desc (Cofork.π s).val e) ((coequalizer.π f.val g.val).base y) ⊢ IsLocalRingHom (RingHom.comp (PresheafedSpace.stalkMap (Cofork.π (coequalizerCofork f g)).val y) h)
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _)
change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y)
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _)
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case this X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g e : f.val ≫ (Cofork.π s).val = g.val ≫ (Cofork.π s).val y : (forget TopCat).obj ↑Y.toPresheafedSpace h : ↑(PresheafedSpace.stalk s.pt.toPresheafedSpace ((coequalizer.desc (Cofork.π s).val e).base ((coequalizer.π f.val g.val).base y))) →+* ↑(PresheafedSpace.stalk (coequalizerCofork f g).pt.toPresheafedSpace ((coequalizer.π f.val g.val).base y)) := PresheafedSpace.stalkMap (coequalizer.desc (Cofork.π s).val e) ((coequalizer.π f.val g.val).base y) ⊢ IsLocalRingHom (h ≫ PresheafedSpace.stalkMap (Cofork.π (coequalizerCofork f g)).val y)
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y)
erw [← PresheafedSpace.stalkMap.comp]
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y)
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case this X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g e : f.val ≫ (Cofork.π s).val = g.val ≫ (Cofork.π s).val y : (forget TopCat).obj ↑Y.toPresheafedSpace h : ↑(PresheafedSpace.stalk s.pt.toPresheafedSpace ((coequalizer.desc (Cofork.π s).val e).base ((coequalizer.π f.val g.val).base y))) →+* ↑(PresheafedSpace.stalk (coequalizerCofork f g).pt.toPresheafedSpace ((coequalizer.π f.val g.val).base y)) := PresheafedSpace.stalkMap (coequalizer.desc (Cofork.π s).val e) ((coequalizer.π f.val g.val).base y) ⊢ IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val ≫ coequalizer.desc (Cofork.π s).val e) y)
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp]
apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp]
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case this X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g e : f.val ≫ (Cofork.π s).val = g.val ≫ (Cofork.π s).val y : (forget TopCat).obj ↑Y.toPresheafedSpace h : ↑(PresheafedSpace.stalk s.pt.toPresheafedSpace ((coequalizer.desc (Cofork.π s).val e).base ((coequalizer.π f.val g.val).base y))) →+* ↑(PresheafedSpace.stalk (coequalizerCofork f g).pt.toPresheafedSpace ((coequalizer.π f.val g.val).base y)) := PresheafedSpace.stalkMap (coequalizer.desc (Cofork.π s).val e) ((coequalizer.π f.val g.val).base y) ⊢ IsLocalRingHom (PresheafedSpace.stalkMap (Cofork.π s).val y)
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y
infer_instance
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case create.refine_2 X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g e : f.val ≫ (Cofork.π s).val = g.val ≫ (Cofork.π s).val ⊢ Cofork.π (coequalizerCofork f g) ≫ { val := coequalizer.desc (Cofork.π s).val e, prop := (_ : ∀ (x : ↑↑(coequalizerCofork f g).pt.toPresheafedSpace), IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.desc (Cofork.π s).val e) x)) } = Cofork.π s ∧ ∀ {m : ((Functor.const WalkingParallelPair).obj (coequalizerCofork f g).pt).obj WalkingParallelPair.one ⟶ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one}, Cofork.π (coequalizerCofork f g) ≫ m = Cofork.π s → m = { val := coequalizer.desc (Cofork.π s).val e, prop := (_ : ∀ (x : ↑↑(coequalizerCofork f g).pt.toPresheafedSpace), IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.desc (Cofork.π s).val e) x)) }
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance
constructor
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case create.refine_2.left X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g e : f.val ≫ (Cofork.π s).val = g.val ≫ (Cofork.π s).val ⊢ Cofork.π (coequalizerCofork f g) ≫ { val := coequalizer.desc (Cofork.π s).val e, prop := (_ : ∀ (x : ↑↑(coequalizerCofork f g).pt.toPresheafedSpace), IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.desc (Cofork.π s).val e) x)) } = Cofork.π s
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor ·
exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _)
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor ·
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case create.refine_2.right X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g e : f.val ≫ (Cofork.π s).val = g.val ≫ (Cofork.π s).val ⊢ ∀ {m : ((Functor.const WalkingParallelPair).obj (coequalizerCofork f g).pt).obj WalkingParallelPair.one ⟶ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one}, Cofork.π (coequalizerCofork f g) ≫ m = Cofork.π s → m = { val := coequalizer.desc (Cofork.π s).val e, prop := (_ : ∀ (x : ↑↑(coequalizerCofork f g).pt.toPresheafedSpace), IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.desc (Cofork.π s).val e) x)) }
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _)
intro m h
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _)
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case create.refine_2.right X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g e : f.val ≫ (Cofork.π s).val = g.val ≫ (Cofork.π s).val m : ((Functor.const WalkingParallelPair).obj (coequalizerCofork f g).pt).obj WalkingParallelPair.one ⟶ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one h : Cofork.π (coequalizerCofork f g) ≫ m = Cofork.π s ⊢ m = { val := coequalizer.desc (Cofork.π s).val e, prop := (_ : ∀ (x : ↑↑(coequalizerCofork f g).pt.toPresheafedSpace), IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.desc (Cofork.π s).val e) x)) }
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h
replace h : (coequalizerCofork f g).π.1 ≫ m.1 = s.π.1 := by rw [← h]; rfl
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g e : f.val ≫ (Cofork.π s).val = g.val ≫ (Cofork.π s).val m : ((Functor.const WalkingParallelPair).obj (coequalizerCofork f g).pt).obj WalkingParallelPair.one ⟶ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one h : Cofork.π (coequalizerCofork f g) ≫ m = Cofork.π s ⊢ (Cofork.π (coequalizerCofork f g)).val ≫ m.val = (Cofork.π s).val
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h replace h : (coequalizerCofork f g).π.1 ≫ m.1 = s.π.1 := by
rw [← h]
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h replace h : (coequalizerCofork f g).π.1 ≫ m.1 = s.π.1 := by
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g e : f.val ≫ (Cofork.π s).val = g.val ≫ (Cofork.π s).val m : ((Functor.const WalkingParallelPair).obj (coequalizerCofork f g).pt).obj WalkingParallelPair.one ⟶ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one h : Cofork.π (coequalizerCofork f g) ≫ m = Cofork.π s ⊢ (Cofork.π (coequalizerCofork f g)).val ≫ m.val = (Cofork.π (coequalizerCofork f g) ≫ m).val
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h replace h : (coequalizerCofork f g).π.1 ≫ m.1 = s.π.1 := by rw [← h];
rfl
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h replace h : (coequalizerCofork f g).π.1 ≫ m.1 = s.π.1 := by rw [← h];
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case create.refine_2.right X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g e : f.val ≫ (Cofork.π s).val = g.val ≫ (Cofork.π s).val m : ((Functor.const WalkingParallelPair).obj (coequalizerCofork f g).pt).obj WalkingParallelPair.one ⟶ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one h : (Cofork.π (coequalizerCofork f g)).val ≫ m.val = (Cofork.π s).val ⊢ m = { val := coequalizer.desc (Cofork.π s).val e, prop := (_ : ∀ (x : ↑↑(coequalizerCofork f g).pt.toPresheafedSpace), IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.desc (Cofork.π s).val e) x)) }
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h replace h : (coequalizerCofork f g).π.1 ≫ m.1 = s.π.1 := by rw [← h]; rfl
apply LocallyRingedSpace.Hom.ext
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h replace h : (coequalizerCofork f g).π.1 ≫ m.1 = s.π.1 := by rw [← h]; rfl
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case create.refine_2.right.val X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g e : f.val ≫ (Cofork.π s).val = g.val ≫ (Cofork.π s).val m : ((Functor.const WalkingParallelPair).obj (coequalizerCofork f g).pt).obj WalkingParallelPair.one ⟶ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one h : (Cofork.π (coequalizerCofork f g)).val ≫ m.val = (Cofork.π s).val ⊢ m.val = { val := coequalizer.desc (Cofork.π s).val e, prop := (_ : ∀ (x : ↑↑(coequalizerCofork f g).pt.toPresheafedSpace), IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.desc (Cofork.π s).val e) x)) }.val
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h replace h : (coequalizerCofork f g).π.1 ≫ m.1 = s.π.1 := by rw [← h]; rfl apply LocallyRingedSpace.Hom.ext
apply (colimit.isColimit (parallelPair f.1 g.1)).uniq (Cofork.ofπ s.π.1 e) m.1
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h replace h : (coequalizerCofork f g).π.1 ≫ m.1 = s.π.1 := by rw [← h]; rfl apply LocallyRingedSpace.Hom.ext
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case create.refine_2.right.val X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g e : f.val ≫ (Cofork.π s).val = g.val ≫ (Cofork.π s).val m : ((Functor.const WalkingParallelPair).obj (coequalizerCofork f g).pt).obj WalkingParallelPair.one ⟶ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one h : (Cofork.π (coequalizerCofork f g)).val ≫ m.val = (Cofork.π s).val ⊢ ∀ (j : WalkingParallelPair), (colimit.cocone (parallelPair f.val g.val)).ι.app j ≫ m.val = (Cofork.ofπ (Cofork.π s).val e).ι.app j
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h replace h : (coequalizerCofork f g).π.1 ≫ m.1 = s.π.1 := by rw [← h]; rfl apply LocallyRingedSpace.Hom.ext apply (colimit.isColimit (parallelPair f.1 g.1)).uniq (Cofork.ofπ s.π.1 e) m.1
rintro ⟨⟩
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h replace h : (coequalizerCofork f g).π.1 ≫ m.1 = s.π.1 := by rw [← h]; rfl apply LocallyRingedSpace.Hom.ext apply (colimit.isColimit (parallelPair f.1 g.1)).uniq (Cofork.ofπ s.π.1 e) m.1
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case create.refine_2.right.val.zero X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g e : f.val ≫ (Cofork.π s).val = g.val ≫ (Cofork.π s).val m : ((Functor.const WalkingParallelPair).obj (coequalizerCofork f g).pt).obj WalkingParallelPair.one ⟶ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one h : (Cofork.π (coequalizerCofork f g)).val ≫ m.val = (Cofork.π s).val ⊢ (colimit.cocone (parallelPair f.val g.val)).ι.app WalkingParallelPair.zero ≫ m.val = (Cofork.ofπ (Cofork.π s).val e).ι.app WalkingParallelPair.zero
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h replace h : (coequalizerCofork f g).π.1 ≫ m.1 = s.π.1 := by rw [← h]; rfl apply LocallyRingedSpace.Hom.ext apply (colimit.isColimit (parallelPair f.1 g.1)).uniq (Cofork.ofπ s.π.1 e) m.1 rintro ⟨⟩ ·
rw [← (colimit.cocone (parallelPair f.val g.val)).w WalkingParallelPairHom.left, Category.assoc]
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h replace h : (coequalizerCofork f g).π.1 ≫ m.1 = s.π.1 := by rw [← h]; rfl apply LocallyRingedSpace.Hom.ext apply (colimit.isColimit (parallelPair f.1 g.1)).uniq (Cofork.ofπ s.π.1 e) m.1 rintro ⟨⟩ ·
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case create.refine_2.right.val.zero X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g e : f.val ≫ (Cofork.π s).val = g.val ≫ (Cofork.π s).val m : ((Functor.const WalkingParallelPair).obj (coequalizerCofork f g).pt).obj WalkingParallelPair.one ⟶ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one h : (Cofork.π (coequalizerCofork f g)).val ≫ m.val = (Cofork.π s).val ⊢ (parallelPair f.val g.val).map WalkingParallelPairHom.left ≫ (colimit.cocone (parallelPair f.val g.val)).ι.app WalkingParallelPair.one ≫ m.val = (Cofork.ofπ (Cofork.π s).val e).ι.app WalkingParallelPair.zero
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h replace h : (coequalizerCofork f g).π.1 ≫ m.1 = s.π.1 := by rw [← h]; rfl apply LocallyRingedSpace.Hom.ext apply (colimit.isColimit (parallelPair f.1 g.1)).uniq (Cofork.ofπ s.π.1 e) m.1 rintro ⟨⟩ · rw [← (colimit.cocone (parallelPair f.val g.val)).w WalkingParallelPairHom.left, Category.assoc]
change _ ≫ _ ≫ _ = _ ≫ _
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h replace h : (coequalizerCofork f g).π.1 ≫ m.1 = s.π.1 := by rw [← h]; rfl apply LocallyRingedSpace.Hom.ext apply (colimit.isColimit (parallelPair f.1 g.1)).uniq (Cofork.ofπ s.π.1 e) m.1 rintro ⟨⟩ · rw [← (colimit.cocone (parallelPair f.val g.val)).w WalkingParallelPairHom.left, Category.assoc]
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case create.refine_2.right.val.zero X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g e : f.val ≫ (Cofork.π s).val = g.val ≫ (Cofork.π s).val m : ((Functor.const WalkingParallelPair).obj (coequalizerCofork f g).pt).obj WalkingParallelPair.one ⟶ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one h : (Cofork.π (coequalizerCofork f g)).val ≫ m.val = (Cofork.π s).val ⊢ (parallelPair f.val g.val).map WalkingParallelPairHom.left ≫ (colimit.cocone (parallelPair f.val g.val)).ι.app WalkingParallelPair.one ≫ m.val = f.val ≫ (Cofork.π s).val
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h replace h : (coequalizerCofork f g).π.1 ≫ m.1 = s.π.1 := by rw [← h]; rfl apply LocallyRingedSpace.Hom.ext apply (colimit.isColimit (parallelPair f.1 g.1)).uniq (Cofork.ofπ s.π.1 e) m.1 rintro ⟨⟩ · rw [← (colimit.cocone (parallelPair f.val g.val)).w WalkingParallelPairHom.left, Category.assoc] change _ ≫ _ ≫ _ = _ ≫ _
congr
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h replace h : (coequalizerCofork f g).π.1 ≫ m.1 = s.π.1 := by rw [← h]; rfl apply LocallyRingedSpace.Hom.ext apply (colimit.isColimit (parallelPair f.1 g.1)).uniq (Cofork.ofπ s.π.1 e) m.1 rintro ⟨⟩ · rw [← (colimit.cocone (parallelPair f.val g.val)).w WalkingParallelPairHom.left, Category.assoc] change _ ≫ _ ≫ _ = _ ≫ _
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case create.refine_2.right.val.one X Y : LocallyRingedSpace f g : X ⟶ Y s : Cofork f g e : f.val ≫ (Cofork.π s).val = g.val ≫ (Cofork.π s).val m : ((Functor.const WalkingParallelPair).obj (coequalizerCofork f g).pt).obj WalkingParallelPair.one ⟶ ((Functor.const WalkingParallelPair).obj s.pt).obj WalkingParallelPair.one h : (Cofork.π (coequalizerCofork f g)).val ≫ m.val = (Cofork.π s).val ⊢ (colimit.cocone (parallelPair f.val g.val)).ι.app WalkingParallelPair.one ≫ m.val = (Cofork.ofπ (Cofork.π s).val e).ι.app WalkingParallelPair.one
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h replace h : (coequalizerCofork f g).π.1 ≫ m.1 = s.π.1 := by rw [← h]; rfl apply LocallyRingedSpace.Hom.ext apply (colimit.isColimit (parallelPair f.1 g.1)).uniq (Cofork.ofπ s.π.1 e) m.1 rintro ⟨⟩ · rw [← (colimit.cocone (parallelPair f.val g.val)).w WalkingParallelPairHom.left, Category.assoc] change _ ≫ _ ≫ _ = _ ≫ _ congr ·
exact h
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h replace h : (coequalizerCofork f g).π.1 ≫ m.1 = s.π.1 := by rw [← h]; rfl apply LocallyRingedSpace.Hom.ext apply (colimit.isColimit (parallelPair f.1 g.1)).uniq (Cofork.ofπ s.π.1 e) m.1 rintro ⟨⟩ · rw [← (colimit.cocone (parallelPair f.val g.val)).w WalkingParallelPairHom.left, Category.assoc] change _ ≫ _ ≫ _ = _ ≫ _ congr ·
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.284_0.tE6q65npbp8AX2g
/-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g)
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
X Y : LocallyRingedSpace f g : X ⟶ Y F : WalkingParallelPair ⥤ LocallyRingedSpace ⊢ PreservesColimit F forgetToSheafedSpace
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h replace h : (coequalizerCofork f g).π.1 ≫ m.1 = s.π.1 := by rw [← h]; rfl apply LocallyRingedSpace.Hom.ext apply (colimit.isColimit (parallelPair f.1 g.1)).uniq (Cofork.ofπ s.π.1 e) m.1 rintro ⟨⟩ · rw [← (colimit.cocone (parallelPair f.val g.val)).w WalkingParallelPairHom.left, Category.assoc] change _ ≫ _ ≫ _ = _ ≫ _ congr · exact h #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork_is_colimit AlgebraicGeometry.LocallyRingedSpace.coequalizerCoforkIsColimit instance : HasCoequalizer f g := ⟨⟨⟨_, coequalizerCoforkIsColimit f g⟩⟩⟩ instance : HasCoequalizers LocallyRingedSpace := hasCoequalizers_of_hasColimit_parallelPair _ noncomputable instance preservesCoequalizer : PreservesColimitsOfShape WalkingParallelPair forgetToSheafedSpace.{v} := ⟨fun {F} => by -- Porting note : was `apply preservesColimitOfIsoDiagram ...` and the proof that preservation -- of colimit is provided later
suffices : PreservesColimit (parallelPair (F.map WalkingParallelPairHom.left) (F.map WalkingParallelPairHom.right)) forgetToSheafedSpace
noncomputable instance preservesCoequalizer : PreservesColimitsOfShape WalkingParallelPair forgetToSheafedSpace.{v} := ⟨fun {F} => by -- Porting note : was `apply preservesColimitOfIsoDiagram ...` and the proof that preservation -- of colimit is provided later
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.324_0.tE6q65npbp8AX2g
noncomputable instance preservesCoequalizer : PreservesColimitsOfShape WalkingParallelPair forgetToSheafedSpace.{v}
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
X Y : LocallyRingedSpace f g : X ⟶ Y F : WalkingParallelPair ⥤ LocallyRingedSpace this : PreservesColimit (parallelPair (F.map WalkingParallelPairHom.left) (F.map WalkingParallelPairHom.right)) forgetToSheafedSpace ⊢ PreservesColimit F forgetToSheafedSpace
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h replace h : (coequalizerCofork f g).π.1 ≫ m.1 = s.π.1 := by rw [← h]; rfl apply LocallyRingedSpace.Hom.ext apply (colimit.isColimit (parallelPair f.1 g.1)).uniq (Cofork.ofπ s.π.1 e) m.1 rintro ⟨⟩ · rw [← (colimit.cocone (parallelPair f.val g.val)).w WalkingParallelPairHom.left, Category.assoc] change _ ≫ _ ≫ _ = _ ≫ _ congr · exact h #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork_is_colimit AlgebraicGeometry.LocallyRingedSpace.coequalizerCoforkIsColimit instance : HasCoequalizer f g := ⟨⟨⟨_, coequalizerCoforkIsColimit f g⟩⟩⟩ instance : HasCoequalizers LocallyRingedSpace := hasCoequalizers_of_hasColimit_parallelPair _ noncomputable instance preservesCoequalizer : PreservesColimitsOfShape WalkingParallelPair forgetToSheafedSpace.{v} := ⟨fun {F} => by -- Porting note : was `apply preservesColimitOfIsoDiagram ...` and the proof that preservation -- of colimit is provided later suffices : PreservesColimit (parallelPair (F.map WalkingParallelPairHom.left) (F.map WalkingParallelPairHom.right)) forgetToSheafedSpace ·
apply preservesColimitOfIsoDiagram _ (diagramIsoParallelPair F).symm
noncomputable instance preservesCoequalizer : PreservesColimitsOfShape WalkingParallelPair forgetToSheafedSpace.{v} := ⟨fun {F} => by -- Porting note : was `apply preservesColimitOfIsoDiagram ...` and the proof that preservation -- of colimit is provided later suffices : PreservesColimit (parallelPair (F.map WalkingParallelPairHom.left) (F.map WalkingParallelPairHom.right)) forgetToSheafedSpace ·
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.324_0.tE6q65npbp8AX2g
noncomputable instance preservesCoequalizer : PreservesColimitsOfShape WalkingParallelPair forgetToSheafedSpace.{v}
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case this X Y : LocallyRingedSpace f g : X ⟶ Y F : WalkingParallelPair ⥤ LocallyRingedSpace ⊢ PreservesColimit (parallelPair (F.map WalkingParallelPairHom.left) (F.map WalkingParallelPairHom.right)) forgetToSheafedSpace
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h replace h : (coequalizerCofork f g).π.1 ≫ m.1 = s.π.1 := by rw [← h]; rfl apply LocallyRingedSpace.Hom.ext apply (colimit.isColimit (parallelPair f.1 g.1)).uniq (Cofork.ofπ s.π.1 e) m.1 rintro ⟨⟩ · rw [← (colimit.cocone (parallelPair f.val g.val)).w WalkingParallelPairHom.left, Category.assoc] change _ ≫ _ ≫ _ = _ ≫ _ congr · exact h #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork_is_colimit AlgebraicGeometry.LocallyRingedSpace.coequalizerCoforkIsColimit instance : HasCoequalizer f g := ⟨⟨⟨_, coequalizerCoforkIsColimit f g⟩⟩⟩ instance : HasCoequalizers LocallyRingedSpace := hasCoequalizers_of_hasColimit_parallelPair _ noncomputable instance preservesCoequalizer : PreservesColimitsOfShape WalkingParallelPair forgetToSheafedSpace.{v} := ⟨fun {F} => by -- Porting note : was `apply preservesColimitOfIsoDiagram ...` and the proof that preservation -- of colimit is provided later suffices : PreservesColimit (parallelPair (F.map WalkingParallelPairHom.left) (F.map WalkingParallelPairHom.right)) forgetToSheafedSpace · apply preservesColimitOfIsoDiagram _ (diagramIsoParallelPair F).symm
apply preservesColimitOfPreservesColimitCocone (coequalizerCoforkIsColimit _ _)
noncomputable instance preservesCoequalizer : PreservesColimitsOfShape WalkingParallelPair forgetToSheafedSpace.{v} := ⟨fun {F} => by -- Porting note : was `apply preservesColimitOfIsoDiagram ...` and the proof that preservation -- of colimit is provided later suffices : PreservesColimit (parallelPair (F.map WalkingParallelPairHom.left) (F.map WalkingParallelPairHom.right)) forgetToSheafedSpace · apply preservesColimitOfIsoDiagram _ (diagramIsoParallelPair F).symm
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.324_0.tE6q65npbp8AX2g
noncomputable instance preservesCoequalizer : PreservesColimitsOfShape WalkingParallelPair forgetToSheafedSpace.{v}
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
case this X Y : LocallyRingedSpace f g : X ⟶ Y F : WalkingParallelPair ⥤ LocallyRingedSpace ⊢ IsColimit (forgetToSheafedSpace.mapCocone (coequalizerCofork (F.map WalkingParallelPairHom.left) (F.map WalkingParallelPairHom.right)))
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h replace h : (coequalizerCofork f g).π.1 ≫ m.1 = s.π.1 := by rw [← h]; rfl apply LocallyRingedSpace.Hom.ext apply (colimit.isColimit (parallelPair f.1 g.1)).uniq (Cofork.ofπ s.π.1 e) m.1 rintro ⟨⟩ · rw [← (colimit.cocone (parallelPair f.val g.val)).w WalkingParallelPairHom.left, Category.assoc] change _ ≫ _ ≫ _ = _ ≫ _ congr · exact h #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork_is_colimit AlgebraicGeometry.LocallyRingedSpace.coequalizerCoforkIsColimit instance : HasCoequalizer f g := ⟨⟨⟨_, coequalizerCoforkIsColimit f g⟩⟩⟩ instance : HasCoequalizers LocallyRingedSpace := hasCoequalizers_of_hasColimit_parallelPair _ noncomputable instance preservesCoequalizer : PreservesColimitsOfShape WalkingParallelPair forgetToSheafedSpace.{v} := ⟨fun {F} => by -- Porting note : was `apply preservesColimitOfIsoDiagram ...` and the proof that preservation -- of colimit is provided later suffices : PreservesColimit (parallelPair (F.map WalkingParallelPairHom.left) (F.map WalkingParallelPairHom.right)) forgetToSheafedSpace · apply preservesColimitOfIsoDiagram _ (diagramIsoParallelPair F).symm apply preservesColimitOfPreservesColimitCocone (coequalizerCoforkIsColimit _ _)
apply (isColimitMapCoconeCoforkEquiv _ _).symm _
noncomputable instance preservesCoequalizer : PreservesColimitsOfShape WalkingParallelPair forgetToSheafedSpace.{v} := ⟨fun {F} => by -- Porting note : was `apply preservesColimitOfIsoDiagram ...` and the proof that preservation -- of colimit is provided later suffices : PreservesColimit (parallelPair (F.map WalkingParallelPairHom.left) (F.map WalkingParallelPairHom.right)) forgetToSheafedSpace · apply preservesColimitOfIsoDiagram _ (diagramIsoParallelPair F).symm apply preservesColimitOfPreservesColimitCocone (coequalizerCoforkIsColimit _ _)
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.324_0.tE6q65npbp8AX2g
noncomputable instance preservesCoequalizer : PreservesColimitsOfShape WalkingParallelPair forgetToSheafedSpace.{v}
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
X Y : LocallyRingedSpace f g : X ⟶ Y F : WalkingParallelPair ⥤ LocallyRingedSpace ⊢ IsColimit (Cofork.ofπ (forgetToSheafedSpace.map { val := coequalizer.π (F.map WalkingParallelPairHom.left).val (F.map WalkingParallelPairHom.right).val, prop := (_ : ∀ (x : ↑(toTopCat (F.obj WalkingParallelPair.one))), IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π (F.map WalkingParallelPairHom.left).val (F.map WalkingParallelPairHom.right).val) x)) }) (_ : forgetToSheafedSpace.map (F.map WalkingParallelPairHom.left) ≫ forgetToSheafedSpace.map { val := coequalizer.π (F.map WalkingParallelPairHom.left).val (F.map WalkingParallelPairHom.right).val, prop := (_ : ∀ (x : ↑(toTopCat (F.obj WalkingParallelPair.one))), IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π (F.map WalkingParallelPairHom.left).val (F.map WalkingParallelPairHom.right).val) x)) } = forgetToSheafedSpace.map (F.map WalkingParallelPairHom.right) ≫ forgetToSheafedSpace.map { val := coequalizer.π (F.map WalkingParallelPairHom.left).val (F.map WalkingParallelPairHom.right).val, prop := (_ : ∀ (x : ↑(toTopCat (F.obj WalkingParallelPair.one))), IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π (F.map WalkingParallelPairHom.left).val (F.map WalkingParallelPairHom.right).val) x)) }))
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h replace h : (coequalizerCofork f g).π.1 ≫ m.1 = s.π.1 := by rw [← h]; rfl apply LocallyRingedSpace.Hom.ext apply (colimit.isColimit (parallelPair f.1 g.1)).uniq (Cofork.ofπ s.π.1 e) m.1 rintro ⟨⟩ · rw [← (colimit.cocone (parallelPair f.val g.val)).w WalkingParallelPairHom.left, Category.assoc] change _ ≫ _ ≫ _ = _ ≫ _ congr · exact h #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork_is_colimit AlgebraicGeometry.LocallyRingedSpace.coequalizerCoforkIsColimit instance : HasCoequalizer f g := ⟨⟨⟨_, coequalizerCoforkIsColimit f g⟩⟩⟩ instance : HasCoequalizers LocallyRingedSpace := hasCoequalizers_of_hasColimit_parallelPair _ noncomputable instance preservesCoequalizer : PreservesColimitsOfShape WalkingParallelPair forgetToSheafedSpace.{v} := ⟨fun {F} => by -- Porting note : was `apply preservesColimitOfIsoDiagram ...` and the proof that preservation -- of colimit is provided later suffices : PreservesColimit (parallelPair (F.map WalkingParallelPairHom.left) (F.map WalkingParallelPairHom.right)) forgetToSheafedSpace · apply preservesColimitOfIsoDiagram _ (diagramIsoParallelPair F).symm apply preservesColimitOfPreservesColimitCocone (coequalizerCoforkIsColimit _ _) apply (isColimitMapCoconeCoforkEquiv _ _).symm _
dsimp only [forgetToSheafedSpace]
noncomputable instance preservesCoequalizer : PreservesColimitsOfShape WalkingParallelPair forgetToSheafedSpace.{v} := ⟨fun {F} => by -- Porting note : was `apply preservesColimitOfIsoDiagram ...` and the proof that preservation -- of colimit is provided later suffices : PreservesColimit (parallelPair (F.map WalkingParallelPairHom.left) (F.map WalkingParallelPairHom.right)) forgetToSheafedSpace · apply preservesColimitOfIsoDiagram _ (diagramIsoParallelPair F).symm apply preservesColimitOfPreservesColimitCocone (coequalizerCoforkIsColimit _ _) apply (isColimitMapCoconeCoforkEquiv _ _).symm _
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.324_0.tE6q65npbp8AX2g
noncomputable instance preservesCoequalizer : PreservesColimitsOfShape WalkingParallelPair forgetToSheafedSpace.{v}
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
X Y : LocallyRingedSpace f g : X ⟶ Y F : WalkingParallelPair ⥤ LocallyRingedSpace ⊢ IsColimit (Cofork.ofπ (coequalizer.π (F.map WalkingParallelPairHom.left).val (F.map WalkingParallelPairHom.right).val) (_ : (F.map WalkingParallelPairHom.left).val ≫ coequalizer.π (F.map WalkingParallelPairHom.left).val (F.map WalkingParallelPairHom.right).val = (F.map WalkingParallelPairHom.right).val ≫ coequalizer.π (F.map WalkingParallelPairHom.left).val (F.map WalkingParallelPairHom.right).val))
/- Copyright (c) 2021 Andrew Yang. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang -/ import Mathlib.Geometry.RingedSpace.LocallyRingedSpace import Mathlib.Algebra.Category.Ring.Constructions import Mathlib.Geometry.RingedSpace.OpenImmersion import Mathlib.CategoryTheory.Limits.Constructions.LimitsOfProductsAndEqualizers #align_import algebraic_geometry.locally_ringed_space.has_colimits from "leanprover-community/mathlib"@"533f62f4dd62a5aad24a04326e6e787c8f7e98b1" /-! # Colimits of LocallyRingedSpace We construct the explicit coproducts and coequalizers of `LocallyRingedSpace`. It then follows that `LocallyRingedSpace` has all colimits, and `forget_to_SheafedSpace` preserves them. -/ set_option linter.uppercaseLean3 false namespace AlgebraicGeometry universe v u open CategoryTheory CategoryTheory.Limits Opposite TopologicalSpace namespace SheafedSpace variable {C : Type u} [Category.{v} C] [HasLimits C] variable {J : Type v} [Category.{v} J] (F : J ⥤ SheafedSpace.{_, _, v} C) theorem isColimit_exists_rep {c : Cocone F} (hc : IsColimit c) (x : c.pt) : ∃ (i : J) (y : F.obj i), (c.ι.app i).base y = x := Concrete.isColimit_exists_rep (F ⋙ forget C) (isColimitOfPreserves (forget C) hc) x #align algebraic_geometry.SheafedSpace.is_colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.isColimit_exists_rep -- Porting note : argument `C` of colimit need to be made explicit, odd theorem colimit_exists_rep (x : colimit (C := SheafedSpace C) F) : ∃ (i : J) (y : F.obj i), (colimit.ι F i).base y = x := Concrete.isColimit_exists_rep (F ⋙ SheafedSpace.forget C) (isColimitOfPreserves (SheafedSpace.forget _) (colimit.isColimit F)) x #align algebraic_geometry.SheafedSpace.colimit_exists_rep AlgebraicGeometry.SheafedSpaceₓ.colimit_exists_rep instance {X Y : SheafedSpace C} (f g : X ⟶ Y) : Epi (coequalizer.π f g).base := by erw [← show _ = (coequalizer.π f g).base from ι_comp_coequalizerComparison f g (SheafedSpace.forget C)] rw [← PreservesCoequalizer.iso_hom] apply epi_comp end SheafedSpace namespace LocallyRingedSpace section HasCoproducts variable {ι : Type u} (F : Discrete ι ⥤ LocallyRingedSpace.{u}) -- Porting note : in this section, I marked `CommRingCat` as `CommRingCatMax.{u,u}` -- This is a hack to avoid the following: /- ``` stuck at solving universe constraint u =?= max u ?u.11876 while trying to unify HasLimits CommRingCat with (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) (HasLimitsOfSize CommRingCatMax) ``` -/ /-- The explicit coproduct for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproduct : LocallyRingedSpace where toSheafedSpace := colimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) localRing x := by obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x haveI : LocalRing (((F ⋙ forgetToSheafedSpace).obj i).toPresheafedSpace.stalk y) := (F.obj i).localRing _ exact (asIso (PresheafedSpace.stalkMap (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i : _) y)).symm.commRingCatIsoToRingEquiv.localRing #align algebraic_geometry.LocallyRingedSpace.coproduct AlgebraicGeometry.LocallyRingedSpace.coproduct /-- The explicit coproduct cofan for `F : discrete ι ⥤ LocallyRingedSpace`. -/ noncomputable def coproductCofan : Cocone F where pt := coproduct F ι := { app := fun j => ⟨colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) j, inferInstance⟩ naturality := fun ⟨j⟩ ⟨j'⟩ ⟨⟨(f : j = j')⟩⟩ => by subst f; aesop } #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan AlgebraicGeometry.LocallyRingedSpace.coproductCofan /-- The explicit coproduct cofan constructed in `coproduct_cofan` is indeed a colimit. -/ noncomputable def coproductCofanIsColimit : IsColimit (coproductCofan F) where desc s := ⟨colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s), by intro x obtain ⟨i, y, ⟨⟩⟩ := SheafedSpace.colimit_exists_rep (F ⋙ forgetToSheafedSpace) x have := PresheafedSpace.stalkMap.comp (colimit.ι (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) i) (colimit.desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (F ⋙ forgetToSheafedSpace) (forgetToSheafedSpace.mapCocone s)) y rw [← IsIso.comp_inv_eq] at this erw [← this, PresheafedSpace.stalkMap.congr_hom _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) (forgetToSheafedSpace.mapCocone s) i : _)] haveI : IsLocalRingHom (PresheafedSpace.stalkMap ((forgetToSheafedSpace.mapCocone s).ι.app i) y) := (s.ι.app i).2 y infer_instance⟩ fac s j := LocallyRingedSpace.Hom.ext _ _ (colimit.ι_desc (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _ _) uniq s f h := LocallyRingedSpace.Hom.ext _ _ (IsColimit.uniq _ (forgetToSheafedSpace.mapCocone s) f.1 fun j => congr_arg LocallyRingedSpace.Hom.val (h j)) #align algebraic_geometry.LocallyRingedSpace.coproduct_cofan_is_colimit AlgebraicGeometry.LocallyRingedSpace.coproductCofanIsColimit instance : HasCoproducts.{u} LocallyRingedSpace.{u} := fun _ => ⟨fun F => ⟨⟨⟨_, coproductCofanIsColimit F⟩⟩⟩⟩ noncomputable instance (J : Type _) : PreservesColimitsOfShape (Discrete.{u} J) forgetToSheafedSpace.{u} := ⟨fun {G} => preservesColimitOfPreservesColimitCocone (coproductCofanIsColimit G) ((colimit.isColimit (C := SheafedSpace.{u+1, u, u} CommRingCatMax.{u, u}) _).ofIsoColimit (Cocones.ext (Iso.refl _) fun _ => Category.comp_id _))⟩ end HasCoproducts section HasCoequalizer variable {X Y : LocallyRingedSpace.{v}} (f g : X ⟶ Y) namespace HasCoequalizer instance coequalizer_π_app_isLocalRingHom (U : TopologicalSpace.Opens (coequalizer f.val g.val).carrier) : IsLocalRingHom ((coequalizer.π f.val g.val : _).c.app (op U)) := by have := ι_comp_coequalizerComparison f.1 g.1 SheafedSpace.forgetToPresheafedSpace rw [← PreservesCoequalizer.iso_hom] at this erw [SheafedSpace.congr_app this.symm (op U)] rw [PresheafedSpace.comp_c_app, ← PresheafedSpace.colimitPresheafObjIsoComponentwiseLimit_hom_π] -- Porting note : this instance has to be manually added haveI : IsIso (PreservesCoequalizer.iso SheafedSpace.forgetToPresheafedSpace f.val g.val).hom.c := PresheafedSpace.c_isIso_of_iso _ infer_instance #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_app_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_app_isLocalRingHom /-! We roughly follow the construction given in [MR0302656]. Given a pair `f, g : X ⟶ Y` of morphisms of locally ringed spaces, we want to show that the stalk map of `π = coequalizer.π f g` (as sheafed space homs) is a local ring hom. It then follows that `coequalizer f g` is indeed a locally ringed space, and `coequalizer.π f g` is a morphism of locally ringed space. Given a germ `⟨U, s⟩` of `x : coequalizer f g` such that `π꙳ x : Y` is invertible, we ought to show that `⟨U, s⟩` is invertible. That is, there exists an open set `U' ⊆ U` containing `x` such that the restriction of `s` onto `U'` is invertible. This `U'` is given by `π '' V`, where `V` is the basic open set of `π⋆x`. Since `f ⁻¹' V = Y.basic_open (f ≫ π)꙳ x = Y.basic_open (g ≫ π)꙳ x = g ⁻¹' V`, we have `π ⁻¹' (π '' V) = V` (as the underlying set map is merely the set-theoretic coequalizer). This shows that `π '' V` is indeed open, and `s` is invertible on `π '' V` as the components of `π꙳` are local ring homs. -/ variable (U : Opens (coequalizer f.1 g.1).carrier) variable (s : (coequalizer f.1 g.1).presheaf.obj (op U)) /-- (Implementation). The basic open set of the section `π꙳ s`. -/ noncomputable def imageBasicOpen : Opens Y := Y.toRingedSpace.basicOpen (show Y.presheaf.obj (op (unop _)) from ((coequalizer.π f.1 g.1).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen theorem imageBasicOpen_image_preimage : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) = (imageBasicOpen f g U s).1 := by fapply Types.coequalizer_preimage_image_eq_of_preimage_eq -- Porting note : Type of `f.1.base` and `g.1.base` needs to be explicit (f.1.base : X.carrier.1 ⟶ Y.carrier.1) (g.1.base : X.carrier.1 ⟶ Y.carrier.1) · ext simp_rw [types_comp_apply, ← TopCat.comp_app, ← PresheafedSpace.comp_base] congr 2 exact coequalizer.condition f.1 g.1 · apply isColimitCoforkMapOfIsColimit (forget TopCat) apply isColimitCoforkMapOfIsColimit (SheafedSpace.forget _) exact coequalizerIsCoequalizer f.1 g.1 · suffices (TopologicalSpace.Opens.map f.1.base).obj (imageBasicOpen f g U s) = (TopologicalSpace.Opens.map g.1.base).obj (imageBasicOpen f g U s) by injection this delta imageBasicOpen rw [preimage_basicOpen f, preimage_basicOpen g] dsimp only [Functor.op, unop_op] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← SheafedSpace.comp_c_app', ← comp_apply, ← SheafedSpace.comp_c_app', SheafedSpace.congr_app (coequalizer.condition f.1 g.1), comp_apply, X.toRingedSpace.basicOpen_res] apply inf_eq_right.mpr refine' (RingedSpace.basicOpen_le _ _).trans _ rw [coequalizer.condition f.1 g.1] #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_preimage AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_preimage theorem imageBasicOpen_image_open : IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1 g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp] erw [← coe_comp] rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison] dsimp only [SheafedSpace.forget] -- Porting note : change `rw` to `erw` erw [imageBasicOpen_image_preimage] exact (imageBasicOpen f g U s).2 #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.image_basic_open_image_open AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.imageBasicOpen_image_open instance coequalizer_π_stalk_isLocalRingHom (x : Y) : IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by constructor rintro a ha rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩ erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha let V := imageBasicOpen f g U s have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 := imageBasicOpen_image_preimage f g U s have hV' : V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ := SetLike.ext' hV.symm have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) := imageBasicOpen_image_open f g U s have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U := Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _) have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩ erw [← (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU) ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s] apply RingHom.isUnit_map rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply, NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ← isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)] -- Porting note : change `rw` to `erw` erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp] convert @RingedSpace.isUnit_res_basicOpen Y.toRingedSpace (unop _) (((coequalizer.π f.val g.val).c.app (op U)) s) #align algebraic_geometry.LocallyRingedSpace.has_coequalizer.coequalizer_π_stalk_is_local_ring_hom AlgebraicGeometry.LocallyRingedSpace.HasCoequalizer.coequalizer_π_stalk_isLocalRingHom end HasCoequalizer /-- The coequalizer of two locally ringed space in the category of sheafed spaces is a locally ringed space. -/ noncomputable def coequalizer : LocallyRingedSpace where toSheafedSpace := Limits.coequalizer f.1 g.1 localRing x := by obtain ⟨y, rfl⟩ := (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x exact (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) y).domain_localRing #align algebraic_geometry.LocallyRingedSpace.coequalizer AlgebraicGeometry.LocallyRingedSpace.coequalizer /-- The explicit coequalizer cofork of locally ringed spaces. -/ noncomputable def coequalizerCofork : Cofork f g := @Cofork.ofπ _ _ _ _ f g (coequalizer f g) ⟨coequalizer.π f.1 g.1, -- Porting note : this used to be automatic HasCoequalizer.coequalizer_π_stalk_isLocalRingHom _ _⟩ (LocallyRingedSpace.Hom.ext _ _ (coequalizer.condition f.1 g.1)) #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork AlgebraicGeometry.LocallyRingedSpace.coequalizerCofork theorem isLocalRingHom_stalkMap_congr {X Y : RingedSpace} (f g : X ⟶ Y) (H : f = g) (x) (h : IsLocalRingHom (PresheafedSpace.stalkMap f x)) : IsLocalRingHom (PresheafedSpace.stalkMap g x) := by rw [PresheafedSpace.stalkMap.congr_hom _ _ H.symm x]; infer_instance #align algebraic_geometry.LocallyRingedSpace.is_local_ring_hom_stalk_map_congr AlgebraicGeometry.LocallyRingedSpace.isLocalRingHom_stalkMap_congr /-- The cofork constructed in `coequalizer_cofork` is indeed a colimit cocone. -/ noncomputable def coequalizerCoforkIsColimit : IsColimit (coequalizerCofork f g) := by apply Cofork.IsColimit.mk' intro s have e : f.val ≫ s.π.val = g.val ≫ s.π.val := by injection s.condition refine ⟨⟨coequalizer.desc s.π.1 e, ?_⟩, ?_⟩ · intro x rcases (TopCat.epi_iff_surjective (coequalizer.π f.val g.val).base).mp inferInstance x with ⟨y, rfl⟩ -- Porting note : was `apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap ...)`, this -- used to allow you to provide the proof that `... ≫ ...` is a local ring homomorphism later, -- but this is no longer possible set h := _ change IsLocalRingHom h suffices : IsLocalRingHom ((PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _).comp h) · apply isLocalRingHom_of_comp _ (PresheafedSpace.stalkMap (coequalizerCofork f g).π.1 _) change IsLocalRingHom (_ ≫ PresheafedSpace.stalkMap (coequalizerCofork f g).π.val y) erw [← PresheafedSpace.stalkMap.comp] apply isLocalRingHom_stalkMap_congr _ _ (coequalizer.π_desc s.π.1 e).symm y infer_instance constructor · exact LocallyRingedSpace.Hom.ext _ _ (coequalizer.π_desc _ _) intro m h replace h : (coequalizerCofork f g).π.1 ≫ m.1 = s.π.1 := by rw [← h]; rfl apply LocallyRingedSpace.Hom.ext apply (colimit.isColimit (parallelPair f.1 g.1)).uniq (Cofork.ofπ s.π.1 e) m.1 rintro ⟨⟩ · rw [← (colimit.cocone (parallelPair f.val g.val)).w WalkingParallelPairHom.left, Category.assoc] change _ ≫ _ ≫ _ = _ ≫ _ congr · exact h #align algebraic_geometry.LocallyRingedSpace.coequalizer_cofork_is_colimit AlgebraicGeometry.LocallyRingedSpace.coequalizerCoforkIsColimit instance : HasCoequalizer f g := ⟨⟨⟨_, coequalizerCoforkIsColimit f g⟩⟩⟩ instance : HasCoequalizers LocallyRingedSpace := hasCoequalizers_of_hasColimit_parallelPair _ noncomputable instance preservesCoequalizer : PreservesColimitsOfShape WalkingParallelPair forgetToSheafedSpace.{v} := ⟨fun {F} => by -- Porting note : was `apply preservesColimitOfIsoDiagram ...` and the proof that preservation -- of colimit is provided later suffices : PreservesColimit (parallelPair (F.map WalkingParallelPairHom.left) (F.map WalkingParallelPairHom.right)) forgetToSheafedSpace · apply preservesColimitOfIsoDiagram _ (diagramIsoParallelPair F).symm apply preservesColimitOfPreservesColimitCocone (coequalizerCoforkIsColimit _ _) apply (isColimitMapCoconeCoforkEquiv _ _).symm _ dsimp only [forgetToSheafedSpace]
exact coequalizerIsCoequalizer _ _
noncomputable instance preservesCoequalizer : PreservesColimitsOfShape WalkingParallelPair forgetToSheafedSpace.{v} := ⟨fun {F} => by -- Porting note : was `apply preservesColimitOfIsoDiagram ...` and the proof that preservation -- of colimit is provided later suffices : PreservesColimit (parallelPair (F.map WalkingParallelPairHom.left) (F.map WalkingParallelPairHom.right)) forgetToSheafedSpace · apply preservesColimitOfIsoDiagram _ (diagramIsoParallelPair F).symm apply preservesColimitOfPreservesColimitCocone (coequalizerCoforkIsColimit _ _) apply (isColimitMapCoconeCoforkEquiv _ _).symm _ dsimp only [forgetToSheafedSpace]
Mathlib.Geometry.RingedSpace.LocallyRingedSpace.HasColimits.324_0.tE6q65npbp8AX2g
noncomputable instance preservesCoequalizer : PreservesColimitsOfShape WalkingParallelPair forgetToSheafedSpace.{v}
Mathlib_Geometry_RingedSpace_LocallyRingedSpace_HasColimits
R : Type u inst✝ : AddGroupWithOne R m n : ℕ h : m ≤ n ⊢ ↑(n - m) + ↑m = ↑n
/- Copyright (c) 2017 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Gabriel Ebner -/ import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Data.Int.Cast.Defs import Mathlib.Algebra.Group.Basic #align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Cast of integers (additional theorems) This file proves additional properties about the *canonical* homomorphism from the integers into an additive group with a one (`Int.cast`). There is also `Data.Int.Cast.Lemmas`, which includes lemmas stated in terms of algebraic homomorphisms, and results involving the order structure of `ℤ`. By contrast, this file's only import beyond `Data.Int.Cast.Defs` is `Algebra.Group.Basic`. -/ universe u namespace Nat variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast] theorem cast_sub {m n} (h : m ≤ n) : ((n - m : ℕ) : R) = n - m := eq_sub_of_add_eq <| by
rw [← cast_add, Nat.sub_add_cancel h]
@[simp, norm_cast] theorem cast_sub {m n} (h : m ≤ n) : ((n - m : ℕ) : R) = n - m := eq_sub_of_add_eq <| by
Mathlib.Data.Int.Cast.Basic.32_0.3MsWc9B5PAFbTbn
@[simp, norm_cast] theorem cast_sub {m n} (h : m ≤ n) : ((n - m : ℕ) : R) = n - m
Mathlib_Data_Int_Cast_Basic
R : Type u inst✝ : AddGroupWithOne R h : 0 < 0 ⊢ ↑(0 - 1) = ↑0 - 1
/- Copyright (c) 2017 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Gabriel Ebner -/ import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Data.Int.Cast.Defs import Mathlib.Algebra.Group.Basic #align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Cast of integers (additional theorems) This file proves additional properties about the *canonical* homomorphism from the integers into an additive group with a one (`Int.cast`). There is also `Data.Int.Cast.Lemmas`, which includes lemmas stated in terms of algebraic homomorphisms, and results involving the order structure of `ℤ`. By contrast, this file's only import beyond `Data.Int.Cast.Defs` is `Algebra.Group.Basic`. -/ universe u namespace Nat variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast] theorem cast_sub {m n} (h : m ≤ n) : ((n - m : ℕ) : R) = n - m := eq_sub_of_add_eq <| by rw [← cast_add, Nat.sub_add_cancel h] #align nat.cast_sub Nat.cast_subₓ -- `HasLiftT` appeared in the type signature @[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by
cases h
@[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by
Mathlib.Data.Int.Cast.Basic.38_0.3MsWc9B5PAFbTbn
@[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by cases h | n + 1, _ => by rw [cast_succ, add_sub_cancel]; rfl
Mathlib_Data_Int_Cast_Basic
R : Type u inst✝ : AddGroupWithOne R n : ℕ x✝ : 0 < n + 1 ⊢ ↑(n + 1 - 1) = ↑(n + 1) - 1
/- Copyright (c) 2017 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Gabriel Ebner -/ import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Data.Int.Cast.Defs import Mathlib.Algebra.Group.Basic #align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Cast of integers (additional theorems) This file proves additional properties about the *canonical* homomorphism from the integers into an additive group with a one (`Int.cast`). There is also `Data.Int.Cast.Lemmas`, which includes lemmas stated in terms of algebraic homomorphisms, and results involving the order structure of `ℤ`. By contrast, this file's only import beyond `Data.Int.Cast.Defs` is `Algebra.Group.Basic`. -/ universe u namespace Nat variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast] theorem cast_sub {m n} (h : m ≤ n) : ((n - m : ℕ) : R) = n - m := eq_sub_of_add_eq <| by rw [← cast_add, Nat.sub_add_cancel h] #align nat.cast_sub Nat.cast_subₓ -- `HasLiftT` appeared in the type signature @[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by cases h | n + 1, _ => by
rw [cast_succ, add_sub_cancel]
@[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by cases h | n + 1, _ => by
Mathlib.Data.Int.Cast.Basic.38_0.3MsWc9B5PAFbTbn
@[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by cases h | n + 1, _ => by rw [cast_succ, add_sub_cancel]; rfl
Mathlib_Data_Int_Cast_Basic
R : Type u inst✝ : AddGroupWithOne R n : ℕ x✝ : 0 < n + 1 ⊢ ↑(n + 1 - 1) = ↑n
/- Copyright (c) 2017 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Gabriel Ebner -/ import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Data.Int.Cast.Defs import Mathlib.Algebra.Group.Basic #align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Cast of integers (additional theorems) This file proves additional properties about the *canonical* homomorphism from the integers into an additive group with a one (`Int.cast`). There is also `Data.Int.Cast.Lemmas`, which includes lemmas stated in terms of algebraic homomorphisms, and results involving the order structure of `ℤ`. By contrast, this file's only import beyond `Data.Int.Cast.Defs` is `Algebra.Group.Basic`. -/ universe u namespace Nat variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast] theorem cast_sub {m n} (h : m ≤ n) : ((n - m : ℕ) : R) = n - m := eq_sub_of_add_eq <| by rw [← cast_add, Nat.sub_add_cancel h] #align nat.cast_sub Nat.cast_subₓ -- `HasLiftT` appeared in the type signature @[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by cases h | n + 1, _ => by rw [cast_succ, add_sub_cancel];
rfl
@[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by cases h | n + 1, _ => by rw [cast_succ, add_sub_cancel];
Mathlib.Data.Int.Cast.Basic.38_0.3MsWc9B5PAFbTbn
@[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by cases h | n + 1, _ => by rw [cast_succ, add_sub_cancel]; rfl
Mathlib_Data_Int_Cast_Basic
R : Type u inst✝¹ : AddGroupWithOne R n : ℕ inst✝ : AtLeastTwo n ⊢ ↑(OfNat.ofNat n) = OfNat.ofNat n
/- Copyright (c) 2017 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Gabriel Ebner -/ import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Data.Int.Cast.Defs import Mathlib.Algebra.Group.Basic #align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Cast of integers (additional theorems) This file proves additional properties about the *canonical* homomorphism from the integers into an additive group with a one (`Int.cast`). There is also `Data.Int.Cast.Lemmas`, which includes lemmas stated in terms of algebraic homomorphisms, and results involving the order structure of `ℤ`. By contrast, this file's only import beyond `Data.Int.Cast.Defs` is `Algebra.Group.Basic`. -/ universe u namespace Nat variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast] theorem cast_sub {m n} (h : m ≤ n) : ((n - m : ℕ) : R) = n - m := eq_sub_of_add_eq <| by rw [← cast_add, Nat.sub_add_cancel h] #align nat.cast_sub Nat.cast_subₓ -- `HasLiftT` appeared in the type signature @[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by cases h | n + 1, _ => by rw [cast_succ, add_sub_cancel]; rfl #align nat.cast_pred Nat.cast_pred end Nat open Nat namespace Int variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast squash] theorem cast_negSucc (n : ℕ) : (-[n+1] : R) = -(n + 1 : ℕ) := AddGroupWithOne.intCast_negSucc n #align int.cast_neg_succ_of_nat Int.cast_negSuccₓ -- expected `n` to be implicit, and `HasLiftT` @[simp, norm_cast] theorem cast_zero : ((0 : ℤ) : R) = 0 := (AddGroupWithOne.intCast_ofNat 0).trans Nat.cast_zero #align int.cast_zero Int.cast_zeroₓ -- type had `HasLiftT` @[simp high, nolint simpNF, norm_cast] -- this lemma competes with `Int.ofNat_eq_cast` to come later theorem cast_ofNat (n : ℕ) : ((n : ℤ) : R) = n := AddGroupWithOne.intCast_ofNat _ #align int.cast_coe_nat Int.cast_ofNatₓ -- expected `n` to be implicit, and `HasLiftT` #align int.cast_of_nat Int.cast_ofNatₓ -- See note [no_index around OfNat.ofNat] @[simp, norm_cast] theorem int_cast_ofNat (n : ℕ) [n.AtLeastTwo] : ((no_index (OfNat.ofNat n) : ℤ) : R) = OfNat.ofNat n := by
simpa only [OfNat.ofNat] using AddGroupWithOne.intCast_ofNat (R := R) n
@[simp, norm_cast] theorem int_cast_ofNat (n : ℕ) [n.AtLeastTwo] : ((no_index (OfNat.ofNat n) : ℤ) : R) = OfNat.ofNat n := by
Mathlib.Data.Int.Cast.Basic.72_0.3MsWc9B5PAFbTbn
@[simp, norm_cast] theorem int_cast_ofNat (n : ℕ) [n.AtLeastTwo] : ((no_index (OfNat.ofNat n) : ℤ) : R) = OfNat.ofNat n
Mathlib_Data_Int_Cast_Basic
R : Type u inst✝ : AddGroupWithOne R ⊢ ↑1 = 1
/- Copyright (c) 2017 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Gabriel Ebner -/ import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Data.Int.Cast.Defs import Mathlib.Algebra.Group.Basic #align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Cast of integers (additional theorems) This file proves additional properties about the *canonical* homomorphism from the integers into an additive group with a one (`Int.cast`). There is also `Data.Int.Cast.Lemmas`, which includes lemmas stated in terms of algebraic homomorphisms, and results involving the order structure of `ℤ`. By contrast, this file's only import beyond `Data.Int.Cast.Defs` is `Algebra.Group.Basic`. -/ universe u namespace Nat variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast] theorem cast_sub {m n} (h : m ≤ n) : ((n - m : ℕ) : R) = n - m := eq_sub_of_add_eq <| by rw [← cast_add, Nat.sub_add_cancel h] #align nat.cast_sub Nat.cast_subₓ -- `HasLiftT` appeared in the type signature @[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by cases h | n + 1, _ => by rw [cast_succ, add_sub_cancel]; rfl #align nat.cast_pred Nat.cast_pred end Nat open Nat namespace Int variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast squash] theorem cast_negSucc (n : ℕ) : (-[n+1] : R) = -(n + 1 : ℕ) := AddGroupWithOne.intCast_negSucc n #align int.cast_neg_succ_of_nat Int.cast_negSuccₓ -- expected `n` to be implicit, and `HasLiftT` @[simp, norm_cast] theorem cast_zero : ((0 : ℤ) : R) = 0 := (AddGroupWithOne.intCast_ofNat 0).trans Nat.cast_zero #align int.cast_zero Int.cast_zeroₓ -- type had `HasLiftT` @[simp high, nolint simpNF, norm_cast] -- this lemma competes with `Int.ofNat_eq_cast` to come later theorem cast_ofNat (n : ℕ) : ((n : ℤ) : R) = n := AddGroupWithOne.intCast_ofNat _ #align int.cast_coe_nat Int.cast_ofNatₓ -- expected `n` to be implicit, and `HasLiftT` #align int.cast_of_nat Int.cast_ofNatₓ -- See note [no_index around OfNat.ofNat] @[simp, norm_cast] theorem int_cast_ofNat (n : ℕ) [n.AtLeastTwo] : ((no_index (OfNat.ofNat n) : ℤ) : R) = OfNat.ofNat n := by simpa only [OfNat.ofNat] using AddGroupWithOne.intCast_ofNat (R := R) n @[simp, norm_cast] theorem cast_one : ((1 : ℤ) : R) = 1 := by
erw [cast_ofNat, Nat.cast_one]
@[simp, norm_cast] theorem cast_one : ((1 : ℤ) : R) = 1 := by
Mathlib.Data.Int.Cast.Basic.77_0.3MsWc9B5PAFbTbn
@[simp, norm_cast] theorem cast_one : ((1 : ℤ) : R) = 1
Mathlib_Data_Int_Cast_Basic
R : Type u inst✝ : AddGroupWithOne R ⊢ ↑(-↑0) = -↑↑0
/- Copyright (c) 2017 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Gabriel Ebner -/ import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Data.Int.Cast.Defs import Mathlib.Algebra.Group.Basic #align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Cast of integers (additional theorems) This file proves additional properties about the *canonical* homomorphism from the integers into an additive group with a one (`Int.cast`). There is also `Data.Int.Cast.Lemmas`, which includes lemmas stated in terms of algebraic homomorphisms, and results involving the order structure of `ℤ`. By contrast, this file's only import beyond `Data.Int.Cast.Defs` is `Algebra.Group.Basic`. -/ universe u namespace Nat variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast] theorem cast_sub {m n} (h : m ≤ n) : ((n - m : ℕ) : R) = n - m := eq_sub_of_add_eq <| by rw [← cast_add, Nat.sub_add_cancel h] #align nat.cast_sub Nat.cast_subₓ -- `HasLiftT` appeared in the type signature @[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by cases h | n + 1, _ => by rw [cast_succ, add_sub_cancel]; rfl #align nat.cast_pred Nat.cast_pred end Nat open Nat namespace Int variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast squash] theorem cast_negSucc (n : ℕ) : (-[n+1] : R) = -(n + 1 : ℕ) := AddGroupWithOne.intCast_negSucc n #align int.cast_neg_succ_of_nat Int.cast_negSuccₓ -- expected `n` to be implicit, and `HasLiftT` @[simp, norm_cast] theorem cast_zero : ((0 : ℤ) : R) = 0 := (AddGroupWithOne.intCast_ofNat 0).trans Nat.cast_zero #align int.cast_zero Int.cast_zeroₓ -- type had `HasLiftT` @[simp high, nolint simpNF, norm_cast] -- this lemma competes with `Int.ofNat_eq_cast` to come later theorem cast_ofNat (n : ℕ) : ((n : ℤ) : R) = n := AddGroupWithOne.intCast_ofNat _ #align int.cast_coe_nat Int.cast_ofNatₓ -- expected `n` to be implicit, and `HasLiftT` #align int.cast_of_nat Int.cast_ofNatₓ -- See note [no_index around OfNat.ofNat] @[simp, norm_cast] theorem int_cast_ofNat (n : ℕ) [n.AtLeastTwo] : ((no_index (OfNat.ofNat n) : ℤ) : R) = OfNat.ofNat n := by simpa only [OfNat.ofNat] using AddGroupWithOne.intCast_ofNat (R := R) n @[simp, norm_cast] theorem cast_one : ((1 : ℤ) : R) = 1 := by erw [cast_ofNat, Nat.cast_one] #align int.cast_one Int.cast_oneₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n | (0 : ℕ) => by
erw [cast_zero, neg_zero]
@[simp, norm_cast] theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n | (0 : ℕ) => by
Mathlib.Data.Int.Cast.Basic.83_0.3MsWc9B5PAFbTbn
@[simp, norm_cast] theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n | (0 : ℕ) => by erw [cast_zero, neg_zero] | (n + 1 : ℕ) => by erw [cast_ofNat, cast_negSucc] | -[n+1] => by erw [cast_ofNat, cast_negSucc, neg_neg]
Mathlib_Data_Int_Cast_Basic
R : Type u inst✝ : AddGroupWithOne R n : ℕ ⊢ ↑(-↑(n + 1)) = -↑↑(n + 1)
/- Copyright (c) 2017 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Gabriel Ebner -/ import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Data.Int.Cast.Defs import Mathlib.Algebra.Group.Basic #align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Cast of integers (additional theorems) This file proves additional properties about the *canonical* homomorphism from the integers into an additive group with a one (`Int.cast`). There is also `Data.Int.Cast.Lemmas`, which includes lemmas stated in terms of algebraic homomorphisms, and results involving the order structure of `ℤ`. By contrast, this file's only import beyond `Data.Int.Cast.Defs` is `Algebra.Group.Basic`. -/ universe u namespace Nat variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast] theorem cast_sub {m n} (h : m ≤ n) : ((n - m : ℕ) : R) = n - m := eq_sub_of_add_eq <| by rw [← cast_add, Nat.sub_add_cancel h] #align nat.cast_sub Nat.cast_subₓ -- `HasLiftT` appeared in the type signature @[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by cases h | n + 1, _ => by rw [cast_succ, add_sub_cancel]; rfl #align nat.cast_pred Nat.cast_pred end Nat open Nat namespace Int variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast squash] theorem cast_negSucc (n : ℕ) : (-[n+1] : R) = -(n + 1 : ℕ) := AddGroupWithOne.intCast_negSucc n #align int.cast_neg_succ_of_nat Int.cast_negSuccₓ -- expected `n` to be implicit, and `HasLiftT` @[simp, norm_cast] theorem cast_zero : ((0 : ℤ) : R) = 0 := (AddGroupWithOne.intCast_ofNat 0).trans Nat.cast_zero #align int.cast_zero Int.cast_zeroₓ -- type had `HasLiftT` @[simp high, nolint simpNF, norm_cast] -- this lemma competes with `Int.ofNat_eq_cast` to come later theorem cast_ofNat (n : ℕ) : ((n : ℤ) : R) = n := AddGroupWithOne.intCast_ofNat _ #align int.cast_coe_nat Int.cast_ofNatₓ -- expected `n` to be implicit, and `HasLiftT` #align int.cast_of_nat Int.cast_ofNatₓ -- See note [no_index around OfNat.ofNat] @[simp, norm_cast] theorem int_cast_ofNat (n : ℕ) [n.AtLeastTwo] : ((no_index (OfNat.ofNat n) : ℤ) : R) = OfNat.ofNat n := by simpa only [OfNat.ofNat] using AddGroupWithOne.intCast_ofNat (R := R) n @[simp, norm_cast] theorem cast_one : ((1 : ℤ) : R) = 1 := by erw [cast_ofNat, Nat.cast_one] #align int.cast_one Int.cast_oneₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n | (0 : ℕ) => by erw [cast_zero, neg_zero] | (n + 1 : ℕ) => by
erw [cast_ofNat, cast_negSucc]
@[simp, norm_cast] theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n | (0 : ℕ) => by erw [cast_zero, neg_zero] | (n + 1 : ℕ) => by
Mathlib.Data.Int.Cast.Basic.83_0.3MsWc9B5PAFbTbn
@[simp, norm_cast] theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n | (0 : ℕ) => by erw [cast_zero, neg_zero] | (n + 1 : ℕ) => by erw [cast_ofNat, cast_negSucc] | -[n+1] => by erw [cast_ofNat, cast_negSucc, neg_neg]
Mathlib_Data_Int_Cast_Basic
R : Type u inst✝ : AddGroupWithOne R n : ℕ ⊢ ↑(- -[n+1]) = -↑-[n+1]
/- Copyright (c) 2017 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Gabriel Ebner -/ import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Data.Int.Cast.Defs import Mathlib.Algebra.Group.Basic #align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Cast of integers (additional theorems) This file proves additional properties about the *canonical* homomorphism from the integers into an additive group with a one (`Int.cast`). There is also `Data.Int.Cast.Lemmas`, which includes lemmas stated in terms of algebraic homomorphisms, and results involving the order structure of `ℤ`. By contrast, this file's only import beyond `Data.Int.Cast.Defs` is `Algebra.Group.Basic`. -/ universe u namespace Nat variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast] theorem cast_sub {m n} (h : m ≤ n) : ((n - m : ℕ) : R) = n - m := eq_sub_of_add_eq <| by rw [← cast_add, Nat.sub_add_cancel h] #align nat.cast_sub Nat.cast_subₓ -- `HasLiftT` appeared in the type signature @[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by cases h | n + 1, _ => by rw [cast_succ, add_sub_cancel]; rfl #align nat.cast_pred Nat.cast_pred end Nat open Nat namespace Int variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast squash] theorem cast_negSucc (n : ℕ) : (-[n+1] : R) = -(n + 1 : ℕ) := AddGroupWithOne.intCast_negSucc n #align int.cast_neg_succ_of_nat Int.cast_negSuccₓ -- expected `n` to be implicit, and `HasLiftT` @[simp, norm_cast] theorem cast_zero : ((0 : ℤ) : R) = 0 := (AddGroupWithOne.intCast_ofNat 0).trans Nat.cast_zero #align int.cast_zero Int.cast_zeroₓ -- type had `HasLiftT` @[simp high, nolint simpNF, norm_cast] -- this lemma competes with `Int.ofNat_eq_cast` to come later theorem cast_ofNat (n : ℕ) : ((n : ℤ) : R) = n := AddGroupWithOne.intCast_ofNat _ #align int.cast_coe_nat Int.cast_ofNatₓ -- expected `n` to be implicit, and `HasLiftT` #align int.cast_of_nat Int.cast_ofNatₓ -- See note [no_index around OfNat.ofNat] @[simp, norm_cast] theorem int_cast_ofNat (n : ℕ) [n.AtLeastTwo] : ((no_index (OfNat.ofNat n) : ℤ) : R) = OfNat.ofNat n := by simpa only [OfNat.ofNat] using AddGroupWithOne.intCast_ofNat (R := R) n @[simp, norm_cast] theorem cast_one : ((1 : ℤ) : R) = 1 := by erw [cast_ofNat, Nat.cast_one] #align int.cast_one Int.cast_oneₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n | (0 : ℕ) => by erw [cast_zero, neg_zero] | (n + 1 : ℕ) => by erw [cast_ofNat, cast_negSucc] | -[n+1] => by
erw [cast_ofNat, cast_negSucc, neg_neg]
@[simp, norm_cast] theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n | (0 : ℕ) => by erw [cast_zero, neg_zero] | (n + 1 : ℕ) => by erw [cast_ofNat, cast_negSucc] | -[n+1] => by
Mathlib.Data.Int.Cast.Basic.83_0.3MsWc9B5PAFbTbn
@[simp, norm_cast] theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n | (0 : ℕ) => by erw [cast_zero, neg_zero] | (n + 1 : ℕ) => by erw [cast_ofNat, cast_negSucc] | -[n+1] => by erw [cast_ofNat, cast_negSucc, neg_neg]
Mathlib_Data_Int_Cast_Basic
R : Type u inst✝ : AddGroupWithOne R m n : ℕ ⊢ ↑(subNatNat m n) = ↑m - ↑n
/- Copyright (c) 2017 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Gabriel Ebner -/ import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Data.Int.Cast.Defs import Mathlib.Algebra.Group.Basic #align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Cast of integers (additional theorems) This file proves additional properties about the *canonical* homomorphism from the integers into an additive group with a one (`Int.cast`). There is also `Data.Int.Cast.Lemmas`, which includes lemmas stated in terms of algebraic homomorphisms, and results involving the order structure of `ℤ`. By contrast, this file's only import beyond `Data.Int.Cast.Defs` is `Algebra.Group.Basic`. -/ universe u namespace Nat variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast] theorem cast_sub {m n} (h : m ≤ n) : ((n - m : ℕ) : R) = n - m := eq_sub_of_add_eq <| by rw [← cast_add, Nat.sub_add_cancel h] #align nat.cast_sub Nat.cast_subₓ -- `HasLiftT` appeared in the type signature @[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by cases h | n + 1, _ => by rw [cast_succ, add_sub_cancel]; rfl #align nat.cast_pred Nat.cast_pred end Nat open Nat namespace Int variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast squash] theorem cast_negSucc (n : ℕ) : (-[n+1] : R) = -(n + 1 : ℕ) := AddGroupWithOne.intCast_negSucc n #align int.cast_neg_succ_of_nat Int.cast_negSuccₓ -- expected `n` to be implicit, and `HasLiftT` @[simp, norm_cast] theorem cast_zero : ((0 : ℤ) : R) = 0 := (AddGroupWithOne.intCast_ofNat 0).trans Nat.cast_zero #align int.cast_zero Int.cast_zeroₓ -- type had `HasLiftT` @[simp high, nolint simpNF, norm_cast] -- this lemma competes with `Int.ofNat_eq_cast` to come later theorem cast_ofNat (n : ℕ) : ((n : ℤ) : R) = n := AddGroupWithOne.intCast_ofNat _ #align int.cast_coe_nat Int.cast_ofNatₓ -- expected `n` to be implicit, and `HasLiftT` #align int.cast_of_nat Int.cast_ofNatₓ -- See note [no_index around OfNat.ofNat] @[simp, norm_cast] theorem int_cast_ofNat (n : ℕ) [n.AtLeastTwo] : ((no_index (OfNat.ofNat n) : ℤ) : R) = OfNat.ofNat n := by simpa only [OfNat.ofNat] using AddGroupWithOne.intCast_ofNat (R := R) n @[simp, norm_cast] theorem cast_one : ((1 : ℤ) : R) = 1 := by erw [cast_ofNat, Nat.cast_one] #align int.cast_one Int.cast_oneₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n | (0 : ℕ) => by erw [cast_zero, neg_zero] | (n + 1 : ℕ) => by erw [cast_ofNat, cast_negSucc] | -[n+1] => by erw [cast_ofNat, cast_negSucc, neg_neg] #align int.cast_neg Int.cast_negₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n := by
unfold subNatNat
@[simp, norm_cast] theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n := by
Mathlib.Data.Int.Cast.Basic.91_0.3MsWc9B5PAFbTbn
@[simp, norm_cast] theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n
Mathlib_Data_Int_Cast_Basic
R : Type u inst✝ : AddGroupWithOne R m n : ℕ ⊢ ↑(match n - m with | 0 => ofNat (m - n) | succ k => -[k+1]) = ↑m - ↑n
/- Copyright (c) 2017 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Gabriel Ebner -/ import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Data.Int.Cast.Defs import Mathlib.Algebra.Group.Basic #align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Cast of integers (additional theorems) This file proves additional properties about the *canonical* homomorphism from the integers into an additive group with a one (`Int.cast`). There is also `Data.Int.Cast.Lemmas`, which includes lemmas stated in terms of algebraic homomorphisms, and results involving the order structure of `ℤ`. By contrast, this file's only import beyond `Data.Int.Cast.Defs` is `Algebra.Group.Basic`. -/ universe u namespace Nat variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast] theorem cast_sub {m n} (h : m ≤ n) : ((n - m : ℕ) : R) = n - m := eq_sub_of_add_eq <| by rw [← cast_add, Nat.sub_add_cancel h] #align nat.cast_sub Nat.cast_subₓ -- `HasLiftT` appeared in the type signature @[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by cases h | n + 1, _ => by rw [cast_succ, add_sub_cancel]; rfl #align nat.cast_pred Nat.cast_pred end Nat open Nat namespace Int variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast squash] theorem cast_negSucc (n : ℕ) : (-[n+1] : R) = -(n + 1 : ℕ) := AddGroupWithOne.intCast_negSucc n #align int.cast_neg_succ_of_nat Int.cast_negSuccₓ -- expected `n` to be implicit, and `HasLiftT` @[simp, norm_cast] theorem cast_zero : ((0 : ℤ) : R) = 0 := (AddGroupWithOne.intCast_ofNat 0).trans Nat.cast_zero #align int.cast_zero Int.cast_zeroₓ -- type had `HasLiftT` @[simp high, nolint simpNF, norm_cast] -- this lemma competes with `Int.ofNat_eq_cast` to come later theorem cast_ofNat (n : ℕ) : ((n : ℤ) : R) = n := AddGroupWithOne.intCast_ofNat _ #align int.cast_coe_nat Int.cast_ofNatₓ -- expected `n` to be implicit, and `HasLiftT` #align int.cast_of_nat Int.cast_ofNatₓ -- See note [no_index around OfNat.ofNat] @[simp, norm_cast] theorem int_cast_ofNat (n : ℕ) [n.AtLeastTwo] : ((no_index (OfNat.ofNat n) : ℤ) : R) = OfNat.ofNat n := by simpa only [OfNat.ofNat] using AddGroupWithOne.intCast_ofNat (R := R) n @[simp, norm_cast] theorem cast_one : ((1 : ℤ) : R) = 1 := by erw [cast_ofNat, Nat.cast_one] #align int.cast_one Int.cast_oneₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n | (0 : ℕ) => by erw [cast_zero, neg_zero] | (n + 1 : ℕ) => by erw [cast_ofNat, cast_negSucc] | -[n+1] => by erw [cast_ofNat, cast_negSucc, neg_neg] #align int.cast_neg Int.cast_negₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n := by unfold subNatNat
cases e : n - m
@[simp, norm_cast] theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n := by unfold subNatNat
Mathlib.Data.Int.Cast.Basic.91_0.3MsWc9B5PAFbTbn
@[simp, norm_cast] theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n
Mathlib_Data_Int_Cast_Basic
case zero R : Type u inst✝ : AddGroupWithOne R m n : ℕ e : n - m = zero ⊢ ↑(match zero with | 0 => ofNat (m - n) | succ k => -[k+1]) = ↑m - ↑n
/- Copyright (c) 2017 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Gabriel Ebner -/ import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Data.Int.Cast.Defs import Mathlib.Algebra.Group.Basic #align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Cast of integers (additional theorems) This file proves additional properties about the *canonical* homomorphism from the integers into an additive group with a one (`Int.cast`). There is also `Data.Int.Cast.Lemmas`, which includes lemmas stated in terms of algebraic homomorphisms, and results involving the order structure of `ℤ`. By contrast, this file's only import beyond `Data.Int.Cast.Defs` is `Algebra.Group.Basic`. -/ universe u namespace Nat variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast] theorem cast_sub {m n} (h : m ≤ n) : ((n - m : ℕ) : R) = n - m := eq_sub_of_add_eq <| by rw [← cast_add, Nat.sub_add_cancel h] #align nat.cast_sub Nat.cast_subₓ -- `HasLiftT` appeared in the type signature @[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by cases h | n + 1, _ => by rw [cast_succ, add_sub_cancel]; rfl #align nat.cast_pred Nat.cast_pred end Nat open Nat namespace Int variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast squash] theorem cast_negSucc (n : ℕ) : (-[n+1] : R) = -(n + 1 : ℕ) := AddGroupWithOne.intCast_negSucc n #align int.cast_neg_succ_of_nat Int.cast_negSuccₓ -- expected `n` to be implicit, and `HasLiftT` @[simp, norm_cast] theorem cast_zero : ((0 : ℤ) : R) = 0 := (AddGroupWithOne.intCast_ofNat 0).trans Nat.cast_zero #align int.cast_zero Int.cast_zeroₓ -- type had `HasLiftT` @[simp high, nolint simpNF, norm_cast] -- this lemma competes with `Int.ofNat_eq_cast` to come later theorem cast_ofNat (n : ℕ) : ((n : ℤ) : R) = n := AddGroupWithOne.intCast_ofNat _ #align int.cast_coe_nat Int.cast_ofNatₓ -- expected `n` to be implicit, and `HasLiftT` #align int.cast_of_nat Int.cast_ofNatₓ -- See note [no_index around OfNat.ofNat] @[simp, norm_cast] theorem int_cast_ofNat (n : ℕ) [n.AtLeastTwo] : ((no_index (OfNat.ofNat n) : ℤ) : R) = OfNat.ofNat n := by simpa only [OfNat.ofNat] using AddGroupWithOne.intCast_ofNat (R := R) n @[simp, norm_cast] theorem cast_one : ((1 : ℤ) : R) = 1 := by erw [cast_ofNat, Nat.cast_one] #align int.cast_one Int.cast_oneₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n | (0 : ℕ) => by erw [cast_zero, neg_zero] | (n + 1 : ℕ) => by erw [cast_ofNat, cast_negSucc] | -[n+1] => by erw [cast_ofNat, cast_negSucc, neg_neg] #align int.cast_neg Int.cast_negₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n := by unfold subNatNat cases e : n - m ·
simp only [ofNat_eq_coe]
@[simp, norm_cast] theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n := by unfold subNatNat cases e : n - m ·
Mathlib.Data.Int.Cast.Basic.91_0.3MsWc9B5PAFbTbn
@[simp, norm_cast] theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n
Mathlib_Data_Int_Cast_Basic
case zero R : Type u inst✝ : AddGroupWithOne R m n : ℕ e : n - m = zero ⊢ ↑↑(m - n) = ↑m - ↑n
/- Copyright (c) 2017 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Gabriel Ebner -/ import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Data.Int.Cast.Defs import Mathlib.Algebra.Group.Basic #align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Cast of integers (additional theorems) This file proves additional properties about the *canonical* homomorphism from the integers into an additive group with a one (`Int.cast`). There is also `Data.Int.Cast.Lemmas`, which includes lemmas stated in terms of algebraic homomorphisms, and results involving the order structure of `ℤ`. By contrast, this file's only import beyond `Data.Int.Cast.Defs` is `Algebra.Group.Basic`. -/ universe u namespace Nat variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast] theorem cast_sub {m n} (h : m ≤ n) : ((n - m : ℕ) : R) = n - m := eq_sub_of_add_eq <| by rw [← cast_add, Nat.sub_add_cancel h] #align nat.cast_sub Nat.cast_subₓ -- `HasLiftT` appeared in the type signature @[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by cases h | n + 1, _ => by rw [cast_succ, add_sub_cancel]; rfl #align nat.cast_pred Nat.cast_pred end Nat open Nat namespace Int variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast squash] theorem cast_negSucc (n : ℕ) : (-[n+1] : R) = -(n + 1 : ℕ) := AddGroupWithOne.intCast_negSucc n #align int.cast_neg_succ_of_nat Int.cast_negSuccₓ -- expected `n` to be implicit, and `HasLiftT` @[simp, norm_cast] theorem cast_zero : ((0 : ℤ) : R) = 0 := (AddGroupWithOne.intCast_ofNat 0).trans Nat.cast_zero #align int.cast_zero Int.cast_zeroₓ -- type had `HasLiftT` @[simp high, nolint simpNF, norm_cast] -- this lemma competes with `Int.ofNat_eq_cast` to come later theorem cast_ofNat (n : ℕ) : ((n : ℤ) : R) = n := AddGroupWithOne.intCast_ofNat _ #align int.cast_coe_nat Int.cast_ofNatₓ -- expected `n` to be implicit, and `HasLiftT` #align int.cast_of_nat Int.cast_ofNatₓ -- See note [no_index around OfNat.ofNat] @[simp, norm_cast] theorem int_cast_ofNat (n : ℕ) [n.AtLeastTwo] : ((no_index (OfNat.ofNat n) : ℤ) : R) = OfNat.ofNat n := by simpa only [OfNat.ofNat] using AddGroupWithOne.intCast_ofNat (R := R) n @[simp, norm_cast] theorem cast_one : ((1 : ℤ) : R) = 1 := by erw [cast_ofNat, Nat.cast_one] #align int.cast_one Int.cast_oneₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n | (0 : ℕ) => by erw [cast_zero, neg_zero] | (n + 1 : ℕ) => by erw [cast_ofNat, cast_negSucc] | -[n+1] => by erw [cast_ofNat, cast_negSucc, neg_neg] #align int.cast_neg Int.cast_negₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n := by unfold subNatNat cases e : n - m · simp only [ofNat_eq_coe]
simp [e, Nat.le_of_sub_eq_zero e]
@[simp, norm_cast] theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n := by unfold subNatNat cases e : n - m · simp only [ofNat_eq_coe]
Mathlib.Data.Int.Cast.Basic.91_0.3MsWc9B5PAFbTbn
@[simp, norm_cast] theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n
Mathlib_Data_Int_Cast_Basic
case succ R : Type u inst✝ : AddGroupWithOne R m n n✝ : ℕ e : n - m = succ n✝ ⊢ ↑(match succ n✝ with | 0 => ofNat (m - n) | succ k => -[k+1]) = ↑m - ↑n
/- Copyright (c) 2017 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Gabriel Ebner -/ import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Data.Int.Cast.Defs import Mathlib.Algebra.Group.Basic #align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Cast of integers (additional theorems) This file proves additional properties about the *canonical* homomorphism from the integers into an additive group with a one (`Int.cast`). There is also `Data.Int.Cast.Lemmas`, which includes lemmas stated in terms of algebraic homomorphisms, and results involving the order structure of `ℤ`. By contrast, this file's only import beyond `Data.Int.Cast.Defs` is `Algebra.Group.Basic`. -/ universe u namespace Nat variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast] theorem cast_sub {m n} (h : m ≤ n) : ((n - m : ℕ) : R) = n - m := eq_sub_of_add_eq <| by rw [← cast_add, Nat.sub_add_cancel h] #align nat.cast_sub Nat.cast_subₓ -- `HasLiftT` appeared in the type signature @[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by cases h | n + 1, _ => by rw [cast_succ, add_sub_cancel]; rfl #align nat.cast_pred Nat.cast_pred end Nat open Nat namespace Int variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast squash] theorem cast_negSucc (n : ℕ) : (-[n+1] : R) = -(n + 1 : ℕ) := AddGroupWithOne.intCast_negSucc n #align int.cast_neg_succ_of_nat Int.cast_negSuccₓ -- expected `n` to be implicit, and `HasLiftT` @[simp, norm_cast] theorem cast_zero : ((0 : ℤ) : R) = 0 := (AddGroupWithOne.intCast_ofNat 0).trans Nat.cast_zero #align int.cast_zero Int.cast_zeroₓ -- type had `HasLiftT` @[simp high, nolint simpNF, norm_cast] -- this lemma competes with `Int.ofNat_eq_cast` to come later theorem cast_ofNat (n : ℕ) : ((n : ℤ) : R) = n := AddGroupWithOne.intCast_ofNat _ #align int.cast_coe_nat Int.cast_ofNatₓ -- expected `n` to be implicit, and `HasLiftT` #align int.cast_of_nat Int.cast_ofNatₓ -- See note [no_index around OfNat.ofNat] @[simp, norm_cast] theorem int_cast_ofNat (n : ℕ) [n.AtLeastTwo] : ((no_index (OfNat.ofNat n) : ℤ) : R) = OfNat.ofNat n := by simpa only [OfNat.ofNat] using AddGroupWithOne.intCast_ofNat (R := R) n @[simp, norm_cast] theorem cast_one : ((1 : ℤ) : R) = 1 := by erw [cast_ofNat, Nat.cast_one] #align int.cast_one Int.cast_oneₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n | (0 : ℕ) => by erw [cast_zero, neg_zero] | (n + 1 : ℕ) => by erw [cast_ofNat, cast_negSucc] | -[n+1] => by erw [cast_ofNat, cast_negSucc, neg_neg] #align int.cast_neg Int.cast_negₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n := by unfold subNatNat cases e : n - m · simp only [ofNat_eq_coe] simp [e, Nat.le_of_sub_eq_zero e] ·
rw [cast_negSucc, Nat.add_one, ← e, Nat.cast_sub <| _root_.le_of_lt <| Nat.lt_of_sub_eq_succ e, neg_sub]
@[simp, norm_cast] theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n := by unfold subNatNat cases e : n - m · simp only [ofNat_eq_coe] simp [e, Nat.le_of_sub_eq_zero e] ·
Mathlib.Data.Int.Cast.Basic.91_0.3MsWc9B5PAFbTbn
@[simp, norm_cast] theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n
Mathlib_Data_Int_Cast_Basic
R : Type u inst✝ : AddGroupWithOne R n : ℕ ⊢ ↑(negOfNat n) = -↑n
/- Copyright (c) 2017 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Gabriel Ebner -/ import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Data.Int.Cast.Defs import Mathlib.Algebra.Group.Basic #align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Cast of integers (additional theorems) This file proves additional properties about the *canonical* homomorphism from the integers into an additive group with a one (`Int.cast`). There is also `Data.Int.Cast.Lemmas`, which includes lemmas stated in terms of algebraic homomorphisms, and results involving the order structure of `ℤ`. By contrast, this file's only import beyond `Data.Int.Cast.Defs` is `Algebra.Group.Basic`. -/ universe u namespace Nat variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast] theorem cast_sub {m n} (h : m ≤ n) : ((n - m : ℕ) : R) = n - m := eq_sub_of_add_eq <| by rw [← cast_add, Nat.sub_add_cancel h] #align nat.cast_sub Nat.cast_subₓ -- `HasLiftT` appeared in the type signature @[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by cases h | n + 1, _ => by rw [cast_succ, add_sub_cancel]; rfl #align nat.cast_pred Nat.cast_pred end Nat open Nat namespace Int variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast squash] theorem cast_negSucc (n : ℕ) : (-[n+1] : R) = -(n + 1 : ℕ) := AddGroupWithOne.intCast_negSucc n #align int.cast_neg_succ_of_nat Int.cast_negSuccₓ -- expected `n` to be implicit, and `HasLiftT` @[simp, norm_cast] theorem cast_zero : ((0 : ℤ) : R) = 0 := (AddGroupWithOne.intCast_ofNat 0).trans Nat.cast_zero #align int.cast_zero Int.cast_zeroₓ -- type had `HasLiftT` @[simp high, nolint simpNF, norm_cast] -- this lemma competes with `Int.ofNat_eq_cast` to come later theorem cast_ofNat (n : ℕ) : ((n : ℤ) : R) = n := AddGroupWithOne.intCast_ofNat _ #align int.cast_coe_nat Int.cast_ofNatₓ -- expected `n` to be implicit, and `HasLiftT` #align int.cast_of_nat Int.cast_ofNatₓ -- See note [no_index around OfNat.ofNat] @[simp, norm_cast] theorem int_cast_ofNat (n : ℕ) [n.AtLeastTwo] : ((no_index (OfNat.ofNat n) : ℤ) : R) = OfNat.ofNat n := by simpa only [OfNat.ofNat] using AddGroupWithOne.intCast_ofNat (R := R) n @[simp, norm_cast] theorem cast_one : ((1 : ℤ) : R) = 1 := by erw [cast_ofNat, Nat.cast_one] #align int.cast_one Int.cast_oneₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n | (0 : ℕ) => by erw [cast_zero, neg_zero] | (n + 1 : ℕ) => by erw [cast_ofNat, cast_negSucc] | -[n+1] => by erw [cast_ofNat, cast_negSucc, neg_neg] #align int.cast_neg Int.cast_negₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n := by unfold subNatNat cases e : n - m · simp only [ofNat_eq_coe] simp [e, Nat.le_of_sub_eq_zero e] · rw [cast_negSucc, Nat.add_one, ← e, Nat.cast_sub <| _root_.le_of_lt <| Nat.lt_of_sub_eq_succ e, neg_sub] #align int.cast_sub_nat_nat Int.cast_subNatNatₓ -- type had `HasLiftT` #align int.neg_of_nat_eq Int.negOfNat_eq @[simp] theorem cast_negOfNat (n : ℕ) : ((negOfNat n : ℤ) : R) = -n := by
simp [Int.cast_neg, negOfNat_eq]
@[simp] theorem cast_negOfNat (n : ℕ) : ((negOfNat n : ℤ) : R) = -n := by
Mathlib.Data.Int.Cast.Basic.104_0.3MsWc9B5PAFbTbn
@[simp] theorem cast_negOfNat (n : ℕ) : ((negOfNat n : ℤ) : R) = -n
Mathlib_Data_Int_Cast_Basic
R : Type u inst✝ : AddGroupWithOne R m n : ℕ ⊢ ↑(↑m + ↑n) = ↑↑m + ↑↑n
/- Copyright (c) 2017 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Gabriel Ebner -/ import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Data.Int.Cast.Defs import Mathlib.Algebra.Group.Basic #align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Cast of integers (additional theorems) This file proves additional properties about the *canonical* homomorphism from the integers into an additive group with a one (`Int.cast`). There is also `Data.Int.Cast.Lemmas`, which includes lemmas stated in terms of algebraic homomorphisms, and results involving the order structure of `ℤ`. By contrast, this file's only import beyond `Data.Int.Cast.Defs` is `Algebra.Group.Basic`. -/ universe u namespace Nat variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast] theorem cast_sub {m n} (h : m ≤ n) : ((n - m : ℕ) : R) = n - m := eq_sub_of_add_eq <| by rw [← cast_add, Nat.sub_add_cancel h] #align nat.cast_sub Nat.cast_subₓ -- `HasLiftT` appeared in the type signature @[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by cases h | n + 1, _ => by rw [cast_succ, add_sub_cancel]; rfl #align nat.cast_pred Nat.cast_pred end Nat open Nat namespace Int variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast squash] theorem cast_negSucc (n : ℕ) : (-[n+1] : R) = -(n + 1 : ℕ) := AddGroupWithOne.intCast_negSucc n #align int.cast_neg_succ_of_nat Int.cast_negSuccₓ -- expected `n` to be implicit, and `HasLiftT` @[simp, norm_cast] theorem cast_zero : ((0 : ℤ) : R) = 0 := (AddGroupWithOne.intCast_ofNat 0).trans Nat.cast_zero #align int.cast_zero Int.cast_zeroₓ -- type had `HasLiftT` @[simp high, nolint simpNF, norm_cast] -- this lemma competes with `Int.ofNat_eq_cast` to come later theorem cast_ofNat (n : ℕ) : ((n : ℤ) : R) = n := AddGroupWithOne.intCast_ofNat _ #align int.cast_coe_nat Int.cast_ofNatₓ -- expected `n` to be implicit, and `HasLiftT` #align int.cast_of_nat Int.cast_ofNatₓ -- See note [no_index around OfNat.ofNat] @[simp, norm_cast] theorem int_cast_ofNat (n : ℕ) [n.AtLeastTwo] : ((no_index (OfNat.ofNat n) : ℤ) : R) = OfNat.ofNat n := by simpa only [OfNat.ofNat] using AddGroupWithOne.intCast_ofNat (R := R) n @[simp, norm_cast] theorem cast_one : ((1 : ℤ) : R) = 1 := by erw [cast_ofNat, Nat.cast_one] #align int.cast_one Int.cast_oneₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n | (0 : ℕ) => by erw [cast_zero, neg_zero] | (n + 1 : ℕ) => by erw [cast_ofNat, cast_negSucc] | -[n+1] => by erw [cast_ofNat, cast_negSucc, neg_neg] #align int.cast_neg Int.cast_negₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n := by unfold subNatNat cases e : n - m · simp only [ofNat_eq_coe] simp [e, Nat.le_of_sub_eq_zero e] · rw [cast_negSucc, Nat.add_one, ← e, Nat.cast_sub <| _root_.le_of_lt <| Nat.lt_of_sub_eq_succ e, neg_sub] #align int.cast_sub_nat_nat Int.cast_subNatNatₓ -- type had `HasLiftT` #align int.neg_of_nat_eq Int.negOfNat_eq @[simp] theorem cast_negOfNat (n : ℕ) : ((negOfNat n : ℤ) : R) = -n := by simp [Int.cast_neg, negOfNat_eq] #align int.cast_neg_of_nat Int.cast_negOfNat @[simp, norm_cast] theorem cast_add : ∀ m n, ((m + n : ℤ) : R) = m + n | (m : ℕ), (n : ℕ) => by
simp [-Int.natCast_add, ← Int.ofNat_add]
@[simp, norm_cast] theorem cast_add : ∀ m n, ((m + n : ℤ) : R) = m + n | (m : ℕ), (n : ℕ) => by
Mathlib.Data.Int.Cast.Basic.108_0.3MsWc9B5PAFbTbn
@[simp, norm_cast] theorem cast_add : ∀ m n, ((m + n : ℤ) : R) = m + n | (m : ℕ), (n : ℕ) => by simp [-Int.natCast_add, ← Int.ofNat_add] | (m : ℕ), -[n+1] => by erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_add_neg] | -[m+1], (n : ℕ) => by erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_iff_eq_add, add_assoc, eq_neg_add_iff_add_eq, ← Nat.cast_add, ← Nat.cast_add, Nat.add_comm] | -[m+1], -[n+1] => show (-[m + n + 1+1] : R) = _ by rw [cast_negSucc, cast_negSucc, cast_negSucc, ← neg_add_rev, ← Nat.cast_add, Nat.add_right_comm m n 1, Nat.add_assoc, Nat.add_comm]
Mathlib_Data_Int_Cast_Basic
R : Type u inst✝ : AddGroupWithOne R m n : ℕ ⊢ ↑(↑m + -[n+1]) = ↑↑m + ↑-[n+1]
/- Copyright (c) 2017 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Gabriel Ebner -/ import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Data.Int.Cast.Defs import Mathlib.Algebra.Group.Basic #align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Cast of integers (additional theorems) This file proves additional properties about the *canonical* homomorphism from the integers into an additive group with a one (`Int.cast`). There is also `Data.Int.Cast.Lemmas`, which includes lemmas stated in terms of algebraic homomorphisms, and results involving the order structure of `ℤ`. By contrast, this file's only import beyond `Data.Int.Cast.Defs` is `Algebra.Group.Basic`. -/ universe u namespace Nat variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast] theorem cast_sub {m n} (h : m ≤ n) : ((n - m : ℕ) : R) = n - m := eq_sub_of_add_eq <| by rw [← cast_add, Nat.sub_add_cancel h] #align nat.cast_sub Nat.cast_subₓ -- `HasLiftT` appeared in the type signature @[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by cases h | n + 1, _ => by rw [cast_succ, add_sub_cancel]; rfl #align nat.cast_pred Nat.cast_pred end Nat open Nat namespace Int variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast squash] theorem cast_negSucc (n : ℕ) : (-[n+1] : R) = -(n + 1 : ℕ) := AddGroupWithOne.intCast_negSucc n #align int.cast_neg_succ_of_nat Int.cast_negSuccₓ -- expected `n` to be implicit, and `HasLiftT` @[simp, norm_cast] theorem cast_zero : ((0 : ℤ) : R) = 0 := (AddGroupWithOne.intCast_ofNat 0).trans Nat.cast_zero #align int.cast_zero Int.cast_zeroₓ -- type had `HasLiftT` @[simp high, nolint simpNF, norm_cast] -- this lemma competes with `Int.ofNat_eq_cast` to come later theorem cast_ofNat (n : ℕ) : ((n : ℤ) : R) = n := AddGroupWithOne.intCast_ofNat _ #align int.cast_coe_nat Int.cast_ofNatₓ -- expected `n` to be implicit, and `HasLiftT` #align int.cast_of_nat Int.cast_ofNatₓ -- See note [no_index around OfNat.ofNat] @[simp, norm_cast] theorem int_cast_ofNat (n : ℕ) [n.AtLeastTwo] : ((no_index (OfNat.ofNat n) : ℤ) : R) = OfNat.ofNat n := by simpa only [OfNat.ofNat] using AddGroupWithOne.intCast_ofNat (R := R) n @[simp, norm_cast] theorem cast_one : ((1 : ℤ) : R) = 1 := by erw [cast_ofNat, Nat.cast_one] #align int.cast_one Int.cast_oneₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n | (0 : ℕ) => by erw [cast_zero, neg_zero] | (n + 1 : ℕ) => by erw [cast_ofNat, cast_negSucc] | -[n+1] => by erw [cast_ofNat, cast_negSucc, neg_neg] #align int.cast_neg Int.cast_negₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n := by unfold subNatNat cases e : n - m · simp only [ofNat_eq_coe] simp [e, Nat.le_of_sub_eq_zero e] · rw [cast_negSucc, Nat.add_one, ← e, Nat.cast_sub <| _root_.le_of_lt <| Nat.lt_of_sub_eq_succ e, neg_sub] #align int.cast_sub_nat_nat Int.cast_subNatNatₓ -- type had `HasLiftT` #align int.neg_of_nat_eq Int.negOfNat_eq @[simp] theorem cast_negOfNat (n : ℕ) : ((negOfNat n : ℤ) : R) = -n := by simp [Int.cast_neg, negOfNat_eq] #align int.cast_neg_of_nat Int.cast_negOfNat @[simp, norm_cast] theorem cast_add : ∀ m n, ((m + n : ℤ) : R) = m + n | (m : ℕ), (n : ℕ) => by simp [-Int.natCast_add, ← Int.ofNat_add] | (m : ℕ), -[n+1] => by
erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_add_neg]
@[simp, norm_cast] theorem cast_add : ∀ m n, ((m + n : ℤ) : R) = m + n | (m : ℕ), (n : ℕ) => by simp [-Int.natCast_add, ← Int.ofNat_add] | (m : ℕ), -[n+1] => by
Mathlib.Data.Int.Cast.Basic.108_0.3MsWc9B5PAFbTbn
@[simp, norm_cast] theorem cast_add : ∀ m n, ((m + n : ℤ) : R) = m + n | (m : ℕ), (n : ℕ) => by simp [-Int.natCast_add, ← Int.ofNat_add] | (m : ℕ), -[n+1] => by erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_add_neg] | -[m+1], (n : ℕ) => by erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_iff_eq_add, add_assoc, eq_neg_add_iff_add_eq, ← Nat.cast_add, ← Nat.cast_add, Nat.add_comm] | -[m+1], -[n+1] => show (-[m + n + 1+1] : R) = _ by rw [cast_negSucc, cast_negSucc, cast_negSucc, ← neg_add_rev, ← Nat.cast_add, Nat.add_right_comm m n 1, Nat.add_assoc, Nat.add_comm]
Mathlib_Data_Int_Cast_Basic
R : Type u inst✝ : AddGroupWithOne R m n : ℕ ⊢ ↑(-[m+1] + ↑n) = ↑-[m+1] + ↑↑n
/- Copyright (c) 2017 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Gabriel Ebner -/ import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Data.Int.Cast.Defs import Mathlib.Algebra.Group.Basic #align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Cast of integers (additional theorems) This file proves additional properties about the *canonical* homomorphism from the integers into an additive group with a one (`Int.cast`). There is also `Data.Int.Cast.Lemmas`, which includes lemmas stated in terms of algebraic homomorphisms, and results involving the order structure of `ℤ`. By contrast, this file's only import beyond `Data.Int.Cast.Defs` is `Algebra.Group.Basic`. -/ universe u namespace Nat variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast] theorem cast_sub {m n} (h : m ≤ n) : ((n - m : ℕ) : R) = n - m := eq_sub_of_add_eq <| by rw [← cast_add, Nat.sub_add_cancel h] #align nat.cast_sub Nat.cast_subₓ -- `HasLiftT` appeared in the type signature @[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by cases h | n + 1, _ => by rw [cast_succ, add_sub_cancel]; rfl #align nat.cast_pred Nat.cast_pred end Nat open Nat namespace Int variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast squash] theorem cast_negSucc (n : ℕ) : (-[n+1] : R) = -(n + 1 : ℕ) := AddGroupWithOne.intCast_negSucc n #align int.cast_neg_succ_of_nat Int.cast_negSuccₓ -- expected `n` to be implicit, and `HasLiftT` @[simp, norm_cast] theorem cast_zero : ((0 : ℤ) : R) = 0 := (AddGroupWithOne.intCast_ofNat 0).trans Nat.cast_zero #align int.cast_zero Int.cast_zeroₓ -- type had `HasLiftT` @[simp high, nolint simpNF, norm_cast] -- this lemma competes with `Int.ofNat_eq_cast` to come later theorem cast_ofNat (n : ℕ) : ((n : ℤ) : R) = n := AddGroupWithOne.intCast_ofNat _ #align int.cast_coe_nat Int.cast_ofNatₓ -- expected `n` to be implicit, and `HasLiftT` #align int.cast_of_nat Int.cast_ofNatₓ -- See note [no_index around OfNat.ofNat] @[simp, norm_cast] theorem int_cast_ofNat (n : ℕ) [n.AtLeastTwo] : ((no_index (OfNat.ofNat n) : ℤ) : R) = OfNat.ofNat n := by simpa only [OfNat.ofNat] using AddGroupWithOne.intCast_ofNat (R := R) n @[simp, norm_cast] theorem cast_one : ((1 : ℤ) : R) = 1 := by erw [cast_ofNat, Nat.cast_one] #align int.cast_one Int.cast_oneₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n | (0 : ℕ) => by erw [cast_zero, neg_zero] | (n + 1 : ℕ) => by erw [cast_ofNat, cast_negSucc] | -[n+1] => by erw [cast_ofNat, cast_negSucc, neg_neg] #align int.cast_neg Int.cast_negₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n := by unfold subNatNat cases e : n - m · simp only [ofNat_eq_coe] simp [e, Nat.le_of_sub_eq_zero e] · rw [cast_negSucc, Nat.add_one, ← e, Nat.cast_sub <| _root_.le_of_lt <| Nat.lt_of_sub_eq_succ e, neg_sub] #align int.cast_sub_nat_nat Int.cast_subNatNatₓ -- type had `HasLiftT` #align int.neg_of_nat_eq Int.negOfNat_eq @[simp] theorem cast_negOfNat (n : ℕ) : ((negOfNat n : ℤ) : R) = -n := by simp [Int.cast_neg, negOfNat_eq] #align int.cast_neg_of_nat Int.cast_negOfNat @[simp, norm_cast] theorem cast_add : ∀ m n, ((m + n : ℤ) : R) = m + n | (m : ℕ), (n : ℕ) => by simp [-Int.natCast_add, ← Int.ofNat_add] | (m : ℕ), -[n+1] => by erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_add_neg] | -[m+1], (n : ℕ) => by
erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_iff_eq_add, add_assoc, eq_neg_add_iff_add_eq, ← Nat.cast_add, ← Nat.cast_add, Nat.add_comm]
@[simp, norm_cast] theorem cast_add : ∀ m n, ((m + n : ℤ) : R) = m + n | (m : ℕ), (n : ℕ) => by simp [-Int.natCast_add, ← Int.ofNat_add] | (m : ℕ), -[n+1] => by erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_add_neg] | -[m+1], (n : ℕ) => by
Mathlib.Data.Int.Cast.Basic.108_0.3MsWc9B5PAFbTbn
@[simp, norm_cast] theorem cast_add : ∀ m n, ((m + n : ℤ) : R) = m + n | (m : ℕ), (n : ℕ) => by simp [-Int.natCast_add, ← Int.ofNat_add] | (m : ℕ), -[n+1] => by erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_add_neg] | -[m+1], (n : ℕ) => by erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_iff_eq_add, add_assoc, eq_neg_add_iff_add_eq, ← Nat.cast_add, ← Nat.cast_add, Nat.add_comm] | -[m+1], -[n+1] => show (-[m + n + 1+1] : R) = _ by rw [cast_negSucc, cast_negSucc, cast_negSucc, ← neg_add_rev, ← Nat.cast_add, Nat.add_right_comm m n 1, Nat.add_assoc, Nat.add_comm]
Mathlib_Data_Int_Cast_Basic
R : Type u inst✝ : AddGroupWithOne R m n : ℕ ⊢ ↑-[m + n + 1+1] = ↑-[m+1] + ↑-[n+1]
/- Copyright (c) 2017 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Gabriel Ebner -/ import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Data.Int.Cast.Defs import Mathlib.Algebra.Group.Basic #align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Cast of integers (additional theorems) This file proves additional properties about the *canonical* homomorphism from the integers into an additive group with a one (`Int.cast`). There is also `Data.Int.Cast.Lemmas`, which includes lemmas stated in terms of algebraic homomorphisms, and results involving the order structure of `ℤ`. By contrast, this file's only import beyond `Data.Int.Cast.Defs` is `Algebra.Group.Basic`. -/ universe u namespace Nat variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast] theorem cast_sub {m n} (h : m ≤ n) : ((n - m : ℕ) : R) = n - m := eq_sub_of_add_eq <| by rw [← cast_add, Nat.sub_add_cancel h] #align nat.cast_sub Nat.cast_subₓ -- `HasLiftT` appeared in the type signature @[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by cases h | n + 1, _ => by rw [cast_succ, add_sub_cancel]; rfl #align nat.cast_pred Nat.cast_pred end Nat open Nat namespace Int variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast squash] theorem cast_negSucc (n : ℕ) : (-[n+1] : R) = -(n + 1 : ℕ) := AddGroupWithOne.intCast_negSucc n #align int.cast_neg_succ_of_nat Int.cast_negSuccₓ -- expected `n` to be implicit, and `HasLiftT` @[simp, norm_cast] theorem cast_zero : ((0 : ℤ) : R) = 0 := (AddGroupWithOne.intCast_ofNat 0).trans Nat.cast_zero #align int.cast_zero Int.cast_zeroₓ -- type had `HasLiftT` @[simp high, nolint simpNF, norm_cast] -- this lemma competes with `Int.ofNat_eq_cast` to come later theorem cast_ofNat (n : ℕ) : ((n : ℤ) : R) = n := AddGroupWithOne.intCast_ofNat _ #align int.cast_coe_nat Int.cast_ofNatₓ -- expected `n` to be implicit, and `HasLiftT` #align int.cast_of_nat Int.cast_ofNatₓ -- See note [no_index around OfNat.ofNat] @[simp, norm_cast] theorem int_cast_ofNat (n : ℕ) [n.AtLeastTwo] : ((no_index (OfNat.ofNat n) : ℤ) : R) = OfNat.ofNat n := by simpa only [OfNat.ofNat] using AddGroupWithOne.intCast_ofNat (R := R) n @[simp, norm_cast] theorem cast_one : ((1 : ℤ) : R) = 1 := by erw [cast_ofNat, Nat.cast_one] #align int.cast_one Int.cast_oneₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n | (0 : ℕ) => by erw [cast_zero, neg_zero] | (n + 1 : ℕ) => by erw [cast_ofNat, cast_negSucc] | -[n+1] => by erw [cast_ofNat, cast_negSucc, neg_neg] #align int.cast_neg Int.cast_negₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n := by unfold subNatNat cases e : n - m · simp only [ofNat_eq_coe] simp [e, Nat.le_of_sub_eq_zero e] · rw [cast_negSucc, Nat.add_one, ← e, Nat.cast_sub <| _root_.le_of_lt <| Nat.lt_of_sub_eq_succ e, neg_sub] #align int.cast_sub_nat_nat Int.cast_subNatNatₓ -- type had `HasLiftT` #align int.neg_of_nat_eq Int.negOfNat_eq @[simp] theorem cast_negOfNat (n : ℕ) : ((negOfNat n : ℤ) : R) = -n := by simp [Int.cast_neg, negOfNat_eq] #align int.cast_neg_of_nat Int.cast_negOfNat @[simp, norm_cast] theorem cast_add : ∀ m n, ((m + n : ℤ) : R) = m + n | (m : ℕ), (n : ℕ) => by simp [-Int.natCast_add, ← Int.ofNat_add] | (m : ℕ), -[n+1] => by erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_add_neg] | -[m+1], (n : ℕ) => by erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_iff_eq_add, add_assoc, eq_neg_add_iff_add_eq, ← Nat.cast_add, ← Nat.cast_add, Nat.add_comm] | -[m+1], -[n+1] => show (-[m + n + 1+1] : R) = _ by
rw [cast_negSucc, cast_negSucc, cast_negSucc, ← neg_add_rev, ← Nat.cast_add, Nat.add_right_comm m n 1, Nat.add_assoc, Nat.add_comm]
@[simp, norm_cast] theorem cast_add : ∀ m n, ((m + n : ℤ) : R) = m + n | (m : ℕ), (n : ℕ) => by simp [-Int.natCast_add, ← Int.ofNat_add] | (m : ℕ), -[n+1] => by erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_add_neg] | -[m+1], (n : ℕ) => by erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_iff_eq_add, add_assoc, eq_neg_add_iff_add_eq, ← Nat.cast_add, ← Nat.cast_add, Nat.add_comm] | -[m+1], -[n+1] => show (-[m + n + 1+1] : R) = _ by
Mathlib.Data.Int.Cast.Basic.108_0.3MsWc9B5PAFbTbn
@[simp, norm_cast] theorem cast_add : ∀ m n, ((m + n : ℤ) : R) = m + n | (m : ℕ), (n : ℕ) => by simp [-Int.natCast_add, ← Int.ofNat_add] | (m : ℕ), -[n+1] => by erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_add_neg] | -[m+1], (n : ℕ) => by erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_iff_eq_add, add_assoc, eq_neg_add_iff_add_eq, ← Nat.cast_add, ← Nat.cast_add, Nat.add_comm] | -[m+1], -[n+1] => show (-[m + n + 1+1] : R) = _ by rw [cast_negSucc, cast_negSucc, cast_negSucc, ← neg_add_rev, ← Nat.cast_add, Nat.add_right_comm m n 1, Nat.add_assoc, Nat.add_comm]
Mathlib_Data_Int_Cast_Basic
R : Type u inst✝ : AddGroupWithOne R m n : ℤ ⊢ ↑(m - n) = ↑m - ↑n
/- Copyright (c) 2017 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Gabriel Ebner -/ import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Data.Int.Cast.Defs import Mathlib.Algebra.Group.Basic #align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Cast of integers (additional theorems) This file proves additional properties about the *canonical* homomorphism from the integers into an additive group with a one (`Int.cast`). There is also `Data.Int.Cast.Lemmas`, which includes lemmas stated in terms of algebraic homomorphisms, and results involving the order structure of `ℤ`. By contrast, this file's only import beyond `Data.Int.Cast.Defs` is `Algebra.Group.Basic`. -/ universe u namespace Nat variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast] theorem cast_sub {m n} (h : m ≤ n) : ((n - m : ℕ) : R) = n - m := eq_sub_of_add_eq <| by rw [← cast_add, Nat.sub_add_cancel h] #align nat.cast_sub Nat.cast_subₓ -- `HasLiftT` appeared in the type signature @[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by cases h | n + 1, _ => by rw [cast_succ, add_sub_cancel]; rfl #align nat.cast_pred Nat.cast_pred end Nat open Nat namespace Int variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast squash] theorem cast_negSucc (n : ℕ) : (-[n+1] : R) = -(n + 1 : ℕ) := AddGroupWithOne.intCast_negSucc n #align int.cast_neg_succ_of_nat Int.cast_negSuccₓ -- expected `n` to be implicit, and `HasLiftT` @[simp, norm_cast] theorem cast_zero : ((0 : ℤ) : R) = 0 := (AddGroupWithOne.intCast_ofNat 0).trans Nat.cast_zero #align int.cast_zero Int.cast_zeroₓ -- type had `HasLiftT` @[simp high, nolint simpNF, norm_cast] -- this lemma competes with `Int.ofNat_eq_cast` to come later theorem cast_ofNat (n : ℕ) : ((n : ℤ) : R) = n := AddGroupWithOne.intCast_ofNat _ #align int.cast_coe_nat Int.cast_ofNatₓ -- expected `n` to be implicit, and `HasLiftT` #align int.cast_of_nat Int.cast_ofNatₓ -- See note [no_index around OfNat.ofNat] @[simp, norm_cast] theorem int_cast_ofNat (n : ℕ) [n.AtLeastTwo] : ((no_index (OfNat.ofNat n) : ℤ) : R) = OfNat.ofNat n := by simpa only [OfNat.ofNat] using AddGroupWithOne.intCast_ofNat (R := R) n @[simp, norm_cast] theorem cast_one : ((1 : ℤ) : R) = 1 := by erw [cast_ofNat, Nat.cast_one] #align int.cast_one Int.cast_oneₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n | (0 : ℕ) => by erw [cast_zero, neg_zero] | (n + 1 : ℕ) => by erw [cast_ofNat, cast_negSucc] | -[n+1] => by erw [cast_ofNat, cast_negSucc, neg_neg] #align int.cast_neg Int.cast_negₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n := by unfold subNatNat cases e : n - m · simp only [ofNat_eq_coe] simp [e, Nat.le_of_sub_eq_zero e] · rw [cast_negSucc, Nat.add_one, ← e, Nat.cast_sub <| _root_.le_of_lt <| Nat.lt_of_sub_eq_succ e, neg_sub] #align int.cast_sub_nat_nat Int.cast_subNatNatₓ -- type had `HasLiftT` #align int.neg_of_nat_eq Int.negOfNat_eq @[simp] theorem cast_negOfNat (n : ℕ) : ((negOfNat n : ℤ) : R) = -n := by simp [Int.cast_neg, negOfNat_eq] #align int.cast_neg_of_nat Int.cast_negOfNat @[simp, norm_cast] theorem cast_add : ∀ m n, ((m + n : ℤ) : R) = m + n | (m : ℕ), (n : ℕ) => by simp [-Int.natCast_add, ← Int.ofNat_add] | (m : ℕ), -[n+1] => by erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_add_neg] | -[m+1], (n : ℕ) => by erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_iff_eq_add, add_assoc, eq_neg_add_iff_add_eq, ← Nat.cast_add, ← Nat.cast_add, Nat.add_comm] | -[m+1], -[n+1] => show (-[m + n + 1+1] : R) = _ by rw [cast_negSucc, cast_negSucc, cast_negSucc, ← neg_add_rev, ← Nat.cast_add, Nat.add_right_comm m n 1, Nat.add_assoc, Nat.add_comm] #align int.cast_add Int.cast_addₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_sub (m n) : ((m - n : ℤ) : R) = m - n := by
simp [Int.sub_eq_add_neg, sub_eq_add_neg, Int.cast_neg, Int.cast_add]
@[simp, norm_cast] theorem cast_sub (m n) : ((m - n : ℤ) : R) = m - n := by
Mathlib.Data.Int.Cast.Basic.122_0.3MsWc9B5PAFbTbn
@[simp, norm_cast] theorem cast_sub (m n) : ((m - n : ℤ) : R) = m - n
Mathlib_Data_Int_Cast_Basic
R : Type u inst✝ : AddGroupWithOne R n : ℤ ⊢ ↑(bit1 n) = bit1 ↑n
/- Copyright (c) 2017 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Gabriel Ebner -/ import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Data.Int.Cast.Defs import Mathlib.Algebra.Group.Basic #align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Cast of integers (additional theorems) This file proves additional properties about the *canonical* homomorphism from the integers into an additive group with a one (`Int.cast`). There is also `Data.Int.Cast.Lemmas`, which includes lemmas stated in terms of algebraic homomorphisms, and results involving the order structure of `ℤ`. By contrast, this file's only import beyond `Data.Int.Cast.Defs` is `Algebra.Group.Basic`. -/ universe u namespace Nat variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast] theorem cast_sub {m n} (h : m ≤ n) : ((n - m : ℕ) : R) = n - m := eq_sub_of_add_eq <| by rw [← cast_add, Nat.sub_add_cancel h] #align nat.cast_sub Nat.cast_subₓ -- `HasLiftT` appeared in the type signature @[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by cases h | n + 1, _ => by rw [cast_succ, add_sub_cancel]; rfl #align nat.cast_pred Nat.cast_pred end Nat open Nat namespace Int variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast squash] theorem cast_negSucc (n : ℕ) : (-[n+1] : R) = -(n + 1 : ℕ) := AddGroupWithOne.intCast_negSucc n #align int.cast_neg_succ_of_nat Int.cast_negSuccₓ -- expected `n` to be implicit, and `HasLiftT` @[simp, norm_cast] theorem cast_zero : ((0 : ℤ) : R) = 0 := (AddGroupWithOne.intCast_ofNat 0).trans Nat.cast_zero #align int.cast_zero Int.cast_zeroₓ -- type had `HasLiftT` @[simp high, nolint simpNF, norm_cast] -- this lemma competes with `Int.ofNat_eq_cast` to come later theorem cast_ofNat (n : ℕ) : ((n : ℤ) : R) = n := AddGroupWithOne.intCast_ofNat _ #align int.cast_coe_nat Int.cast_ofNatₓ -- expected `n` to be implicit, and `HasLiftT` #align int.cast_of_nat Int.cast_ofNatₓ -- See note [no_index around OfNat.ofNat] @[simp, norm_cast] theorem int_cast_ofNat (n : ℕ) [n.AtLeastTwo] : ((no_index (OfNat.ofNat n) : ℤ) : R) = OfNat.ofNat n := by simpa only [OfNat.ofNat] using AddGroupWithOne.intCast_ofNat (R := R) n @[simp, norm_cast] theorem cast_one : ((1 : ℤ) : R) = 1 := by erw [cast_ofNat, Nat.cast_one] #align int.cast_one Int.cast_oneₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n | (0 : ℕ) => by erw [cast_zero, neg_zero] | (n + 1 : ℕ) => by erw [cast_ofNat, cast_negSucc] | -[n+1] => by erw [cast_ofNat, cast_negSucc, neg_neg] #align int.cast_neg Int.cast_negₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n := by unfold subNatNat cases e : n - m · simp only [ofNat_eq_coe] simp [e, Nat.le_of_sub_eq_zero e] · rw [cast_negSucc, Nat.add_one, ← e, Nat.cast_sub <| _root_.le_of_lt <| Nat.lt_of_sub_eq_succ e, neg_sub] #align int.cast_sub_nat_nat Int.cast_subNatNatₓ -- type had `HasLiftT` #align int.neg_of_nat_eq Int.negOfNat_eq @[simp] theorem cast_negOfNat (n : ℕ) : ((negOfNat n : ℤ) : R) = -n := by simp [Int.cast_neg, negOfNat_eq] #align int.cast_neg_of_nat Int.cast_negOfNat @[simp, norm_cast] theorem cast_add : ∀ m n, ((m + n : ℤ) : R) = m + n | (m : ℕ), (n : ℕ) => by simp [-Int.natCast_add, ← Int.ofNat_add] | (m : ℕ), -[n+1] => by erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_add_neg] | -[m+1], (n : ℕ) => by erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_iff_eq_add, add_assoc, eq_neg_add_iff_add_eq, ← Nat.cast_add, ← Nat.cast_add, Nat.add_comm] | -[m+1], -[n+1] => show (-[m + n + 1+1] : R) = _ by rw [cast_negSucc, cast_negSucc, cast_negSucc, ← neg_add_rev, ← Nat.cast_add, Nat.add_right_comm m n 1, Nat.add_assoc, Nat.add_comm] #align int.cast_add Int.cast_addₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_sub (m n) : ((m - n : ℤ) : R) = m - n := by simp [Int.sub_eq_add_neg, sub_eq_add_neg, Int.cast_neg, Int.cast_add] #align int.cast_sub Int.cast_subₓ -- type had `HasLiftT` section deprecated set_option linter.deprecated false @[norm_cast, deprecated] theorem ofNat_bit0 (n : ℕ) : (↑(bit0 n) : ℤ) = bit0 ↑n := rfl #align int.coe_nat_bit0 Int.ofNat_bit0 @[norm_cast, deprecated] theorem ofNat_bit1 (n : ℕ) : (↑(bit1 n) : ℤ) = bit1 ↑n := rfl #align int.coe_nat_bit1 Int.ofNat_bit1 @[norm_cast, deprecated] theorem cast_bit0 (n : ℤ) : ((bit0 n : ℤ) : R) = bit0 (n : R) := Int.cast_add _ _ #align int.cast_bit0 Int.cast_bit0 @[norm_cast, deprecated] theorem cast_bit1 (n : ℤ) : ((bit1 n : ℤ) : R) = bit1 (n : R) := by
rw [bit1, Int.cast_add, Int.cast_one, cast_bit0]
@[norm_cast, deprecated] theorem cast_bit1 (n : ℤ) : ((bit1 n : ℤ) : R) = bit1 (n : R) := by
Mathlib.Data.Int.Cast.Basic.146_0.3MsWc9B5PAFbTbn
@[norm_cast, deprecated] theorem cast_bit1 (n : ℤ) : ((bit1 n : ℤ) : R) = bit1 (n : R)
Mathlib_Data_Int_Cast_Basic
R : Type u inst✝ : AddGroupWithOne R n : ℤ ⊢ bit0 ↑n + 1 = bit1 ↑n
/- Copyright (c) 2017 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Mario Carneiro, Gabriel Ebner -/ import Mathlib.Init.Data.Nat.Lemmas import Mathlib.Data.Int.Cast.Defs import Mathlib.Algebra.Group.Basic #align_import data.int.cast.basic from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025" /-! # Cast of integers (additional theorems) This file proves additional properties about the *canonical* homomorphism from the integers into an additive group with a one (`Int.cast`). There is also `Data.Int.Cast.Lemmas`, which includes lemmas stated in terms of algebraic homomorphisms, and results involving the order structure of `ℤ`. By contrast, this file's only import beyond `Data.Int.Cast.Defs` is `Algebra.Group.Basic`. -/ universe u namespace Nat variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast] theorem cast_sub {m n} (h : m ≤ n) : ((n - m : ℕ) : R) = n - m := eq_sub_of_add_eq <| by rw [← cast_add, Nat.sub_add_cancel h] #align nat.cast_sub Nat.cast_subₓ -- `HasLiftT` appeared in the type signature @[simp, norm_cast] theorem cast_pred : ∀ {n}, 0 < n → ((n - 1 : ℕ) : R) = n - 1 | 0, h => by cases h | n + 1, _ => by rw [cast_succ, add_sub_cancel]; rfl #align nat.cast_pred Nat.cast_pred end Nat open Nat namespace Int variable {R : Type u} [AddGroupWithOne R] @[simp, norm_cast squash] theorem cast_negSucc (n : ℕ) : (-[n+1] : R) = -(n + 1 : ℕ) := AddGroupWithOne.intCast_negSucc n #align int.cast_neg_succ_of_nat Int.cast_negSuccₓ -- expected `n` to be implicit, and `HasLiftT` @[simp, norm_cast] theorem cast_zero : ((0 : ℤ) : R) = 0 := (AddGroupWithOne.intCast_ofNat 0).trans Nat.cast_zero #align int.cast_zero Int.cast_zeroₓ -- type had `HasLiftT` @[simp high, nolint simpNF, norm_cast] -- this lemma competes with `Int.ofNat_eq_cast` to come later theorem cast_ofNat (n : ℕ) : ((n : ℤ) : R) = n := AddGroupWithOne.intCast_ofNat _ #align int.cast_coe_nat Int.cast_ofNatₓ -- expected `n` to be implicit, and `HasLiftT` #align int.cast_of_nat Int.cast_ofNatₓ -- See note [no_index around OfNat.ofNat] @[simp, norm_cast] theorem int_cast_ofNat (n : ℕ) [n.AtLeastTwo] : ((no_index (OfNat.ofNat n) : ℤ) : R) = OfNat.ofNat n := by simpa only [OfNat.ofNat] using AddGroupWithOne.intCast_ofNat (R := R) n @[simp, norm_cast] theorem cast_one : ((1 : ℤ) : R) = 1 := by erw [cast_ofNat, Nat.cast_one] #align int.cast_one Int.cast_oneₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_neg : ∀ n, ((-n : ℤ) : R) = -n | (0 : ℕ) => by erw [cast_zero, neg_zero] | (n + 1 : ℕ) => by erw [cast_ofNat, cast_negSucc] | -[n+1] => by erw [cast_ofNat, cast_negSucc, neg_neg] #align int.cast_neg Int.cast_negₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_subNatNat (m n) : ((Int.subNatNat m n : ℤ) : R) = m - n := by unfold subNatNat cases e : n - m · simp only [ofNat_eq_coe] simp [e, Nat.le_of_sub_eq_zero e] · rw [cast_negSucc, Nat.add_one, ← e, Nat.cast_sub <| _root_.le_of_lt <| Nat.lt_of_sub_eq_succ e, neg_sub] #align int.cast_sub_nat_nat Int.cast_subNatNatₓ -- type had `HasLiftT` #align int.neg_of_nat_eq Int.negOfNat_eq @[simp] theorem cast_negOfNat (n : ℕ) : ((negOfNat n : ℤ) : R) = -n := by simp [Int.cast_neg, negOfNat_eq] #align int.cast_neg_of_nat Int.cast_negOfNat @[simp, norm_cast] theorem cast_add : ∀ m n, ((m + n : ℤ) : R) = m + n | (m : ℕ), (n : ℕ) => by simp [-Int.natCast_add, ← Int.ofNat_add] | (m : ℕ), -[n+1] => by erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_add_neg] | -[m+1], (n : ℕ) => by erw [cast_subNatNat, cast_ofNat, cast_negSucc, sub_eq_iff_eq_add, add_assoc, eq_neg_add_iff_add_eq, ← Nat.cast_add, ← Nat.cast_add, Nat.add_comm] | -[m+1], -[n+1] => show (-[m + n + 1+1] : R) = _ by rw [cast_negSucc, cast_negSucc, cast_negSucc, ← neg_add_rev, ← Nat.cast_add, Nat.add_right_comm m n 1, Nat.add_assoc, Nat.add_comm] #align int.cast_add Int.cast_addₓ -- type had `HasLiftT` @[simp, norm_cast] theorem cast_sub (m n) : ((m - n : ℤ) : R) = m - n := by simp [Int.sub_eq_add_neg, sub_eq_add_neg, Int.cast_neg, Int.cast_add] #align int.cast_sub Int.cast_subₓ -- type had `HasLiftT` section deprecated set_option linter.deprecated false @[norm_cast, deprecated] theorem ofNat_bit0 (n : ℕ) : (↑(bit0 n) : ℤ) = bit0 ↑n := rfl #align int.coe_nat_bit0 Int.ofNat_bit0 @[norm_cast, deprecated] theorem ofNat_bit1 (n : ℕ) : (↑(bit1 n) : ℤ) = bit1 ↑n := rfl #align int.coe_nat_bit1 Int.ofNat_bit1 @[norm_cast, deprecated] theorem cast_bit0 (n : ℤ) : ((bit0 n : ℤ) : R) = bit0 (n : R) := Int.cast_add _ _ #align int.cast_bit0 Int.cast_bit0 @[norm_cast, deprecated] theorem cast_bit1 (n : ℤ) : ((bit1 n : ℤ) : R) = bit1 (n : R) := by rw [bit1, Int.cast_add, Int.cast_one, cast_bit0];
rfl
@[norm_cast, deprecated] theorem cast_bit1 (n : ℤ) : ((bit1 n : ℤ) : R) = bit1 (n : R) := by rw [bit1, Int.cast_add, Int.cast_one, cast_bit0];
Mathlib.Data.Int.Cast.Basic.146_0.3MsWc9B5PAFbTbn
@[norm_cast, deprecated] theorem cast_bit1 (n : ℤ) : ((bit1 n : ℤ) : R) = bit1 (n : R)
Mathlib_Data_Int_Cast_Basic