l3lab/ntp-mathlib huggingface dataset:
/-- The composition of two open immersions is an open immersion. -/
instance comp {Z : PresheafedSpace C} (f : X ⟶ Y) [hf : IsOpenImmersion f] (g : Y ⟶ Z)
    [hg : IsOpenImmersion g] : IsOpenImmersion (f ≫ g) where
  base_open := hg.base_open.comp hf.base_open
  c_iso U := by
    generalize_proofs h
    dsimp only [AlgebraicGeometry.PresheafedSpace.comp_c_app, unop_op, Functor.op, comp_base,
      TopCat.Presheaf.pushforwardObj_obj, Opens.map_comp_obj]
    -- Porting note : was `apply (config := { instances := False }) ...`
    -- See https://github.com/leanprover/lean4/issues/2273
    have : IsIso (g.c.app (op <| (h.functor).obj U))
    · have : h.functor.obj U = hg.openFunctor.obj (hf.openFunctor.obj U) := by
        

Proof state:
C : Type u_1
inst✝ : Category.{?u.21081, u_1} C
X Y : PresheafedSpace C
f✝ : X ⟶ Y
H : IsOpenImmersion f✝
Z : PresheafedSpace C
f : X ⟶ Y
hf : IsOpenImmersion f
g : Y ⟶ Z
hg : IsOpenImmersion g
U : Opens ↑↑X
h : IsOpenMap ⇑(f ≫ g).base
⊢ (IsOpenMap.functor h).obj U = (openFunctor hg).obj ((openFunctor hf).obj U)

Next tactic:
ext1
/-- The composition of two open immersions is an open immersion. -/
instance comp {Z : PresheafedSpace C} (f : X ⟶ Y) [hf : IsOpenImmersion f] (g : Y ⟶ Z)
    [hg : IsOpenImmersion g] : IsOpenImmersion (f ≫ g) where
  base_open := hg.base_open.comp hf.base_open
  c_iso U := by
    generalize_proofs h
    dsimp only [AlgebraicGeometry.PresheafedSpace.comp_c_app, unop_op, Functor.op, comp_base,
      TopCat.Presheaf.pushforwardObj_obj, Opens.map_comp_obj]
    -- Porting note : was `apply (config := { instances := False }) ...`
    -- See https://github.com/leanprover/lean4/issues/2273
    have : IsIso (g.c.app (op <| (h.functor).obj U))
    · have : h.functor.obj U = hg.openFunctor.obj (hf.openFunctor.obj U) := by
        ext1
        

Proof state:
case h
C : Type u_1
inst✝ : Category.{?u.21081, u_1} C
X Y : PresheafedSpace C
f✝ : X ⟶ Y
H : IsOpenImmersion f✝
Z : PresheafedSpace C
f : X ⟶ Y
hf : IsOpenImmersion f
g : Y ⟶ Z
hg : IsOpenImmersion g
U : Opens ↑↑X
h : IsOpenMap ⇑(f ≫ g).base
⊢ ↑((IsOpenMap.functor h).obj U) = ↑((openFunctor hg).obj ((openFunctor hf).obj U))

Next tactic:
dsimp only [IsOpenMap.functor_obj_coe]
/-- The composition of two open immersions is an open immersion. -/
instance comp {Z : PresheafedSpace C} (f : X ⟶ Y) [hf : IsOpenImmersion f] (g : Y ⟶ Z)
    [hg : IsOpenImmersion g] : IsOpenImmersion (f ≫ g) where
  base_open := hg.base_open.comp hf.base_open
  c_iso U := by
    generalize_proofs h
    dsimp only [AlgebraicGeometry.PresheafedSpace.comp_c_app, unop_op, Functor.op, comp_base,
      TopCat.Presheaf.pushforwardObj_obj, Opens.map_comp_obj]
    -- Porting note : was `apply (config := { instances := False }) ...`
    -- See https://github.com/leanprover/lean4/issues/2273
    have : IsIso (g.c.app (op <| (h.functor).obj U))
    · have : h.functor.obj U = hg.openFunctor.obj (hf.openFunctor.obj U) := by
        ext1
        dsimp only [IsOpenMap.functor_obj_coe]
        -- Porting note : slightly more hand holding here: `g ∘ f` and `fun x => g (f x)`
        

Proof state:
case h
C : Type u_1
inst✝ : Category.{?u.21081, u_1} C
X Y : PresheafedSpace C
f✝ : X ⟶ Y
H : IsOpenImmersion f✝
Z : PresheafedSpace C
f : X ⟶ Y
hf : IsOpenImmersion f
g : Y ⟶ Z
hg : IsOpenImmersion g
U : Opens ↑↑X
h : IsOpenMap ⇑(f ≫ g).base
⊢ ⇑(f ≫ g).base '' ↑U = ⇑g.base '' (⇑f.base '' ↑U)

Next tactic:
rw [comp_base, coe_comp, show g.base ∘ f.base = fun x => g.base (f.base x) from rfl,
          ← Set.image_image]
/-- The composition of two open immersions is an open immersion. -/
instance comp {Z : PresheafedSpace C} (f : X ⟶ Y) [hf : IsOpenImmersion f] (g : Y ⟶ Z)
    [hg : IsOpenImmersion g] : IsOpenImmersion (f ≫ g) where
  base_open := hg.base_open.comp hf.base_open
  c_iso U := by
    generalize_proofs h
    dsimp only [AlgebraicGeometry.PresheafedSpace.comp_c_app, unop_op, Functor.op, comp_base,
      TopCat.Presheaf.pushforwardObj_obj, Opens.map_comp_obj]
    -- Porting note : was `apply (config := { instances := False }) ...`
    -- See https://github.com/leanprover/lean4/issues/2273
    have : IsIso (g.c.app (op <| (h.functor).obj U))
    · have : h.functor.obj U = hg.openFunctor.obj (hf.openFunctor.obj U) := by
        ext1
        dsimp only [IsOpenMap.functor_obj_coe]
        -- Porting note : slightly more hand holding here: `g ∘ f` and `fun x => g (f x)`
        rw [comp_base, coe_comp, show g.base ∘ f.base = fun x => g.base (f.base x) from rfl,
          ← Set.image_image]
      

Proof state:
case this
C : Type u_1
inst✝ : Category.{?u.21081, u_1} C
X Y : PresheafedSpace C
f✝ : X ⟶ Y
H : IsOpenImmersion f✝
Z : PresheafedSpace C
f : X ⟶ Y
hf : IsOpenImmersion f
g : Y ⟶ Z
hg : IsOpenImmersion g
U : Opens ↑↑X
h : IsOpenMap ⇑(f ≫ g).base
this : (IsOpenMap.functor h).obj U = (openFunctor hg).obj ((openFunctor hf).obj U)
⊢ IsIso (g.c.app (op ((IsOpenMap.functor h).obj U)))

Next tactic:
rw [this]
/-- The composition of two open immersions is an open immersion. -/
instance comp {Z : PresheafedSpace C} (f : X ⟶ Y) [hf : IsOpenImmersion f] (g : Y ⟶ Z)
    [hg : IsOpenImmersion g] : IsOpenImmersion (f ≫ g) where
  base_open := hg.base_open.comp hf.base_open
  c_iso U := by
    generalize_proofs h
    dsimp only [AlgebraicGeometry.PresheafedSpace.comp_c_app, unop_op, Functor.op, comp_base,
      TopCat.Presheaf.pushforwardObj_obj, Opens.map_comp_obj]
    -- Porting note : was `apply (config := { instances := False }) ...`
    -- See https://github.com/leanprover/lean4/issues/2273
    have : IsIso (g.c.app (op <| (h.functor).obj U))
    · have : h.functor.obj U = hg.openFunctor.obj (hf.openFunctor.obj U) := by
        ext1
        dsimp only [IsOpenMap.functor_obj_coe]
        -- Porting note : slightly more hand holding here: `g ∘ f` and `fun x => g (f x)`
        rw [comp_base, coe_comp, show g.base ∘ f.base = fun x => g.base (f.base x) from rfl,
          ← Set.image_image]
      rw [this]
      

Proof state:
case this
C : Type u_1
inst✝ : Category.{?u.21081, u_1} C
X Y : PresheafedSpace C
f✝ : X ⟶ Y
H : IsOpenImmersion f✝
Z : PresheafedSpace C
f : X ⟶ Y
hf : IsOpenImmersion f
g : Y ⟶ Z
hg : IsOpenImmersion g
U : Opens ↑↑X
h : IsOpenMap ⇑(f ≫ g).base
this : (IsOpenMap.functor h).obj U = (openFunctor hg).obj ((openFunctor hf).obj U)
⊢ IsIso (g.c.app (op ((openFunctor hg).obj ((openFunctor hf).obj U))))

Next tactic:
infer_instance
/-- The composition of two open immersions is an open immersion. -/
instance comp {Z : PresheafedSpace C} (f : X ⟶ Y) [hf : IsOpenImmersion f] (g : Y ⟶ Z)
    [hg : IsOpenImmersion g] : IsOpenImmersion (f ≫ g) where
  base_open := hg.base_open.comp hf.base_open
  c_iso U := by
    generalize_proofs h
    dsimp only [AlgebraicGeometry.PresheafedSpace.comp_c_app, unop_op, Functor.op, comp_base,
      TopCat.Presheaf.pushforwardObj_obj, Opens.map_comp_obj]
    -- Porting note : was `apply (config := { instances := False }) ...`
    -- See https://github.com/leanprover/lean4/issues/2273
    have : IsIso (g.c.app (op <| (h.functor).obj U))
    · have : h.functor.obj U = hg.openFunctor.obj (hf.openFunctor.obj U) := by
        ext1
        dsimp only [IsOpenMap.functor_obj_coe]
        -- Porting note : slightly more hand holding here: `g ∘ f` and `fun x => g (f x)`
        rw [comp_base, coe_comp, show g.base ∘ f.base = fun x => g.base (f.base x) from rfl,
          ← Set.image_image]
      rw [this]
      infer_instance
    

Proof state:
C : Type u_1
inst✝ : Category.{?u.21081, u_1} C
X Y : PresheafedSpace C
f✝ : X ⟶ Y
H : IsOpenImmersion f✝
Z : PresheafedSpace C
f : X ⟶ Y
hf : IsOpenImmersion f
g : Y ⟶ Z
hg : IsOpenImmersion g
U : Opens ↑↑X
h : IsOpenMap ⇑(f ≫ g).base
this : IsIso (g.c.app (op ((IsOpenMap.functor h).obj U)))
⊢ IsIso
    (g.c.app (op ((IsOpenMap.functor h).obj U)) ≫ f.c.app (op ((Opens.map g.base).obj ((IsOpenMap.functor h).obj U))))

Next tactic:
have : IsIso (f.c.app (op <| (Opens.map g.base).obj ((IsOpenMap.functor h).obj U)))
/-- The composition of two open immersions is an open immersion. -/
instance comp {Z : PresheafedSpace C} (f : X ⟶ Y) [hf : IsOpenImmersion f] (g : Y ⟶ Z)
    [hg : IsOpenImmersion g] : IsOpenImmersion (f ≫ g) where
  base_open := hg.base_open.comp hf.base_open
  c_iso U := by
    generalize_proofs h
    dsimp only [AlgebraicGeometry.PresheafedSpace.comp_c_app, unop_op, Functor.op, comp_base,
      TopCat.Presheaf.pushforwardObj_obj, Opens.map_comp_obj]
    -- Porting note : was `apply (config := { instances := False }) ...`
    -- See https://github.com/leanprover/lean4/issues/2273
    have : IsIso (g.c.app (op <| (h.functor).obj U))
    · have : h.functor.obj U = hg.openFunctor.obj (hf.openFunctor.obj U) := by
        ext1
        dsimp only [IsOpenMap.functor_obj_coe]
        -- Porting note : slightly more hand holding here: `g ∘ f` and `fun x => g (f x)`
        rw [comp_base, coe_comp, show g.base ∘ f.base = fun x => g.base (f.base x) from rfl,
          ← Set.image_image]
      rw [this]
      infer_instance
    have : IsIso (f.c.app (op <| (Opens.map g.base).obj ((IsOpenMap.functor h).obj U)))
    · 

Proof state:
case this
C : Type u_1
inst✝ : Category.{?u.21081, u_1} C
X Y : PresheafedSpace C
f✝ : X ⟶ Y
H : IsOpenImmersion f✝
Z : PresheafedSpace C
f : X ⟶ Y
hf : IsOpenImmersion f
g : Y ⟶ Z
hg : IsOpenImmersion g
U : Opens ↑↑X
h : IsOpenMap ⇑(f ≫ g).base
this : IsIso (g.c.app (op ((IsOpenMap.functor h).obj U)))
⊢ IsIso (f.c.app (op ((Opens.map g.base).obj ((IsOpenMap.functor h).obj U))))

Next tactic:
have : (Opens.map g.base).obj (h.functor.obj U) = hf.openFunctor.obj U := by
        ext1
        dsimp only [Opens.map_coe, IsOpenMap.functor_obj_coe, comp_base]
        -- Porting note : slightly more hand holding here: `g ∘ f` and `fun x => g (f x)`
        rw [coe_comp, show g.base ∘ f.base = fun x => g.base (f.base x) from rfl,
          ← Set.image_image g.base f.base, Set.preimage_image_eq _ hg.base_open.inj]
/-- The composition of two open immersions is an open immersion. -/
instance comp {Z : PresheafedSpace C} (f : X ⟶ Y) [hf : IsOpenImmersion f] (g : Y ⟶ Z)
    [hg : IsOpenImmersion g] : IsOpenImmersion (f ≫ g) where
  base_open := hg.base_open.comp hf.base_open
  c_iso U := by
    generalize_proofs h
    dsimp only [AlgebraicGeometry.PresheafedSpace.comp_c_app, unop_op, Functor.op, comp_base,
      TopCat.Presheaf.pushforwardObj_obj, Opens.map_comp_obj]
    -- Porting note : was `apply (config := { instances := False }) ...`
    -- See https://github.com/leanprover/lean4/issues/2273
    have : IsIso (g.c.app (op <| (h.functor).obj U))
    · have : h.functor.obj U = hg.openFunctor.obj (hf.openFunctor.obj U) := by
        ext1
        dsimp only [IsOpenMap.functor_obj_coe]
        -- Porting note : slightly more hand holding here: `g ∘ f` and `fun x => g (f x)`
        rw [comp_base, coe_comp, show g.base ∘ f.base = fun x => g.base (f.base x) from rfl,
          ← Set.image_image]
      rw [this]
      infer_instance
    have : IsIso (f.c.app (op <| (Opens.map g.base).obj ((IsOpenMap.functor h).obj U)))
    · have : (Opens.map g.base).obj (h.functor.obj U) = hf.openFunctor.obj U := by
        

Proof state:
C : Type u_1
inst✝ : Category.{?u.21081, u_1} C
X Y : PresheafedSpace C
f✝ : X ⟶ Y
H : IsOpenImmersion f✝
Z : PresheafedSpace C
f : X ⟶ Y
hf : IsOpenImmersion f
g : Y ⟶ Z
hg : IsOpenImmersion g
U : Opens ↑↑X
h : IsOpenMap ⇑(f ≫ g).base
this : IsIso (g.c.app (op ((IsOpenMap.functor h).obj U)))
⊢ (Opens.map g.base).obj ((IsOpenMap.functor h).obj U) = (openFunctor hf).obj U

Next tactic:
ext1
/-- The composition of two open immersions is an open immersion. -/
instance comp {Z : PresheafedSpace C} (f : X ⟶ Y) [hf : IsOpenImmersion f] (g : Y ⟶ Z)
    [hg : IsOpenImmersion g] : IsOpenImmersion (f ≫ g) where
  base_open := hg.base_open.comp hf.base_open
  c_iso U := by
    generalize_proofs h
    dsimp only [AlgebraicGeometry.PresheafedSpace.comp_c_app, unop_op, Functor.op, comp_base,
      TopCat.Presheaf.pushforwardObj_obj, Opens.map_comp_obj]
    -- Porting note : was `apply (config := { instances := False }) ...`
    -- See https://github.com/leanprover/lean4/issues/2273
    have : IsIso (g.c.app (op <| (h.functor).obj U))
    · have : h.functor.obj U = hg.openFunctor.obj (hf.openFunctor.obj U) := by
        ext1
        dsimp only [IsOpenMap.functor_obj_coe]
        -- Porting note : slightly more hand holding here: `g ∘ f` and `fun x => g (f x)`
        rw [comp_base, coe_comp, show g.base ∘ f.base = fun x => g.base (f.base x) from rfl,
          ← Set.image_image]
      rw [this]
      infer_instance
    have : IsIso (f.c.app (op <| (Opens.map g.base).obj ((IsOpenMap.functor h).obj U)))
    · have : (Opens.map g.base).obj (h.functor.obj U) = hf.openFunctor.obj U := by
        ext1
        

Proof state:
case h
C : Type u_1
inst✝ : Category.{?u.21081, u_1} C
X Y : PresheafedSpace C
f✝ : X ⟶ Y
H : IsOpenImmersion f✝
Z : PresheafedSpace C
f : X ⟶ Y
hf : IsOpenImmersion f
g : Y ⟶ Z
hg : IsOpenImmersion g
U : Opens ↑↑X
h : IsOpenMap ⇑(f ≫ g).base
this : IsIso (g.c.app (op ((IsOpenMap.functor h).obj U)))
⊢ ↑((Opens.map g.base).obj ((IsOpenMap.functor h).obj U)) = ↑((openFunctor hf).obj U)

Next tactic:
dsimp only [Opens.map_coe, IsOpenMap.functor_obj_coe, comp_base]
/-- The composition of two open immersions is an open immersion. -/
instance comp {Z : PresheafedSpace C} (f : X ⟶ Y) [hf : IsOpenImmersion f] (g : Y ⟶ Z)
    [hg : IsOpenImmersion g] : IsOpenImmersion (f ≫ g) where
  base_open := hg.base_open.comp hf.base_open
  c_iso U := by
    generalize_proofs h
    dsimp only [AlgebraicGeometry.PresheafedSpace.comp_c_app, unop_op, Functor.op, comp_base,
      TopCat.Presheaf.pushforwardObj_obj, Opens.map_comp_obj]
    -- Porting note : was `apply (config := { instances := False }) ...`
    -- See https://github.com/leanprover/lean4/issues/2273
    have : IsIso (g.c.app (op <| (h.functor).obj U))
    · have : h.functor.obj U = hg.openFunctor.obj (hf.openFunctor.obj U) := by
        ext1
        dsimp only [IsOpenMap.functor_obj_coe]
        -- Porting note : slightly more hand holding here: `g ∘ f` and `fun x => g (f x)`
        rw [comp_base, coe_comp, show g.base ∘ f.base = fun x => g.base (f.base x) from rfl,
          ← Set.image_image]
      rw [this]
      infer_instance
    have : IsIso (f.c.app (op <| (Opens.map g.base).obj ((IsOpenMap.functor h).obj U)))
    · have : (Opens.map g.base).obj (h.functor.obj U) = hf.openFunctor.obj U := by
        ext1
        dsimp only [Opens.map_coe, IsOpenMap.functor_obj_coe, comp_base]
        -- Porting note : slightly more hand holding here: `g ∘ f` and `fun x => g (f x)`
        

Proof state:
case h
C : Type u_1
inst✝ : Category.{?u.21081, u_1} C
X Y : PresheafedSpace C
f✝ : X ⟶ Y
H : IsOpenImmersion f✝
Z : PresheafedSpace C
f : X ⟶ Y
hf : IsOpenImmersion f
g : Y ⟶ Z
hg : IsOpenImmersion g
U : Opens ↑↑X
h : IsOpenMap ⇑(f ≫ g).base
this : IsIso (g.c.app (op ((IsOpenMap.functor h).obj U)))
⊢ ⇑g.base ⁻¹' (⇑(f.base ≫ g.base) '' ↑U) = ⇑f.base '' ↑U

Next tactic:
rw [coe_comp, show g.base ∘ f.base = fun x => g.base (f.base x) from rfl,
          ← Set.image_image g.base f.base, Set.preimage_image_eq _ hg.base_open.inj]
/-- The composition of two open immersions is an open immersion. -/
instance comp {Z : PresheafedSpace C} (f : X ⟶ Y) [hf : IsOpenImmersion f] (g : Y ⟶ Z)
    [hg : IsOpenImmersion g] : IsOpenImmersion (f ≫ g) where
  base_open := hg.base_open.comp hf.base_open
  c_iso U := by
    generalize_proofs h
    dsimp only [AlgebraicGeometry.PresheafedSpace.comp_c_app, unop_op, Functor.op, comp_base,
      TopCat.Presheaf.pushforwardObj_obj, Opens.map_comp_obj]
    -- Porting note : was `apply (config := { instances := False }) ...`
    -- See https://github.com/leanprover/lean4/issues/2273
    have : IsIso (g.c.app (op <| (h.functor).obj U))
    · have : h.functor.obj U = hg.openFunctor.obj (hf.openFunctor.obj U) := by
        ext1
        dsimp only [IsOpenMap.functor_obj_coe]
        -- Porting note : slightly more hand holding here: `g ∘ f` and `fun x => g (f x)`
        rw [comp_base, coe_comp, show g.base ∘ f.base = fun x => g.base (f.base x) from rfl,
          ← Set.image_image]
      rw [this]
      infer_instance
    have : IsIso (f.c.app (op <| (Opens.map g.base).obj ((IsOpenMap.functor h).obj U)))
    · have : (Opens.map g.base).obj (h.functor.obj U) = hf.openFunctor.obj U := by
        ext1
        dsimp only [Opens.map_coe, IsOpenMap.functor_obj_coe, comp_base]
        -- Porting note : slightly more hand holding here: `g ∘ f` and `fun x => g (f x)`
        rw [coe_comp, show g.base ∘ f.base = fun x => g.base (f.base x) from rfl,
          ← Set.image_image g.base f.base, Set.preimage_image_eq _ hg.base_open.inj]
      

Proof state:
case this
C : Type u_1
inst✝ : Category.{?u.21081, u_1} C
X Y : PresheafedSpace C
f✝ : X ⟶ Y
H : IsOpenImmersion f✝
Z : PresheafedSpace C
f : X ⟶ Y
hf : IsOpenImmersion f
g : Y ⟶ Z
hg : IsOpenImmersion g
U : Opens ↑↑X
h : IsOpenMap ⇑(f ≫ g).base
this✝ : IsIso (g.c.app (op ((IsOpenMap.functor h).obj U)))
this : (Opens.map g.base).obj ((IsOpenMap.functor h).obj U) = (openFunctor hf).obj U
⊢ IsIso (f.c.app (op ((Opens.map g.base).obj ((IsOpenMap.functor h).obj U))))

Next tactic:
rw [this]
/-- The composition of two open immersions is an open immersion. -/
instance comp {Z : PresheafedSpace C} (f : X ⟶ Y) [hf : IsOpenImmersion f] (g : Y ⟶ Z)
    [hg : IsOpenImmersion g] : IsOpenImmersion (f ≫ g) where
  base_open := hg.base_open.comp hf.base_open
  c_iso U := by
    generalize_proofs h
    dsimp only [AlgebraicGeometry.PresheafedSpace.comp_c_app, unop_op, Functor.op, comp_base,
      TopCat.Presheaf.pushforwardObj_obj, Opens.map_comp_obj]
    -- Porting note : was `apply (config := { instances := False }) ...`
    -- See https://github.com/leanprover/lean4/issues/2273
    have : IsIso (g.c.app (op <| (h.functor).obj U))
    · have : h.functor.obj U = hg.openFunctor.obj (hf.openFunctor.obj U) := by
        ext1
        dsimp only [IsOpenMap.functor_obj_coe]
        -- Porting note : slightly more hand holding here: `g ∘ f` and `fun x => g (f x)`
        rw [comp_base, coe_comp, show g.base ∘ f.base = fun x => g.base (f.base x) from rfl,
          ← Set.image_image]
      rw [this]
      infer_instance
    have : IsIso (f.c.app (op <| (Opens.map g.base).obj ((IsOpenMap.functor h).obj U)))
    · have : (Opens.map g.base).obj (h.functor.obj U) = hf.openFunctor.obj U := by
        ext1
        dsimp only [Opens.map_coe, IsOpenMap.functor_obj_coe, comp_base]
        -- Porting note : slightly more hand holding here: `g ∘ f` and `fun x => g (f x)`
        rw [coe_comp, show g.base ∘ f.base = fun x => g.base (f.base x) from rfl,
          ← Set.image_image g.base f.base, Set.preimage_image_eq _ hg.base_open.inj]
      rw [this]
      

Proof state:
case this
C : Type u_1
inst✝ : Category.{?u.21081, u_1} C
X Y : PresheafedSpace C
f✝ : X ⟶ Y
H : IsOpenImmersion f✝
Z : PresheafedSpace C
f : X ⟶ Y
hf : IsOpenImmersion f
g : Y ⟶ Z
hg : IsOpenImmersion g
U : Opens ↑↑X
h : IsOpenMap ⇑(f ≫ g).base
this✝ : IsIso (g.c.app (op ((IsOpenMap.functor h).obj U)))
this : (Opens.map g.base).obj ((IsOpenMap.functor h).obj U) = (openFunctor hf).obj U
⊢ IsIso (f.c.app (op ((openFunctor hf).obj U)))

Next tactic:
infer_instance
/-- The composition of two open immersions is an open immersion. -/
instance comp {Z : PresheafedSpace C} (f : X ⟶ Y) [hf : IsOpenImmersion f] (g : Y ⟶ Z)
    [hg : IsOpenImmersion g] : IsOpenImmersion (f ≫ g) where
  base_open := hg.base_open.comp hf.base_open
  c_iso U := by
    generalize_proofs h
    dsimp only [AlgebraicGeometry.PresheafedSpace.comp_c_app, unop_op, Functor.op, comp_base,
      TopCat.Presheaf.pushforwardObj_obj, Opens.map_comp_obj]
    -- Porting note : was `apply (config := { instances := False }) ...`
    -- See https://github.com/leanprover/lean4/issues/2273
    have : IsIso (g.c.app (op <| (h.functor).obj U))
    · have : h.functor.obj U = hg.openFunctor.obj (hf.openFunctor.obj U) := by
        ext1
        dsimp only [IsOpenMap.functor_obj_coe]
        -- Porting note : slightly more hand holding here: `g ∘ f` and `fun x => g (f x)`
        rw [comp_base, coe_comp, show g.base ∘ f.base = fun x => g.base (f.base x) from rfl,
          ← Set.image_image]
      rw [this]
      infer_instance
    have : IsIso (f.c.app (op <| (Opens.map g.base).obj ((IsOpenMap.functor h).obj U)))
    · have : (Opens.map g.base).obj (h.functor.obj U) = hf.openFunctor.obj U := by
        ext1
        dsimp only [Opens.map_coe, IsOpenMap.functor_obj_coe, comp_base]
        -- Porting note : slightly more hand holding here: `g ∘ f` and `fun x => g (f x)`
        rw [coe_comp, show g.base ∘ f.base = fun x => g.base (f.base x) from rfl,
          ← Set.image_image g.base f.base, Set.preimage_image_eq _ hg.base_open.inj]
      rw [this]
      infer_instance
    

Proof state:
C : Type u_1
inst✝ : Category.{?u.21081, u_1} C
X Y : PresheafedSpace C
f✝ : X ⟶ Y
H : IsOpenImmersion f✝
Z : PresheafedSpace C
f : X ⟶ Y
hf : IsOpenImmersion f
g : Y ⟶ Z
hg : IsOpenImmersion g
U : Opens ↑↑X
h : IsOpenMap ⇑(f ≫ g).base
this✝ : IsIso (g.c.app (op ((IsOpenMap.functor h).obj U)))
this : IsIso (f.c.app (op ((Opens.map g.base).obj ((IsOpenMap.functor h).obj U))))
⊢ IsIso
    (g.c.app (op ((IsOpenMap.functor h).obj U)) ≫ f.c.app (op ((Opens.map g.base).obj ((IsOpenMap.functor h).obj U))))

Next tactic:
apply IsIso.comp_isIso
/-- For an open immersion `f : X ⟶ Y` and an open set `U ⊆ X`, we have the map `X(U) ⟶ Y(U)`. -/
noncomputable def invApp (U : Opens X) :
    X.presheaf.obj (op U) ⟶ Y.presheaf.obj (op (H.openFunctor.obj U)) :=
  X.presheaf.map (eqToHom (by
    -- Porting note : was just `simp [opens.map, Set.preimage_image_eq _ H.base_open.inj]`
    -- See https://github.com/leanprover-community/mathlib4/issues/5026
    -- I think this is because `Set.preimage_image_eq _ H.base_open.inj` can't see through a
    -- structure
    

Proof state:
C : Type u_1
inst✝ : Category.{?u.27455, u_1} C
X Y : PresheafedSpace C
f : X ⟶ Y
H : IsOpenImmersion f
U : Opens ↑↑X
⊢ op U = (Opens.map f.base).op.obj (op ((openFunctor H).obj U))

Next tactic:
congr
/-- For an open immersion `f : X ⟶ Y` and an open set `U ⊆ X`, we have the map `X(U) ⟶ Y(U)`. -/
noncomputable def invApp (U : Opens X) :
    X.presheaf.obj (op U) ⟶ Y.presheaf.obj (op (H.openFunctor.obj U)) :=
  X.presheaf.map (eqToHom (by
    -- Porting note : was just `simp [opens.map, Set.preimage_image_eq _ H.base_open.inj]`
    -- See https://github.com/leanprover-community/mathlib4/issues/5026
    -- I think this is because `Set.preimage_image_eq _ H.base_open.inj` can't see through a
    -- structure
    congr; 

Proof state:
case e_x
C : Type u_1
inst✝ : Category.{?u.27455, u_1} C
X Y : PresheafedSpace C
f : X ⟶ Y
H : IsOpenImmersion f
U : Opens ↑↑X
⊢ U = (Opens.map f.base).obj (op ((openFunctor H).obj U)).unop

Next tactic:
ext
/-- For an open immersion `f : X ⟶ Y` and an open set `U ⊆ X`, we have the map `X(U) ⟶ Y(U)`. -/
noncomputable def invApp (U : Opens X) :
    X.presheaf.obj (op U) ⟶ Y.presheaf.obj (op (H.openFunctor.obj U)) :=
  X.presheaf.map (eqToHom (by
    -- Porting note : was just `simp [opens.map, Set.preimage_image_eq _ H.base_open.inj]`
    -- See https://github.com/leanprover-community/mathlib4/issues/5026
    -- I think this is because `Set.preimage_image_eq _ H.base_open.inj` can't see through a
    -- structure
    congr; ext
    

Proof state:
case e_x.h.h
C : Type u_1
inst✝ : Category.{?u.27455, u_1} C
X Y : PresheafedSpace C
f : X ⟶ Y
H : IsOpenImmersion f
U : Opens ↑↑X
x✝ : ↑↑X
⊢ x✝ ∈ ↑U ↔ x✝ ∈ ↑((Opens.map f.base).obj (op ((openFunctor H).obj U)).unop)

Next tactic:
dsimp [openFunctor, IsOpenMap.functor]