l3lab/ntp-mathlib huggingface dataset:
/-- Isomorphic `PresheafedSpace`s have naturally isomorphic presheaves. -/
@[simps]
def sheafIsoOfIso (H : X ≅ Y) : Y.2 ≅ H.hom.base _* X.2 where
  hom := H.hom.c
  inv := Presheaf.pushforwardToOfIso ((forget _).mapIso H).symm H.inv.c
  hom_inv_id := by
    ext U
    rw [NatTrans.comp_app]
    simpa using congr_arg (fun f => f ≫ eqToHom _) (congr_app H.inv_hom_id (op U))
  inv_hom_id := by
    ext U
    dsimp
    rw [NatTrans.comp_app, NatTrans.id_app]
    simp only [Presheaf.pushforwardObj_obj, op_obj, Presheaf.pushforwardToOfIso_app,
      Iso.symm_inv, mapIso_hom, forget_map, Iso.symm_hom, mapIso_inv,
      unop_op, eqToHom_map, assoc]
    have eq₁ := congr_app H.hom_inv_id (op ((Opens.map H.hom.base).obj U))
    

Proof state:
case w
C : Type u_1
inst✝ : Category.{?u.223152, u_1} C
X Y : PresheafedSpace C
H : X ≅ Y
U : Opens ↑↑Y
eq₁ :
  (H.hom ≫ H.inv).c.app (op ((Opens.map H.hom.base).obj U)) =
    (𝟙 X).c.app (op ((Opens.map H.hom.base).obj U)) ≫
      X.presheaf.map
        (eqToHom
          (_ :
            (Opens.map (𝟙 X).base).op.obj (op ((Opens.map H.hom.base).obj U)) =
              (Opens.map (H.hom ≫ H.inv).base).op.obj (op ((Opens.map H.hom.base).obj U))))
⊢ H.inv.c.app (op ((Opens.map H.hom.base).obj U)) ≫
      eqToHom
          (_ :
            Y.presheaf.obj (op ((Opens.map H.inv.base).obj ((Opens.map H.hom.base).obj U))) = Y.presheaf.obj (op U)) ≫
        H.hom.c.app (op U) =
    𝟙 (X.presheaf.obj (op ((Opens.map H.hom.base).obj U)))

Next tactic:
have eq₂ := H.hom.c.naturality (eqToHom (congr_obj (congr_arg Opens.map
      ((forget C).congr_map H.inv_hom_id.symm)) U)).op
/-- Isomorphic `PresheafedSpace`s have naturally isomorphic presheaves. -/
@[simps]
def sheafIsoOfIso (H : X ≅ Y) : Y.2 ≅ H.hom.base _* X.2 where
  hom := H.hom.c
  inv := Presheaf.pushforwardToOfIso ((forget _).mapIso H).symm H.inv.c
  hom_inv_id := by
    ext U
    rw [NatTrans.comp_app]
    simpa using congr_arg (fun f => f ≫ eqToHom _) (congr_app H.inv_hom_id (op U))
  inv_hom_id := by
    ext U
    dsimp
    rw [NatTrans.comp_app, NatTrans.id_app]
    simp only [Presheaf.pushforwardObj_obj, op_obj, Presheaf.pushforwardToOfIso_app,
      Iso.symm_inv, mapIso_hom, forget_map, Iso.symm_hom, mapIso_inv,
      unop_op, eqToHom_map, assoc]
    have eq₁ := congr_app H.hom_inv_id (op ((Opens.map H.hom.base).obj U))
    have eq₂ := H.hom.c.naturality (eqToHom (congr_obj (congr_arg Opens.map
      ((forget C).congr_map H.inv_hom_id.symm)) U)).op
    

Proof state:
case w
C : Type u_1
inst✝ : Category.{?u.223152, u_1} C
X Y : PresheafedSpace C
H : X ≅ Y
U : Opens ↑↑Y
eq₁ :
  (H.hom ≫ H.inv).c.app (op ((Opens.map H.hom.base).obj U)) =
    (𝟙 X).c.app (op ((Opens.map H.hom.base).obj U)) ≫
      X.presheaf.map
        (eqToHom
          (_ :
            (Opens.map (𝟙 X).base).op.obj (op ((Opens.map H.hom.base).obj U)) =
              (Opens.map (H.hom ≫ H.inv).base).op.obj (op ((Opens.map H.hom.base).obj U))))
eq₂ :
  Y.presheaf.map
        (eqToHom
            (_ : (Opens.map ((forget C).map (𝟙 Y))).obj U = (Opens.map ((forget C).map (H.inv ≫ H.hom))).obj U)).op ≫
      H.hom.c.app (op ((Opens.map ((forget C).map (𝟙 Y))).obj U)) =
    H.hom.c.app (op ((Opens.map ((forget C).map (H.inv ≫ H.hom))).obj U)) ≫
      (H.hom.base _* X.presheaf).map
        (eqToHom (_ : (Opens.map ((forget C).map (𝟙 Y))).obj U = (Opens.map ((forget C).map (H.inv ≫ H.hom))).obj U)).op
⊢ H.inv.c.app (op ((Opens.map H.hom.base).obj U)) ≫
      eqToHom
          (_ :
            Y.presheaf.obj (op ((Opens.map H.inv.base).obj ((Opens.map H.hom.base).obj U))) = Y.presheaf.obj (op U)) ≫
        H.hom.c.app (op U) =
    𝟙 (X.presheaf.obj (op ((Opens.map H.hom.base).obj U)))

Next tactic:
rw [id_c, NatTrans.id_app, id_comp, eqToHom_map, comp_c_app] at eq₁
/-- Isomorphic `PresheafedSpace`s have naturally isomorphic presheaves. -/
@[simps]
def sheafIsoOfIso (H : X ≅ Y) : Y.2 ≅ H.hom.base _* X.2 where
  hom := H.hom.c
  inv := Presheaf.pushforwardToOfIso ((forget _).mapIso H).symm H.inv.c
  hom_inv_id := by
    ext U
    rw [NatTrans.comp_app]
    simpa using congr_arg (fun f => f ≫ eqToHom _) (congr_app H.inv_hom_id (op U))
  inv_hom_id := by
    ext U
    dsimp
    rw [NatTrans.comp_app, NatTrans.id_app]
    simp only [Presheaf.pushforwardObj_obj, op_obj, Presheaf.pushforwardToOfIso_app,
      Iso.symm_inv, mapIso_hom, forget_map, Iso.symm_hom, mapIso_inv,
      unop_op, eqToHom_map, assoc]
    have eq₁ := congr_app H.hom_inv_id (op ((Opens.map H.hom.base).obj U))
    have eq₂ := H.hom.c.naturality (eqToHom (congr_obj (congr_arg Opens.map
      ((forget C).congr_map H.inv_hom_id.symm)) U)).op
    rw [id_c, NatTrans.id_app, id_comp, eqToHom_map, comp_c_app] at eq₁
    

Proof state:
case w
C : Type u_1
inst✝ : Category.{?u.223152, u_1} C
X Y : PresheafedSpace C
H : X ≅ Y
U : Opens ↑↑Y
eq₁ :
  H.inv.c.app (op ((Opens.map H.hom.base).obj U)) ≫
      H.hom.c.app (op ((Opens.map H.inv.base).obj (op ((Opens.map H.hom.base).obj U)).unop)) =
    eqToHom
      (_ :
        X.presheaf.obj ((Opens.map (𝟙 X).base).op.obj (op ((Opens.map H.hom.base).obj U))) =
          X.presheaf.obj ((Opens.map (H.hom ≫ H.inv).base).op.obj (op ((Opens.map H.hom.base).obj U))))
eq₂ :
  Y.presheaf.map
        (eqToHom
            (_ : (Opens.map ((forget C).map (𝟙 Y))).obj U = (Opens.map ((forget C).map (H.inv ≫ H.hom))).obj U)).op ≫
      H.hom.c.app (op ((Opens.map ((forget C).map (𝟙 Y))).obj U)) =
    H.hom.c.app (op ((Opens.map ((forget C).map (H.inv ≫ H.hom))).obj U)) ≫
      (H.hom.base _* X.presheaf).map
        (eqToHom (_ : (Opens.map ((forget C).map (𝟙 Y))).obj U = (Opens.map ((forget C).map (H.inv ≫ H.hom))).obj U)).op
⊢ H.inv.c.app (op ((Opens.map H.hom.base).obj U)) ≫
      eqToHom
          (_ :
            Y.presheaf.obj (op ((Opens.map H.inv.base).obj ((Opens.map H.hom.base).obj U))) = Y.presheaf.obj (op U)) ≫
        H.hom.c.app (op U) =
    𝟙 (X.presheaf.obj (op ((Opens.map H.hom.base).obj U)))

Next tactic:
rw [eqToHom_op, eqToHom_map] at eq₂
/-- Isomorphic `PresheafedSpace`s have naturally isomorphic presheaves. -/
@[simps]
def sheafIsoOfIso (H : X ≅ Y) : Y.2 ≅ H.hom.base _* X.2 where
  hom := H.hom.c
  inv := Presheaf.pushforwardToOfIso ((forget _).mapIso H).symm H.inv.c
  hom_inv_id := by
    ext U
    rw [NatTrans.comp_app]
    simpa using congr_arg (fun f => f ≫ eqToHom _) (congr_app H.inv_hom_id (op U))
  inv_hom_id := by
    ext U
    dsimp
    rw [NatTrans.comp_app, NatTrans.id_app]
    simp only [Presheaf.pushforwardObj_obj, op_obj, Presheaf.pushforwardToOfIso_app,
      Iso.symm_inv, mapIso_hom, forget_map, Iso.symm_hom, mapIso_inv,
      unop_op, eqToHom_map, assoc]
    have eq₁ := congr_app H.hom_inv_id (op ((Opens.map H.hom.base).obj U))
    have eq₂ := H.hom.c.naturality (eqToHom (congr_obj (congr_arg Opens.map
      ((forget C).congr_map H.inv_hom_id.symm)) U)).op
    rw [id_c, NatTrans.id_app, id_comp, eqToHom_map, comp_c_app] at eq₁
    rw [eqToHom_op, eqToHom_map] at eq₂
    

Proof state:
case w
C : Type u_1
inst✝ : Category.{?u.223152, u_1} C
X Y : PresheafedSpace C
H : X ≅ Y
U : Opens ↑↑Y
eq₁ :
  H.inv.c.app (op ((Opens.map H.hom.base).obj U)) ≫
      H.hom.c.app (op ((Opens.map H.inv.base).obj (op ((Opens.map H.hom.base).obj U)).unop)) =
    eqToHom
      (_ :
        X.presheaf.obj ((Opens.map (𝟙 X).base).op.obj (op ((Opens.map H.hom.base).obj U))) =
          X.presheaf.obj ((Opens.map (H.hom ≫ H.inv).base).op.obj (op ((Opens.map H.hom.base).obj U))))
eq₂ :
  eqToHom
        (_ :
          Y.presheaf.obj (op ((Opens.map ((forget C).map (H.inv ≫ H.hom))).obj U)) =
            Y.presheaf.obj (op ((Opens.map ((forget C).map (𝟙 Y))).obj U))) ≫
      H.hom.c.app (op ((Opens.map ((forget C).map (𝟙 Y))).obj U)) =
    H.hom.c.app (op ((Opens.map ((forget C).map (H.inv ≫ H.hom))).obj U)) ≫
      (H.hom.base _* X.presheaf).map
        (eqToHom
          (_ : op ((Opens.map ((forget C).map (H.inv ≫ H.hom))).obj U) = op ((Opens.map ((forget C).map (𝟙 Y))).obj U)))
⊢ H.inv.c.app (op ((Opens.map H.hom.base).obj U)) ≫
      eqToHom
          (_ :
            Y.presheaf.obj (op ((Opens.map H.inv.base).obj ((Opens.map H.hom.base).obj U))) = Y.presheaf.obj (op U)) ≫
        H.hom.c.app (op U) =
    𝟙 (X.presheaf.obj (op ((Opens.map H.hom.base).obj U)))

Next tactic:
erw [eq₂, reassoc_of% eq₁]
/-- Isomorphic `PresheafedSpace`s have naturally isomorphic presheaves. -/
@[simps]
def sheafIsoOfIso (H : X ≅ Y) : Y.2 ≅ H.hom.base _* X.2 where
  hom := H.hom.c
  inv := Presheaf.pushforwardToOfIso ((forget _).mapIso H).symm H.inv.c
  hom_inv_id := by
    ext U
    rw [NatTrans.comp_app]
    simpa using congr_arg (fun f => f ≫ eqToHom _) (congr_app H.inv_hom_id (op U))
  inv_hom_id := by
    ext U
    dsimp
    rw [NatTrans.comp_app, NatTrans.id_app]
    simp only [Presheaf.pushforwardObj_obj, op_obj, Presheaf.pushforwardToOfIso_app,
      Iso.symm_inv, mapIso_hom, forget_map, Iso.symm_hom, mapIso_inv,
      unop_op, eqToHom_map, assoc]
    have eq₁ := congr_app H.hom_inv_id (op ((Opens.map H.hom.base).obj U))
    have eq₂ := H.hom.c.naturality (eqToHom (congr_obj (congr_arg Opens.map
      ((forget C).congr_map H.inv_hom_id.symm)) U)).op
    rw [id_c, NatTrans.id_app, id_comp, eqToHom_map, comp_c_app] at eq₁
    rw [eqToHom_op, eqToHom_map] at eq₂
    erw [eq₂, reassoc_of% eq₁]
    

Proof state:
case w
C : Type u_1
inst✝ : Category.{?u.223152, u_1} C
X Y : PresheafedSpace C
H : X ≅ Y
U : Opens ↑↑Y
eq₁ :
  H.inv.c.app (op ((Opens.map H.hom.base).obj U)) ≫
      H.hom.c.app (op ((Opens.map H.inv.base).obj (op ((Opens.map H.hom.base).obj U)).unop)) =
    eqToHom
      (_ :
        X.presheaf.obj ((Opens.map (𝟙 X).base).op.obj (op ((Opens.map H.hom.base).obj U))) =
          X.presheaf.obj ((Opens.map (H.hom ≫ H.inv).base).op.obj (op ((Opens.map H.hom.base).obj U))))
eq₂ :
  eqToHom
        (_ :
          Y.presheaf.obj (op ((Opens.map ((forget C).map (H.inv ≫ H.hom))).obj U)) =
            Y.presheaf.obj (op ((Opens.map ((forget C).map (𝟙 Y))).obj U))) ≫
      H.hom.c.app (op ((Opens.map ((forget C).map (𝟙 Y))).obj U)) =
    H.hom.c.app (op ((Opens.map ((forget C).map (H.inv ≫ H.hom))).obj U)) ≫
      (H.hom.base _* X.presheaf).map
        (eqToHom
          (_ : op ((Opens.map ((forget C).map (H.inv ≫ H.hom))).obj U) = op ((Opens.map ((forget C).map (𝟙 Y))).obj U)))
⊢ eqToHom
        (_ :
          X.presheaf.obj ((Opens.map (𝟙 X).base).op.obj (op ((Opens.map H.hom.base).obj U))) =
            X.presheaf.obj ((Opens.map (H.hom ≫ H.inv).base).op.obj (op ((Opens.map H.hom.base).obj U)))) ≫
      (H.hom.base _* X.presheaf).map
        (eqToHom
          (_ :
            op ((Opens.map ((forget C).map (H.inv ≫ H.hom))).obj U) = op ((Opens.map ((forget C).map (𝟙 Y))).obj U))) =
    𝟙 (X.presheaf.obj (op ((Opens.map H.hom.base).obj U)))

Next tactic:
simp
/-- The map from the restriction of a presheafed space.
-/
@[simps]
def ofRestrict {U : TopCat} (X : PresheafedSpace C) {f : U ⟶ (X : TopCat)}
    (h : OpenEmbedding f) : X.restrict h ⟶ X where
  base := f
  c :=
    { app := fun V => X.presheaf.map (h.isOpenMap.adjunction.counit.app V.unop).op
      naturality := fun U V f =>
        show _ = _ ≫ X.presheaf.map _ by
          

Proof state:
C : Type u_1
inst✝ : Category.{?u.249254, u_1} C
U✝ : TopCat
X : PresheafedSpace C
f✝ : U✝ ⟶ ↑X
h : OpenEmbedding ⇑f✝
U V : (Opens ↑↑X)ᵒᵖ
f : U ⟶ V
⊢ X.presheaf.map f ≫ (fun V => X.presheaf.map ((IsOpenMap.adjunction (_ : IsOpenMap ⇑f✝)).counit.app V.unop).op) V =
    (fun V => X.presheaf.map ((IsOpenMap.adjunction (_ : IsOpenMap ⇑f✝)).counit.app V.unop).op) U ≫
      X.presheaf.map ((IsOpenMap.functor (_ : IsOpenMap ⇑f✝)).op.map ((Opens.map f✝).op.map f))

Next tactic:
rw [← map_comp, ← map_comp]
/-- The map from the restriction of a presheafed space.
-/
@[simps]
def ofRestrict {U : TopCat} (X : PresheafedSpace C) {f : U ⟶ (X : TopCat)}
    (h : OpenEmbedding f) : X.restrict h ⟶ X where
  base := f
  c :=
    { app := fun V => X.presheaf.map (h.isOpenMap.adjunction.counit.app V.unop).op
      naturality := fun U V f =>
        show _ = _ ≫ X.presheaf.map _ by
          rw [← map_comp, ← map_comp]
          

Proof state:
C : Type u_1
inst✝ : Category.{?u.249254, u_1} C
U✝ : TopCat
X : PresheafedSpace C
f✝ : U✝ ⟶ ↑X
h : OpenEmbedding ⇑f✝
U V : (Opens ↑↑X)ᵒᵖ
f : U ⟶ V
⊢ X.presheaf.map (f ≫ ((IsOpenMap.adjunction (_ : IsOpenMap ⇑f✝)).counit.app V.unop).op) =
    X.presheaf.map
      (((IsOpenMap.adjunction (_ : IsOpenMap ⇑f✝)).counit.app U.unop).op ≫
        (IsOpenMap.functor (_ : IsOpenMap ⇑f✝)).op.map ((Opens.map f✝).op.map f))

Next tactic:
rfl
instance ofRestrict_mono {U : TopCat} (X : PresheafedSpace C) (f : U ⟶ X.1) (hf : OpenEmbedding f) :
    Mono (X.ofRestrict hf) := by
  

Proof state:
C : Type u_1
inst✝ : Category.{?u.253961, u_1} C
U : TopCat
X : PresheafedSpace C
f : U ⟶ ↑X
hf : OpenEmbedding ⇑f
⊢ Mono (ofRestrict X hf)

Next tactic:
haveI : Mono f := (TopCat.mono_iff_injective _).mpr hf.inj
instance ofRestrict_mono {U : TopCat} (X : PresheafedSpace C) (f : U ⟶ X.1) (hf : OpenEmbedding f) :
    Mono (X.ofRestrict hf) := by
  haveI : Mono f := (TopCat.mono_iff_injective _).mpr hf.inj
  

Proof state:
C : Type u_1
inst✝ : Category.{?u.253961, u_1} C
U : TopCat
X : PresheafedSpace C
f : U ⟶ ↑X
hf : OpenEmbedding ⇑f
this : Mono f
⊢ Mono (ofRestrict X hf)

Next tactic:
constructor
instance ofRestrict_mono {U : TopCat} (X : PresheafedSpace C) (f : U ⟶ X.1) (hf : OpenEmbedding f) :
    Mono (X.ofRestrict hf) := by
  haveI : Mono f := (TopCat.mono_iff_injective _).mpr hf.inj
  constructor
  

Proof state:
case right_cancellation
C : Type u_1
inst✝ : Category.{?u.253961, u_1} C
U : TopCat
X : PresheafedSpace C
f : U ⟶ ↑X
hf : OpenEmbedding ⇑f
this : Mono f
⊢ ∀ {Z : PresheafedSpace C} (g h : Z ⟶ restrict X hf), g ≫ ofRestrict X hf = h ≫ ofRestrict X hf → g = h

Next tactic:
intro Z g₁ g₂ eq
instance ofRestrict_mono {U : TopCat} (X : PresheafedSpace C) (f : U ⟶ X.1) (hf : OpenEmbedding f) :
    Mono (X.ofRestrict hf) := by
  haveI : Mono f := (TopCat.mono_iff_injective _).mpr hf.inj
  constructor
  intro Z g₁ g₂ eq
  

Proof state:
case right_cancellation
C : Type u_1
inst✝ : Category.{?u.253961, u_1} C
U : TopCat
X : PresheafedSpace C
f : U ⟶ ↑X
hf : OpenEmbedding ⇑f
this : Mono f
Z : PresheafedSpace C
g₁ g₂ : Z ⟶ restrict X hf
eq : g₁ ≫ ofRestrict X hf = g₂ ≫ ofRestrict X hf
⊢ g₁ = g₂

Next tactic:
ext1
instance ofRestrict_mono {U : TopCat} (X : PresheafedSpace C) (f : U ⟶ X.1) (hf : OpenEmbedding f) :
    Mono (X.ofRestrict hf) := by
  haveI : Mono f := (TopCat.mono_iff_injective _).mpr hf.inj
  constructor
  intro Z g₁ g₂ eq
  ext1
  · 

Proof state:
case right_cancellation.w
C : Type u_1
inst✝ : Category.{?u.253961, u_1} C
U : TopCat
X : PresheafedSpace C
f : U ⟶ ↑X
hf : OpenEmbedding ⇑f
this : Mono f
Z : PresheafedSpace C
g₁ g₂ : Z ⟶ restrict X hf
eq : g₁ ≫ ofRestrict X hf = g₂ ≫ ofRestrict X hf
⊢ g₁.base = g₂.base

Next tactic:
have := congr_arg PresheafedSpace.Hom.base eq
instance ofRestrict_mono {U : TopCat} (X : PresheafedSpace C) (f : U ⟶ X.1) (hf : OpenEmbedding f) :
    Mono (X.ofRestrict hf) := by
  haveI : Mono f := (TopCat.mono_iff_injective _).mpr hf.inj
  constructor
  intro Z g₁ g₂ eq
  ext1
  · have := congr_arg PresheafedSpace.Hom.base eq
    

Proof state:
case right_cancellation.w
C : Type u_1
inst✝ : Category.{?u.253961, u_1} C
U : TopCat
X : PresheafedSpace C
f : U ⟶ ↑X
hf : OpenEmbedding ⇑f
this✝ : Mono f
Z : PresheafedSpace C
g₁ g₂ : Z ⟶ restrict X hf
eq : g₁ ≫ ofRestrict X hf = g₂ ≫ ofRestrict X hf
this : (g₁ ≫ ofRestrict X hf).base = (g₂ ≫ ofRestrict X hf).base
⊢ g₁.base = g₂.base

Next tactic:
simp only [PresheafedSpace.comp_base, PresheafedSpace.ofRestrict_base] at this
instance ofRestrict_mono {U : TopCat} (X : PresheafedSpace C) (f : U ⟶ X.1) (hf : OpenEmbedding f) :
    Mono (X.ofRestrict hf) := by
  haveI : Mono f := (TopCat.mono_iff_injective _).mpr hf.inj
  constructor
  intro Z g₁ g₂ eq
  ext1
  · have := congr_arg PresheafedSpace.Hom.base eq
    simp only [PresheafedSpace.comp_base, PresheafedSpace.ofRestrict_base] at this
    

Proof state:
case right_cancellation.w
C : Type u_1
inst✝ : Category.{?u.253961, u_1} C
U : TopCat
X : PresheafedSpace C
f : U ⟶ ↑X
hf : OpenEmbedding ⇑f
this✝ : Mono f
Z : PresheafedSpace C
g₁ g₂ : Z ⟶ restrict X hf
eq : g₁ ≫ ofRestrict X hf = g₂ ≫ ofRestrict X hf
this : g₁.base ≫ f = g₂.base ≫ f
⊢ g₁.base = g₂.base

Next tactic:
rw [cancel_mono] at this
instance ofRestrict_mono {U : TopCat} (X : PresheafedSpace C) (f : U ⟶ X.1) (hf : OpenEmbedding f) :
    Mono (X.ofRestrict hf) := by
  haveI : Mono f := (TopCat.mono_iff_injective _).mpr hf.inj
  constructor
  intro Z g₁ g₂ eq
  ext1
  · have := congr_arg PresheafedSpace.Hom.base eq
    simp only [PresheafedSpace.comp_base, PresheafedSpace.ofRestrict_base] at this
    rw [cancel_mono] at this
    

Proof state:
case right_cancellation.w
C : Type u_1
inst✝ : Category.{?u.253961, u_1} C
U : TopCat
X : PresheafedSpace C
f : U ⟶ ↑X
hf : OpenEmbedding ⇑f
this✝ : Mono f
Z : PresheafedSpace C
g₁ g₂ : Z ⟶ restrict X hf
eq : g₁ ≫ ofRestrict X hf = g₂ ≫ ofRestrict X hf
this : g₁.base = g₂.base
⊢ g₁.base = g₂.base

Next tactic:
exact this
instance ofRestrict_mono {U : TopCat} (X : PresheafedSpace C) (f : U ⟶ X.1) (hf : OpenEmbedding f) :
    Mono (X.ofRestrict hf) := by
  haveI : Mono f := (TopCat.mono_iff_injective _).mpr hf.inj
  constructor
  intro Z g₁ g₂ eq
  ext1
  · have := congr_arg PresheafedSpace.Hom.base eq
    simp only [PresheafedSpace.comp_base, PresheafedSpace.ofRestrict_base] at this
    rw [cancel_mono] at this
    exact this
  · 

Proof state:
case right_cancellation.h
C : Type u_1
inst✝ : Category.{?u.253961, u_1} C
U : TopCat
X : PresheafedSpace C
f : U ⟶ ↑X
hf : OpenEmbedding ⇑f
this : Mono f
Z : PresheafedSpace C
g₁ g₂ : Z ⟶ restrict X hf
eq : g₁ ≫ ofRestrict X hf = g₂ ≫ ofRestrict X hf
⊢ g₁.c ≫ whiskerRight (eqToHom (_ : (Opens.map g₁.base).op = (Opens.map g₂.base).op)) Z.presheaf = g₂.c

Next tactic:
ext V
instance ofRestrict_mono {U : TopCat} (X : PresheafedSpace C) (f : U ⟶ X.1) (hf : OpenEmbedding f) :
    Mono (X.ofRestrict hf) := by
  haveI : Mono f := (TopCat.mono_iff_injective _).mpr hf.inj
  constructor
  intro Z g₁ g₂ eq
  ext1
  · have := congr_arg PresheafedSpace.Hom.base eq
    simp only [PresheafedSpace.comp_base, PresheafedSpace.ofRestrict_base] at this
    rw [cancel_mono] at this
    exact this
  · ext V
    

Proof state:
case right_cancellation.h.w
C : Type u_1
inst✝ : Category.{?u.253961, u_1} C
U : TopCat
X : PresheafedSpace C
f : U ⟶ ↑X
hf : OpenEmbedding ⇑f
this : Mono f
Z : PresheafedSpace C
g₁ g₂ : Z ⟶ restrict X hf
eq : g₁ ≫ ofRestrict X hf = g₂ ≫ ofRestrict X hf
V : Opens ↑↑(restrict X hf)
⊢ (g₁.c ≫ whiskerRight (eqToHom (_ : (Opens.map g₁.base).op = (Opens.map g₂.base).op)) Z.presheaf).app (op V) =
    g₂.c.app (op V)

Next tactic:
have hV : (Opens.map (X.ofRestrict hf).base).obj (hf.isOpenMap.functor.obj V) = V := by
      ext1
      exact Set.preimage_image_eq _ hf.inj
instance ofRestrict_mono {U : TopCat} (X : PresheafedSpace C) (f : U ⟶ X.1) (hf : OpenEmbedding f) :
    Mono (X.ofRestrict hf) := by
  haveI : Mono f := (TopCat.mono_iff_injective _).mpr hf.inj
  constructor
  intro Z g₁ g₂ eq
  ext1
  · have := congr_arg PresheafedSpace.Hom.base eq
    simp only [PresheafedSpace.comp_base, PresheafedSpace.ofRestrict_base] at this
    rw [cancel_mono] at this
    exact this
  · ext V
    have hV : (Opens.map (X.ofRestrict hf).base).obj (hf.isOpenMap.functor.obj V) = V := by
      

Proof state:
C : Type u_1
inst✝ : Category.{?u.253961, u_1} C
U : TopCat
X : PresheafedSpace C
f : U ⟶ ↑X
hf : OpenEmbedding ⇑f
this : Mono f
Z : PresheafedSpace C
g₁ g₂ : Z ⟶ restrict X hf
eq : g₁ ≫ ofRestrict X hf = g₂ ≫ ofRestrict X hf
V : Opens ↑↑(restrict X hf)
⊢ (Opens.map (ofRestrict X hf).base).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V) = V

Next tactic:
ext1
instance ofRestrict_mono {U : TopCat} (X : PresheafedSpace C) (f : U ⟶ X.1) (hf : OpenEmbedding f) :
    Mono (X.ofRestrict hf) := by
  haveI : Mono f := (TopCat.mono_iff_injective _).mpr hf.inj
  constructor
  intro Z g₁ g₂ eq
  ext1
  · have := congr_arg PresheafedSpace.Hom.base eq
    simp only [PresheafedSpace.comp_base, PresheafedSpace.ofRestrict_base] at this
    rw [cancel_mono] at this
    exact this
  · ext V
    have hV : (Opens.map (X.ofRestrict hf).base).obj (hf.isOpenMap.functor.obj V) = V := by
      ext1
      

Proof state:
case h
C : Type u_1
inst✝ : Category.{?u.253961, u_1} C
U : TopCat
X : PresheafedSpace C
f : U ⟶ ↑X
hf : OpenEmbedding ⇑f
this : Mono f
Z : PresheafedSpace C
g₁ g₂ : Z ⟶ restrict X hf
eq : g₁ ≫ ofRestrict X hf = g₂ ≫ ofRestrict X hf
V : Opens ↑↑(restrict X hf)
⊢ ↑((Opens.map (ofRestrict X hf).base).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)) = ↑V

Next tactic:
exact Set.preimage_image_eq _ hf.inj
instance ofRestrict_mono {U : TopCat} (X : PresheafedSpace C) (f : U ⟶ X.1) (hf : OpenEmbedding f) :
    Mono (X.ofRestrict hf) := by
  haveI : Mono f := (TopCat.mono_iff_injective _).mpr hf.inj
  constructor
  intro Z g₁ g₂ eq
  ext1
  · have := congr_arg PresheafedSpace.Hom.base eq
    simp only [PresheafedSpace.comp_base, PresheafedSpace.ofRestrict_base] at this
    rw [cancel_mono] at this
    exact this
  · ext V
    have hV : (Opens.map (X.ofRestrict hf).base).obj (hf.isOpenMap.functor.obj V) = V := by
      ext1
      exact Set.preimage_image_eq _ hf.inj
    

Proof state:
case right_cancellation.h.w
C : Type u_1
inst✝ : Category.{?u.253961, u_1} C
U : TopCat
X : PresheafedSpace C
f : U ⟶ ↑X
hf : OpenEmbedding ⇑f
this : Mono f
Z : PresheafedSpace C
g₁ g₂ : Z ⟶ restrict X hf
eq : g₁ ≫ ofRestrict X hf = g₂ ≫ ofRestrict X hf
V : Opens ↑↑(restrict X hf)
hV : (Opens.map (ofRestrict X hf).base).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V) = V
⊢ (g₁.c ≫ whiskerRight (eqToHom (_ : (Opens.map g₁.base).op = (Opens.map g₂.base).op)) Z.presheaf).app (op V) =
    g₂.c.app (op V)

Next tactic:
haveI :
      IsIso (hf.isOpenMap.adjunction.counit.app (unop (op (hf.isOpenMap.functor.obj V)))) :=
        NatIso.isIso_app_of_isIso
          (whiskerLeft hf.isOpenMap.functor hf.isOpenMap.adjunction.counit) V
instance ofRestrict_mono {U : TopCat} (X : PresheafedSpace C) (f : U ⟶ X.1) (hf : OpenEmbedding f) :
    Mono (X.ofRestrict hf) := by
  haveI : Mono f := (TopCat.mono_iff_injective _).mpr hf.inj
  constructor
  intro Z g₁ g₂ eq
  ext1
  · have := congr_arg PresheafedSpace.Hom.base eq
    simp only [PresheafedSpace.comp_base, PresheafedSpace.ofRestrict_base] at this
    rw [cancel_mono] at this
    exact this
  · ext V
    have hV : (Opens.map (X.ofRestrict hf).base).obj (hf.isOpenMap.functor.obj V) = V := by
      ext1
      exact Set.preimage_image_eq _ hf.inj
    haveI :
      IsIso (hf.isOpenMap.adjunction.counit.app (unop (op (hf.isOpenMap.functor.obj V)))) :=
        NatIso.isIso_app_of_isIso
          (whiskerLeft hf.isOpenMap.functor hf.isOpenMap.adjunction.counit) V
    

Proof state:
case right_cancellation.h.w
C : Type u_1
inst✝ : Category.{?u.253961, u_1} C
U : TopCat
X : PresheafedSpace C
f : U ⟶ ↑X
hf : OpenEmbedding ⇑f
this✝ : Mono f
Z : PresheafedSpace C
g₁ g₂ : Z ⟶ restrict X hf
eq : g₁ ≫ ofRestrict X hf = g₂ ≫ ofRestrict X hf
V : Opens ↑↑(restrict X hf)
hV : (Opens.map (ofRestrict X hf).base).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V) = V
this :
  IsIso ((IsOpenMap.adjunction (_ : IsOpenMap ⇑f)).counit.app (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)).unop)
⊢ (g₁.c ≫ whiskerRight (eqToHom (_ : (Opens.map g₁.base).op = (Opens.map g₂.base).op)) Z.presheaf).app (op V) =
    g₂.c.app (op V)

Next tactic:
have := PresheafedSpace.congr_app eq (op (hf.isOpenMap.functor.obj V))