l3lab/ntp-mathlib huggingface dataset:
theorem imageBasicOpen_image_open :
    IsOpen ((coequalizer.π f.1 g.1).base '' (imageBasicOpen f g U s).1) := by
  rw [← (TopCat.homeoOfIso (PreservesCoequalizer.iso (SheafedSpace.forget _) f.1
    g.1)).isOpen_preimage, TopCat.coequalizer_isOpen_iff, ← Set.preimage_comp]
  erw [← coe_comp]
  rw [PreservesCoequalizer.iso_hom, ι_comp_coequalizerComparison]
  dsimp only [SheafedSpace.forget]
  -- Porting note : change `rw` to `erw`
  erw [imageBasicOpen_image_preimage]
  

Proof state:
X Y : LocallyRingedSpace
f g : X ⟶ Y
U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U))
⊢ IsOpen (imageBasicOpen f g U s).carrier

Next tactic:
exact (imageBasicOpen f g U s).2
instance coequalizer_π_stalk_isLocalRingHom (x : Y) :
    IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by
  

Proof state:
X Y : LocallyRingedSpace
f g : X ⟶ Y
U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U))
x : ↑(toTopCat Y)
⊢ IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val) x)

Next tactic:
constructor
instance coequalizer_π_stalk_isLocalRingHom (x : Y) :
    IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by
  constructor
  

Proof state:
case map_nonunit
X Y : LocallyRingedSpace
f g : X ⟶ Y
U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U))
x : ↑(toTopCat Y)
⊢ ∀ (a : ↑(PresheafedSpace.stalk (coequalizer f.val g.val).toPresheafedSpace ((coequalizer.π f.val g.val).base x))),
    IsUnit ((PresheafedSpace.stalkMap (coequalizer.π f.val g.val) x) a) → IsUnit a

Next tactic:
rintro a ha
instance coequalizer_π_stalk_isLocalRingHom (x : Y) :
    IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by
  constructor
  rintro a ha
  

Proof state:
case map_nonunit
X Y : LocallyRingedSpace
f g : X ⟶ Y
U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
s : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U))
x : ↑(toTopCat Y)
a : ↑(PresheafedSpace.stalk (coequalizer f.val g.val).toPresheafedSpace ((coequalizer.π f.val g.val).base x))
ha : IsUnit ((PresheafedSpace.stalkMap (coequalizer.π f.val g.val) x) a)
⊢ IsUnit a

Next tactic:
rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩
instance coequalizer_π_stalk_isLocalRingHom (x : Y) :
    IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by
  constructor
  rintro a ha
  rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩
  

Proof state:
case map_nonunit.intro.intro.intro
X Y : LocallyRingedSpace
f g : X ⟶ Y
U✝ : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
s✝ : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U✝))
x : ↑(toTopCat Y)
U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
hU : (coequalizer.π f.val g.val).base x ∈ U
s : (forget CommRingCat).obj ((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U))
ha :
  IsUnit
    ((PresheafedSpace.stalkMap (coequalizer.π f.val g.val) x)
      ((TopCat.Presheaf.germ (coequalizer f.val g.val).toPresheafedSpace.presheaf
          { val := (coequalizer.π f.val g.val).base x, property := hU })
        s))
⊢ IsUnit
    ((TopCat.Presheaf.germ (coequalizer f.val g.val).toPresheafedSpace.presheaf
        { val := (coequalizer.π f.val g.val).base x, property := hU })
      s)

Next tactic:
erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha
instance coequalizer_π_stalk_isLocalRingHom (x : Y) :
    IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by
  constructor
  rintro a ha
  rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩
  erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha
  

Proof state:
case map_nonunit.intro.intro.intro
X Y : LocallyRingedSpace
f g : X ⟶ Y
U✝ : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
s✝ : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U✝))
x : ↑(toTopCat Y)
U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
hU : (coequalizer.π f.val g.val).base x ∈ U
s : (forget CommRingCat).obj ((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U))
ha :
  IsUnit ((TopCat.Presheaf.germ Y.presheaf { val := x, property := hU }) (((coequalizer.π f.val g.val).c.app (op U)) s))
⊢ IsUnit
    ((TopCat.Presheaf.germ (coequalizer f.val g.val).toPresheafedSpace.presheaf
        { val := (coequalizer.π f.val g.val).base x, property := hU })
      s)

Next tactic:
let V := imageBasicOpen f g U s
instance coequalizer_π_stalk_isLocalRingHom (x : Y) :
    IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by
  constructor
  rintro a ha
  rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩
  erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha
  let V := imageBasicOpen f g U s
  

Proof state:
case map_nonunit.intro.intro.intro
X Y : LocallyRingedSpace
f g : X ⟶ Y
U✝ : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
s✝ : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U✝))
x : ↑(toTopCat Y)
U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
hU : (coequalizer.π f.val g.val).base x ∈ U
s : (forget CommRingCat).obj ((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U))
ha :
  IsUnit ((TopCat.Presheaf.germ Y.presheaf { val := x, property := hU }) (((coequalizer.π f.val g.val).c.app (op U)) s))
V : Opens ↑(toTopCat Y) := imageBasicOpen f g U s
⊢ IsUnit
    ((TopCat.Presheaf.germ (coequalizer f.val g.val).toPresheafedSpace.presheaf
        { val := (coequalizer.π f.val g.val).base x, property := hU })
      s)

Next tactic:
have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 :=
    imageBasicOpen_image_preimage f g U s
instance coequalizer_π_stalk_isLocalRingHom (x : Y) :
    IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by
  constructor
  rintro a ha
  rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩
  erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha
  let V := imageBasicOpen f g U s
  have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 :=
    imageBasicOpen_image_preimage f g U s
  

Proof state:
case map_nonunit.intro.intro.intro
X Y : LocallyRingedSpace
f g : X ⟶ Y
U✝ : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
s✝ : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U✝))
x : ↑(toTopCat Y)
U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
hU : (coequalizer.π f.val g.val).base x ∈ U
s : (forget CommRingCat).obj ((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U))
ha :
  IsUnit ((TopCat.Presheaf.germ Y.presheaf { val := x, property := hU }) (((coequalizer.π f.val g.val).c.app (op U)) s))
V : Opens ↑(toTopCat Y) := imageBasicOpen f g U s
hV : ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier) = V.carrier
⊢ IsUnit
    ((TopCat.Presheaf.germ (coequalizer f.val g.val).toPresheafedSpace.presheaf
        { val := (coequalizer.π f.val g.val).base x, property := hU })
      s)

Next tactic:
have hV' :
    V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ :=
    SetLike.ext' hV.symm
instance coequalizer_π_stalk_isLocalRingHom (x : Y) :
    IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by
  constructor
  rintro a ha
  rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩
  erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha
  let V := imageBasicOpen f g U s
  have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 :=
    imageBasicOpen_image_preimage f g U s
  have hV' :
    V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ :=
    SetLike.ext' hV.symm
  

Proof state:
case map_nonunit.intro.intro.intro
X Y : LocallyRingedSpace
f g : X ⟶ Y
U✝ : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
s✝ : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U✝))
x : ↑(toTopCat Y)
U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
hU : (coequalizer.π f.val g.val).base x ∈ U
s : (forget CommRingCat).obj ((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U))
ha :
  IsUnit ((TopCat.Presheaf.germ Y.presheaf { val := x, property := hU }) (((coequalizer.π f.val g.val).c.app (op U)) s))
V : Opens ↑(toTopCat Y) := imageBasicOpen f g U s
hV : ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier) = V.carrier
hV' :
  V =
    { carrier := ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier),
      is_open' :=
        (_ : IsOpen (⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier))) }
⊢ IsUnit
    ((TopCat.Presheaf.germ (coequalizer f.val g.val).toPresheafedSpace.presheaf
        { val := (coequalizer.π f.val g.val).base x, property := hU })
      s)

Next tactic:
have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) :=
    imageBasicOpen_image_open f g U s
instance coequalizer_π_stalk_isLocalRingHom (x : Y) :
    IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by
  constructor
  rintro a ha
  rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩
  erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha
  let V := imageBasicOpen f g U s
  have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 :=
    imageBasicOpen_image_preimage f g U s
  have hV' :
    V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ :=
    SetLike.ext' hV.symm
  have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) :=
    imageBasicOpen_image_open f g U s
  

Proof state:
case map_nonunit.intro.intro.intro
X Y : LocallyRingedSpace
f g : X ⟶ Y
U✝ : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
s✝ : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U✝))
x : ↑(toTopCat Y)
U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
hU : (coequalizer.π f.val g.val).base x ∈ U
s : (forget CommRingCat).obj ((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U))
ha :
  IsUnit ((TopCat.Presheaf.germ Y.presheaf { val := x, property := hU }) (((coequalizer.π f.val g.val).c.app (op U)) s))
V : Opens ↑(toTopCat Y) := imageBasicOpen f g U s
hV : ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier) = V.carrier
hV' :
  V =
    { carrier := ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier),
      is_open' :=
        (_ : IsOpen (⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier))) }
V_open : IsOpen (⇑(coequalizer.π f.val g.val).base '' V.carrier)
⊢ IsUnit
    ((TopCat.Presheaf.germ (coequalizer f.val g.val).toPresheafedSpace.presheaf
        { val := (coequalizer.π f.val g.val).base x, property := hU })
      s)

Next tactic:
have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U :=
    Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _)
instance coequalizer_π_stalk_isLocalRingHom (x : Y) :
    IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by
  constructor
  rintro a ha
  rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩
  erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha
  let V := imageBasicOpen f g U s
  have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 :=
    imageBasicOpen_image_preimage f g U s
  have hV' :
    V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ :=
    SetLike.ext' hV.symm
  have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) :=
    imageBasicOpen_image_open f g U s
  have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U :=
    Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _)
  

Proof state:
case map_nonunit.intro.intro.intro
X Y : LocallyRingedSpace
f g : X ⟶ Y
U✝ : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
s✝ : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U✝))
x : ↑(toTopCat Y)
U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
hU : (coequalizer.π f.val g.val).base x ∈ U
s : (forget CommRingCat).obj ((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U))
ha :
  IsUnit ((TopCat.Presheaf.germ Y.presheaf { val := x, property := hU }) (((coequalizer.π f.val g.val).c.app (op U)) s))
V : Opens ↑(toTopCat Y) := imageBasicOpen f g U s
hV : ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier) = V.carrier
hV' :
  V =
    { carrier := ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier),
      is_open' :=
        (_ : IsOpen (⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier))) }
V_open : IsOpen (⇑(coequalizer.π f.val g.val).base '' V.carrier)
VleU : { carrier := ⇑(coequalizer.π f.val g.val).base '' V.carrier, is_open' := V_open } ≤ U
⊢ IsUnit
    ((TopCat.Presheaf.germ (coequalizer f.val g.val).toPresheafedSpace.presheaf
        { val := (coequalizer.π f.val g.val).base x, property := hU })
      s)

Next tactic:
have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩
instance coequalizer_π_stalk_isLocalRingHom (x : Y) :
    IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by
  constructor
  rintro a ha
  rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩
  erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha
  let V := imageBasicOpen f g U s
  have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 :=
    imageBasicOpen_image_preimage f g U s
  have hV' :
    V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ :=
    SetLike.ext' hV.symm
  have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) :=
    imageBasicOpen_image_open f g U s
  have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U :=
    Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _)
  have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩
  

Proof state:
case map_nonunit.intro.intro.intro
X Y : LocallyRingedSpace
f g : X ⟶ Y
U✝ : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
s✝ : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U✝))
x : ↑(toTopCat Y)
U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
hU : (coequalizer.π f.val g.val).base x ∈ U
s : (forget CommRingCat).obj ((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U))
ha :
  IsUnit ((TopCat.Presheaf.germ Y.presheaf { val := x, property := hU }) (((coequalizer.π f.val g.val).c.app (op U)) s))
V : Opens ↑(toTopCat Y) := imageBasicOpen f g U s
hV : ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier) = V.carrier
hV' :
  V =
    { carrier := ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier),
      is_open' :=
        (_ : IsOpen (⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier))) }
V_open : IsOpen (⇑(coequalizer.π f.val g.val).base '' V.carrier)
VleU : { carrier := ⇑(coequalizer.π f.val g.val).base '' V.carrier, is_open' := V_open } ≤ U
hxV : x ∈ V
⊢ IsUnit
    ((TopCat.Presheaf.germ (coequalizer f.val g.val).toPresheafedSpace.presheaf
        { val := (coequalizer.π f.val g.val).base x, property := hU })
      s)

Next tactic:
erw [←
    (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU)
      ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s]
instance coequalizer_π_stalk_isLocalRingHom (x : Y) :
    IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by
  constructor
  rintro a ha
  rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩
  erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha
  let V := imageBasicOpen f g U s
  have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 :=
    imageBasicOpen_image_preimage f g U s
  have hV' :
    V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ :=
    SetLike.ext' hV.symm
  have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) :=
    imageBasicOpen_image_open f g U s
  have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U :=
    Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _)
  have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩
  erw [←
    (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU)
      ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s]
  

Proof state:
case map_nonunit.intro.intro.intro
X Y : LocallyRingedSpace
f g : X ⟶ Y
U✝ : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
s✝ : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U✝))
x : ↑(toTopCat Y)
U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
hU : (coequalizer.π f.val g.val).base x ∈ U
s : (forget CommRingCat).obj ((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U))
ha :
  IsUnit ((TopCat.Presheaf.germ Y.presheaf { val := x, property := hU }) (((coequalizer.π f.val g.val).c.app (op U)) s))
V : Opens ↑(toTopCat Y) := imageBasicOpen f g U s
hV : ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier) = V.carrier
hV' :
  V =
    { carrier := ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier),
      is_open' :=
        (_ : IsOpen (⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier))) }
V_open : IsOpen (⇑(coequalizer.π f.val g.val).base '' V.carrier)
VleU : { carrier := ⇑(coequalizer.π f.val g.val).base '' V.carrier, is_open' := V_open } ≤ U
hxV : x ∈ V
⊢ IsUnit
    ((TopCat.Presheaf.germ (coequalizer f.val g.val).toPresheafedSpace.presheaf
        { val := (coequalizer.π f.val g.val).base x,
          property := (_ : (coequalizer.π f.val g.val).base x ∈ ⇑(coequalizer.π f.val g.val).base '' V.carrier) })
      (((coequalizer f.val g.val).toPresheafedSpace.presheaf.map (homOfLE VleU).op) s))

Next tactic:
apply RingHom.isUnit_map
instance coequalizer_π_stalk_isLocalRingHom (x : Y) :
    IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by
  constructor
  rintro a ha
  rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩
  erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha
  let V := imageBasicOpen f g U s
  have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 :=
    imageBasicOpen_image_preimage f g U s
  have hV' :
    V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ :=
    SetLike.ext' hV.symm
  have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) :=
    imageBasicOpen_image_open f g U s
  have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U :=
    Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _)
  have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩
  erw [←
    (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU)
      ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s]
  apply RingHom.isUnit_map
  

Proof state:
case map_nonunit.intro.intro.intro.a
X Y : LocallyRingedSpace
f g : X ⟶ Y
U✝ : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
s✝ : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U✝))
x : ↑(toTopCat Y)
U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
hU : (coequalizer.π f.val g.val).base x ∈ U
s : (forget CommRingCat).obj ((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U))
ha :
  IsUnit ((TopCat.Presheaf.germ Y.presheaf { val := x, property := hU }) (((coequalizer.π f.val g.val).c.app (op U)) s))
V : Opens ↑(toTopCat Y) := imageBasicOpen f g U s
hV : ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier) = V.carrier
hV' :
  V =
    { carrier := ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier),
      is_open' :=
        (_ : IsOpen (⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier))) }
V_open : IsOpen (⇑(coequalizer.π f.val g.val).base '' V.carrier)
VleU : { carrier := ⇑(coequalizer.π f.val g.val).base '' V.carrier, is_open' := V_open } ≤ U
hxV : x ∈ V
⊢ IsUnit (((coequalizer f.val g.val).toPresheafedSpace.presheaf.map (homOfLE VleU).op) s)

Next tactic:
rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply,
    NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ←
    isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)]
instance coequalizer_π_stalk_isLocalRingHom (x : Y) :
    IsLocalRingHom (PresheafedSpace.stalkMap (coequalizer.π f.val g.val : _) x) := by
  constructor
  rintro a ha
  rcases TopCat.Presheaf.germ_exist _ _ a with ⟨U, hU, s, rfl⟩
  erw [PresheafedSpace.stalkMap_germ_apply (coequalizer.π f.1 g.1 : _) U ⟨_, hU⟩] at ha
  let V := imageBasicOpen f g U s
  have hV : (coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1) = V.1 :=
    imageBasicOpen_image_preimage f g U s
  have hV' :
    V = ⟨(coequalizer.π f.1 g.1).base ⁻¹' ((coequalizer.π f.1 g.1).base '' V.1), hV.symm ▸ V.2⟩ :=
    SetLike.ext' hV.symm
  have V_open : IsOpen ((coequalizer.π f.val g.val).base '' V.1) :=
    imageBasicOpen_image_open f g U s
  have VleU : (⟨(coequalizer.π f.val g.val).base '' V.1, V_open⟩ : TopologicalSpace.Opens _) ≤ U :=
    Set.image_subset_iff.mpr (Y.toRingedSpace.basicOpen_le _)
  have hxV : x ∈ V := ⟨⟨_, hU⟩, ha, rfl⟩
  erw [←
    (coequalizer f.val g.val).presheaf.germ_res_apply (homOfLE VleU)
      ⟨_, @Set.mem_image_of_mem _ _ (coequalizer.π f.val g.val).base x V.1 hxV⟩ s]
  apply RingHom.isUnit_map
  rw [← isUnit_map_iff ((coequalizer.π f.val g.val : _).c.app _), ← comp_apply,
    NatTrans.naturality, comp_apply, TopCat.Presheaf.pushforwardObj_map, ←
    isUnit_map_iff (Y.presheaf.map (eqToHom hV').op)]
  -- Porting note : change `rw` to `erw`
  

Proof state:
case map_nonunit.intro.intro.intro.a
X Y : LocallyRingedSpace
f g : X ⟶ Y
U✝ : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
s✝ : ↑((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U✝))
x : ↑(toTopCat Y)
U : Opens ↑↑(coequalizer f.val g.val).toPresheafedSpace
hU : (coequalizer.π f.val g.val).base x ∈ U
s : (forget CommRingCat).obj ((coequalizer f.val g.val).toPresheafedSpace.presheaf.obj (op U))
ha :
  IsUnit ((TopCat.Presheaf.germ Y.presheaf { val := x, property := hU }) (((coequalizer.π f.val g.val).c.app (op U)) s))
V : Opens ↑(toTopCat Y) := imageBasicOpen f g U s
hV : ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier) = V.carrier
hV' :
  V =
    { carrier := ⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier),
      is_open' :=
        (_ : IsOpen (⇑(coequalizer.π f.val g.val).base ⁻¹' (⇑(coequalizer.π f.val g.val).base '' V.carrier))) }
V_open : IsOpen (⇑(coequalizer.π f.val g.val).base '' V.carrier)
VleU : { carrier := ⇑(coequalizer.π f.val g.val).base '' V.carrier, is_open' := V_open } ≤ U
hxV : x ∈ V
⊢ IsUnit
    ((Y.presheaf.map (eqToHom hV').op)
      ((Y.presheaf.map ((Opens.map (coequalizer.π f.val g.val).base).op.map (homOfLE VleU).op))
        (((coequalizer.π f.val g.val).c.app (op U)) s)))

Next tactic:
erw [← comp_apply, ← comp_apply, ← Y.presheaf.map_comp]