l3lab/ntp-mathlib huggingface dataset:
/-- Restricting a morphism twice onto a basic open set is isomorphic to one restriction.  -/
def morphismRestrictRestrictBasicOpen {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y)
    (r : Y.presheaf.obj (op U)) :
    Arrow.mk
        (f ∣_ U ∣_
          (Y ∣_ᵤ U).basicOpen (Y.presheaf.map (eqToHom U.openEmbedding_obj_top).op r)) ≅
      Arrow.mk (f ∣_ Y.basicOpen r) := by
  refine' morphismRestrictRestrict _ _ _ ≪≫ morphismRestrictEq _ _
  have e := Scheme.preimage_basicOpen (Y.ofRestrict U.openEmbedding) r
  erw [Scheme.ofRestrict_val_c_app, Opens.adjunction_counit_app_self, eqToHom_op] at e
  

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X Y : Scheme
f : X ⟶ Y
U : Opens ↑↑Y.toPresheafedSpace
r : ↑(Y.presheaf.obj (op U))
e :
  Scheme.ofRestrict Y (_ : OpenEmbedding ⇑(Opens.inclusion U))⁻¹ᵁ Y.basicOpen r =
    (Y ∣_ᵤ U).basicOpen
      ((Y.presheaf.map
          (eqToHom
            (_ :
              op (op U).unop =
                op
                  ((IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj
                    ((Opens.map (Opens.inclusion U)).obj (op U).unop)))))
        r)
⊢ (IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj
      ((Y ∣_ᵤ U).basicOpen
        ((Y.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj ⊤ = U)).op) r)) =
    Y.basicOpen r

Next tactic:
rw [← (Y.restrict U.openEmbedding).basicOpen_res_eq _ (eqToHom U.inclusion_map_eq_top).op]
/-- Restricting a morphism twice onto a basic open set is isomorphic to one restriction.  -/
def morphismRestrictRestrictBasicOpen {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y)
    (r : Y.presheaf.obj (op U)) :
    Arrow.mk
        (f ∣_ U ∣_
          (Y ∣_ᵤ U).basicOpen (Y.presheaf.map (eqToHom U.openEmbedding_obj_top).op r)) ≅
      Arrow.mk (f ∣_ Y.basicOpen r) := by
  refine' morphismRestrictRestrict _ _ _ ≪≫ morphismRestrictEq _ _
  have e := Scheme.preimage_basicOpen (Y.ofRestrict U.openEmbedding) r
  erw [Scheme.ofRestrict_val_c_app, Opens.adjunction_counit_app_self, eqToHom_op] at e
  rw [← (Y.restrict U.openEmbedding).basicOpen_res_eq _ (eqToHom U.inclusion_map_eq_top).op]
  

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X Y : Scheme
f : X ⟶ Y
U : Opens ↑↑Y.toPresheafedSpace
r : ↑(Y.presheaf.obj (op U))
e :
  Scheme.ofRestrict Y (_ : OpenEmbedding ⇑(Opens.inclusion U))⁻¹ᵁ Y.basicOpen r =
    (Y ∣_ᵤ U).basicOpen
      ((Y.presheaf.map
          (eqToHom
            (_ :
              op (op U).unop =
                op
                  ((IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj
                    ((Opens.map (Opens.inclusion U)).obj (op U).unop)))))
        r)
⊢ (IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj
      ((Y ∣_ᵤ U).basicOpen
        (((Y ∣_ᵤ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.map
            (eqToHom (_ : (Opens.map (Opens.inclusion U)).obj U = ⊤)).op)
          ((Y.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj ⊤ = U)).op) r))) =
    Y.basicOpen r

Next tactic:
erw [← comp_apply]
/-- Restricting a morphism twice onto a basic open set is isomorphic to one restriction.  -/
def morphismRestrictRestrictBasicOpen {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y)
    (r : Y.presheaf.obj (op U)) :
    Arrow.mk
        (f ∣_ U ∣_
          (Y ∣_ᵤ U).basicOpen (Y.presheaf.map (eqToHom U.openEmbedding_obj_top).op r)) ≅
      Arrow.mk (f ∣_ Y.basicOpen r) := by
  refine' morphismRestrictRestrict _ _ _ ≪≫ morphismRestrictEq _ _
  have e := Scheme.preimage_basicOpen (Y.ofRestrict U.openEmbedding) r
  erw [Scheme.ofRestrict_val_c_app, Opens.adjunction_counit_app_self, eqToHom_op] at e
  rw [← (Y.restrict U.openEmbedding).basicOpen_res_eq _ (eqToHom U.inclusion_map_eq_top).op]
  erw [← comp_apply]
  

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X Y : Scheme
f : X ⟶ Y
U : Opens ↑↑Y.toPresheafedSpace
r : ↑(Y.presheaf.obj (op U))
e :
  Scheme.ofRestrict Y (_ : OpenEmbedding ⇑(Opens.inclusion U))⁻¹ᵁ Y.basicOpen r =
    (Y ∣_ᵤ U).basicOpen
      ((Y.presheaf.map
          (eqToHom
            (_ :
              op (op U).unop =
                op
                  ((IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj
                    ((Opens.map (Opens.inclusion U)).obj (op U).unop)))))
        r)
⊢ (IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj
      ((Y ∣_ᵤ U).basicOpen
        ((Y.presheaf.map (eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj ⊤ = U)).op ≫
            (Y ∣_ᵤ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf.map
              (eqToHom (_ : (Opens.map (Opens.inclusion U)).obj U = ⊤)).op)
          r)) =
    Y.basicOpen r

Next tactic:
erw [← Y.presheaf.map_comp]
/-- Restricting a morphism twice onto a basic open set is isomorphic to one restriction.  -/
def morphismRestrictRestrictBasicOpen {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y)
    (r : Y.presheaf.obj (op U)) :
    Arrow.mk
        (f ∣_ U ∣_
          (Y ∣_ᵤ U).basicOpen (Y.presheaf.map (eqToHom U.openEmbedding_obj_top).op r)) ≅
      Arrow.mk (f ∣_ Y.basicOpen r) := by
  refine' morphismRestrictRestrict _ _ _ ≪≫ morphismRestrictEq _ _
  have e := Scheme.preimage_basicOpen (Y.ofRestrict U.openEmbedding) r
  erw [Scheme.ofRestrict_val_c_app, Opens.adjunction_counit_app_self, eqToHom_op] at e
  rw [← (Y.restrict U.openEmbedding).basicOpen_res_eq _ (eqToHom U.inclusion_map_eq_top).op]
  erw [← comp_apply]
  erw [← Y.presheaf.map_comp]
  

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X Y : Scheme
f : X ⟶ Y
U : Opens ↑↑Y.toPresheafedSpace
r : ↑(Y.presheaf.obj (op U))
e :
  Scheme.ofRestrict Y (_ : OpenEmbedding ⇑(Opens.inclusion U))⁻¹ᵁ Y.basicOpen r =
    (Y ∣_ᵤ U).basicOpen
      ((Y.presheaf.map
          (eqToHom
            (_ :
              op (op U).unop =
                op
                  ((IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj
                    ((Opens.map (Opens.inclusion U)).obj (op U).unop)))))
        r)
⊢ (IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj
      ((Y ∣_ᵤ U).basicOpen
        ((Y.presheaf.map
            ((eqToHom (_ : (IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj ⊤ = U)).op ≫
              (IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).op.map
                (eqToHom (_ : (Opens.map (Opens.inclusion U)).obj U = ⊤)).op))
          r)) =
    Y.basicOpen r

Next tactic:
rw [eqToHom_op, eqToHom_op, eqToHom_map, eqToHom_trans]
/-- Restricting a morphism twice onto a basic open set is isomorphic to one restriction.  -/
def morphismRestrictRestrictBasicOpen {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y)
    (r : Y.presheaf.obj (op U)) :
    Arrow.mk
        (f ∣_ U ∣_
          (Y ∣_ᵤ U).basicOpen (Y.presheaf.map (eqToHom U.openEmbedding_obj_top).op r)) ≅
      Arrow.mk (f ∣_ Y.basicOpen r) := by
  refine' morphismRestrictRestrict _ _ _ ≪≫ morphismRestrictEq _ _
  have e := Scheme.preimage_basicOpen (Y.ofRestrict U.openEmbedding) r
  erw [Scheme.ofRestrict_val_c_app, Opens.adjunction_counit_app_self, eqToHom_op] at e
  rw [← (Y.restrict U.openEmbedding).basicOpen_res_eq _ (eqToHom U.inclusion_map_eq_top).op]
  erw [← comp_apply]
  erw [← Y.presheaf.map_comp]
  rw [eqToHom_op, eqToHom_op, eqToHom_map, eqToHom_trans]
  

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X Y : Scheme
f : X ⟶ Y
U : Opens ↑↑Y.toPresheafedSpace
r : ↑(Y.presheaf.obj (op U))
e :
  Scheme.ofRestrict Y (_ : OpenEmbedding ⇑(Opens.inclusion U))⁻¹ᵁ Y.basicOpen r =
    (Y ∣_ᵤ U).basicOpen
      ((Y.presheaf.map
          (eqToHom
            (_ :
              op (op U).unop =
                op
                  ((IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj
                    ((Opens.map (Opens.inclusion U)).obj (op U).unop)))))
        r)
⊢ (IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj
      ((Y ∣_ᵤ U).basicOpen
        ((Y.presheaf.map
            (eqToHom
              (_ :
                op U =
                  (IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).op.obj
                    (op ((Opens.map (Opens.inclusion U)).obj U)))))
          r)) =
    Y.basicOpen r

Next tactic:
erw [← e]
/-- Restricting a morphism twice onto a basic open set is isomorphic to one restriction.  -/
def morphismRestrictRestrictBasicOpen {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y)
    (r : Y.presheaf.obj (op U)) :
    Arrow.mk
        (f ∣_ U ∣_
          (Y ∣_ᵤ U).basicOpen (Y.presheaf.map (eqToHom U.openEmbedding_obj_top).op r)) ≅
      Arrow.mk (f ∣_ Y.basicOpen r) := by
  refine' morphismRestrictRestrict _ _ _ ≪≫ morphismRestrictEq _ _
  have e := Scheme.preimage_basicOpen (Y.ofRestrict U.openEmbedding) r
  erw [Scheme.ofRestrict_val_c_app, Opens.adjunction_counit_app_self, eqToHom_op] at e
  rw [← (Y.restrict U.openEmbedding).basicOpen_res_eq _ (eqToHom U.inclusion_map_eq_top).op]
  erw [← comp_apply]
  erw [← Y.presheaf.map_comp]
  rw [eqToHom_op, eqToHom_op, eqToHom_map, eqToHom_trans]
  erw [← e]
  

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X Y : Scheme
f : X ⟶ Y
U : Opens ↑↑Y.toPresheafedSpace
r : ↑(Y.presheaf.obj (op U))
e :
  Scheme.ofRestrict Y (_ : OpenEmbedding ⇑(Opens.inclusion U))⁻¹ᵁ Y.basicOpen r =
    (Y ∣_ᵤ U).basicOpen
      ((Y.presheaf.map
          (eqToHom
            (_ :
              op (op U).unop =
                op
                  ((IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj
                    ((Opens.map (Opens.inclusion U)).obj (op U).unop)))))
        r)
⊢ (IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj
      (Scheme.ofRestrict Y (_ : OpenEmbedding ⇑(Opens.inclusion U))⁻¹ᵁ Y.basicOpen r) =
    Y.basicOpen r

Next tactic:
ext1
/-- Restricting a morphism twice onto a basic open set is isomorphic to one restriction.  -/
def morphismRestrictRestrictBasicOpen {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y)
    (r : Y.presheaf.obj (op U)) :
    Arrow.mk
        (f ∣_ U ∣_
          (Y ∣_ᵤ U).basicOpen (Y.presheaf.map (eqToHom U.openEmbedding_obj_top).op r)) ≅
      Arrow.mk (f ∣_ Y.basicOpen r) := by
  refine' morphismRestrictRestrict _ _ _ ≪≫ morphismRestrictEq _ _
  have e := Scheme.preimage_basicOpen (Y.ofRestrict U.openEmbedding) r
  erw [Scheme.ofRestrict_val_c_app, Opens.adjunction_counit_app_self, eqToHom_op] at e
  rw [← (Y.restrict U.openEmbedding).basicOpen_res_eq _ (eqToHom U.inclusion_map_eq_top).op]
  erw [← comp_apply]
  erw [← Y.presheaf.map_comp]
  rw [eqToHom_op, eqToHom_op, eqToHom_map, eqToHom_trans]
  erw [← e]
  ext1
  

Proof state:
case h
C : Type u
inst✝ : Category.{v, u} C
X Y : Scheme
f : X ⟶ Y
U : Opens ↑↑Y.toPresheafedSpace
r : ↑(Y.presheaf.obj (op U))
e :
  Scheme.ofRestrict Y (_ : OpenEmbedding ⇑(Opens.inclusion U))⁻¹ᵁ Y.basicOpen r =
    (Y ∣_ᵤ U).basicOpen
      ((Y.presheaf.map
          (eqToHom
            (_ :
              op (op U).unop =
                op
                  ((IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj
                    ((Opens.map (Opens.inclusion U)).obj (op U).unop)))))
        r)
⊢ ↑((IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj
        (Scheme.ofRestrict Y (_ : OpenEmbedding ⇑(Opens.inclusion U))⁻¹ᵁ Y.basicOpen r)) =
    ↑(Y.basicOpen r)

Next tactic:
dsimp [Opens.map_coe, Scheme.restrict]
/-- Restricting a morphism twice onto a basic open set is isomorphic to one restriction.  -/
def morphismRestrictRestrictBasicOpen {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y)
    (r : Y.presheaf.obj (op U)) :
    Arrow.mk
        (f ∣_ U ∣_
          (Y ∣_ᵤ U).basicOpen (Y.presheaf.map (eqToHom U.openEmbedding_obj_top).op r)) ≅
      Arrow.mk (f ∣_ Y.basicOpen r) := by
  refine' morphismRestrictRestrict _ _ _ ≪≫ morphismRestrictEq _ _
  have e := Scheme.preimage_basicOpen (Y.ofRestrict U.openEmbedding) r
  erw [Scheme.ofRestrict_val_c_app, Opens.adjunction_counit_app_self, eqToHom_op] at e
  rw [← (Y.restrict U.openEmbedding).basicOpen_res_eq _ (eqToHom U.inclusion_map_eq_top).op]
  erw [← comp_apply]
  erw [← Y.presheaf.map_comp]
  rw [eqToHom_op, eqToHom_op, eqToHom_map, eqToHom_trans]
  erw [← e]
  ext1
  dsimp [Opens.map_coe, Scheme.restrict]
  

Proof state:
case h
C : Type u
inst✝ : Category.{v, u} C
X Y : Scheme
f : X ⟶ Y
U : Opens ↑↑Y.toPresheafedSpace
r : ↑(Y.presheaf.obj (op U))
e :
  Scheme.ofRestrict Y (_ : OpenEmbedding ⇑(Opens.inclusion U))⁻¹ᵁ Y.basicOpen r =
    (Y ∣_ᵤ U).basicOpen
      ((Y.presheaf.map
          (eqToHom
            (_ :
              op (op U).unop =
                op
                  ((IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj
                    ((Opens.map (Opens.inclusion U)).obj (op U).unop)))))
        r)
⊢ Subtype.val '' (Subtype.val ⁻¹' ↑(Y.basicOpen r)) = ↑(Y.basicOpen r)

Next tactic:
rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left, Subtype.range_val]
/-- Restricting a morphism twice onto a basic open set is isomorphic to one restriction.  -/
def morphismRestrictRestrictBasicOpen {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y)
    (r : Y.presheaf.obj (op U)) :
    Arrow.mk
        (f ∣_ U ∣_
          (Y ∣_ᵤ U).basicOpen (Y.presheaf.map (eqToHom U.openEmbedding_obj_top).op r)) ≅
      Arrow.mk (f ∣_ Y.basicOpen r) := by
  refine' morphismRestrictRestrict _ _ _ ≪≫ morphismRestrictEq _ _
  have e := Scheme.preimage_basicOpen (Y.ofRestrict U.openEmbedding) r
  erw [Scheme.ofRestrict_val_c_app, Opens.adjunction_counit_app_self, eqToHom_op] at e
  rw [← (Y.restrict U.openEmbedding).basicOpen_res_eq _ (eqToHom U.inclusion_map_eq_top).op]
  erw [← comp_apply]
  erw [← Y.presheaf.map_comp]
  rw [eqToHom_op, eqToHom_op, eqToHom_map, eqToHom_trans]
  erw [← e]
  ext1
  dsimp [Opens.map_coe, Scheme.restrict]
  rw [Set.image_preimage_eq_inter_range, Set.inter_eq_left, Subtype.range_val]
  

Proof state:
case h
C : Type u
inst✝ : Category.{v, u} C
X Y : Scheme
f : X ⟶ Y
U : Opens ↑↑Y.toPresheafedSpace
r : ↑(Y.presheaf.obj (op U))
e :
  Scheme.ofRestrict Y (_ : OpenEmbedding ⇑(Opens.inclusion U))⁻¹ᵁ Y.basicOpen r =
    (Y ∣_ᵤ U).basicOpen
      ((Y.presheaf.map
          (eqToHom
            (_ :
              op (op U).unop =
                op
                  ((IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion U))).obj
                    ((Opens.map (Opens.inclusion U)).obj (op U).unop)))))
        r)
⊢ ↑(Y.basicOpen r) ⊆ ↑U

Next tactic:
exact Y.basicOpen_le r
/-- The stalk map of a restriction of a morphism is isomorphic to the stalk map of the original map.
-/
def morphismRestrictStalkMap {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) (x) :
    Arrow.mk (PresheafedSpace.stalkMap (f ∣_ U).1 x) ≅
      Arrow.mk (PresheafedSpace.stalkMap f.1 x.1) := by
  

Proof state:
C : Type u
inst✝ : Category.{v, u} C
X Y : Scheme
f : X ⟶ Y
U : Opens ↑↑Y.toPresheafedSpace
x : ↑↑(X ∣_ᵤ f⁻¹ᵁ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
⊢ Arrow.mk (PresheafedSpace.stalkMap (f ∣_ U).val x) ≅ Arrow.mk (PresheafedSpace.stalkMap f.val ↑x)

Next tactic:
fapply Arrow.isoMk'
/-- The stalk map of a restriction of a morphism is isomorphic to the stalk map of the original map.
-/
def morphismRestrictStalkMap {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) (x) :
    Arrow.mk (PresheafedSpace.stalkMap (f ∣_ U).1 x) ≅
      Arrow.mk (PresheafedSpace.stalkMap f.1 x.1) := by
  fapply Arrow.isoMk'
  · 

Proof state:
case e₁
C : Type u
inst✝ : Category.{v, u} C
X Y : Scheme
f : X ⟶ Y
U : Opens ↑↑Y.toPresheafedSpace
x : ↑↑(X ∣_ᵤ f⁻¹ᵁ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
⊢ PresheafedSpace.stalk (Y ∣_ᵤ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace ((f ∣_ U).val.base x) ≅
    PresheafedSpace.stalk Y.toPresheafedSpace (f.val.base ↑x)

Next tactic:
refine' Y.restrictStalkIso U.openEmbedding ((f ∣_ U).1.1 x) ≪≫ TopCat.Presheaf.stalkCongr _ _
/-- The stalk map of a restriction of a morphism is isomorphic to the stalk map of the original map.
-/
def morphismRestrictStalkMap {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) (x) :
    Arrow.mk (PresheafedSpace.stalkMap (f ∣_ U).1 x) ≅
      Arrow.mk (PresheafedSpace.stalkMap f.1 x.1) := by
  fapply Arrow.isoMk'
  · refine' Y.restrictStalkIso U.openEmbedding ((f ∣_ U).1.1 x) ≪≫ TopCat.Presheaf.stalkCongr _ _
    

Proof state:
case e₁
C : Type u
inst✝ : Category.{v, u} C
X Y : Scheme
f : X ⟶ Y
U : Opens ↑↑Y.toPresheafedSpace
x : ↑↑(X ∣_ᵤ f⁻¹ᵁ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
⊢ Inseparable ((Opens.inclusion U) ((f ∣_ U).val.base x)) (f.val.base ↑x)

Next tactic:
apply Inseparable.of_eq
/-- The stalk map of a restriction of a morphism is isomorphic to the stalk map of the original map.
-/
def morphismRestrictStalkMap {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) (x) :
    Arrow.mk (PresheafedSpace.stalkMap (f ∣_ U).1 x) ≅
      Arrow.mk (PresheafedSpace.stalkMap f.1 x.1) := by
  fapply Arrow.isoMk'
  · refine' Y.restrictStalkIso U.openEmbedding ((f ∣_ U).1.1 x) ≪≫ TopCat.Presheaf.stalkCongr _ _
    apply Inseparable.of_eq
    

Proof state:
case e₁.e
C : Type u
inst✝ : Category.{v, u} C
X Y : Scheme
f : X ⟶ Y
U : Opens ↑↑Y.toPresheafedSpace
x : ↑↑(X ∣_ᵤ f⁻¹ᵁ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
⊢ (Opens.inclusion U) ((f ∣_ U).val.base x) = f.val.base ↑x

Next tactic:
exact morphismRestrict_base_coe f U x
/-- The stalk map of a restriction of a morphism is isomorphic to the stalk map of the original map.
-/
def morphismRestrictStalkMap {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) (x) :
    Arrow.mk (PresheafedSpace.stalkMap (f ∣_ U).1 x) ≅
      Arrow.mk (PresheafedSpace.stalkMap f.1 x.1) := by
  fapply Arrow.isoMk'
  · refine' Y.restrictStalkIso U.openEmbedding ((f ∣_ U).1.1 x) ≪≫ TopCat.Presheaf.stalkCongr _ _
    apply Inseparable.of_eq
    exact morphismRestrict_base_coe f U x
  · 

Proof state:
case e₂
C : Type u
inst✝ : Category.{v, u} C
X Y : Scheme
f : X ⟶ Y
U : Opens ↑↑Y.toPresheafedSpace
x : ↑↑(X ∣_ᵤ f⁻¹ᵁ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
⊢ PresheafedSpace.stalk (X ∣_ᵤ f⁻¹ᵁ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace x ≅
    PresheafedSpace.stalk X.toPresheafedSpace ↑x

Next tactic:
exact X.restrictStalkIso (Opens.openEmbedding _) _
/-- The stalk map of a restriction of a morphism is isomorphic to the stalk map of the original map.
-/
def morphismRestrictStalkMap {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) (x) :
    Arrow.mk (PresheafedSpace.stalkMap (f ∣_ U).1 x) ≅
      Arrow.mk (PresheafedSpace.stalkMap f.1 x.1) := by
  fapply Arrow.isoMk'
  · refine' Y.restrictStalkIso U.openEmbedding ((f ∣_ U).1.1 x) ≪≫ TopCat.Presheaf.stalkCongr _ _
    apply Inseparable.of_eq
    exact morphismRestrict_base_coe f U x
  · exact X.restrictStalkIso (Opens.openEmbedding _) _
  · 

Proof state:
case h
C : Type u
inst✝ : Category.{v, u} C
X Y : Scheme
f : X ⟶ Y
U : Opens ↑↑Y.toPresheafedSpace
x : ↑↑(X ∣_ᵤ f⁻¹ᵁ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
⊢ autoParam
    ((PresheafedSpace.restrictStalkIso Y.toPresheafedSpace (_ : OpenEmbedding ⇑(Opens.inclusion U))
              ((f ∣_ U).val.base x) ≪≫
            TopCat.Presheaf.stalkCongr Y.presheaf
              (_ : Inseparable ((Opens.inclusion U) ((f ∣_ U).val.base x)) (f.val.base ↑x))).hom ≫
        PresheafedSpace.stalkMap f.val ↑x =
      PresheafedSpace.stalkMap (f ∣_ U).val x ≫
        (PresheafedSpace.restrictStalkIso X.toPresheafedSpace (_ : OpenEmbedding ⇑(Opens.inclusion (f⁻¹ᵁ U))) x).hom)
    _auto✝

Next tactic:
apply TopCat.Presheaf.stalk_hom_ext
/-- The stalk map of a restriction of a morphism is isomorphic to the stalk map of the original map.
-/
def morphismRestrictStalkMap {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) (x) :
    Arrow.mk (PresheafedSpace.stalkMap (f ∣_ U).1 x) ≅
      Arrow.mk (PresheafedSpace.stalkMap f.1 x.1) := by
  fapply Arrow.isoMk'
  · refine' Y.restrictStalkIso U.openEmbedding ((f ∣_ U).1.1 x) ≪≫ TopCat.Presheaf.stalkCongr _ _
    apply Inseparable.of_eq
    exact morphismRestrict_base_coe f U x
  · exact X.restrictStalkIso (Opens.openEmbedding _) _
  · apply TopCat.Presheaf.stalk_hom_ext
    

Proof state:
case h.ih
C : Type u
inst✝ : Category.{v, u} C
X Y : Scheme
f : X ⟶ Y
U : Opens ↑↑Y.toPresheafedSpace
x : ↑↑(X ∣_ᵤ f⁻¹ᵁ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
⊢ ∀ (U_1 : Opens ↑↑(Y ∣_ᵤ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace) (hxU : (f ∣_ U).val.base x ∈ U_1),
    TopCat.Presheaf.germ (Y ∣_ᵤ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf
          { val := (f ∣_ U).val.base x, property := hxU } ≫
        (PresheafedSpace.restrictStalkIso Y.toPresheafedSpace (_ : OpenEmbedding ⇑(Opens.inclusion U))
                ((f ∣_ U).val.base x) ≪≫
              TopCat.Presheaf.stalkCongr Y.presheaf
                (_ : Inseparable ((Opens.inclusion U) ((f ∣_ U).val.base x)) (f.val.base ↑x))).hom ≫
          PresheafedSpace.stalkMap f.val ↑x =
      TopCat.Presheaf.germ (Y ∣_ᵤ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf
          { val := (f ∣_ U).val.base x, property := hxU } ≫
        PresheafedSpace.stalkMap (f ∣_ U).val x ≫
          (PresheafedSpace.restrictStalkIso X.toPresheafedSpace (_ : OpenEmbedding ⇑(Opens.inclusion (f⁻¹ᵁ U))) x).hom

Next tactic:
intro V hxV
/-- The stalk map of a restriction of a morphism is isomorphic to the stalk map of the original map.
-/
def morphismRestrictStalkMap {X Y : Scheme} (f : X ⟶ Y) (U : Opens Y) (x) :
    Arrow.mk (PresheafedSpace.stalkMap (f ∣_ U).1 x) ≅
      Arrow.mk (PresheafedSpace.stalkMap f.1 x.1) := by
  fapply Arrow.isoMk'
  · refine' Y.restrictStalkIso U.openEmbedding ((f ∣_ U).1.1 x) ≪≫ TopCat.Presheaf.stalkCongr _ _
    apply Inseparable.of_eq
    exact morphismRestrict_base_coe f U x
  · exact X.restrictStalkIso (Opens.openEmbedding _) _
  · apply TopCat.Presheaf.stalk_hom_ext
    intro V hxV
    

Proof state:
case h.ih
C : Type u
inst✝ : Category.{v, u} C
X Y : Scheme
f : X ⟶ Y
U : Opens ↑↑Y.toPresheafedSpace
x : ↑↑(X ∣_ᵤ f⁻¹ᵁ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
V : Opens ↑↑(Y ∣_ᵤ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace
hxV : (f ∣_ U).val.base x ∈ V
⊢ TopCat.Presheaf.germ (Y ∣_ᵤ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf
        { val := (f ∣_ U).val.base x, property := hxV } ≫
      (PresheafedSpace.restrictStalkIso Y.toPresheafedSpace (_ : OpenEmbedding ⇑(Opens.inclusion U))
              ((f ∣_ U).val.base x) ≪≫
            TopCat.Presheaf.stalkCongr Y.presheaf
              (_ : Inseparable ((Opens.inclusion U) ((f ∣_ U).val.base x)) (f.val.base ↑x))).hom ≫
        PresheafedSpace.stalkMap f.val ↑x =
    TopCat.Presheaf.germ (Y ∣_ᵤ U).toLocallyRingedSpace.toSheafedSpace.toPresheafedSpace.presheaf
        { val := (f ∣_ U).val.base x, property := hxV } ≫
      PresheafedSpace.stalkMap (f ∣_ U).val x ≫
        (PresheafedSpace.restrictStalkIso X.toPresheafedSpace (_ : OpenEmbedding ⇑(Opens.inclusion (f⁻¹ᵁ U))) x).hom

Next tactic:
change ↑(f ⁻¹ᵁ U) at x