l3lab/ntp-mathlib huggingface dataset:
/-- If `f : 𝓕.stalk p₀ ⟶ c`, then a natural transformation `𝓕 ⟶ skyscraperPresheaf p₀ c` can be
defined by: `𝓕.germ p₀ ≫ f : 𝓕(U) ⟶ c` if `p₀ ∈ U` and the unique morphism to a terminal object
if `p₀ ∉ U`.
-/
@[simps]
def toSkyscraperPresheaf {𝓕 : Presheaf C X} {c : C} (f : 𝓕.stalk p₀ ⟶ c) :
    𝓕 ⟶ skyscraperPresheaf p₀ c where
  app U :=
    if h : p₀ ∈ U.unop then 𝓕.germ ⟨p₀, h⟩ ≫ f ≫ eqToHom (if_pos h).symm
    else ((if_neg h).symm.ndrec terminalIsTerminal).from _
  naturality U V inc := by
    -- Porting note : don't know why original proof fell short of working, add `aesop_cat` finished
    -- the proofs anyway
    

Proof state:
X : TopCat
p₀ : ↑X
inst✝³ : (U : Opens ↑X) → Decidable (p₀ ∈ U)
C : Type v
inst✝² : Category.{u, v} C
A : C
inst✝¹ : HasTerminal C
inst✝ : HasColimits C
𝓕 : Presheaf C X
c : C
f : Presheaf.stalk 𝓕 p₀ ⟶ c
U V : (Opens ↑X)ᵒᵖ
inc : U ⟶ V
⊢ 𝓕.map inc ≫
      (fun U =>
          if h : p₀ ∈ U.unop then
            Presheaf.germ 𝓕 { val := p₀, property := h } ≫ f ≫ eqToHom (_ : c = if p₀ ∈ U.unop then c else ⊤_ C)
          else IsTerminal.from ((_ : (⊤_ C) = if p₀ ∈ U.unop then c else ⊤_ C) ▸ terminalIsTerminal) (𝓕.obj U))
        V =
    (fun U =>
          if h : p₀ ∈ U.unop then
            Presheaf.germ 𝓕 { val := p₀, property := h } ≫ f ≫ eqToHom (_ : c = if p₀ ∈ U.unop then c else ⊤_ C)
          else IsTerminal.from ((_ : (⊤_ C) = if p₀ ∈ U.unop then c else ⊤_ C) ▸ terminalIsTerminal) (𝓕.obj U))
        U ≫
      (skyscraperPresheaf p₀ c).map inc

Next tactic:
dsimp
/-- If `f : 𝓕.stalk p₀ ⟶ c`, then a natural transformation `𝓕 ⟶ skyscraperPresheaf p₀ c` can be
defined by: `𝓕.germ p₀ ≫ f : 𝓕(U) ⟶ c` if `p₀ ∈ U` and the unique morphism to a terminal object
if `p₀ ∉ U`.
-/
@[simps]
def toSkyscraperPresheaf {𝓕 : Presheaf C X} {c : C} (f : 𝓕.stalk p₀ ⟶ c) :
    𝓕 ⟶ skyscraperPresheaf p₀ c where
  app U :=
    if h : p₀ ∈ U.unop then 𝓕.germ ⟨p₀, h⟩ ≫ f ≫ eqToHom (if_pos h).symm
    else ((if_neg h).symm.ndrec terminalIsTerminal).from _
  naturality U V inc := by
    -- Porting note : don't know why original proof fell short of working, add `aesop_cat` finished
    -- the proofs anyway
    dsimp
    

Proof state:
X : TopCat
p₀ : ↑X
inst✝³ : (U : Opens ↑X) → Decidable (p₀ ∈ U)
C : Type v
inst✝² : Category.{u, v} C
A : C
inst✝¹ : HasTerminal C
inst✝ : HasColimits C
𝓕 : Presheaf C X
c : C
f : Presheaf.stalk 𝓕 p₀ ⟶ c
U V : (Opens ↑X)ᵒᵖ
inc : U ⟶ V
⊢ (𝓕.map inc ≫
      if h : p₀ ∈ V.unop then
        Presheaf.germ 𝓕 { val := p₀, property := h } ≫ f ≫ eqToHom (_ : c = if p₀ ∈ V.unop then c else ⊤_ C)
      else IsTerminal.from ((_ : (⊤_ C) = if p₀ ∈ V.unop then c else ⊤_ C) ▸ terminalIsTerminal) (𝓕.obj V)) =
    (if h : p₀ ∈ U.unop then
        Presheaf.germ 𝓕 { val := p₀, property := h } ≫ f ≫ eqToHom (_ : c = if p₀ ∈ U.unop then c else ⊤_ C)
      else IsTerminal.from ((_ : (⊤_ C) = if p₀ ∈ U.unop then c else ⊤_ C) ▸ terminalIsTerminal) (𝓕.obj U)) ≫
      if h : p₀ ∈ V.unop then
        eqToHom (_ : (fun U => if p₀ ∈ U.unop then c else ⊤_ C) U = (fun U => if p₀ ∈ U.unop then c else ⊤_ C) V)
      else
        IsTerminal.from ((_ : (⊤_ C) = if p₀ ∈ V.unop then c else ⊤_ C) ▸ terminalIsTerminal)
          (if p₀ ∈ U.unop then c else ⊤_ C)

Next tactic:
by_cases hV : p₀ ∈ V.unop
/-- If `f : 𝓕.stalk p₀ ⟶ c`, then a natural transformation `𝓕 ⟶ skyscraperPresheaf p₀ c` can be
defined by: `𝓕.germ p₀ ≫ f : 𝓕(U) ⟶ c` if `p₀ ∈ U` and the unique morphism to a terminal object
if `p₀ ∉ U`.
-/
@[simps]
def toSkyscraperPresheaf {𝓕 : Presheaf C X} {c : C} (f : 𝓕.stalk p₀ ⟶ c) :
    𝓕 ⟶ skyscraperPresheaf p₀ c where
  app U :=
    if h : p₀ ∈ U.unop then 𝓕.germ ⟨p₀, h⟩ ≫ f ≫ eqToHom (if_pos h).symm
    else ((if_neg h).symm.ndrec terminalIsTerminal).from _
  naturality U V inc := by
    -- Porting note : don't know why original proof fell short of working, add `aesop_cat` finished
    -- the proofs anyway
    dsimp
    by_cases hV : p₀ ∈ V.unop
    · 

Proof state:
case pos
X : TopCat
p₀ : ↑X
inst✝³ : (U : Opens ↑X) → Decidable (p₀ ∈ U)
C : Type v
inst✝² : Category.{u, v} C
A : C
inst✝¹ : HasTerminal C
inst✝ : HasColimits C
𝓕 : Presheaf C X
c : C
f : Presheaf.stalk 𝓕 p₀ ⟶ c
U V : (Opens ↑X)ᵒᵖ
inc : U ⟶ V
hV : p₀ ∈ V.unop
⊢ (𝓕.map inc ≫
      if h : p₀ ∈ V.unop then
        Presheaf.germ 𝓕 { val := p₀, property := h } ≫ f ≫ eqToHom (_ : c = if p₀ ∈ V.unop then c else ⊤_ C)
      else IsTerminal.from ((_ : (⊤_ C) = if p₀ ∈ V.unop then c else ⊤_ C) ▸ terminalIsTerminal) (𝓕.obj V)) =
    (if h : p₀ ∈ U.unop then
        Presheaf.germ 𝓕 { val := p₀, property := h } ≫ f ≫ eqToHom (_ : c = if p₀ ∈ U.unop then c else ⊤_ C)
      else IsTerminal.from ((_ : (⊤_ C) = if p₀ ∈ U.unop then c else ⊤_ C) ▸ terminalIsTerminal) (𝓕.obj U)) ≫
      if h : p₀ ∈ V.unop then
        eqToHom (_ : (fun U => if p₀ ∈ U.unop then c else ⊤_ C) U = (fun U => if p₀ ∈ U.unop then c else ⊤_ C) V)
      else
        IsTerminal.from ((_ : (⊤_ C) = if p₀ ∈ V.unop then c else ⊤_ C) ▸ terminalIsTerminal)
          (if p₀ ∈ U.unop then c else ⊤_ C)

Next tactic:
have hU : p₀ ∈ U.unop := leOfHom inc.unop hV
/-- If `f : 𝓕.stalk p₀ ⟶ c`, then a natural transformation `𝓕 ⟶ skyscraperPresheaf p₀ c` can be
defined by: `𝓕.germ p₀ ≫ f : 𝓕(U) ⟶ c` if `p₀ ∈ U` and the unique morphism to a terminal object
if `p₀ ∉ U`.
-/
@[simps]
def toSkyscraperPresheaf {𝓕 : Presheaf C X} {c : C} (f : 𝓕.stalk p₀ ⟶ c) :
    𝓕 ⟶ skyscraperPresheaf p₀ c where
  app U :=
    if h : p₀ ∈ U.unop then 𝓕.germ ⟨p₀, h⟩ ≫ f ≫ eqToHom (if_pos h).symm
    else ((if_neg h).symm.ndrec terminalIsTerminal).from _
  naturality U V inc := by
    -- Porting note : don't know why original proof fell short of working, add `aesop_cat` finished
    -- the proofs anyway
    dsimp
    by_cases hV : p₀ ∈ V.unop
    · have hU : p₀ ∈ U.unop := leOfHom inc.unop hV
      

Proof state:
case pos
X : TopCat
p₀ : ↑X
inst✝³ : (U : Opens ↑X) → Decidable (p₀ ∈ U)
C : Type v
inst✝² : Category.{u, v} C
A : C
inst✝¹ : HasTerminal C
inst✝ : HasColimits C
𝓕 : Presheaf C X
c : C
f : Presheaf.stalk 𝓕 p₀ ⟶ c
U V : (Opens ↑X)ᵒᵖ
inc : U ⟶ V
hV : p₀ ∈ V.unop
hU : p₀ ∈ U.unop
⊢ (𝓕.map inc ≫
      if h : p₀ ∈ V.unop then
        Presheaf.germ 𝓕 { val := p₀, property := h } ≫ f ≫ eqToHom (_ : c = if p₀ ∈ V.unop then c else ⊤_ C)
      else IsTerminal.from ((_ : (⊤_ C) = if p₀ ∈ V.unop then c else ⊤_ C) ▸ terminalIsTerminal) (𝓕.obj V)) =
    (if h : p₀ ∈ U.unop then
        Presheaf.germ 𝓕 { val := p₀, property := h } ≫ f ≫ eqToHom (_ : c = if p₀ ∈ U.unop then c else ⊤_ C)
      else IsTerminal.from ((_ : (⊤_ C) = if p₀ ∈ U.unop then c else ⊤_ C) ▸ terminalIsTerminal) (𝓕.obj U)) ≫
      if h : p₀ ∈ V.unop then
        eqToHom (_ : (fun U => if p₀ ∈ U.unop then c else ⊤_ C) U = (fun U => if p₀ ∈ U.unop then c else ⊤_ C) V)
      else
        IsTerminal.from ((_ : (⊤_ C) = if p₀ ∈ V.unop then c else ⊤_ C) ▸ terminalIsTerminal)
          (if p₀ ∈ U.unop then c else ⊤_ C)

Next tactic:
split_ifs
/-- If `f : 𝓕.stalk p₀ ⟶ c`, then a natural transformation `𝓕 ⟶ skyscraperPresheaf p₀ c` can be
defined by: `𝓕.germ p₀ ≫ f : 𝓕(U) ⟶ c` if `p₀ ∈ U` and the unique morphism to a terminal object
if `p₀ ∉ U`.
-/
@[simps]
def toSkyscraperPresheaf {𝓕 : Presheaf C X} {c : C} (f : 𝓕.stalk p₀ ⟶ c) :
    𝓕 ⟶ skyscraperPresheaf p₀ c where
  app U :=
    if h : p₀ ∈ U.unop then 𝓕.germ ⟨p₀, h⟩ ≫ f ≫ eqToHom (if_pos h).symm
    else ((if_neg h).symm.ndrec terminalIsTerminal).from _
  naturality U V inc := by
    -- Porting note : don't know why original proof fell short of working, add `aesop_cat` finished
    -- the proofs anyway
    dsimp
    by_cases hV : p₀ ∈ V.unop
    · have hU : p₀ ∈ U.unop := leOfHom inc.unop hV
      split_ifs
      · 

Proof state:
case pos
X : TopCat
p₀ : ↑X
inst✝³ : (U : Opens ↑X) → Decidable (p₀ ∈ U)
C : Type v
inst✝² : Category.{u, v} C
A : C
inst✝¹ : HasTerminal C
inst✝ : HasColimits C
𝓕 : Presheaf C X
c : C
f : Presheaf.stalk 𝓕 p₀ ⟶ c
U V : (Opens ↑X)ᵒᵖ
inc : U ⟶ V
hV : p₀ ∈ V.unop
hU : p₀ ∈ U.unop
h✝ : p₀ ∈ V.unop
⊢ 𝓕.map inc ≫ Presheaf.germ 𝓕 { val := p₀, property := h✝ } ≫ f ≫ eqToHom (_ : c = if p₀ ∈ V.unop then c else ⊤_ C) =
    (Presheaf.germ 𝓕 { val := p₀, property := hU } ≫ f ≫ eqToHom (_ : c = if p₀ ∈ U.unop then c else ⊤_ C)) ≫
      eqToHom (_ : (fun U => if p₀ ∈ U.unop then c else ⊤_ C) U = (fun U => if p₀ ∈ U.unop then c else ⊤_ C) V)

Next tactic:
erw [← Category.assoc, 𝓕.germ_res inc.unop, Category.assoc, Category.assoc, eqToHom_trans]
/-- If `f : 𝓕.stalk p₀ ⟶ c`, then a natural transformation `𝓕 ⟶ skyscraperPresheaf p₀ c` can be
defined by: `𝓕.germ p₀ ≫ f : 𝓕(U) ⟶ c` if `p₀ ∈ U` and the unique morphism to a terminal object
if `p₀ ∉ U`.
-/
@[simps]
def toSkyscraperPresheaf {𝓕 : Presheaf C X} {c : C} (f : 𝓕.stalk p₀ ⟶ c) :
    𝓕 ⟶ skyscraperPresheaf p₀ c where
  app U :=
    if h : p₀ ∈ U.unop then 𝓕.germ ⟨p₀, h⟩ ≫ f ≫ eqToHom (if_pos h).symm
    else ((if_neg h).symm.ndrec terminalIsTerminal).from _
  naturality U V inc := by
    -- Porting note : don't know why original proof fell short of working, add `aesop_cat` finished
    -- the proofs anyway
    dsimp
    by_cases hV : p₀ ∈ V.unop
    · have hU : p₀ ∈ U.unop := leOfHom inc.unop hV
      split_ifs
      · erw [← Category.assoc, 𝓕.germ_res inc.unop, Category.assoc, Category.assoc, eqToHom_trans]
      · 

Proof state:
case neg
X : TopCat
p₀ : ↑X
inst✝³ : (U : Opens ↑X) → Decidable (p₀ ∈ U)
C : Type v
inst✝² : Category.{u, v} C
A : C
inst✝¹ : HasTerminal C
inst✝ : HasColimits C
𝓕 : Presheaf C X
c : C
f : Presheaf.stalk 𝓕 p₀ ⟶ c
U V : (Opens ↑X)ᵒᵖ
inc : U ⟶ V
hV : p₀ ∈ V.unop
hU : p₀ ∈ U.unop
h✝ : p₀ ∉ V.unop
⊢ 𝓕.map inc ≫ Presheaf.germ 𝓕 { val := p₀, property := hV } ≫ f ≫ eqToHom (_ : c = if p₀ ∈ V.unop then c else ⊤_ C) =
    (Presheaf.germ 𝓕 { val := p₀, property := hU } ≫ f ≫ eqToHom (_ : c = if p₀ ∈ U.unop then c else ⊤_ C)) ≫
      eqToHom (_ : (fun U => if p₀ ∈ U.unop then c else ⊤_ C) U = (fun U => if p₀ ∈ U.unop then c else ⊤_ C) V)

Next tactic:
aesop_cat
/-- If `f : 𝓕.stalk p₀ ⟶ c`, then a natural transformation `𝓕 ⟶ skyscraperPresheaf p₀ c` can be
defined by: `𝓕.germ p₀ ≫ f : 𝓕(U) ⟶ c` if `p₀ ∈ U` and the unique morphism to a terminal object
if `p₀ ∉ U`.
-/
@[simps]
def toSkyscraperPresheaf {𝓕 : Presheaf C X} {c : C} (f : 𝓕.stalk p₀ ⟶ c) :
    𝓕 ⟶ skyscraperPresheaf p₀ c where
  app U :=
    if h : p₀ ∈ U.unop then 𝓕.germ ⟨p₀, h⟩ ≫ f ≫ eqToHom (if_pos h).symm
    else ((if_neg h).symm.ndrec terminalIsTerminal).from _
  naturality U V inc := by
    -- Porting note : don't know why original proof fell short of working, add `aesop_cat` finished
    -- the proofs anyway
    dsimp
    by_cases hV : p₀ ∈ V.unop
    · have hU : p₀ ∈ U.unop := leOfHom inc.unop hV
      split_ifs
      · erw [← Category.assoc, 𝓕.germ_res inc.unop, Category.assoc, Category.assoc, eqToHom_trans]
      · aesop_cat
    · 

Proof state:
case neg
X : TopCat
p₀ : ↑X
inst✝³ : (U : Opens ↑X) → Decidable (p₀ ∈ U)
C : Type v
inst✝² : Category.{u, v} C
A : C
inst✝¹ : HasTerminal C
inst✝ : HasColimits C
𝓕 : Presheaf C X
c : C
f : Presheaf.stalk 𝓕 p₀ ⟶ c
U V : (Opens ↑X)ᵒᵖ
inc : U ⟶ V
hV : p₀ ∉ V.unop
⊢ (𝓕.map inc ≫
      if h : p₀ ∈ V.unop then
        Presheaf.germ 𝓕 { val := p₀, property := h } ≫ f ≫ eqToHom (_ : c = if p₀ ∈ V.unop then c else ⊤_ C)
      else IsTerminal.from ((_ : (⊤_ C) = if p₀ ∈ V.unop then c else ⊤_ C) ▸ terminalIsTerminal) (𝓕.obj V)) =
    (if h : p₀ ∈ U.unop then
        Presheaf.germ 𝓕 { val := p₀, property := h } ≫ f ≫ eqToHom (_ : c = if p₀ ∈ U.unop then c else ⊤_ C)
      else IsTerminal.from ((_ : (⊤_ C) = if p₀ ∈ U.unop then c else ⊤_ C) ▸ terminalIsTerminal) (𝓕.obj U)) ≫
      if h : p₀ ∈ V.unop then
        eqToHom (_ : (fun U => if p₀ ∈ U.unop then c else ⊤_ C) U = (fun U => if p₀ ∈ U.unop then c else ⊤_ C) V)
      else
        IsTerminal.from ((_ : (⊤_ C) = if p₀ ∈ V.unop then c else ⊤_ C) ▸ terminalIsTerminal)
          (if p₀ ∈ U.unop then c else ⊤_ C)

Next tactic:
split_ifs
/-- If `f : 𝓕.stalk p₀ ⟶ c`, then a natural transformation `𝓕 ⟶ skyscraperPresheaf p₀ c` can be
defined by: `𝓕.germ p₀ ≫ f : 𝓕(U) ⟶ c` if `p₀ ∈ U` and the unique morphism to a terminal object
if `p₀ ∉ U`.
-/
@[simps]
def toSkyscraperPresheaf {𝓕 : Presheaf C X} {c : C} (f : 𝓕.stalk p₀ ⟶ c) :
    𝓕 ⟶ skyscraperPresheaf p₀ c where
  app U :=
    if h : p₀ ∈ U.unop then 𝓕.germ ⟨p₀, h⟩ ≫ f ≫ eqToHom (if_pos h).symm
    else ((if_neg h).symm.ndrec terminalIsTerminal).from _
  naturality U V inc := by
    -- Porting note : don't know why original proof fell short of working, add `aesop_cat` finished
    -- the proofs anyway
    dsimp
    by_cases hV : p₀ ∈ V.unop
    · have hU : p₀ ∈ U.unop := leOfHom inc.unop hV
      split_ifs
      · erw [← Category.assoc, 𝓕.germ_res inc.unop, Category.assoc, Category.assoc, eqToHom_trans]
      · aesop_cat
    · split_ifs
      · 

Proof state:
case pos
X : TopCat
p₀ : ↑X
inst✝³ : (U : Opens ↑X) → Decidable (p₀ ∈ U)
C : Type v
inst✝² : Category.{u, v} C
A : C
inst✝¹ : HasTerminal C
inst✝ : HasColimits C
𝓕 : Presheaf C X
c : C
f : Presheaf.stalk 𝓕 p₀ ⟶ c
U V : (Opens ↑X)ᵒᵖ
inc : U ⟶ V
hV : p₀ ∉ V.unop
h✝ : p₀ ∈ V.unop
⊢ 𝓕.map inc ≫ Presheaf.germ 𝓕 { val := p₀, property := h✝ } ≫ f ≫ eqToHom (_ : c = if p₀ ∈ V.unop then c else ⊤_ C) =
    (if h : p₀ ∈ U.unop then
        Presheaf.germ 𝓕 { val := p₀, property := h } ≫ f ≫ eqToHom (_ : c = if p₀ ∈ U.unop then c else ⊤_ C)
      else IsTerminal.from ((_ : (⊤_ C) = if p₀ ∈ U.unop then c else ⊤_ C) ▸ terminalIsTerminal) (𝓕.obj U)) ≫
      eqToHom (_ : (fun U => if p₀ ∈ U.unop then c else ⊤_ C) U = (fun U => if p₀ ∈ U.unop then c else ⊤_ C) V)

Next tactic:
exact ((if_neg hV).symm.ndrec terminalIsTerminal).hom_ext ..
/-- If `f : 𝓕.stalk p₀ ⟶ c`, then a natural transformation `𝓕 ⟶ skyscraperPresheaf p₀ c` can be
defined by: `𝓕.germ p₀ ≫ f : 𝓕(U) ⟶ c` if `p₀ ∈ U` and the unique morphism to a terminal object
if `p₀ ∉ U`.
-/
@[simps]
def toSkyscraperPresheaf {𝓕 : Presheaf C X} {c : C} (f : 𝓕.stalk p₀ ⟶ c) :
    𝓕 ⟶ skyscraperPresheaf p₀ c where
  app U :=
    if h : p₀ ∈ U.unop then 𝓕.germ ⟨p₀, h⟩ ≫ f ≫ eqToHom (if_pos h).symm
    else ((if_neg h).symm.ndrec terminalIsTerminal).from _
  naturality U V inc := by
    -- Porting note : don't know why original proof fell short of working, add `aesop_cat` finished
    -- the proofs anyway
    dsimp
    by_cases hV : p₀ ∈ V.unop
    · have hU : p₀ ∈ U.unop := leOfHom inc.unop hV
      split_ifs
      · erw [← Category.assoc, 𝓕.germ_res inc.unop, Category.assoc, Category.assoc, eqToHom_trans]
      · aesop_cat
    · split_ifs
      · exact ((if_neg hV).symm.ndrec terminalIsTerminal).hom_ext ..
      · 

Proof state:
case neg
X : TopCat
p₀ : ↑X
inst✝³ : (U : Opens ↑X) → Decidable (p₀ ∈ U)
C : Type v
inst✝² : Category.{u, v} C
A : C
inst✝¹ : HasTerminal C
inst✝ : HasColimits C
𝓕 : Presheaf C X
c : C
f : Presheaf.stalk 𝓕 p₀ ⟶ c
U V : (Opens ↑X)ᵒᵖ
inc : U ⟶ V
hV h✝ : p₀ ∉ V.unop
⊢ 𝓕.map inc ≫ IsTerminal.from ((_ : (⊤_ C) = if p₀ ∈ V.unop then c else ⊤_ C) ▸ terminalIsTerminal) (𝓕.obj V) =
    (if h : p₀ ∈ U.unop then
        Presheaf.germ 𝓕 { val := p₀, property := h } ≫ f ≫ eqToHom (_ : c = if p₀ ∈ U.unop then c else ⊤_ C)
      else IsTerminal.from ((_ : (⊤_ C) = if p₀ ∈ U.unop then c else ⊤_ C) ▸ terminalIsTerminal) (𝓕.obj U)) ≫
      IsTerminal.from ((_ : (⊤_ C) = if p₀ ∈ V.unop then c else ⊤_ C) ▸ terminalIsTerminal)
        (if p₀ ∈ U.unop then c else ⊤_ C)

Next tactic:
aesop_cat
/-- If `f : 𝓕 ⟶ skyscraperPresheaf p₀ c` is a natural transformation, then there is a morphism
`𝓕.stalk p₀ ⟶ c` defined as the morphism from colimit to cocone at `c`.
-/
def fromStalk {𝓕 : Presheaf C X} {c : C} (f : 𝓕 ⟶ skyscraperPresheaf p₀ c) : 𝓕.stalk p₀ ⟶ c :=
  let χ : Cocone ((OpenNhds.inclusion p₀).op ⋙ 𝓕) :=
    Cocone.mk c <|
      { app := fun U => f.app (op U.unop.1) ≫ eqToHom (if_pos U.unop.2)
        naturality := fun U V inc => by
          

Proof state:
X : TopCat
p₀ : ↑X
inst✝³ : (U : Opens ↑X) → Decidable (p₀ ∈ U)
C : Type v
inst✝² : Category.{u, v} C
A : C
inst✝¹ : HasTerminal C
inst✝ : HasColimits C
𝓕 : Presheaf C X
c : C
f : 𝓕 ⟶ skyscraperPresheaf p₀ c
U V : (OpenNhds p₀)ᵒᵖ
inc : U ⟶ V
⊢ ((OpenNhds.inclusion p₀).op ⋙ 𝓕).map inc ≫
      (fun U => f.app (op U.unop.obj) ≫ eqToHom (_ : (if p₀ ∈ U.unop.obj then c else ⊤_ C) = c)) V =
    (fun U => f.app (op U.unop.obj) ≫ eqToHom (_ : (if p₀ ∈ U.unop.obj then c else ⊤_ C) = c)) U ≫
      ((Functor.const (OpenNhds p₀)ᵒᵖ).obj c).map inc

Next tactic:
dsimp
/-- If `f : 𝓕 ⟶ skyscraperPresheaf p₀ c` is a natural transformation, then there is a morphism
`𝓕.stalk p₀ ⟶ c` defined as the morphism from colimit to cocone at `c`.
-/
def fromStalk {𝓕 : Presheaf C X} {c : C} (f : 𝓕 ⟶ skyscraperPresheaf p₀ c) : 𝓕.stalk p₀ ⟶ c :=
  let χ : Cocone ((OpenNhds.inclusion p₀).op ⋙ 𝓕) :=
    Cocone.mk c <|
      { app := fun U => f.app (op U.unop.1) ≫ eqToHom (if_pos U.unop.2)
        naturality := fun U V inc => by
          dsimp
          

Proof state:
X : TopCat
p₀ : ↑X
inst✝³ : (U : Opens ↑X) → Decidable (p₀ ∈ U)
C : Type v
inst✝² : Category.{u, v} C
A : C
inst✝¹ : HasTerminal C
inst✝ : HasColimits C
𝓕 : Presheaf C X
c : C
f : 𝓕 ⟶ skyscraperPresheaf p₀ c
U V : (OpenNhds p₀)ᵒᵖ
inc : U ⟶ V
⊢ 𝓕.map ((OpenNhds.inclusion p₀).map inc.unop).op ≫
      f.app (op V.unop.obj) ≫ eqToHom (_ : (if p₀ ∈ V.unop.obj then c else ⊤_ C) = c) =
    (f.app (op U.unop.obj) ≫ eqToHom (_ : (if p₀ ∈ U.unop.obj then c else ⊤_ C) = c)) ≫ 𝟙 c

Next tactic:
erw [Category.comp_id, ← Category.assoc, comp_eqToHom_iff, Category.assoc,
            eqToHom_trans, f.naturality, skyscraperPresheaf_map]
/-- If `f : 𝓕 ⟶ skyscraperPresheaf p₀ c` is a natural transformation, then there is a morphism
`𝓕.stalk p₀ ⟶ c` defined as the morphism from colimit to cocone at `c`.
-/
def fromStalk {𝓕 : Presheaf C X} {c : C} (f : 𝓕 ⟶ skyscraperPresheaf p₀ c) : 𝓕.stalk p₀ ⟶ c :=
  let χ : Cocone ((OpenNhds.inclusion p₀).op ⋙ 𝓕) :=
    Cocone.mk c <|
      { app := fun U => f.app (op U.unop.1) ≫ eqToHom (if_pos U.unop.2)
        naturality := fun U V inc => by
          dsimp
          erw [Category.comp_id, ← Category.assoc, comp_eqToHom_iff, Category.assoc,
            eqToHom_trans, f.naturality, skyscraperPresheaf_map]
          -- Porting note : added this `dsimp` and `rfl` in the end
          

Proof state:
X : TopCat
p₀ : ↑X
inst✝³ : (U : Opens ↑X) → Decidable (p₀ ∈ U)
C : Type v
inst✝² : Category.{u, v} C
A : C
inst✝¹ : HasTerminal C
inst✝ : HasColimits C
𝓕 : Presheaf C X
c : C
f : 𝓕 ⟶ skyscraperPresheaf p₀ c
U V : (OpenNhds p₀)ᵒᵖ
inc : U ⟶ V
⊢ (f.app (op ((OpenNhds.inclusion p₀).obj U.unop)) ≫
      if h : p₀ ∈ (op ((OpenNhds.inclusion p₀).obj V.unop)).unop then
        eqToHom
          (_ :
            (fun U => if p₀ ∈ U.unop then c else ⊤_ C) (op ((OpenNhds.inclusion p₀).obj U.unop)) =
              (fun U => if p₀ ∈ U.unop then c else ⊤_ C) (op ((OpenNhds.inclusion p₀).obj V.unop)))
      else
        IsTerminal.from
          ((_ : (⊤_ C) = if p₀ ∈ (op ((OpenNhds.inclusion p₀).obj V.unop)).unop then c else ⊤_ C) ▸ terminalIsTerminal)
          ((fun U => if p₀ ∈ U.unop then c else ⊤_ C) (op ((OpenNhds.inclusion p₀).obj U.unop)))) =
    f.app (op U.unop.obj) ≫ eqToHom (_ : (if p₀ ∈ U.unop.obj then c else ⊤_ C) = if p₀ ∈ V.unop.obj then c else ⊤_ C)

Next tactic:
dsimp only [skyscraperPresheaf_obj, unop_op, Eq.ndrec]
/-- If `f : 𝓕 ⟶ skyscraperPresheaf p₀ c` is a natural transformation, then there is a morphism
`𝓕.stalk p₀ ⟶ c` defined as the morphism from colimit to cocone at `c`.
-/
def fromStalk {𝓕 : Presheaf C X} {c : C} (f : 𝓕 ⟶ skyscraperPresheaf p₀ c) : 𝓕.stalk p₀ ⟶ c :=
  let χ : Cocone ((OpenNhds.inclusion p₀).op ⋙ 𝓕) :=
    Cocone.mk c <|
      { app := fun U => f.app (op U.unop.1) ≫ eqToHom (if_pos U.unop.2)
        naturality := fun U V inc => by
          dsimp
          erw [Category.comp_id, ← Category.assoc, comp_eqToHom_iff, Category.assoc,
            eqToHom_trans, f.naturality, skyscraperPresheaf_map]
          -- Porting note : added this `dsimp` and `rfl` in the end
          dsimp only [skyscraperPresheaf_obj, unop_op, Eq.ndrec]
          

Proof state:
X : TopCat
p₀ : ↑X
inst✝³ : (U : Opens ↑X) → Decidable (p₀ ∈ U)
C : Type v
inst✝² : Category.{u, v} C
A : C
inst✝¹ : HasTerminal C
inst✝ : HasColimits C
𝓕 : Presheaf C X
c : C
f : 𝓕 ⟶ skyscraperPresheaf p₀ c
U V : (OpenNhds p₀)ᵒᵖ
inc : U ⟶ V
⊢ (f.app (op ((OpenNhds.inclusion p₀).obj U.unop)) ≫
      if h : p₀ ∈ (OpenNhds.inclusion p₀).obj V.unop then
        eqToHom
          (_ :
            (fun U => if p₀ ∈ U.unop then c else ⊤_ C) (op ((OpenNhds.inclusion p₀).obj U.unop)) =
              (fun U => if p₀ ∈ U.unop then c else ⊤_ C) (op ((OpenNhds.inclusion p₀).obj V.unop)))
      else
        IsTerminal.from
          ((_ : (⊤_ C) = if p₀ ∈ (op ((OpenNhds.inclusion p₀).obj V.unop)).unop then c else ⊤_ C) ▸ terminalIsTerminal)
          (if p₀ ∈ (OpenNhds.inclusion p₀).obj U.unop then c else ⊤_ C)) =
    f.app (op U.unop.obj) ≫ eqToHom (_ : (if p₀ ∈ U.unop.obj then c else ⊤_ C) = if p₀ ∈ V.unop.obj then c else ⊤_ C)

Next tactic:
have hV : p₀ ∈ (OpenNhds.inclusion p₀).obj V.unop := V.unop.2
/-- If `f : 𝓕 ⟶ skyscraperPresheaf p₀ c` is a natural transformation, then there is a morphism
`𝓕.stalk p₀ ⟶ c` defined as the morphism from colimit to cocone at `c`.
-/
def fromStalk {𝓕 : Presheaf C X} {c : C} (f : 𝓕 ⟶ skyscraperPresheaf p₀ c) : 𝓕.stalk p₀ ⟶ c :=
  let χ : Cocone ((OpenNhds.inclusion p₀).op ⋙ 𝓕) :=
    Cocone.mk c <|
      { app := fun U => f.app (op U.unop.1) ≫ eqToHom (if_pos U.unop.2)
        naturality := fun U V inc => by
          dsimp
          erw [Category.comp_id, ← Category.assoc, comp_eqToHom_iff, Category.assoc,
            eqToHom_trans, f.naturality, skyscraperPresheaf_map]
          -- Porting note : added this `dsimp` and `rfl` in the end
          dsimp only [skyscraperPresheaf_obj, unop_op, Eq.ndrec]
          have hV : p₀ ∈ (OpenNhds.inclusion p₀).obj V.unop := V.unop.2; 

Proof state:
X : TopCat
p₀ : ↑X
inst✝³ : (U : Opens ↑X) → Decidable (p₀ ∈ U)
C : Type v
inst✝² : Category.{u, v} C
A : C
inst✝¹ : HasTerminal C
inst✝ : HasColimits C
𝓕 : Presheaf C X
c : C
f : 𝓕 ⟶ skyscraperPresheaf p₀ c
U V : (OpenNhds p₀)ᵒᵖ
inc : U ⟶ V
hV : p₀ ∈ (OpenNhds.inclusion p₀).obj V.unop
⊢ (f.app (op ((OpenNhds.inclusion p₀).obj U.unop)) ≫
      if h : p₀ ∈ (OpenNhds.inclusion p₀).obj V.unop then
        eqToHom
          (_ :
            (fun U => if p₀ ∈ U.unop then c else ⊤_ C) (op ((OpenNhds.inclusion p₀).obj U.unop)) =
              (fun U => if p₀ ∈ U.unop then c else ⊤_ C) (op ((OpenNhds.inclusion p₀).obj V.unop)))
      else
        IsTerminal.from
          ((_ : (⊤_ C) = if p₀ ∈ (op ((OpenNhds.inclusion p₀).obj V.unop)).unop then c else ⊤_ C) ▸ terminalIsTerminal)
          (if p₀ ∈ (OpenNhds.inclusion p₀).obj U.unop then c else ⊤_ C)) =
    f.app (op U.unop.obj) ≫ eqToHom (_ : (if p₀ ∈ U.unop.obj then c else ⊤_ C) = if p₀ ∈ V.unop.obj then c else ⊤_ C)

Next tactic:
split_ifs