File: Mathlib/Geometry/RingedSpace/OpenImmersion.lean

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.base_open
code: /-- An open immersion of PresheafedSpaces is an open embedding `f : X ⟶ U ⊆ Y` of the underlying
spaces, such that the sheaf map `Y(V) ⟶ f _* X(V)` is an iso for each `V ⊆ U`.
-/
class PresheafedSpace.IsOpenImmersion {X Y : PresheafedSpace C} (f : X ⟶ Y) : Prop where
  /-- the underlying continuous map of underlying spaces from the source to an open subset of the
    target. -/
  base_open : OpenEmbedding f.base
  /-- the underlying sheaf morphism is an isomorphism on each open subset-/
  c_iso : ∀ U : Opens X, IsIso (f.c.app (op (base_open.isOpenMap.functor.obj U)))
goal: OpenEmbedding ⇑f.base

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion
code: /-- An open immersion of PresheafedSpaces is an open embedding `f : X ⟶ U ⊆ Y` of the underlying
spaces, such that the sheaf map `Y(V) ⟶ f _* X(V)` is an iso for each `V ⊆ U`.
-/
class PresheafedSpace.IsOpenImmersion {X Y : PresheafedSpace C} (f : X ⟶ Y) : Prop where
  /-- the underlying continuous map of underlying spaces from the source to an open subset of the
    target. -/
  base_open : OpenEmbedding f.base
  /-- the underlying sheaf morphism is an isomorphism on each open subset-/
  c_iso : ∀ U : Opens X, IsIso (f.c.app (op (base_open.isOpenMap.functor.obj U)))
goal: Prop

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.c_iso
code: /-- An open immersion of PresheafedSpaces is an open embedding `f : X ⟶ U ⊆ Y` of the underlying
spaces, such that the sheaf map `Y(V) ⟶ f _* X(V)` is an iso for each `V ⊆ U`.
-/
class PresheafedSpace.IsOpenImmersion {X Y : PresheafedSpace C} (f : X ⟶ Y) : Prop where
  /-- the underlying continuous map of underlying spaces from the source to an open subset of the
    target. -/
  base_open : OpenEmbedding f.base
  /-- the underlying sheaf morphism is an isomorphism on each open subset-/
  c_iso : ∀ U : Opens X, IsIso (f.c.app (op (base_open.isOpenMap.functor.obj U)))
goal: CategoryTheory.IsIso (f.c.app (Opposite.op (⋯.functor.obj U)))

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion
code: /-- A morphism of SheafedSpaces is an open immersion if it is an open immersion as a morphism
of PresheafedSpaces
-/
abbrev SheafedSpace.IsOpenImmersion {X Y : SheafedSpace C} (f : X ⟶ Y) : Prop 
goal: Prop

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion
code: /-- A morphism of LocallyRingedSpaces is an open immersion if it is an open immersion as a morphism
of SheafedSpaces
-/
abbrev LocallyRingedSpace.IsOpenImmersion {X Y : LocallyRingedSpace} (f : X ⟶ Y) : Prop 
goal: Prop

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion._aux_Mathlib_Geometry_RingedSpace_OpenImmersion___unexpand_AlgebraicGeometry_PresheafedSpace_IsOpenImmersion_1
code: local notation "IsOpenImmersion" => PresheafedSpace.IsOpenImmersion
goal: Lean.PrettyPrinter.Unexpander

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion._aux_Mathlib_Geometry_RingedSpace_OpenImmersion___macroRules_AlgebraicGeometry_PresheafedSpace_IsOpenImmersion_termIsOpenImmersion_1
code: local notation "IsOpenImmersion" => PresheafedSpace.IsOpenImmersion
goal: Lean.Macro

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.opensFunctor
code: /-- The functor `Opens X ⥤ Opens Y` associated with an open immersion `f : X ⟶ Y`. -/
abbrev opensFunctor 
goal: TopologicalSpace.Opens ↑↑X ⥤ TopologicalSpace.Opens ↑↑Y

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isoRestrict
code: /-- An open immersion `f : X ⟶ Y` induces an isomorphism `X ≅ Y|_{f(X)}`. -/
@[simps! hom_c_app]
noncomputable def isoRestrict : X ≅ Y.restrict H.base_open 
goal: X ≅ Y.restrict ⋯

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isoRestrict_hom_c_app
code: /-- An open immersion `f : X ⟶ Y` induces an isomorphism `X ≅ Y|_{f(X)}`. -/
@[simps! hom_c_app]
noncomputable def isoRestrict : X ≅ Y.restrict H.base_open 
goal: ∀ (X_1 : (TopologicalSpace.Opens ↑↑(Y.restrict ⋯))ᵒᵖ),
  (AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isoRestrict f).hom.c.app X_1 =
    f.c.app (Opposite.op ((AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.opensFunctor f).obj (Opposite.unop X_1))) ≫
      X.presheaf.map (CategoryTheory.eqToHom ⋯)

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isoRestrict_hom_ofRestrict
code: @[reassoc (attr := simp)]
theorem isoRestrict_hom_ofRestrict : (isoRestrict f).hom ≫ Y.ofRestrict _ = f 
goal: (AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isoRestrict f).hom ≫ Y.ofRestrict ⋯ = f

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isoRestrict_inv_ofRestrict
code: @[reassoc (attr := simp)]
theorem isoRestrict_inv_ofRestrict : (isoRestrict f).inv ≫ f = Y.ofRestrict _ 
goal: (AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isoRestrict f).inv ≫ f = Y.ofRestrict ⋯

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.mono
code: instance mono : Mono f 
goal: CategoryTheory.Mono f

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.c_iso'
code: lemma c_iso' {V : Opens Y} (U : Opens X) (h : V = (opensFunctor f).obj U) :
    IsIso (f.c.app (Opposite.op V)) 
goal: CategoryTheory.IsIso (f.c.app (Opposite.op V))

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.comp
code: /-- The composition of two open immersions is an open immersion. -/
instance comp {Z : PresheafedSpace C} (g : Y ⟶ Z) [hg : IsOpenImmersion g] :
    IsOpenImmersion (f ≫ g) 
goal: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion (f ≫ g)

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.invApp
code: /-- For an open immersion `f : X ⟶ Y` and an open set `U ⊆ X`, we have the map `X(U) ⟶ Y(U)`. -/
noncomputable def invApp (U : Opens X) :
    X.presheaf.obj (op U) ⟶ Y.presheaf.obj (op (opensFunctor f |>.obj U)) 
goal: X.presheaf.obj (Opposite.op U) ⟶
  Y.presheaf.obj (Opposite.op ((AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.opensFunctor f).obj U))

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.inv_naturality
code: @[simp, reassoc]
theorem inv_naturality {U V : (Opens X)ᵒᵖ} (i : U ⟶ V) :
    X.presheaf.map i ≫ H.invApp (unop V) =
      invApp f (unop U) ≫ Y.presheaf.map (opensFunctor f |>.op.map i) 
goal: X.presheaf.map i ≫ AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.invApp f (Opposite.unop V) =
  AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.invApp f (Opposite.unop U) ≫
    Y.presheaf.map ((AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.opensFunctor f).op.map i)

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.instIsIsoInvApp
code: instance (U : Opens X) : IsIso (invApp f U) 
goal: CategoryTheory.IsIso (AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.invApp f U)

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.inv_invApp
code: theorem inv_invApp (U : Opens X) :
    inv (H.invApp U) =
      f.c.app (op (opensFunctor f |>.obj U)) ≫
        X.presheaf.map
          (eqToHom (by simp [Opens.map, Set.preimage_image_eq _ H.base_open.inj])) 
goal: CategoryTheory.inv (AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.invApp f U) =
  f.c.app (Opposite.op ((AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.opensFunctor f).obj U)) ≫
    X.presheaf.map (CategoryTheory.eqToHom ⋯)

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.invApp_app
code: @[simp, reassoc, elementwise]
theorem invApp_app (U : Opens X) :
    invApp f U ≫ f.c.app (op (opensFunctor f |>.obj U)) =
      X.presheaf.map (eqToHom (by simp [Opens.map, Set.preimage_image_eq _ H.base_open.inj])) 
goal: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.invApp f U ≫
    f.c.app (Opposite.op ((AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.opensFunctor f).obj U)) =
  X.presheaf.map (CategoryTheory.eqToHom ⋯)

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.app_invApp
code: @[simp, reassoc]
theorem app_invApp (U : Opens Y) :
    f.c.app (op U) ≫ H.invApp ((Opens.map f.base).obj U) =
      Y.presheaf.map
        ((homOfLE (Set.image_preimage_subset f.base U.1)).op :
          op U ⟶ op (opensFunctor f |>.obj ((Opens.map f.base).obj U))) 
goal: f.c.app (Opposite.op U) ≫
    AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.invApp f ((TopologicalSpace.Opens.map f.base).obj U) =
  Y.presheaf.map (CategoryTheory.homOfLE ⋯).op

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.app_inv_app'
code: /-- A variant of `app_inv_app` that gives an `eqToHom` instead of `homOfLe`. -/
@[reassoc]
theorem app_inv_app' (U : Opens Y) (hU : (U : Set Y) ⊆ Set.range f.base) :
    f.c.app (op U) ≫ invApp f ((Opens.map f.base).obj U) =
      Y.presheaf.map
        (eqToHom
            (le_antisymm (Set.image_preimage_subset f.base U.1) <|
              (Set.image_preimage_eq_inter_range (f := f.base) (t := U.1)).symm ▸
                Set.subset_inter_iff.mpr ⟨fun _ h => h, hU⟩)).op 
goal: f.c.app (Opposite.op U) ≫
    AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.invApp f ((TopologicalSpace.Opens.map f.base).obj U) =
  Y.presheaf.map (CategoryTheory.eqToHom ⋯).op

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.ofIso
code: /-- An isomorphism is an open immersion. -/
instance ofIso {X Y : PresheafedSpace C} (H : X ≅ Y) : IsOpenImmersion H.hom 
goal: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion H.hom

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.ofIsIso
code: instance (priority := 100) ofIsIso {X Y : PresheafedSpace C} (f : X ⟶ Y) [IsIso f] :
    IsOpenImmersion f 
goal: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion f

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.ofRestrict
code: instance ofRestrict {X : TopCat} (Y : PresheafedSpace C) {f : X ⟶ Y.carrier}
    (hf : OpenEmbedding f) : IsOpenImmersion (Y.ofRestrict hf) 
goal: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion (Y.ofRestrict hf)

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.ofRestrict_invApp
code: @[elementwise, simp]
theorem ofRestrict_invApp {C : Type*} [Category C] (X : PresheafedSpace C) {Y : TopCat}
    {f : Y ⟶ TopCat.of X.carrier} (h : OpenEmbedding f) (U : Opens (X.restrict h).carrier) :
    (PresheafedSpace.IsOpenImmersion.ofRestrict X h).invApp U = 𝟙 _ 
goal: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.invApp (X.ofRestrict h) U =
  𝟙 ((X.restrict h).presheaf.obj (Opposite.op U))

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.to_iso
code: /-- An open immersion is an iso if the underlying continuous map is epi. -/
theorem to_iso [h' : Epi f.base] : IsIso f 
goal: CategoryTheory.IsIso f

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.stalk_iso
code: instance stalk_iso [HasColimits C] (x : X) : IsIso (f.stalkMap x) 
goal: CategoryTheory.IsIso (AlgebraicGeometry.PresheafedSpace.Hom.stalkMap f x)

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeftFst
code: /-- (Implementation.) The projection map when constructing the pullback along an open immersion.
-/
def pullbackConeOfLeftFst :
    Y.restrict (TopCat.snd_openEmbedding_of_left_openEmbedding hf.base_open g.base) ⟶ X 
goal: Y.restrict ⋯ ⟶ X

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullback_cone_of_left_condition
code: theorem pullback_cone_of_left_condition : pullbackConeOfLeftFst f g ≫ f = Y.ofRestrict _ ≫ g 
goal: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeftFst f g ≫ f = Y.ofRestrict ⋯ ≫ g

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeft
code: /-- We construct the pullback along an open immersion via restricting along the pullback of the
maps of underlying spaces (which is also an open embedding).
-/
def pullbackConeOfLeft : PullbackCone f g 
goal: CategoryTheory.Limits.PullbackCone f g

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeftLift
code: /-- (Implementation.) Any cone over `cospan f g` indeed factors through the constructed cone.
-/
def pullbackConeOfLeftLift : s.pt ⟶ (pullbackConeOfLeft f g).pt 
goal: s.pt ⟶ (AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeft f g).pt

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeftLift_fst
code: theorem pullbackConeOfLeftLift_fst :
    pullbackConeOfLeftLift f g s ≫ (pullbackConeOfLeft f g).fst = s.fst 
goal: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeftLift f g s ≫
    (AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeft f g).fst =
  s.fst

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeftLift_snd
code: theorem pullbackConeOfLeftLift_snd :
    pullbackConeOfLeftLift f g s ≫ (pullbackConeOfLeft f g).snd = s.snd 
goal: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeftLift f g s ≫
    (AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeft f g).snd =
  s.snd

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeSndIsOpenImmersion
code: instance pullbackConeSndIsOpenImmersion : IsOpenImmersion (pullbackConeOfLeft f g).snd 
goal: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion
  (AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeft f g).snd

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeftIsLimit
code: /-- The constructed pullback cone is indeed the pullback. -/
def pullbackConeOfLeftIsLimit : IsLimit (pullbackConeOfLeft f g) 
goal: CategoryTheory.Limits.IsLimit (AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackConeOfLeft f g)

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.hasPullback_of_left
code: instance hasPullback_of_left : HasPullback f g 
goal: CategoryTheory.Limits.HasPullback f g

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.hasPullback_of_right
code: instance hasPullback_of_right : HasPullback g f 
goal: CategoryTheory.Limits.HasPullback g f

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackSndOfLeft
code: /-- Open immersions are stable under base-change. -/
instance pullbackSndOfLeft : IsOpenImmersion (pullback.snd f g) 
goal: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion (CategoryTheory.Limits.pullback.snd f g)

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackFstOfRight
code: /-- Open immersions are stable under base-change. -/
instance pullbackFstOfRight : IsOpenImmersion (pullback.fst g f) 
goal: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion (CategoryTheory.Limits.pullback.fst g f)

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullbackToBaseIsOpenImmersion
code: instance pullbackToBaseIsOpenImmersion [IsOpenImmersion g] :
    IsOpenImmersion (limit.π (cospan f g) WalkingCospan.one) 
goal: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion
  (CategoryTheory.Limits.limit.π (CategoryTheory.Limits.cospan f g) CategoryTheory.Limits.WalkingCospan.one)

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.forgetPreservesLimitsOfLeft
code: instance forgetPreservesLimitsOfLeft : PreservesLimit (cospan f g) (forget C) 
goal: CategoryTheory.Limits.PreservesLimit (CategoryTheory.Limits.cospan f g) (AlgebraicGeometry.PresheafedSpace.forget C)

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.forgetPreservesLimitsOfRight
code: instance forgetPreservesLimitsOfRight : PreservesLimit (cospan g f) (forget C) 
goal: CategoryTheory.Limits.PreservesLimit (CategoryTheory.Limits.cospan g f) (AlgebraicGeometry.PresheafedSpace.forget C)

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.pullback_snd_isIso_of_range_subset
code: theorem pullback_snd_isIso_of_range_subset (H : Set.range g.base ⊆ Set.range f.base) :
    IsIso (pullback.snd f g) 
goal: CategoryTheory.IsIso (CategoryTheory.Limits.pullback.snd f g)

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.lift
code: /-- The universal property of open immersions:
For an open immersion `f : X ⟶ Z`, given any morphism of schemes `g : Y ⟶ Z` whose topological
image is contained in the image of `f`, we can lift this morphism to a unique `Y ⟶ X` that
commutes with these maps.
-/
def lift (H : Set.range g.base ⊆ Set.range f.base) : Y ⟶ X 
goal: Y ⟶ X

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.lift_fac
code: @[simp, reassoc]
theorem lift_fac (H : Set.range g.base ⊆ Set.range f.base) : lift f g H ≫ f = g 
goal: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.lift f g H ≫ f = g

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.lift_uniq
code: theorem lift_uniq (H : Set.range g.base ⊆ Set.range f.base) (l : Y ⟶ X) (hl : l ≫ f = g) :
    l = lift f g H 
goal: l = AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.lift f g H

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isoOfRangeEq_inv
code: /-- Two open immersions with equal range is isomorphic. -/
@[simps]
def isoOfRangeEq [IsOpenImmersion g] (e : Set.range f.base = Set.range g.base) : X ≅ Y 
goal: (AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isoOfRangeEq f g e).inv =
  AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.lift f g ⋯

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isoOfRangeEq_hom
code: /-- Two open immersions with equal range is isomorphic. -/
@[simps]
def isoOfRangeEq [IsOpenImmersion g] (e : Set.range f.base = Set.range g.base) : X ≅ Y 
goal: (AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isoOfRangeEq f g e).hom =
  AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.lift g f ⋯

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isoOfRangeEq
code: /-- Two open immersions with equal range is isomorphic. -/
@[simps]
def isoOfRangeEq [IsOpenImmersion g] (e : Set.range f.base = Set.range g.base) : X ≅ Y 
goal: X ≅ Y

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpace
code: /-- If `X ⟶ Y` is an open immersion, and `Y` is a SheafedSpace, then so is `X`. -/
def toSheafedSpace : SheafedSpace C 
goal: AlgebraicGeometry.SheafedSpace C

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpace_toPresheafedSpace
code: @[simp]
theorem toSheafedSpace_toPresheafedSpace : (toSheafedSpace Y f).toPresheafedSpace = X 
goal: (AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpace Y f).toPresheafedSpace = X

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpaceHom
code: /-- If `X ⟶ Y` is an open immersion of PresheafedSpaces, and `Y` is a SheafedSpace, we can
upgrade it into a morphism of SheafedSpaces.
-/
def toSheafedSpaceHom : toSheafedSpace Y f ⟶ Y 
goal: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpace Y f ⟶ Y

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpaceHom_base
code: @[simp]
theorem toSheafedSpaceHom_base : (toSheafedSpaceHom Y f).base = f.base 
goal: (AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpaceHom Y f).base = f.base

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpaceHom_c
code: @[simp]
theorem toSheafedSpaceHom_c : (toSheafedSpaceHom Y f).c = f.c 
goal: (AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpaceHom Y f).c = f.c

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpace_isOpenImmersion
code: instance toSheafedSpace_isOpenImmersion : SheafedSpace.IsOpenImmersion (toSheafedSpaceHom Y f) 
goal: AlgebraicGeometry.SheafedSpace.IsOpenImmersion (AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpaceHom Y f)

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.sheafedSpace_toSheafedSpace
code: @[simp]
theorem sheafedSpace_toSheafedSpace {X Y : SheafedSpace C} (f : X ⟶ Y) [IsOpenImmersion f] :
    toSheafedSpace Y f = X 
goal: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpace Y f = X

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toLocallyRingedSpace
code: /-- If `X ⟶ Y` is an open immersion, and `Y` is a LocallyRingedSpace, then so is `X`. -/
def toLocallyRingedSpace : LocallyRingedSpace 
goal: AlgebraicGeometry.LocallyRingedSpace

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toLocallyRingedSpace_toSheafedSpace
code: @[simp]
theorem toLocallyRingedSpace_toSheafedSpace :
    (toLocallyRingedSpace Y f).toSheafedSpace = toSheafedSpace Y.1 f 
goal: (AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toLocallyRingedSpace Y f).toSheafedSpace =
  AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toSheafedSpace Y.toSheafedSpace f

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toLocallyRingedSpaceHom
code: /-- If `X ⟶ Y` is an open immersion of PresheafedSpaces, and `Y` is a LocallyRingedSpace, we can
upgrade it into a morphism of LocallyRingedSpace.
-/
def toLocallyRingedSpaceHom : toLocallyRingedSpace Y f ⟶ Y 
goal: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toLocallyRingedSpace Y f ⟶ Y

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toLocallyRingedSpaceHom_val
code: @[simp]
theorem toLocallyRingedSpaceHom_val : (toLocallyRingedSpaceHom Y f).val = f 
goal: (AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toLocallyRingedSpaceHom Y f).val = f

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toLocallyRingedSpace_isOpenImmersion
code: instance toLocallyRingedSpace_isOpenImmersion :
    LocallyRingedSpace.IsOpenImmersion (toLocallyRingedSpaceHom Y f) 
goal: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion
  (AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toLocallyRingedSpaceHom Y f)

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.locallyRingedSpace_toLocallyRingedSpace
code: @[simp]
theorem locallyRingedSpace_toLocallyRingedSpace {X Y : LocallyRingedSpace} (f : X ⟶ Y)
    [LocallyRingedSpace.IsOpenImmersion f] : toLocallyRingedSpace Y f.1 = X 
goal: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.toLocallyRingedSpace Y f.val = X

full_name: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.isIso_of_subset
code: theorem isIso_of_subset {X Y : PresheafedSpace C} (f : X ⟶ Y)
    [H : PresheafedSpace.IsOpenImmersion f] (U : Opens Y.carrier)
    (hU : (U : Set Y.carrier) ⊆ Set.range f.base) : IsIso (f.c.app <| op U) 
goal: CategoryTheory.IsIso (f.c.app (Opposite.op U))

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.of_isIso
code: instance (priority := 100) of_isIso {X Y : SheafedSpace C} (f : X ⟶ Y) [IsIso f] :
    SheafedSpace.IsOpenImmersion f 
goal: AlgebraicGeometry.SheafedSpace.IsOpenImmersion f

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.comp
code: instance comp {X Y Z : SheafedSpace C} (f : X ⟶ Y) (g : Y ⟶ Z) [SheafedSpace.IsOpenImmersion f]
    [SheafedSpace.IsOpenImmersion g] : SheafedSpace.IsOpenImmersion (f ≫ g) 
goal: AlgebraicGeometry.SheafedSpace.IsOpenImmersion (f ≫ g)

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion._aux_Mathlib_Geometry_RingedSpace_OpenImmersion___macroRules_AlgebraicGeometry_SheafedSpace_IsOpenImmersion_termForget_1
code: local notation "forget" => SheafedSpace.forgetToPresheafedSpace
goal: Lean.Macro

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion._aux_Mathlib_Geometry_RingedSpace_OpenImmersion___unexpand_AlgebraicGeometry_SheafedSpace_forgetToPresheafedSpace_1
code: local notation "forget" => SheafedSpace.forgetToPresheafedSpace
goal: Lean.PrettyPrinter.Unexpander

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.instMono
code: instance : Mono f 
goal: CategoryTheory.Mono f

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.forgetMapIsOpenImmersion
code: instance forgetMapIsOpenImmersion : PresheafedSpace.IsOpenImmersion ((forget).map f) 
goal: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion (AlgebraicGeometry.SheafedSpace.forgetToPresheafedSpace.map f)

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.hasLimit_cospan_forget_of_left
code: instance hasLimit_cospan_forget_of_left : HasLimit (cospan f g ⋙ forget) 
goal: CategoryTheory.Limits.HasLimit
  (CategoryTheory.Limits.cospan f g ⋙ AlgebraicGeometry.SheafedSpace.forgetToPresheafedSpace)

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.hasLimit_cospan_forget_of_left'
code: instance hasLimit_cospan_forget_of_left' :
    HasLimit (cospan ((cospan f g ⋙ forget).map Hom.inl) ((cospan f g ⋙ forget).map Hom.inr)) 
goal: CategoryTheory.Limits.HasLimit
  (CategoryTheory.Limits.cospan
    ((CategoryTheory.Limits.cospan f g ⋙ AlgebraicGeometry.SheafedSpace.forgetToPresheafedSpace).map
      CategoryTheory.Limits.WalkingCospan.Hom.inl)
    ((CategoryTheory.Limits.cospan f g ⋙ AlgebraicGeometry.SheafedSpace.forgetToPresheafedSpace).map
      CategoryTheory.Limits.WalkingCospan.Hom.inr))

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.hasLimit_cospan_forget_of_right
code: instance hasLimit_cospan_forget_of_right : HasLimit (cospan g f ⋙ forget) 
goal: CategoryTheory.Limits.HasLimit
  (CategoryTheory.Limits.cospan g f ⋙ AlgebraicGeometry.SheafedSpace.forgetToPresheafedSpace)

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.hasLimit_cospan_forget_of_right'
code: instance hasLimit_cospan_forget_of_right' :
    HasLimit (cospan ((cospan g f ⋙ forget).map Hom.inl) ((cospan g f ⋙ forget).map Hom.inr)) 
goal: CategoryTheory.Limits.HasLimit
  (CategoryTheory.Limits.cospan
    ((CategoryTheory.Limits.cospan g f ⋙ AlgebraicGeometry.SheafedSpace.forgetToPresheafedSpace).map
      CategoryTheory.Limits.WalkingCospan.Hom.inl)
    ((CategoryTheory.Limits.cospan g f ⋙ AlgebraicGeometry.SheafedSpace.forgetToPresheafedSpace).map
      CategoryTheory.Limits.WalkingCospan.Hom.inr))

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.forgetCreatesPullbackOfLeft
code: instance forgetCreatesPullbackOfLeft : CreatesLimit (cospan f g) forget 
goal: CategoryTheory.CreatesLimit (CategoryTheory.Limits.cospan f g) AlgebraicGeometry.SheafedSpace.forgetToPresheafedSpace

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.forgetCreatesPullbackOfRight
code: instance forgetCreatesPullbackOfRight : CreatesLimit (cospan g f) forget 
goal: CategoryTheory.CreatesLimit (CategoryTheory.Limits.cospan g f) AlgebraicGeometry.SheafedSpace.forgetToPresheafedSpace

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpaceForgetPreservesOfLeft
code: instance sheafedSpaceForgetPreservesOfLeft : PreservesLimit (cospan f g) (SheafedSpace.forget C) 
goal: CategoryTheory.Limits.PreservesLimit (CategoryTheory.Limits.cospan f g) (AlgebraicGeometry.SheafedSpace.forget C)

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpaceForgetPreservesOfRight
code: instance sheafedSpaceForgetPreservesOfRight : PreservesLimit (cospan g f) (SheafedSpace.forget C) 
goal: CategoryTheory.Limits.PreservesLimit (CategoryTheory.Limits.cospan g f) (AlgebraicGeometry.SheafedSpace.forget C)

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpace_hasPullback_of_left
code: instance sheafedSpace_hasPullback_of_left : HasPullback f g 
goal: CategoryTheory.Limits.HasPullback f g

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpace_hasPullback_of_right
code: instance sheafedSpace_hasPullback_of_right : HasPullback g f 
goal: CategoryTheory.Limits.HasPullback g f

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpace_pullback_snd_of_left
code: /-- Open immersions are stable under base-change. -/
instance sheafedSpace_pullback_snd_of_left :
    SheafedSpace.IsOpenImmersion (pullback.snd f g) 
goal: AlgebraicGeometry.SheafedSpace.IsOpenImmersion (CategoryTheory.Limits.pullback.snd f g)

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpace_pullback_fst_of_right
code: instance sheafedSpace_pullback_fst_of_right :
    SheafedSpace.IsOpenImmersion (pullback.fst g f) 
goal: AlgebraicGeometry.SheafedSpace.IsOpenImmersion (CategoryTheory.Limits.pullback.fst g f)

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sheafedSpace_pullback_to_base_isOpenImmersion
code: instance sheafedSpace_pullback_to_base_isOpenImmersion [SheafedSpace.IsOpenImmersion g] :
    SheafedSpace.IsOpenImmersion (limit.π (cospan f g) one : pullback f g ⟶ Z) 
goal: AlgebraicGeometry.SheafedSpace.IsOpenImmersion
  (CategoryTheory.Limits.limit.π (CategoryTheory.Limits.cospan f g) CategoryTheory.Limits.WalkingCospan.one)

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.of_stalk_iso
code: /-- Suppose `X Y : SheafedSpace C`, where `C` is a concrete category,
whose forgetful functor reflects isomorphisms, preserves limits and filtered colimits.
Then a morphism `X ⟶ Y` that is a topological open embedding
is an open immersion iff every stalk map is an iso.
-/
theorem of_stalk_iso {X Y : SheafedSpace C} (f : X ⟶ Y) (hf : OpenEmbedding f.base)
    [H : ∀ x : X.1, IsIso (f.stalkMap x)] : SheafedSpace.IsOpenImmersion f 
goal: AlgebraicGeometry.SheafedSpace.IsOpenImmersion f

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.opensFunctor
code: /-- The functor `Opens X ⥤ Opens Y` associated with an open immersion `f : X ⟶ Y`. -/
abbrev opensFunctor : Opens X ⥤ Opens Y 
goal: TopologicalSpace.Opens ↑↑X.toPresheafedSpace ⥤ TopologicalSpace.Opens ↑↑Y.toPresheafedSpace

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.isoRestrict_hom_c_app
code: /-- An open immersion `f : X ⟶ Y` induces an isomorphism `X ≅ Y|_{f(X)}`. -/
@[simps! hom_c_app]
noncomputable def isoRestrict : X ≅ Y.restrict H.base_open 
goal: ∀ (X_1 : (TopologicalSpace.Opens ↑↑(Y.restrict ⋯))ᵒᵖ),
  (AlgebraicGeometry.SheafedSpace.IsOpenImmersion.isoRestrict f).hom.c.app X_1 =
    f.c.app (Opposite.op ((AlgebraicGeometry.PresheafedSpace.IsOpenImmersion.opensFunctor f).obj (Opposite.unop X_1))) ≫
      X.presheaf.map (CategoryTheory.eqToHom ⋯)

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.isoRestrict
code: /-- An open immersion `f : X ⟶ Y` induces an isomorphism `X ≅ Y|_{f(X)}`. -/
@[simps! hom_c_app]
noncomputable def isoRestrict : X ≅ Y.restrict H.base_open 
goal: X ≅ Y.restrict ⋯

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.isoRestrict_hom_ofRestrict
code: @[reassoc (attr := simp)]
theorem isoRestrict_hom_ofRestrict : (isoRestrict f).hom ≫ Y.ofRestrict _ = f 
goal: (AlgebraicGeometry.SheafedSpace.IsOpenImmersion.isoRestrict f).hom ≫ Y.ofRestrict ⋯ = f

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.isoRestrict_inv_ofRestrict
code: @[reassoc (attr := simp)]
theorem isoRestrict_inv_ofRestrict : (isoRestrict f).inv ≫ f = Y.ofRestrict _ 
goal: (AlgebraicGeometry.SheafedSpace.IsOpenImmersion.isoRestrict f).inv ≫ f = Y.ofRestrict ⋯

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.invApp
code: /-- For an open immersion `f : X ⟶ Y` and an open set `U ⊆ X`, we have the map `X(U) ⟶ Y(U)`. -/
noncomputable def invApp (U : Opens X) :
    X.presheaf.obj (op U) ⟶ Y.presheaf.obj (op (opensFunctor f |>.obj U)) 
goal: X.presheaf.obj (Opposite.op U) ⟶
  Y.presheaf.obj (Opposite.op ((AlgebraicGeometry.SheafedSpace.IsOpenImmersion.opensFunctor f).obj U))

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.inv_naturality
code: @[reassoc (attr := simp)]
theorem inv_naturality {U V : (Opens X)ᵒᵖ} (i : U ⟶ V) :
    X.presheaf.map i ≫ H.invApp (unop V) =
      H.invApp (unop U) ≫ Y.presheaf.map (opensFunctor f |>.op.map i) 
goal: X.presheaf.map i ≫ AlgebraicGeometry.SheafedSpace.IsOpenImmersion.invApp f (Opposite.unop V) =
  AlgebraicGeometry.SheafedSpace.IsOpenImmersion.invApp f (Opposite.unop U) ≫
    Y.presheaf.map ((AlgebraicGeometry.SheafedSpace.IsOpenImmersion.opensFunctor f).op.map i)

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.instIsIsoInvApp
code: instance (U : Opens X) : IsIso (H.invApp U) 
goal: CategoryTheory.IsIso (AlgebraicGeometry.SheafedSpace.IsOpenImmersion.invApp f U)

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.inv_invApp
code: theorem inv_invApp (U : Opens X) :
    inv (H.invApp U) =
      f.c.app (op (opensFunctor f |>.obj U)) ≫
        X.presheaf.map (eqToHom (by simp [Opens.map, Set.preimage_image_eq _ H.base_open.inj])) 
goal: CategoryTheory.inv (AlgebraicGeometry.SheafedSpace.IsOpenImmersion.invApp f U) =
  f.c.app (Opposite.op ((AlgebraicGeometry.SheafedSpace.IsOpenImmersion.opensFunctor f).obj U)) ≫
    X.presheaf.map (CategoryTheory.eqToHom ⋯)

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.invApp_app
code: @[reassoc (attr := simp)]
theorem invApp_app (U : Opens X) :
    H.invApp U ≫ f.c.app (op (opensFunctor f |>.obj U)) =
      X.presheaf.map (eqToHom (by simp [Opens.map, Set.preimage_image_eq _ H.base_open.inj])) 
goal: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.invApp f U ≫
    f.c.app (Opposite.op ((AlgebraicGeometry.SheafedSpace.IsOpenImmersion.opensFunctor f).obj U)) =
  X.presheaf.map (CategoryTheory.eqToHom ⋯)

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.app_invApp
code: @[reassoc (attr := simp)]
theorem app_invApp (U : Opens Y) :
    f.c.app (op U) ≫ H.invApp ((Opens.map f.base).obj U) =
      Y.presheaf.map
        ((homOfLE (Set.image_preimage_subset f.base U.1)).op :
          op U ⟶ op (opensFunctor f |>.obj ((Opens.map f.base).obj U))) 
goal: f.c.app (Opposite.op U) ≫
    AlgebraicGeometry.SheafedSpace.IsOpenImmersion.invApp f ((TopologicalSpace.Opens.map f.base).obj U) =
  Y.presheaf.map (CategoryTheory.homOfLE ⋯).op

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.app_inv_app'
code: /-- A variant of `app_inv_app` that gives an `eqToHom` instead of `homOfLe`. -/
@[reassoc]
theorem app_inv_app' (U : Opens Y) (hU : (U : Set Y) ⊆ Set.range f.base) :
    f.c.app (op U) ≫ invApp f ((Opens.map f.base).obj U) =
      Y.presheaf.map
        (eqToHom <|
            le_antisymm (Set.image_preimage_subset f.base U.1) <|
              (Set.image_preimage_eq_inter_range (f := f.base) (t := U.1)).symm ▸
                Set.subset_inter_iff.mpr ⟨fun _ h => h, hU⟩).op 
goal: f.c.app (Opposite.op U) ≫
    AlgebraicGeometry.SheafedSpace.IsOpenImmersion.invApp f ((TopologicalSpace.Opens.map f.base).obj U) =
  Y.presheaf.map (CategoryTheory.eqToHom ⋯).op

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.ofRestrict
code: instance ofRestrict {X : TopCat} (Y : SheafedSpace C) {f : X ⟶ Y.carrier}
    (hf : OpenEmbedding f) : IsOpenImmersion (Y.ofRestrict hf) 
goal: AlgebraicGeometry.SheafedSpace.IsOpenImmersion (Y.ofRestrict hf)

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.ofRestrict_invApp
code: @[elementwise, simp]
theorem ofRestrict_invApp {C : Type*} [Category C] (X : SheafedSpace C) {Y : TopCat}
    {f : Y ⟶ TopCat.of X.carrier} (h : OpenEmbedding f) (U : Opens (X.restrict h).carrier) :
    (SheafedSpace.IsOpenImmersion.ofRestrict X h).invApp U = 𝟙 _ 
goal: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.invApp (X.ofRestrict h) U =
  𝟙 ((X.restrict h).presheaf.obj (Opposite.op U))

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.to_iso
code: /-- An open immersion is an iso if the underlying continuous map is epi. -/
theorem to_iso [h' : Epi f.base] : IsIso f 
goal: CategoryTheory.IsIso f

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.stalk_iso
code: instance stalk_iso [HasColimits C] (x : X) :
    IsIso (f.stalkMap x) 
goal: CategoryTheory.IsIso (AlgebraicGeometry.PresheafedSpace.Hom.stalkMap f x)

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sigma_ι_openEmbedding
code: theorem sigma_ι_openEmbedding : OpenEmbedding (colimit.ι F i).base 
goal: OpenEmbedding ⇑(CategoryTheory.Limits.colimit.ι F i).base

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.image_preimage_is_empty
code: theorem image_preimage_is_empty (j : Discrete ι) (h : i ≠ j) (U : Opens (F.obj i)) :
    (Opens.map (colimit.ι (F ⋙ SheafedSpace.forgetToPresheafedSpace) j).base).obj
        ((Opens.map (preservesColimitIso SheafedSpace.forgetToPresheafedSpace F).inv.base).obj
          ((sigma_ι_openEmbedding F i).isOpenMap.functor.obj U)) =
      ⊥ 
goal: (TopologicalSpace.Opens.map
        (CategoryTheory.Limits.colimit.ι (F ⋙ AlgebraicGeometry.SheafedSpace.forgetToPresheafedSpace) j).base).obj
    ((TopologicalSpace.Opens.map
          (CategoryTheory.preservesColimitIso AlgebraicGeometry.SheafedSpace.forgetToPresheafedSpace F).inv.base).obj
      (⋯.functor.obj U)) =
  ⊥

full_name: AlgebraicGeometry.SheafedSpace.IsOpenImmersion.sigma_ι_isOpenImmersion
code: instance sigma_ι_isOpenImmersion [HasStrictTerminalObjects C] :
    SheafedSpace.IsOpenImmersion (colimit.ι F i) 
goal: AlgebraicGeometry.SheafedSpace.IsOpenImmersion (CategoryTheory.Limits.colimit.ι F i)

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.instOfRestrict
code: instance (X : LocallyRingedSpace) {U : TopCat} (f : U ⟶ X.toTopCat) (hf : OpenEmbedding f) :
    LocallyRingedSpace.IsOpenImmersion (X.ofRestrict hf) 
goal: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion (X.ofRestrict hf)

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.of_isIso
code: instance (priority := 100) of_isIso [IsIso g] : LocallyRingedSpace.IsOpenImmersion g 
goal: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion g

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.comp
code: instance comp (g : Z ⟶ Y) [LocallyRingedSpace.IsOpenImmersion g] :
    LocallyRingedSpace.IsOpenImmersion (f ≫ g) 
goal: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion (f ≫ g)

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.mono
code: instance mono : Mono f 
goal: CategoryTheory.Mono f

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.instIsOpenImmersionCommRingCatMapSheafedSpaceForgetToSheafedSpace
code: instance : SheafedSpace.IsOpenImmersion (LocallyRingedSpace.forgetToSheafedSpace.map f) 
goal: AlgebraicGeometry.SheafedSpace.IsOpenImmersion (AlgebraicGeometry.LocallyRingedSpace.forgetToSheafedSpace.map f)

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.pullbackConeOfLeft
code: /-- An explicit pullback cone over `cospan f g` if `f` is an open immersion. -/
def pullbackConeOfLeft : PullbackCone f g 
goal: CategoryTheory.Limits.PullbackCone f g

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.instSndPullbackConeOfLeft
code: instance : LocallyRingedSpace.IsOpenImmersion (pullbackConeOfLeft f g).snd 
goal: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion
  (AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.pullbackConeOfLeft f g).snd

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.pullbackConeOfLeftIsLimit
code: /-- The constructed `pullbackConeOfLeft` is indeed limiting. -/
def pullbackConeOfLeftIsLimit : IsLimit (pullbackConeOfLeft f g) 
goal: CategoryTheory.Limits.IsLimit (AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.pullbackConeOfLeft f g)

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.hasPullback_of_left
code: instance hasPullback_of_left : HasPullback f g 
goal: CategoryTheory.Limits.HasPullback f g

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.hasPullback_of_right
code: instance hasPullback_of_right : HasPullback g f 
goal: CategoryTheory.Limits.HasPullback g f

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.pullback_snd_of_left
code: /-- Open immersions are stable under base-change. -/
instance pullback_snd_of_left :
    LocallyRingedSpace.IsOpenImmersion (pullback.snd f g) 
goal: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion (CategoryTheory.Limits.pullback.snd f g)

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.pullback_fst_of_right
code: /-- Open immersions are stable under base-change. -/
instance pullback_fst_of_right :
    LocallyRingedSpace.IsOpenImmersion (pullback.fst g f) 
goal: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion (CategoryTheory.Limits.pullback.fst g f)

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.pullback_to_base_isOpenImmersion
code: instance pullback_to_base_isOpenImmersion [LocallyRingedSpace.IsOpenImmersion g] :
    LocallyRingedSpace.IsOpenImmersion (limit.π (cospan f g) WalkingCospan.one) 
goal: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion
  (CategoryTheory.Limits.limit.π (CategoryTheory.Limits.cospan f g) CategoryTheory.Limits.WalkingCospan.one)

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetPreservesPullbackOfLeft
code: instance forgetPreservesPullbackOfLeft :
    PreservesLimit (cospan f g) LocallyRingedSpace.forgetToSheafedSpace 
goal: CategoryTheory.Limits.PreservesLimit (CategoryTheory.Limits.cospan f g)
  AlgebraicGeometry.LocallyRingedSpace.forgetToSheafedSpace

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToPresheafedSpacePreservesPullbackOfLeft
code: instance forgetToPresheafedSpacePreservesPullbackOfLeft :
    PreservesLimit (cospan f g)
      (LocallyRingedSpace.forgetToSheafedSpace ⋙ SheafedSpace.forgetToPresheafedSpace) 
goal: CategoryTheory.Limits.PreservesLimit (CategoryTheory.Limits.cospan f g)
  (AlgebraicGeometry.LocallyRingedSpace.forgetToSheafedSpace ⋙ AlgebraicGeometry.SheafedSpace.forgetToPresheafedSpace)

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToPresheafedSpacePreservesOpenImmersion
code: instance forgetToPresheafedSpacePreservesOpenImmersion :
    PresheafedSpace.IsOpenImmersion
      ((LocallyRingedSpace.forgetToSheafedSpace ⋙ SheafedSpace.forgetToPresheafedSpace).map f) 
goal: AlgebraicGeometry.PresheafedSpace.IsOpenImmersion
  ((AlgebraicGeometry.LocallyRingedSpace.forgetToSheafedSpace ⋙
        AlgebraicGeometry.SheafedSpace.forgetToPresheafedSpace).map
    f)

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToTopPreservesPullbackOfLeft
code: instance forgetToTopPreservesPullbackOfLeft :
    PreservesLimit (cospan f g)
      (LocallyRingedSpace.forgetToSheafedSpace ⋙ SheafedSpace.forget _) 
goal: CategoryTheory.Limits.PreservesLimit (CategoryTheory.Limits.cospan f g)
  (AlgebraicGeometry.LocallyRingedSpace.forgetToSheafedSpace ⋙ AlgebraicGeometry.SheafedSpace.forget CommRingCat)

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetReflectsPullbackOfLeft
code: instance forgetReflectsPullbackOfLeft :
    ReflectsLimit (cospan f g) LocallyRingedSpace.forgetToSheafedSpace 
goal: CategoryTheory.Limits.ReflectsLimit (CategoryTheory.Limits.cospan f g)
  AlgebraicGeometry.LocallyRingedSpace.forgetToSheafedSpace

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetPreservesPullbackOfRight
code: instance forgetPreservesPullbackOfRight :
    PreservesLimit (cospan g f) LocallyRingedSpace.forgetToSheafedSpace 
goal: CategoryTheory.Limits.PreservesLimit (CategoryTheory.Limits.cospan g f)
  AlgebraicGeometry.LocallyRingedSpace.forgetToSheafedSpace

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToPresheafedSpacePreservesPullbackOfRight
code: instance forgetToPresheafedSpacePreservesPullbackOfRight :
    PreservesLimit (cospan g f)
      (LocallyRingedSpace.forgetToSheafedSpace ⋙ SheafedSpace.forgetToPresheafedSpace) 
goal: CategoryTheory.Limits.PreservesLimit (CategoryTheory.Limits.cospan g f)
  (AlgebraicGeometry.LocallyRingedSpace.forgetToSheafedSpace ⋙ AlgebraicGeometry.SheafedSpace.forgetToPresheafedSpace)

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetReflectsPullbackOfRight
code: instance forgetReflectsPullbackOfRight :
    ReflectsLimit (cospan g f) LocallyRingedSpace.forgetToSheafedSpace 
goal: CategoryTheory.Limits.ReflectsLimit (CategoryTheory.Limits.cospan g f)
  AlgebraicGeometry.LocallyRingedSpace.forgetToSheafedSpace

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToPresheafedSpaceReflectsPullbackOfLeft
code: instance forgetToPresheafedSpaceReflectsPullbackOfLeft :
    ReflectsLimit (cospan f g)
      (LocallyRingedSpace.forgetToSheafedSpace ⋙ SheafedSpace.forgetToPresheafedSpace) 
goal: CategoryTheory.Limits.ReflectsLimit (CategoryTheory.Limits.cospan f g)
  (AlgebraicGeometry.LocallyRingedSpace.forgetToSheafedSpace ⋙ AlgebraicGeometry.SheafedSpace.forgetToPresheafedSpace)

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.forgetToPresheafedSpaceReflectsPullbackOfRight
code: instance forgetToPresheafedSpaceReflectsPullbackOfRight :
    ReflectsLimit (cospan g f)
      (LocallyRingedSpace.forgetToSheafedSpace ⋙ SheafedSpace.forgetToPresheafedSpace) 
goal: CategoryTheory.Limits.ReflectsLimit (CategoryTheory.Limits.cospan g f)
  (AlgebraicGeometry.LocallyRingedSpace.forgetToSheafedSpace ⋙ AlgebraicGeometry.SheafedSpace.forgetToPresheafedSpace)

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.pullback_snd_isIso_of_range_subset
code: theorem pullback_snd_isIso_of_range_subset (H' : Set.range g.1.base ⊆ Set.range f.1.base) :
    IsIso (pullback.snd f g) 
goal: CategoryTheory.IsIso (CategoryTheory.Limits.pullback.snd f g)

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.lift
code: /-- The universal property of open immersions:
For an open immersion `f : X ⟶ Z`, given any morphism of schemes `g : Y ⟶ Z` whose topological
image is contained in the image of `f`, we can lift this morphism to a unique `Y ⟶ X` that
commutes with these maps.
-/
def lift (H' : Set.range g.1.base ⊆ Set.range f.1.base) : Y ⟶ X 
goal: Y ⟶ X

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.lift_fac
code: @[simp, reassoc]
theorem lift_fac (H' : Set.range g.1.base ⊆ Set.range f.1.base) : lift f g H' ≫ f = g 
goal: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.lift f g H' ≫ f = g

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.lift_uniq
code: theorem lift_uniq (H' : Set.range g.1.base ⊆ Set.range f.1.base) (l : Y ⟶ X) (hl : l ≫ f = g) :
    l = lift f g H' 
goal: l = AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.lift f g H'

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.lift_range
code: theorem lift_range (H' : Set.range g.1.base ⊆ Set.range f.1.base) :
    Set.range (lift f g H').1.base = f.1.base ⁻¹' Set.range g.1.base 
goal: Set.range ⇑(AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.lift f g H').val.base =
  ⇑f.val.base ⁻¹' Set.range ⇑g.val.base

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.isoRestrict
code: /-- An open immersion is isomorphic to the induced open subscheme on its image. -/
noncomputable def isoRestrict {X Y : LocallyRingedSpace} (f : X ⟶ Y)
    [H : LocallyRingedSpace.IsOpenImmersion f] :
    X ≅ Y.restrict H.base_open 
goal: X ≅ Y.restrict ⋯

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.opensFunctor
code: /-- The functor `Opens X ⥤ Opens Y` associated with an open immersion `f : X ⟶ Y`. -/
abbrev opensFunctor {X Y : LocallyRingedSpace} (f : X ⟶ Y)
    [H : LocallyRingedSpace.IsOpenImmersion f] : Opens X ⥤ Opens Y 
goal: TopologicalSpace.Opens ↑X.toTopCat ⥤ TopologicalSpace.Opens ↑Y.toTopCat

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.of_stalk_iso
code: /-- Suppose `X Y : SheafedSpace C`, where `C` is a concrete category,
whose forgetful functor reflects isomorphisms, preserves limits and filtered colimits.
Then a morphism `X ⟶ Y` that is a topological open embedding
is an open immersion iff every stalk map is an iso.
-/
theorem of_stalk_iso {X Y : LocallyRingedSpace} (f : X ⟶ Y) (hf : OpenEmbedding f.1.base)
    [stalk_iso : ∀ x : X.1, IsIso (f.stalkMap x)] :
    LocallyRingedSpace.IsOpenImmersion f 
goal: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion f

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.isoRestrict_hom_ofRestrict
code: @[reassoc (attr := simp)]
theorem isoRestrict_hom_ofRestrict : (isoRestrict f).hom ≫ Y.ofRestrict _ = f 
goal: (AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.isoRestrict f).hom ≫ Y.ofRestrict ⋯ = f

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.isoRestrict_inv_ofRestrict
code: @[reassoc (attr := simp)]
theorem isoRestrict_inv_ofRestrict : (isoRestrict f).inv ≫ f = Y.ofRestrict _ 
goal: (AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.isoRestrict f).inv ≫ f = Y.ofRestrict ⋯

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.invApp
code: /-- For an open immersion `f : X ⟶ Y` and an open set `U ⊆ X`, we have the map `X(U) ⟶ Y(U)`. -/
noncomputable def invApp (U : Opens X) :
    X.presheaf.obj (op U) ⟶ Y.presheaf.obj (op (opensFunctor f |>.obj U)) 
goal: X.presheaf.obj (Opposite.op U) ⟶
  Y.presheaf.obj (Opposite.op ((AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.opensFunctor f).obj U))

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.inv_naturality
code: @[reassoc (attr := simp)]
theorem inv_naturality {U V : (Opens X)ᵒᵖ} (i : U ⟶ V) :
    X.presheaf.map i ≫ H.invApp (unop V) =
      H.invApp (unop U) ≫ Y.presheaf.map (opensFunctor f |>.op.map i) 
goal: X.presheaf.map i ≫ AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.invApp f (Opposite.unop V) =
  AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.invApp f (Opposite.unop U) ≫
    Y.presheaf.map ((AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.opensFunctor f).op.map i)

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.instIsIsoCommRingCatInvApp
code: instance (U : Opens X) : IsIso (H.invApp U) 
goal: CategoryTheory.IsIso (AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.invApp f U)

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.inv_invApp
code: theorem inv_invApp (U : Opens X) :
    inv (H.invApp U) =
      f.1.c.app (op (opensFunctor f |>.obj U)) ≫
        X.presheaf.map (eqToHom (by simp [Opens.map, Set.preimage_image_eq _ H.base_open.inj])) 
goal: CategoryTheory.inv (AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.invApp f U) =
  f.val.c.app (Opposite.op ((AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.opensFunctor f).obj U)) ≫
    X.presheaf.map (CategoryTheory.eqToHom ⋯)

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.invApp_app
code: @[reassoc (attr := simp)]
theorem invApp_app (U : Opens X) :
    H.invApp U ≫ f.1.c.app (op (opensFunctor f |>.obj U)) =
      X.presheaf.map (eqToHom (by simp [Opens.map, Set.preimage_image_eq _ H.base_open.inj])) 
goal: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.invApp f U ≫
    f.val.c.app (Opposite.op ((AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.opensFunctor f).obj U)) =
  X.presheaf.map (CategoryTheory.eqToHom ⋯)

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.app_invApp
code: @[reassoc (attr := simp)]
theorem app_invApp (U : Opens Y) :
    f.1.c.app (op U) ≫ H.invApp ((Opens.map f.1.base).obj U) =
      Y.presheaf.map
        ((homOfLE (Set.image_preimage_subset f.1.base U.1)).op :
          op U ⟶ op (opensFunctor f |>.obj ((Opens.map f.1.base).obj U))) 
goal: f.val.c.app (Opposite.op U) ≫
    AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.invApp f ((TopologicalSpace.Opens.map f.val.base).obj U) =
  Y.presheaf.map (CategoryTheory.homOfLE ⋯).op

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.app_inv_app'
code: /-- A variant of `app_inv_app` that gives an `eqToHom` instead of `homOfLe`. -/
@[reassoc]
theorem app_inv_app' (U : Opens Y) (hU : (U : Set Y) ⊆ Set.range f.1.base) :
    f.1.c.app (op U) ≫ H.invApp ((Opens.map f.1.base).obj U) =
      Y.presheaf.map
        (eqToHom <|
            le_antisymm (Set.image_preimage_subset f.1.base U.1) <|
              (Set.image_preimage_eq_inter_range (f := f.1.base) (t := U.1)).symm ▸
                Set.subset_inter_iff.mpr ⟨fun _ h => h, hU⟩).op 
goal: f.val.c.app (Opposite.op U) ≫
    AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.invApp f ((TopologicalSpace.Opens.map f.val.base).obj U) =
  Y.presheaf.map (CategoryTheory.eqToHom ⋯).op

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.ofRestrict
code: instance ofRestrict {X : TopCat} (Y : LocallyRingedSpace) {f : X ⟶ Y.carrier}
    (hf : OpenEmbedding f) : IsOpenImmersion (Y.ofRestrict hf) 
goal: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion (Y.ofRestrict hf)

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.ofRestrict_invApp
code: @[elementwise, simp]
theorem ofRestrict_invApp (X : LocallyRingedSpace) {Y : TopCat}
    {f : Y ⟶ TopCat.of X.carrier} (h : OpenEmbedding f) (U : Opens (X.restrict h).carrier) :
    (LocallyRingedSpace.IsOpenImmersion.ofRestrict X h).invApp U = 𝟙 _ 
goal: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.invApp (X.ofRestrict h) U =
  𝟙 ((X.restrict h).presheaf.obj (Opposite.op U))

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.stalk_iso
code: instance stalk_iso (x : X) : IsIso (f.stalkMap x) 
goal: CategoryTheory.IsIso (AlgebraicGeometry.LocallyRingedSpace.Hom.stalkMap f x)

full_name: AlgebraicGeometry.LocallyRingedSpace.IsOpenImmersion.to_iso
code: theorem to_iso [h' : Epi f.1.base] : IsIso f 
goal: CategoryTheory.IsIso f