l3lab/ntp-mathlib huggingface dataset:
/-- A variant of `app_inv_app` that gives an `eq_to_hom` instead of `hom_of_le`. -/
@[reassoc]
theorem app_inv_app' (U : Opens Y) (hU : (U : Set Y) ⊆ Set.range f.base) :
    f.c.app (op U) ≫ H.invApp ((Opens.map f.base).obj U) =
      Y.presheaf.map
        (eqToHom
            (by
              apply le_antisymm
              · exact Set.image_preimage_subset f.base U.1
              · rw [← SetLike.coe_subset_coe]
                refine' LE.le.trans_eq _ (@Set.image_preimage_eq_inter_range _ _ f.base U.1).symm
                exact Set.subset_inter_iff.mpr ⟨fun _ h => h, hU⟩)).op :=
  by erw [← Category.assoc]; 

Proof state:
C : Type u_1
inst✝ : Category.{u_3, u_1} C
X Y : PresheafedSpace C
f : X ⟶ Y
H : IsOpenImmersion f
U : Opens ↑↑Y
hU : ↑U ⊆ Set.range ⇑f.base
⊢ (f.c.app (op U) ≫
        X.presheaf.map
          (eqToHom
            (_ :
              op ((Opens.map f.base).obj U) =
                op ((Opens.map f.base).obj (op ((openFunctor H).obj ((Opens.map f.base).obj U))).unop)))) ≫
      inv (f.c.app (op ((openFunctor H).obj ((Opens.map f.base).obj U)))) =
    Y.presheaf.map (eqToHom (_ : (openFunctor H).obj ((Opens.map f.base).obj U) = U)).op

Next tactic:
rw [IsIso.comp_inv_eq, f.c.naturality]
/-- A variant of `app_inv_app` that gives an `eq_to_hom` instead of `hom_of_le`. -/
@[reassoc]
theorem app_inv_app' (U : Opens Y) (hU : (U : Set Y) ⊆ Set.range f.base) :
    f.c.app (op U) ≫ H.invApp ((Opens.map f.base).obj U) =
      Y.presheaf.map
        (eqToHom
            (by
              apply le_antisymm
              · exact Set.image_preimage_subset f.base U.1
              · rw [← SetLike.coe_subset_coe]
                refine' LE.le.trans_eq _ (@Set.image_preimage_eq_inter_range _ _ f.base U.1).symm
                exact Set.subset_inter_iff.mpr ⟨fun _ h => h, hU⟩)).op :=
  by erw [← Category.assoc]; rw [IsIso.comp_inv_eq, f.c.naturality]; 

Proof state:
C : Type u_1
inst✝ : Category.{u_3, u_1} C
X Y : PresheafedSpace C
f : X ⟶ Y
H : IsOpenImmersion f
U : Opens ↑↑Y
hU : ↑U ⊆ Set.range ⇑f.base
⊢ f.c.app (op U) ≫
      X.presheaf.map
        (eqToHom
          (_ :
            op ((Opens.map f.base).obj U) =
              op ((Opens.map f.base).obj (op ((openFunctor H).obj ((Opens.map f.base).obj U))).unop))) =
    f.c.app (op U) ≫ (f.base _* X.presheaf).map (eqToHom (_ : (openFunctor H).obj ((Opens.map f.base).obj U) = U)).op

Next tactic:
congr
instance ofRestrict {X : TopCat} (Y : PresheafedSpace C) {f : X ⟶ Y.carrier}
    (hf : OpenEmbedding f) : IsOpenImmersion (Y.ofRestrict hf) where
  base_open := hf
  c_iso U := by
    

Proof state:
C : Type u_1
inst✝ : Category.{?u.57923, u_1} C
X✝ Y✝ : PresheafedSpace C
f✝ : X✝ ⟶ Y✝
H : IsOpenImmersion f✝
X : TopCat
Y : PresheafedSpace C
f : X ⟶ ↑Y
hf : OpenEmbedding ⇑f
U : Opens ↑↑(restrict Y hf)
⊢ IsIso
    ((PresheafedSpace.ofRestrict Y hf).c.app
      (op ((IsOpenMap.functor (_ : IsOpenMap ⇑(PresheafedSpace.ofRestrict Y hf).base)).obj U)))

Next tactic:
dsimp
instance ofRestrict {X : TopCat} (Y : PresheafedSpace C) {f : X ⟶ Y.carrier}
    (hf : OpenEmbedding f) : IsOpenImmersion (Y.ofRestrict hf) where
  base_open := hf
  c_iso U := by
    dsimp
    

Proof state:
C : Type u_1
inst✝ : Category.{?u.57923, u_1} C
X✝ Y✝ : PresheafedSpace C
f✝ : X✝ ⟶ Y✝
H : IsOpenImmersion f✝
X : TopCat
Y : PresheafedSpace C
f : X ⟶ ↑Y
hf : OpenEmbedding ⇑f
U : Opens ↑↑(restrict Y hf)
⊢ IsIso
    (Y.presheaf.map
      ((IsOpenMap.adjunction (_ : IsOpenMap ⇑f)).counit.app ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U)).op)

Next tactic:
have : (Opens.map f).obj (hf.isOpenMap.functor.obj U) = U := by
      ext1
      exact Set.preimage_image_eq _ hf.inj
instance ofRestrict {X : TopCat} (Y : PresheafedSpace C) {f : X ⟶ Y.carrier}
    (hf : OpenEmbedding f) : IsOpenImmersion (Y.ofRestrict hf) where
  base_open := hf
  c_iso U := by
    dsimp
    have : (Opens.map f).obj (hf.isOpenMap.functor.obj U) = U := by
      

Proof state:
C : Type u_1
inst✝ : Category.{?u.57923, u_1} C
X✝ Y✝ : PresheafedSpace C
f✝ : X✝ ⟶ Y✝
H : IsOpenImmersion f✝
X : TopCat
Y : PresheafedSpace C
f : X ⟶ ↑Y
hf : OpenEmbedding ⇑f
U : Opens ↑↑(restrict Y hf)
⊢ (Opens.map f).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U) = U

Next tactic:
ext1
instance ofRestrict {X : TopCat} (Y : PresheafedSpace C) {f : X ⟶ Y.carrier}
    (hf : OpenEmbedding f) : IsOpenImmersion (Y.ofRestrict hf) where
  base_open := hf
  c_iso U := by
    dsimp
    have : (Opens.map f).obj (hf.isOpenMap.functor.obj U) = U := by
      ext1
      

Proof state:
case h
C : Type u_1
inst✝ : Category.{?u.57923, u_1} C
X✝ Y✝ : PresheafedSpace C
f✝ : X✝ ⟶ Y✝
H : IsOpenImmersion f✝
X : TopCat
Y : PresheafedSpace C
f : X ⟶ ↑Y
hf : OpenEmbedding ⇑f
U : Opens ↑↑(restrict Y hf)
⊢ ↑((Opens.map f).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U)) = ↑U

Next tactic:
exact Set.preimage_image_eq _ hf.inj
instance ofRestrict {X : TopCat} (Y : PresheafedSpace C) {f : X ⟶ Y.carrier}
    (hf : OpenEmbedding f) : IsOpenImmersion (Y.ofRestrict hf) where
  base_open := hf
  c_iso U := by
    dsimp
    have : (Opens.map f).obj (hf.isOpenMap.functor.obj U) = U := by
      ext1
      exact Set.preimage_image_eq _ hf.inj
    

Proof state:
C : Type u_1
inst✝ : Category.{?u.57923, u_1} C
X✝ Y✝ : PresheafedSpace C
f✝ : X✝ ⟶ Y✝
H : IsOpenImmersion f✝
X : TopCat
Y : PresheafedSpace C
f : X ⟶ ↑Y
hf : OpenEmbedding ⇑f
U : Opens ↑↑(restrict Y hf)
this : (Opens.map f).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U) = U
⊢ IsIso
    (Y.presheaf.map
      ((IsOpenMap.adjunction (_ : IsOpenMap ⇑f)).counit.app ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U)).op)

Next tactic:
convert_to IsIso (Y.presheaf.map (𝟙 _))
instance ofRestrict {X : TopCat} (Y : PresheafedSpace C) {f : X ⟶ Y.carrier}
    (hf : OpenEmbedding f) : IsOpenImmersion (Y.ofRestrict hf) where
  base_open := hf
  c_iso U := by
    dsimp
    have : (Opens.map f).obj (hf.isOpenMap.functor.obj U) = U := by
      ext1
      exact Set.preimage_image_eq _ hf.inj
    convert_to IsIso (Y.presheaf.map (𝟙 _))
    · 

Proof state:
case h.e'_4
C : Type u_1
inst✝ : Category.{?u.57923, u_1} C
X✝ Y✝ : PresheafedSpace C
f✝ : X✝ ⟶ Y✝
H : IsOpenImmersion f✝
X : TopCat
Y : PresheafedSpace C
f : X ⟶ ↑Y
hf : OpenEmbedding ⇑f
U : Opens ↑↑(restrict Y hf)
this : (Opens.map f).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U) = U
⊢ Y.presheaf.obj
      (op
        ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj
          ((Opens.map f).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U)))) =
    Y.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U))

Next tactic:
congr
instance ofRestrict {X : TopCat} (Y : PresheafedSpace C) {f : X ⟶ Y.carrier}
    (hf : OpenEmbedding f) : IsOpenImmersion (Y.ofRestrict hf) where
  base_open := hf
  c_iso U := by
    dsimp
    have : (Opens.map f).obj (hf.isOpenMap.functor.obj U) = U := by
      ext1
      exact Set.preimage_image_eq _ hf.inj
    convert_to IsIso (Y.presheaf.map (𝟙 _))
    · congr
    · -- Porting note : was `apply Subsingleton.helim; rw [this]`
      -- See https://github.com/leanprover/lean4/issues/2273
      

Proof state:
case h.e'_5
C : Type u_1
inst✝ : Category.{?u.57923, u_1} C
X✝ Y✝ : PresheafedSpace C
f✝ : X✝ ⟶ Y✝
H : IsOpenImmersion f✝
X : TopCat
Y : PresheafedSpace C
f : X ⟶ ↑Y
hf : OpenEmbedding ⇑f
U : Opens ↑↑(restrict Y hf)
this : (Opens.map f).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U) = U
e_4✝ :
  Y.presheaf.obj
      (op
        ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj
          ((Opens.map f).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U)))) =
    Y.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U))
⊢ HEq
    (Y.presheaf.map
      ((IsOpenMap.adjunction (_ : IsOpenMap ⇑f)).counit.app ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U)).op)
    (Y.presheaf.map (𝟙 (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U))))

Next tactic:
congr
instance ofRestrict {X : TopCat} (Y : PresheafedSpace C) {f : X ⟶ Y.carrier}
    (hf : OpenEmbedding f) : IsOpenImmersion (Y.ofRestrict hf) where
  base_open := hf
  c_iso U := by
    dsimp
    have : (Opens.map f).obj (hf.isOpenMap.functor.obj U) = U := by
      ext1
      exact Set.preimage_image_eq _ hf.inj
    convert_to IsIso (Y.presheaf.map (𝟙 _))
    · congr
    · -- Porting note : was `apply Subsingleton.helim; rw [this]`
      -- See https://github.com/leanprover/lean4/issues/2273
      congr
      

Proof state:
case h.e'_5.e_8.e_3.h
C : Type u_1
inst✝ : Category.{?u.57923, u_1} C
X✝ Y✝ : PresheafedSpace C
f✝ : X✝ ⟶ Y✝
H : IsOpenImmersion f✝
X : TopCat
Y : PresheafedSpace C
f : X ⟶ ↑Y
hf : OpenEmbedding ⇑f
U : Opens ↑↑(restrict Y hf)
this : (Opens.map f).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U) = U
e_4✝ :
  Y.presheaf.obj
      (op
        ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj
          ((Opens.map f).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U)))) =
    Y.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U))
⊢ (IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj ((Opens.map f).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U)) =
    (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U)).unop
case h.e'_5.e_8.e_5
C : Type u_1
inst✝ : Category.{?u.57923, u_1} C
X✝ Y✝ : PresheafedSpace C
f✝ : X✝ ⟶ Y✝
H : IsOpenImmersion f✝
X : TopCat
Y : PresheafedSpace C
f : X ⟶ ↑Y
hf : OpenEmbedding ⇑f
U : Opens ↑↑(restrict Y hf)
this : (Opens.map f).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U) = U
e_4✝ :
  Y.presheaf.obj
      (op
        ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj
          ((Opens.map f).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U)))) =
    Y.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U))
⊢ HEq ((IsOpenMap.adjunction (_ : IsOpenMap ⇑f)).counit.app ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U))
    (𝟙 (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U)).unop)

Next tactic:
simp only [unop_op]
instance ofRestrict {X : TopCat} (Y : PresheafedSpace C) {f : X ⟶ Y.carrier}
    (hf : OpenEmbedding f) : IsOpenImmersion (Y.ofRestrict hf) where
  base_open := hf
  c_iso U := by
    dsimp
    have : (Opens.map f).obj (hf.isOpenMap.functor.obj U) = U := by
      ext1
      exact Set.preimage_image_eq _ hf.inj
    convert_to IsIso (Y.presheaf.map (𝟙 _))
    · congr
    · -- Porting note : was `apply Subsingleton.helim; rw [this]`
      -- See https://github.com/leanprover/lean4/issues/2273
      congr
      simp only [unop_op]
      

Proof state:
case h.e'_5.e_8.e_3.h
C : Type u_1
inst✝ : Category.{?u.57923, u_1} C
X✝ Y✝ : PresheafedSpace C
f✝ : X✝ ⟶ Y✝
H : IsOpenImmersion f✝
X : TopCat
Y : PresheafedSpace C
f : X ⟶ ↑Y
hf : OpenEmbedding ⇑f
U : Opens ↑↑(restrict Y hf)
this : (Opens.map f).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U) = U
e_4✝ :
  Y.presheaf.obj
      (op
        ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj
          ((Opens.map f).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U)))) =
    Y.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U))
⊢ (IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj ((Opens.map f).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U)) =
    (IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U
case h.e'_5.e_8.e_5
C : Type u_1
inst✝ : Category.{?u.57923, u_1} C
X✝ Y✝ : PresheafedSpace C
f✝ : X✝ ⟶ Y✝
H : IsOpenImmersion f✝
X : TopCat
Y : PresheafedSpace C
f : X ⟶ ↑Y
hf : OpenEmbedding ⇑f
U : Opens ↑↑(restrict Y hf)
this : (Opens.map f).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U) = U
e_4✝ :
  Y.presheaf.obj
      (op
        ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj
          ((Opens.map f).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U)))) =
    Y.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U))
⊢ HEq ((IsOpenMap.adjunction (_ : IsOpenMap ⇑f)).counit.app ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U))
    (𝟙 (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U)).unop)

Next tactic:
congr
instance ofRestrict {X : TopCat} (Y : PresheafedSpace C) {f : X ⟶ Y.carrier}
    (hf : OpenEmbedding f) : IsOpenImmersion (Y.ofRestrict hf) where
  base_open := hf
  c_iso U := by
    dsimp
    have : (Opens.map f).obj (hf.isOpenMap.functor.obj U) = U := by
      ext1
      exact Set.preimage_image_eq _ hf.inj
    convert_to IsIso (Y.presheaf.map (𝟙 _))
    · congr
    · -- Porting note : was `apply Subsingleton.helim; rw [this]`
      -- See https://github.com/leanprover/lean4/issues/2273
      congr
      simp only [unop_op]
      congr
      

Proof state:
case h.e'_5.e_8.e_5
C : Type u_1
inst✝ : Category.{?u.57923, u_1} C
X✝ Y✝ : PresheafedSpace C
f✝ : X✝ ⟶ Y✝
H : IsOpenImmersion f✝
X : TopCat
Y : PresheafedSpace C
f : X ⟶ ↑Y
hf : OpenEmbedding ⇑f
U : Opens ↑↑(restrict Y hf)
this : (Opens.map f).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U) = U
e_4✝ :
  Y.presheaf.obj
      (op
        ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj
          ((Opens.map f).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U)))) =
    Y.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U))
⊢ HEq ((IsOpenMap.adjunction (_ : IsOpenMap ⇑f)).counit.app ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U))
    (𝟙 (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U)).unop)

Next tactic:
apply Subsingleton.helim
instance ofRestrict {X : TopCat} (Y : PresheafedSpace C) {f : X ⟶ Y.carrier}
    (hf : OpenEmbedding f) : IsOpenImmersion (Y.ofRestrict hf) where
  base_open := hf
  c_iso U := by
    dsimp
    have : (Opens.map f).obj (hf.isOpenMap.functor.obj U) = U := by
      ext1
      exact Set.preimage_image_eq _ hf.inj
    convert_to IsIso (Y.presheaf.map (𝟙 _))
    · congr
    · -- Porting note : was `apply Subsingleton.helim; rw [this]`
      -- See https://github.com/leanprover/lean4/issues/2273
      congr
      simp only [unop_op]
      congr
      apply Subsingleton.helim
      

Proof state:
case h.e'_5.e_8.e_5.h₂
C : Type u_1
inst✝ : Category.{?u.57923, u_1} C
X✝ Y✝ : PresheafedSpace C
f✝ : X✝ ⟶ Y✝
H : IsOpenImmersion f✝
X : TopCat
Y : PresheafedSpace C
f : X ⟶ ↑Y
hf : OpenEmbedding ⇑f
U : Opens ↑↑(restrict Y hf)
this : (Opens.map f).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U) = U
e_4✝ :
  Y.presheaf.obj
      (op
        ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj
          ((Opens.map f).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U)))) =
    Y.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U))
⊢ ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj ((Opens.map f).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U)) ⟶
      (IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U) =
    ((op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U)).unop ⟶
      (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U)).unop)

Next tactic:
rw [this]
instance ofRestrict {X : TopCat} (Y : PresheafedSpace C) {f : X ⟶ Y.carrier}
    (hf : OpenEmbedding f) : IsOpenImmersion (Y.ofRestrict hf) where
  base_open := hf
  c_iso U := by
    dsimp
    have : (Opens.map f).obj (hf.isOpenMap.functor.obj U) = U := by
      ext1
      exact Set.preimage_image_eq _ hf.inj
    convert_to IsIso (Y.presheaf.map (𝟙 _))
    · congr
    · -- Porting note : was `apply Subsingleton.helim; rw [this]`
      -- See https://github.com/leanprover/lean4/issues/2273
      congr
      simp only [unop_op]
      congr
      apply Subsingleton.helim
      rw [this]
      

Proof state:
case h.e'_5.e_8.e_5.h₂
C : Type u_1
inst✝ : Category.{?u.57923, u_1} C
X✝ Y✝ : PresheafedSpace C
f✝ : X✝ ⟶ Y✝
H : IsOpenImmersion f✝
X : TopCat
Y : PresheafedSpace C
f : X ⟶ ↑Y
hf : OpenEmbedding ⇑f
U : Opens ↑↑(restrict Y hf)
this : (Opens.map f).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U) = U
e_4✝ :
  Y.presheaf.obj
      (op
        ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj
          ((Opens.map f).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U)))) =
    Y.presheaf.obj (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U))
⊢ ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U ⟶ (IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U) =
    ((op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U)).unop ⟶
      (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U)).unop)

Next tactic:
rfl
instance ofRestrict {X : TopCat} (Y : PresheafedSpace C) {f : X ⟶ Y.carrier}
    (hf : OpenEmbedding f) : IsOpenImmersion (Y.ofRestrict hf) where
  base_open := hf
  c_iso U := by
    dsimp
    have : (Opens.map f).obj (hf.isOpenMap.functor.obj U) = U := by
      ext1
      exact Set.preimage_image_eq _ hf.inj
    convert_to IsIso (Y.presheaf.map (𝟙 _))
    · congr
    · -- Porting note : was `apply Subsingleton.helim; rw [this]`
      -- See https://github.com/leanprover/lean4/issues/2273
      congr
      simp only [unop_op]
      congr
      apply Subsingleton.helim
      rw [this]
      rfl
    · 

Proof state:
case convert_2
C : Type u_1
inst✝ : Category.{?u.57923, u_1} C
X✝ Y✝ : PresheafedSpace C
f✝ : X✝ ⟶ Y✝
H : IsOpenImmersion f✝
X : TopCat
Y : PresheafedSpace C
f : X ⟶ ↑Y
hf : OpenEmbedding ⇑f
U : Opens ↑↑(restrict Y hf)
this : (Opens.map f).obj ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U) = U
⊢ IsIso (Y.presheaf.map (𝟙 (op ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).obj U))))

Next tactic:
infer_instance
@[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 = 𝟙 _ := by
  

Proof state:
C✝ : Type u_1
inst✝¹ : Category.{?u.65457, u_1} C✝
X✝ Y✝ : PresheafedSpace C✝
f✝ : X✝ ⟶ Y✝
H : IsOpenImmersion f✝
C : Type u_2
inst✝ : Category.{u_3, u_2} C
X : PresheafedSpace C
Y : TopCat
f : Y ⟶ TopCat.of ↑↑X
h : OpenEmbedding ⇑f
U : Opens ↑↑(restrict X h)
⊢ invApp (_ : IsOpenImmersion (PresheafedSpace.ofRestrict X h)) U = 𝟙 ((restrict X h).presheaf.obj (op U))

Next tactic:
delta invApp
@[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 = 𝟙 _ := by
  delta invApp
  

Proof state:
C✝ : Type u_1
inst✝¹ : Category.{?u.65457, u_1} C✝
X✝ Y✝ : PresheafedSpace C✝
f✝ : X✝ ⟶ Y✝
H : IsOpenImmersion f✝
C : Type u_2
inst✝ : Category.{u_3, u_2} C
X : PresheafedSpace C
Y : TopCat
f : Y ⟶ TopCat.of ↑↑X
h : OpenEmbedding ⇑f
U : Opens ↑↑(restrict X h)
⊢ (restrict X h).presheaf.map
        (eqToHom
          (_ :
            op U =
              op
                ((Opens.map (PresheafedSpace.ofRestrict X h).base).obj
                  (op ((openFunctor (_ : IsOpenImmersion (PresheafedSpace.ofRestrict X h))).obj U)).unop))) ≫
      inv
        ((PresheafedSpace.ofRestrict X h).c.app
          (op ((openFunctor (_ : IsOpenImmersion (PresheafedSpace.ofRestrict X h))).obj U))) =
    𝟙 ((restrict X h).presheaf.obj (op U))

Next tactic:
rw [IsIso.comp_inv_eq, Category.id_comp]
@[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 = 𝟙 _ := by
  delta invApp
  rw [IsIso.comp_inv_eq, Category.id_comp]
  

Proof state:
C✝ : Type u_1
inst✝¹ : Category.{?u.65457, u_1} C✝
X✝ Y✝ : PresheafedSpace C✝
f✝ : X✝ ⟶ Y✝
H : IsOpenImmersion f✝
C : Type u_2
inst✝ : Category.{u_3, u_2} C
X : PresheafedSpace C
Y : TopCat
f : Y ⟶ TopCat.of ↑↑X
h : OpenEmbedding ⇑f
U : Opens ↑↑(restrict X h)
⊢ (restrict X h).presheaf.map
      (eqToHom
        (_ :
          op U =
            op
              ((Opens.map (PresheafedSpace.ofRestrict X h).base).obj
                (op ((openFunctor (_ : IsOpenImmersion (PresheafedSpace.ofRestrict X h))).obj U)).unop))) =
    (PresheafedSpace.ofRestrict X h).c.app
      (op ((openFunctor (_ : IsOpenImmersion (PresheafedSpace.ofRestrict X h))).obj U))

Next tactic:
change X.presheaf.map _ = X.presheaf.map _
@[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 = 𝟙 _ := by
  delta invApp
  rw [IsIso.comp_inv_eq, Category.id_comp]
  change X.presheaf.map _ = X.presheaf.map _
  

Proof state:
C✝ : Type u_1
inst✝¹ : Category.{?u.65457, u_1} C✝
X✝ Y✝ : PresheafedSpace C✝
f✝ : X✝ ⟶ Y✝
H : IsOpenImmersion f✝
C : Type u_2
inst✝ : Category.{u_3, u_2} C
X : PresheafedSpace C
Y : TopCat
f : Y ⟶ TopCat.of ↑↑X
h : OpenEmbedding ⇑f
U : Opens ↑↑(restrict X h)
⊢ X.presheaf.map
      ((IsOpenMap.functor (_ : IsOpenMap ⇑f)).op.map
        (eqToHom
          (_ :
            op U =
              op
                ((Opens.map (PresheafedSpace.ofRestrict X h).base).obj
                  (op ((openFunctor (_ : IsOpenImmersion (PresheafedSpace.ofRestrict X h))).obj U)).unop)))) =
    X.presheaf.map
      ((IsOpenMap.adjunction (_ : IsOpenMap ⇑f)).counit.app
          (op ((openFunctor (_ : IsOpenImmersion (PresheafedSpace.ofRestrict X h))).obj U)).unop).op

Next tactic:
congr 1
/-- An open immersion is an iso if the underlying continuous map is epi. -/
theorem to_iso (f : X ⟶ Y) [h : IsOpenImmersion f] [h' : Epi f.base] : IsIso f := by
  -- Porting Note : was `apply (config := { instances := False }) ...`
  -- See https://github.com/leanprover/lean4/issues/2273
  

Proof state:
C : Type u_1
inst✝ : Category.{u_2, u_1} C
X Y : PresheafedSpace C
f✝ : X ⟶ Y
H : IsOpenImmersion f✝
f : X ⟶ Y
h : IsOpenImmersion f
h' : Epi f.base
⊢ IsIso f

Next tactic:
have : ∀ (U : (Opens Y)ᵒᵖ), IsIso (f.c.app U)
/-- An open immersion is an iso if the underlying continuous map is epi. -/
theorem to_iso (f : X ⟶ Y) [h : IsOpenImmersion f] [h' : Epi f.base] : IsIso f := by
  -- Porting Note : was `apply (config := { instances := False }) ...`
  -- See https://github.com/leanprover/lean4/issues/2273
  have : ∀ (U : (Opens Y)ᵒᵖ), IsIso (f.c.app U)
  · 

Proof state:
case this
C : Type u_1
inst✝ : Category.{u_2, u_1} C
X Y : PresheafedSpace C
f✝ : X ⟶ Y
H : IsOpenImmersion f✝
f : X ⟶ Y
h : IsOpenImmersion f
h' : Epi f.base
⊢ ∀ (U : (Opens ↑↑Y)ᵒᵖ), IsIso (f.c.app U)

Next tactic:
intro U
/-- An open immersion is an iso if the underlying continuous map is epi. -/
theorem to_iso (f : X ⟶ Y) [h : IsOpenImmersion f] [h' : Epi f.base] : IsIso f := by
  -- Porting Note : was `apply (config := { instances := False }) ...`
  -- See https://github.com/leanprover/lean4/issues/2273
  have : ∀ (U : (Opens Y)ᵒᵖ), IsIso (f.c.app U)
  · intro U
    

Proof state:
case this
C : Type u_1
inst✝ : Category.{u_2, u_1} C
X Y : PresheafedSpace C
f✝ : X ⟶ Y
H : IsOpenImmersion f✝
f : X ⟶ Y
h : IsOpenImmersion f
h' : Epi f.base
U : (Opens ↑↑Y)ᵒᵖ
⊢ IsIso (f.c.app U)

Next tactic:
have : U = op (h.openFunctor.obj ((Opens.map f.base).obj (unop U))) := by
      induction U using Opposite.rec' with | h U => ?_
      cases U
      dsimp only [Functor.op, Opens.map]
      congr
      exact (Set.image_preimage_eq _ ((TopCat.epi_iff_surjective _).mp h')).symm
/-- An open immersion is an iso if the underlying continuous map is epi. -/
theorem to_iso (f : X ⟶ Y) [h : IsOpenImmersion f] [h' : Epi f.base] : IsIso f := by
  -- Porting Note : was `apply (config := { instances := False }) ...`
  -- See https://github.com/leanprover/lean4/issues/2273
  have : ∀ (U : (Opens Y)ᵒᵖ), IsIso (f.c.app U)
  · intro U
    have : U = op (h.openFunctor.obj ((Opens.map f.base).obj (unop U))) := by
      

Proof state:
C : Type u_1
inst✝ : Category.{u_2, u_1} C
X Y : PresheafedSpace C
f✝ : X ⟶ Y
H : IsOpenImmersion f✝
f : X ⟶ Y
h : IsOpenImmersion f
h' : Epi f.base
U : (Opens ↑↑Y)ᵒᵖ
⊢ U = op ((openFunctor h).obj ((Opens.map f.base).obj U.unop))

Next tactic:
induction U using Opposite.rec' with | h U => ?_