l3lab/ntp-mathlib huggingface dataset:
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
    have := PresheafedSpace.congr_app eq (op (hf.isOpenMap.functor.obj 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)
this :
  (g₁ ≫ ofRestrict X hf).c.app (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)) =
    (g₂ ≫ ofRestrict X hf).c.app (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)) ≫
      Z.presheaf.map
        (eqToHom
          (_ :
            (Opens.map (g₂ ≫ ofRestrict X hf).base).op.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)) =
              (Opens.map (g₁ ≫ ofRestrict X hf).base).op.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj 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:
simp only [PresheafedSpace.comp_c_app, PresheafedSpace.ofRestrict_c_app, Category.assoc,
      cancel_epi] 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
    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
    have := PresheafedSpace.congr_app eq (op (hf.isOpenMap.functor.obj V))
    simp only [PresheafedSpace.comp_c_app, PresheafedSpace.ofRestrict_c_app, Category.assoc,
      cancel_epi] at this
    

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)
this :
  g₁.c.app (op ((Opens.map (ofRestrict X hf).base).obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)).unop)) =
    g₂.c.app (op ((Opens.map (ofRestrict X hf).base).obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)).unop)) ≫
      Z.presheaf.map
        (eqToHom
          (_ :
            (Opens.map (g₂ ≫ ofRestrict X hf).base).op.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)) =
              (Opens.map (g₁ ≫ ofRestrict X hf).base).op.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj 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:
have h : _ ≫ _ = _ ≫ _ ≫ _ :=
      congr_arg (fun f => (X.restrict hf).presheaf.map (eqToHom hV).op ≫ f) 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
  · 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
    have := PresheafedSpace.congr_app eq (op (hf.isOpenMap.functor.obj V))
    simp only [PresheafedSpace.comp_c_app, PresheafedSpace.ofRestrict_c_app, Category.assoc,
      cancel_epi] at this
    have h : _ ≫ _ = _ ≫ _ ≫ _ :=
      congr_arg (fun f => (X.restrict hf).presheaf.map (eqToHom hV).op ≫ f) this
    

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)
this :
  g₁.c.app (op ((Opens.map (ofRestrict X hf).base).obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)).unop)) =
    g₂.c.app (op ((Opens.map (ofRestrict X hf).base).obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)).unop)) ≫
      Z.presheaf.map
        (eqToHom
          (_ :
            (Opens.map (g₂ ≫ ofRestrict X hf).base).op.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)) =
              (Opens.map (g₁ ≫ ofRestrict X hf).base).op.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V))))
h :
  (restrict X hf).presheaf.map (eqToHom hV).op ≫
      g₁.c.app (op ((Opens.map (ofRestrict X hf).base).obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)).unop)) =
    (restrict X hf).presheaf.map (eqToHom hV).op ≫
      g₂.c.app (op ((Opens.map (ofRestrict X hf).base).obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)).unop)) ≫
        Z.presheaf.map
          (eqToHom
            (_ :
              (Opens.map (g₂ ≫ ofRestrict X hf).base).op.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)) =
                (Opens.map (g₁ ≫ ofRestrict X hf).base).op.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj 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:
erw [g₁.c.naturality, g₂.c.naturality_assoc] at h
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
    have := PresheafedSpace.congr_app eq (op (hf.isOpenMap.functor.obj V))
    simp only [PresheafedSpace.comp_c_app, PresheafedSpace.ofRestrict_c_app, Category.assoc,
      cancel_epi] at this
    have h : _ ≫ _ = _ ≫ _ ≫ _ :=
      congr_arg (fun f => (X.restrict hf).presheaf.map (eqToHom hV).op ≫ f) this
    erw [g₁.c.naturality, g₂.c.naturality_assoc] at h
    

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)
this :
  g₁.c.app (op ((Opens.map (ofRestrict X hf).base).obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)).unop)) =
    g₂.c.app (op ((Opens.map (ofRestrict X hf).base).obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)).unop)) ≫
      Z.presheaf.map
        (eqToHom
          (_ :
            (Opens.map (g₂ ≫ ofRestrict X hf).base).op.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)) =
              (Opens.map (g₁ ≫ ofRestrict X hf).base).op.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V))))
h :
  g₁.c.app (op V) ≫ (g₁.base _* Z.presheaf).map (eqToHom hV).op =
    g₂.c.app (op V) ≫
      (g₂.base _* Z.presheaf).map (eqToHom hV).op ≫
        Z.presheaf.map
          (eqToHom
            (_ :
              (Opens.map (g₂ ≫ ofRestrict X hf).base).op.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)) =
                (Opens.map (g₁ ≫ ofRestrict X hf).base).op.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj 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:
simp only [Presheaf.pushforwardObj_map, eqToHom_op, Category.assoc, eqToHom_map,
      eqToHom_trans] at h
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
    have := PresheafedSpace.congr_app eq (op (hf.isOpenMap.functor.obj V))
    simp only [PresheafedSpace.comp_c_app, PresheafedSpace.ofRestrict_c_app, Category.assoc,
      cancel_epi] at this
    have h : _ ≫ _ = _ ≫ _ ≫ _ :=
      congr_arg (fun f => (X.restrict hf).presheaf.map (eqToHom hV).op ≫ f) this
    erw [g₁.c.naturality, g₂.c.naturality_assoc] at h
    simp only [Presheaf.pushforwardObj_map, eqToHom_op, Category.assoc, eqToHom_map,
      eqToHom_trans] at h
    

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)
this :
  g₁.c.app (op ((Opens.map (ofRestrict X hf).base).obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)).unop)) =
    g₂.c.app (op ((Opens.map (ofRestrict X hf).base).obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)).unop)) ≫
      Z.presheaf.map
        (eqToHom
          (_ :
            (Opens.map (g₂ ≫ ofRestrict X hf).base).op.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)) =
              (Opens.map (g₁ ≫ ofRestrict X hf).base).op.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V))))
h :
  g₁.c.app (op V) ≫
      eqToHom
        (_ :
          Z.presheaf.obj ((Opens.map g₁.base).op.obj (op V)) =
            Z.presheaf.obj
              ((Opens.map g₁.base).op.obj
                (op ((Opens.map (ofRestrict X hf).base).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V))))) =
    g₂.c.app (op V) ≫
      eqToHom
        (_ :
          (g₂.base _* Z.presheaf).obj (op V) =
            (g₁.base _* Z.presheaf).obj
              (op ((Opens.map (ofRestrict X hf).base).obj (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:
rw [← IsIso.comp_inv_eq, inv_eqToHom, Category.assoc, eqToHom_trans] at h
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
    have := PresheafedSpace.congr_app eq (op (hf.isOpenMap.functor.obj V))
    simp only [PresheafedSpace.comp_c_app, PresheafedSpace.ofRestrict_c_app, Category.assoc,
      cancel_epi] at this
    have h : _ ≫ _ = _ ≫ _ ≫ _ :=
      congr_arg (fun f => (X.restrict hf).presheaf.map (eqToHom hV).op ≫ f) this
    erw [g₁.c.naturality, g₂.c.naturality_assoc] at h
    simp only [Presheaf.pushforwardObj_map, eqToHom_op, Category.assoc, eqToHom_map,
      eqToHom_trans] at h
    rw [← IsIso.comp_inv_eq, inv_eqToHom, Category.assoc, eqToHom_trans] at h
    

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)
this :
  g₁.c.app (op ((Opens.map (ofRestrict X hf).base).obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)).unop)) =
    g₂.c.app (op ((Opens.map (ofRestrict X hf).base).obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)).unop)) ≫
      Z.presheaf.map
        (eqToHom
          (_ :
            (Opens.map (g₂ ≫ ofRestrict X hf).base).op.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)) =
              (Opens.map (g₁ ≫ ofRestrict X hf).base).op.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V))))
h :
  g₁.c.app (op V) ≫ eqToHom (_ : (g₁.base _* Z.presheaf).obj (op V) = (g₂.base _* Z.presheaf).obj (op V)) =
    g₂.c.app (op 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:
rw [NatTrans.comp_app]
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
    have := PresheafedSpace.congr_app eq (op (hf.isOpenMap.functor.obj V))
    simp only [PresheafedSpace.comp_c_app, PresheafedSpace.ofRestrict_c_app, Category.assoc,
      cancel_epi] at this
    have h : _ ≫ _ = _ ≫ _ ≫ _ :=
      congr_arg (fun f => (X.restrict hf).presheaf.map (eqToHom hV).op ≫ f) this
    erw [g₁.c.naturality, g₂.c.naturality_assoc] at h
    simp only [Presheaf.pushforwardObj_map, eqToHom_op, Category.assoc, eqToHom_map,
      eqToHom_trans] at h
    rw [← IsIso.comp_inv_eq, inv_eqToHom, Category.assoc, eqToHom_trans] at h
    rw [NatTrans.comp_app]
    

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)
this :
  g₁.c.app (op ((Opens.map (ofRestrict X hf).base).obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)).unop)) =
    g₂.c.app (op ((Opens.map (ofRestrict X hf).base).obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)).unop)) ≫
      Z.presheaf.map
        (eqToHom
          (_ :
            (Opens.map (g₂ ≫ ofRestrict X hf).base).op.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V)) =
              (Opens.map (g₁ ≫ ofRestrict X hf).base).op.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj V))))
h :
  g₁.c.app (op V) ≫ eqToHom (_ : (g₁.base _* Z.presheaf).obj (op V) = (g₂.base _* Z.presheaf).obj (op V)) =
    g₂.c.app (op V)
⊢ g₁.c.app (op V) ≫
      (whiskerRight (eqToHom (_ : (Opens.map g₁.base).op = (Opens.map g₂.base).op)) Z.presheaf).app (op V) =
    g₂.c.app (op V)

Next tactic:
simpa using h
theorem restrict_top_presheaf (X : PresheafedSpace C) :
    (X.restrict (Opens.openEmbedding ⊤)).presheaf =
      (Opens.inclusionTopIso X.carrier).inv _* X.presheaf := by
  

Proof state:
C : Type u_1
inst✝ : Category.{u_2, u_1} C
X : PresheafedSpace C
⊢ (restrict X (_ : OpenEmbedding ⇑(Opens.inclusion ⊤))).presheaf = (Opens.inclusionTopIso ↑X).inv _* X.presheaf

Next tactic:
dsimp
theorem restrict_top_presheaf (X : PresheafedSpace C) :
    (X.restrict (Opens.openEmbedding ⊤)).presheaf =
      (Opens.inclusionTopIso X.carrier).inv _* X.presheaf := by
  dsimp
  

Proof state:
C : Type u_1
inst✝ : Category.{u_2, u_1} C
X : PresheafedSpace C
⊢ (IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion ⊤))).op ⋙ X.presheaf =
    (Opens.inclusionTopIso ↑X).inv _* X.presheaf

Next tactic:
rw [Opens.inclusion_top_functor X.carrier]
theorem restrict_top_presheaf (X : PresheafedSpace C) :
    (X.restrict (Opens.openEmbedding ⊤)).presheaf =
      (Opens.inclusionTopIso X.carrier).inv _* X.presheaf := by
  dsimp
  rw [Opens.inclusion_top_functor X.carrier]
  

Proof state:
C : Type u_1
inst✝ : Category.{u_2, u_1} C
X : PresheafedSpace C
⊢ (Opens.map (Opens.inclusionTopIso ↑X).inv).op ⋙ X.presheaf = (Opens.inclusionTopIso ↑X).inv _* X.presheaf

Next tactic:
rfl
theorem ofRestrict_top_c (X : PresheafedSpace C) :
    (X.ofRestrict (Opens.openEmbedding ⊤)).c =
      eqToHom
        (by
          

Proof state:
C : Type u_1
inst✝ : Category.{?u.272308, u_1} C
X : PresheafedSpace C
⊢ X.presheaf =
    (ofRestrict X (_ : OpenEmbedding ⇑(Opens.inclusion ⊤))).base _*
      (restrict X (_ : OpenEmbedding ⇑(Opens.inclusion ⊤))).presheaf

Next tactic:
rw [restrict_top_presheaf, ← Presheaf.Pushforward.comp_eq]
theorem ofRestrict_top_c (X : PresheafedSpace C) :
    (X.ofRestrict (Opens.openEmbedding ⊤)).c =
      eqToHom
        (by
          rw [restrict_top_presheaf, ← Presheaf.Pushforward.comp_eq]
          

Proof state:
C : Type u_1
inst✝ : Category.{?u.272308, u_1} C
X : PresheafedSpace C
⊢ X.presheaf =
    ((Opens.inclusionTopIso ↑X).inv ≫ (ofRestrict X (_ : OpenEmbedding ⇑(Opens.inclusion ⊤))).base) _* X.presheaf

Next tactic:
erw [Iso.inv_hom_id]
theorem ofRestrict_top_c (X : PresheafedSpace C) :
    (X.ofRestrict (Opens.openEmbedding ⊤)).c =
      eqToHom
        (by
          rw [restrict_top_presheaf, ← Presheaf.Pushforward.comp_eq]
          erw [Iso.inv_hom_id]
          

Proof state:
C : Type u_1
inst✝ : Category.{?u.272308, u_1} C
X : PresheafedSpace C
⊢ X.presheaf = 𝟙 ↑X _* X.presheaf

Next tactic:
rw [Presheaf.Pushforward.id_eq]
theorem ofRestrict_top_c (X : PresheafedSpace C) :
    (X.ofRestrict (Opens.openEmbedding ⊤)).c =
      eqToHom
        (by
          rw [restrict_top_presheaf, ← Presheaf.Pushforward.comp_eq]
          erw [Iso.inv_hom_id]
          rw [Presheaf.Pushforward.id_eq]) := by
  /- another approach would be to prove the left hand side
       is a natural isomorphism, but I encountered a universe
       issue when `apply NatIso.isIso_of_isIso_app`. -/
  

Proof state:
C : Type u_1
inst✝ : Category.{u_2, u_1} C
X : PresheafedSpace C
⊢ (ofRestrict X (_ : OpenEmbedding ⇑(Opens.inclusion ⊤))).c =
    eqToHom
      (_ :
        X.presheaf =
          (ofRestrict X (_ : OpenEmbedding ⇑(Opens.inclusion ⊤))).base _*
            (restrict X (_ : OpenEmbedding ⇑(Opens.inclusion ⊤))).presheaf)

Next tactic:
ext
theorem ofRestrict_top_c (X : PresheafedSpace C) :
    (X.ofRestrict (Opens.openEmbedding ⊤)).c =
      eqToHom
        (by
          rw [restrict_top_presheaf, ← Presheaf.Pushforward.comp_eq]
          erw [Iso.inv_hom_id]
          rw [Presheaf.Pushforward.id_eq]) := by
  /- another approach would be to prove the left hand side
       is a natural isomorphism, but I encountered a universe
       issue when `apply NatIso.isIso_of_isIso_app`. -/
  ext
  

Proof state:
case w
C : Type u_1
inst✝ : Category.{u_2, u_1} C
X : PresheafedSpace C
U✝ : Opens ↑↑X
⊢ (ofRestrict X (_ : OpenEmbedding ⇑(Opens.inclusion ⊤))).c.app (op U✝) =
    (eqToHom
          (_ :
            X.presheaf =
              (ofRestrict X (_ : OpenEmbedding ⇑(Opens.inclusion ⊤))).base _*
                (restrict X (_ : OpenEmbedding ⇑(Opens.inclusion ⊤))).presheaf)).app
      (op U✝)

Next tactic:
dsimp [ofRestrict]
theorem ofRestrict_top_c (X : PresheafedSpace C) :
    (X.ofRestrict (Opens.openEmbedding ⊤)).c =
      eqToHom
        (by
          rw [restrict_top_presheaf, ← Presheaf.Pushforward.comp_eq]
          erw [Iso.inv_hom_id]
          rw [Presheaf.Pushforward.id_eq]) := by
  /- another approach would be to prove the left hand side
       is a natural isomorphism, but I encountered a universe
       issue when `apply NatIso.isIso_of_isIso_app`. -/
  ext
  dsimp [ofRestrict]
  

Proof state:
case w
C : Type u_1
inst✝ : Category.{u_2, u_1} C
X : PresheafedSpace C
U✝ : Opens ↑↑X
⊢ X.presheaf.map ((IsOpenMap.adjunction (_ : IsOpenMap ⇑(Opens.inclusion ⊤))).counit.app U✝).op =
    (eqToHom
          (_ :
            X.presheaf =
              Opens.inclusion ⊤ _* ((IsOpenMap.functor (_ : IsOpenMap ⇑(Opens.inclusion ⊤))).op ⋙ X.presheaf))).app
      (op U✝)

Next tactic:
erw [eqToHom_map, eqToHom_app]