l3lab/ntp-mathlib huggingface dataset:
/-- 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; 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 : 𝓕 ⟶ skyscraperPresheaf p₀ c
U V : (OpenNhds p₀)ᵒᵖ
inc : U ⟶ V
hV : p₀ ∈ (OpenNhds.inclusion p₀).obj V.unop
h✝ : p₀ ∈ V.unop.obj
⊢ f.app (op ((OpenNhds.inclusion p₀).obj U.unop)) ≫
      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))) =
    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:
simp only [comp_eqToHom_iff, Category.assoc, eqToHom_trans, eqToHom_refl,
            Category.comp_id]
/-- 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; split_ifs <;>
          

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 : 𝓕 ⟶ skyscraperPresheaf p₀ c
U V : (OpenNhds p₀)ᵒᵖ
inc : U ⟶ V
hV : p₀ ∈ (OpenNhds.inclusion p₀).obj V.unop
h✝ : p₀ ∉ V.unop.obj
⊢ f.app (op ((OpenNhds.inclusion p₀).obj U.unop)) ≫
      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))) =
    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:
simp only [comp_eqToHom_iff, Category.assoc, eqToHom_trans, eqToHom_refl,
            Category.comp_id]
/-- 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; split_ifs <;>
          simp only [comp_eqToHom_iff, Category.assoc, eqToHom_trans, eqToHom_refl,
            Category.comp_id] <;> 

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 : 𝓕 ⟶ skyscraperPresheaf p₀ c
U V : (OpenNhds p₀)ᵒᵖ
inc : U ⟶ V
hV : p₀ ∈ (OpenNhds.inclusion p₀).obj V.unop
h✝ : p₀ ∈ V.unop.obj
⊢ f.app (op ((OpenNhds.inclusion p₀).obj U.unop)) = f.app (op U.unop.obj)

Next tactic:
rfl
/-- 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; split_ifs <;>
          simp only [comp_eqToHom_iff, Category.assoc, eqToHom_trans, eqToHom_refl,
            Category.comp_id] <;> 

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 : 𝓕 ⟶ skyscraperPresheaf p₀ c
U V : (OpenNhds p₀)ᵒᵖ
inc : U ⟶ V
hV : p₀ ∈ (OpenNhds.inclusion p₀).obj V.unop
h✝ : p₀ ∉ V.unop.obj
⊢ f.app (op ((OpenNhds.inclusion p₀).obj U.unop)) = f.app (op U.unop.obj)

Next tactic:
rfl
theorem to_skyscraper_fromStalk {𝓕 : Presheaf C X} {c : C} (f : 𝓕 ⟶ skyscraperPresheaf p₀ c) :
    toSkyscraperPresheaf p₀ (fromStalk _ f) = f := 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
⊢ toSkyscraperPresheaf p₀ (fromStalk p₀ f) = f

Next tactic:
apply NatTrans.ext
theorem to_skyscraper_fromStalk {𝓕 : Presheaf C X} {c : C} (f : 𝓕 ⟶ skyscraperPresheaf p₀ c) :
    toSkyscraperPresheaf p₀ (fromStalk _ f) = f := by
  apply NatTrans.ext
  

Proof state:
case app
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
⊢ (toSkyscraperPresheaf p₀ (fromStalk p₀ f)).app = f.app

Next tactic:
ext U
theorem to_skyscraper_fromStalk {𝓕 : Presheaf C X} {c : C} (f : 𝓕 ⟶ skyscraperPresheaf p₀ c) :
    toSkyscraperPresheaf p₀ (fromStalk _ f) = f := by
  apply NatTrans.ext
  ext U
  

Proof state:
case app.h
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 : (Opens ↑X)ᵒᵖ
⊢ (toSkyscraperPresheaf p₀ (fromStalk p₀ f)).app U = f.app U

Next tactic:
dsimp
theorem to_skyscraper_fromStalk {𝓕 : Presheaf C X} {c : C} (f : 𝓕 ⟶ skyscraperPresheaf p₀ c) :
    toSkyscraperPresheaf p₀ (fromStalk _ f) = f := by
  apply NatTrans.ext
  ext U
  dsimp
  

Proof state:
case app.h
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 : (Opens ↑X)ᵒᵖ
⊢ (if h : p₀ ∈ U.unop then
      Presheaf.germ 𝓕 { val := p₀, property := h } ≫ fromStalk p₀ 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)) =
    f.app U

Next tactic:
split_ifs with h
theorem to_skyscraper_fromStalk {𝓕 : Presheaf C X} {c : C} (f : 𝓕 ⟶ skyscraperPresheaf p₀ c) :
    toSkyscraperPresheaf p₀ (fromStalk _ f) = f := by
  apply NatTrans.ext
  ext U
  dsimp
  split_ifs with h
  · 

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 : 𝓕 ⟶ skyscraperPresheaf p₀ c
U : (Opens ↑X)ᵒᵖ
h : p₀ ∈ U.unop
⊢ Presheaf.germ 𝓕 { val := p₀, property := h } ≫ fromStalk p₀ f ≫ eqToHom (_ : c = if p₀ ∈ U.unop then c else ⊤_ C) =
    f.app U

Next tactic:
erw [← Category.assoc, colimit.ι_desc, Category.assoc, eqToHom_trans, eqToHom_refl,
      Category.comp_id]
theorem to_skyscraper_fromStalk {𝓕 : Presheaf C X} {c : C} (f : 𝓕 ⟶ skyscraperPresheaf p₀ c) :
    toSkyscraperPresheaf p₀ (fromStalk _ f) = f := by
  apply NatTrans.ext
  ext U
  dsimp
  split_ifs with h
  · erw [← Category.assoc, colimit.ι_desc, Category.assoc, eqToHom_trans, eqToHom_refl,
      Category.comp_id]
    

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 : 𝓕 ⟶ skyscraperPresheaf p₀ c
U : (Opens ↑X)ᵒᵖ
h : p₀ ∈ U.unop
⊢ f.app (op (op { obj := U.unop, property := (_ : ↑{ val := p₀, property := h } ∈ U.unop) }).unop.obj) = f.app U

Next tactic:
simp only [unop_op, op_unop]
theorem to_skyscraper_fromStalk {𝓕 : Presheaf C X} {c : C} (f : 𝓕 ⟶ skyscraperPresheaf p₀ c) :
    toSkyscraperPresheaf p₀ (fromStalk _ f) = f := by
  apply NatTrans.ext
  ext U
  dsimp
  split_ifs with h
  · erw [← Category.assoc, colimit.ι_desc, Category.assoc, eqToHom_trans, eqToHom_refl,
      Category.comp_id]
    simp only [unop_op, op_unop]
  · 

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 : 𝓕 ⟶ skyscraperPresheaf p₀ c
U : (Opens ↑X)ᵒᵖ
h : p₀ ∉ U.unop
⊢ IsTerminal.from ((_ : (⊤_ C) = if p₀ ∈ U.unop then c else ⊤_ C) ▸ terminalIsTerminal) (𝓕.obj U) = f.app U

Next tactic:
exact ((if_neg h).symm.ndrec terminalIsTerminal).hom_ext ..
theorem fromStalk_to_skyscraper {𝓕 : Presheaf C X} {c : C} (f : 𝓕.stalk p₀ ⟶ c) :
    fromStalk p₀ (toSkyscraperPresheaf _ f) = f :=
  colimit.hom_ext fun U => 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 : Presheaf.stalk 𝓕 p₀ ⟶ c
U : (OpenNhds p₀)ᵒᵖ
⊢ colimit.ι (((whiskeringLeft (OpenNhds p₀)ᵒᵖ (Opens ↑X)ᵒᵖ C).obj (OpenNhds.inclusion p₀).op).obj 𝓕) U ≫
      fromStalk p₀ (toSkyscraperPresheaf p₀ f) =
    colimit.ι (((whiskeringLeft (OpenNhds p₀)ᵒᵖ (Opens ↑X)ᵒᵖ C).obj (OpenNhds.inclusion p₀).op).obj 𝓕) U ≫ f

Next tactic:
erw [colimit.ι_desc]
theorem fromStalk_to_skyscraper {𝓕 : Presheaf C X} {c : C} (f : 𝓕.stalk p₀ ⟶ c) :
    fromStalk p₀ (toSkyscraperPresheaf _ f) = f :=
  colimit.hom_ext fun U => by
    erw [colimit.ι_desc]; 

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 : (OpenNhds p₀)ᵒᵖ
⊢ { pt := c,
            ι :=
              NatTrans.mk fun U =>
                (toSkyscraperPresheaf p₀ f).app (op U.unop.obj) ≫
                  eqToHom (_ : (if p₀ ∈ U.unop.obj then c else ⊤_ C) = c) }.ι.app
      U =
    colimit.ι (((whiskeringLeft (OpenNhds p₀)ᵒᵖ (Opens ↑X)ᵒᵖ C).obj (OpenNhds.inclusion p₀).op).obj 𝓕) U ≫ f

Next tactic:
dsimp
theorem fromStalk_to_skyscraper {𝓕 : Presheaf C X} {c : C} (f : 𝓕.stalk p₀ ⟶ c) :
    fromStalk p₀ (toSkyscraperPresheaf _ f) = f :=
  colimit.hom_ext fun U => by
    erw [colimit.ι_desc]; 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 : (OpenNhds p₀)ᵒᵖ
⊢ (if h : p₀ ∈ U.unop.obj then
        Presheaf.germ 𝓕 { val := p₀, property := h } ≫
          f ≫ eqToHom (_ : c = if p₀ ∈ (op U.unop.obj).unop then c else ⊤_ C)
      else
        IsTerminal.from ((_ : (⊤_ C) = if p₀ ∈ (op U.unop.obj).unop then c else ⊤_ C) ▸ terminalIsTerminal)
          (𝓕.obj (op U.unop.obj))) ≫
      eqToHom (_ : (if p₀ ∈ U.unop.obj then c else ⊤_ C) = c) =
    colimit.ι ((OpenNhds.inclusion p₀).op ⋙ 𝓕) U ≫ f

Next tactic:
rw [dif_pos U.unop.2]
theorem fromStalk_to_skyscraper {𝓕 : Presheaf C X} {c : C} (f : 𝓕.stalk p₀ ⟶ c) :
    fromStalk p₀ (toSkyscraperPresheaf _ f) = f :=
  colimit.hom_ext fun U => by
    erw [colimit.ι_desc]; dsimp; rw [dif_pos U.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 : Presheaf.stalk 𝓕 p₀ ⟶ c
U : (OpenNhds p₀)ᵒᵖ
⊢ (Presheaf.germ 𝓕 { val := p₀, property := (_ : p₀ ∈ U.unop.obj) } ≫
        f ≫ eqToHom (_ : c = if p₀ ∈ (op U.unop.obj).unop then c else ⊤_ C)) ≫
      eqToHom (_ : (if p₀ ∈ U.unop.obj then c else ⊤_ C) = c) =
    colimit.ι ((OpenNhds.inclusion p₀).op ⋙ 𝓕) U ≫ f

Next tactic:
rw [Category.assoc, Category.assoc, eqToHom_trans, eqToHom_refl, Category.comp_id,
      Presheaf.germ]
theorem fromStalk_to_skyscraper {𝓕 : Presheaf C X} {c : C} (f : 𝓕.stalk p₀ ⟶ c) :
    fromStalk p₀ (toSkyscraperPresheaf _ f) = f :=
  colimit.hom_ext fun U => by
    erw [colimit.ι_desc]; dsimp; rw [dif_pos U.unop.2]
    rw [Category.assoc, Category.assoc, eqToHom_trans, eqToHom_refl, Category.comp_id,
      Presheaf.germ]
    

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 : (OpenNhds p₀)ᵒᵖ
⊢ colimit.ι ((OpenNhds.inclusion ↑{ val := p₀, property := (_ : p₀ ∈ U.unop.obj) }).op ⋙ 𝓕)
        (op { obj := U.unop.obj, property := (_ : ↑{ val := p₀, property := (_ : p₀ ∈ U.unop.obj) } ∈ U.unop.obj) }) ≫
      f =
    colimit.ι ((OpenNhds.inclusion p₀).op ⋙ 𝓕) U ≫ f

Next tactic:
congr 3
/-- The unit in `Presheaf.stalkFunctor ⊣ skyscraperPresheafFunctor`
-/
@[simps]
protected def unit : 𝟭 (Presheaf C X) ⟶ Presheaf.stalkFunctor C p₀ ⋙ skyscraperPresheafFunctor p₀
    where
  app 𝓕 := toSkyscraperPresheaf _ <| 𝟙 _
  naturality 𝓕 𝓖 f := 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
f : 𝓕 ⟶ 𝓖
⊢ (𝟭 (Presheaf C X)).map f ≫ (fun 𝓕 => toSkyscraperPresheaf p₀ (𝟙 (Presheaf.stalk ((𝟭 (Presheaf C X)).obj 𝓕) p₀))) 𝓖 =
    (fun 𝓕 => toSkyscraperPresheaf p₀ (𝟙 (Presheaf.stalk ((𝟭 (Presheaf C X)).obj 𝓕) p₀))) 𝓕 ≫
      (Presheaf.stalkFunctor C p₀ ⋙ skyscraperPresheafFunctor p₀).map f

Next tactic:
ext U
/-- The unit in `Presheaf.stalkFunctor ⊣ skyscraperPresheafFunctor`
-/
@[simps]
protected def unit : 𝟭 (Presheaf C X) ⟶ Presheaf.stalkFunctor C p₀ ⋙ skyscraperPresheafFunctor p₀
    where
  app 𝓕 := toSkyscraperPresheaf _ <| 𝟙 _
  naturality 𝓕 𝓖 f := by
    ext U; 

Proof state:
case w
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
f : 𝓕 ⟶ 𝓖
U : Opens ↑X
⊢ ((𝟭 (Presheaf C X)).map f ≫
          (fun 𝓕 => toSkyscraperPresheaf p₀ (𝟙 (Presheaf.stalk ((𝟭 (Presheaf C X)).obj 𝓕) p₀))) 𝓖).app
      (op U) =
    ((fun 𝓕 => toSkyscraperPresheaf p₀ (𝟙 (Presheaf.stalk ((𝟭 (Presheaf C X)).obj 𝓕) p₀))) 𝓕 ≫
          (Presheaf.stalkFunctor C p₀ ⋙ skyscraperPresheafFunctor p₀).map f).app
      (op U)

Next tactic:
dsimp
/-- The unit in `Presheaf.stalkFunctor ⊣ skyscraperPresheafFunctor`
-/
@[simps]
protected def unit : 𝟭 (Presheaf C X) ⟶ Presheaf.stalkFunctor C p₀ ⋙ skyscraperPresheafFunctor p₀
    where
  app 𝓕 := toSkyscraperPresheaf _ <| 𝟙 _
  naturality 𝓕 𝓖 f := by
    ext U; dsimp
    -- Porting note : added the following `rw` and `dsimp` to make it compile
    

Proof state:
case w
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
f : 𝓕 ⟶ 𝓖
U : Opens ↑X
⊢ (f ≫ toSkyscraperPresheaf p₀ (𝟙 (Presheaf.stalk 𝓖 p₀))).app (op U) =
    (toSkyscraperPresheaf p₀ (𝟙 (Presheaf.stalk 𝓕 p₀)) ≫
          SkyscraperPresheafFunctor.map' p₀ ((Presheaf.stalkFunctor C p₀).map f)).app
      (op U)

Next tactic:
rw [NatTrans.comp_app, toSkyscraperPresheaf_app, NatTrans.comp_app, toSkyscraperPresheaf_app]
/-- The unit in `Presheaf.stalkFunctor ⊣ skyscraperPresheafFunctor`
-/
@[simps]
protected def unit : 𝟭 (Presheaf C X) ⟶ Presheaf.stalkFunctor C p₀ ⋙ skyscraperPresheafFunctor p₀
    where
  app 𝓕 := toSkyscraperPresheaf _ <| 𝟙 _
  naturality 𝓕 𝓖 f := by
    ext U; dsimp
    -- Porting note : added the following `rw` and `dsimp` to make it compile
    rw [NatTrans.comp_app, toSkyscraperPresheaf_app, NatTrans.comp_app, toSkyscraperPresheaf_app]
    

Proof state:
case w
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
f : 𝓕 ⟶ 𝓖
U : Opens ↑X
⊢ (f.app (op U) ≫
      if h : p₀ ∈ (op U).unop then
        Presheaf.germ 𝓖 { val := p₀, property := h } ≫
          𝟙 (Presheaf.stalk 𝓖 p₀) ≫
            eqToHom (_ : Presheaf.stalk 𝓖 p₀ = if p₀ ∈ (op U).unop then Presheaf.stalk 𝓖 p₀ else ⊤_ C)
      else
        IsTerminal.from ((_ : (⊤_ C) = if p₀ ∈ (op U).unop then Presheaf.stalk 𝓖 p₀ else ⊤_ C) ▸ terminalIsTerminal)
          (𝓖.obj (op U))) =
    (if h : p₀ ∈ (op U).unop then
        Presheaf.germ 𝓕 { val := p₀, property := h } ≫
          𝟙 (Presheaf.stalk 𝓕 p₀) ≫
            eqToHom (_ : Presheaf.stalk 𝓕 p₀ = if p₀ ∈ (op U).unop then Presheaf.stalk 𝓕 p₀ else ⊤_ C)
      else
        IsTerminal.from ((_ : (⊤_ C) = if p₀ ∈ (op U).unop then Presheaf.stalk 𝓕 p₀ else ⊤_ C) ▸ terminalIsTerminal)
          (𝓕.obj (op U))) ≫
      (SkyscraperPresheafFunctor.map' p₀ ((Presheaf.stalkFunctor C p₀).map f)).app (op U)

Next tactic:
dsimp only [skyscraperPresheaf_obj, unop_op, Eq.ndrec, SkyscraperPresheafFunctor.map'_app]
/-- The unit in `Presheaf.stalkFunctor ⊣ skyscraperPresheafFunctor`
-/
@[simps]
protected def unit : 𝟭 (Presheaf C X) ⟶ Presheaf.stalkFunctor C p₀ ⋙ skyscraperPresheafFunctor p₀
    where
  app 𝓕 := toSkyscraperPresheaf _ <| 𝟙 _
  naturality 𝓕 𝓖 f := by
    ext U; dsimp
    -- Porting note : added the following `rw` and `dsimp` to make it compile
    rw [NatTrans.comp_app, toSkyscraperPresheaf_app, NatTrans.comp_app, toSkyscraperPresheaf_app]
    dsimp only [skyscraperPresheaf_obj, unop_op, Eq.ndrec, SkyscraperPresheafFunctor.map'_app]
    

Proof state:
case w
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
f : 𝓕 ⟶ 𝓖
U : Opens ↑X
⊢ (f.app (op U) ≫
      if h : p₀ ∈ U then
        Presheaf.germ 𝓖 { val := p₀, property := h } ≫
          𝟙 (Presheaf.stalk 𝓖 p₀) ≫
            eqToHom (_ : Presheaf.stalk 𝓖 p₀ = if p₀ ∈ (op U).unop then Presheaf.stalk 𝓖 p₀ else ⊤_ C)
      else
        IsTerminal.from ((_ : (⊤_ C) = if p₀ ∈ (op U).unop then Presheaf.stalk 𝓖 p₀ else ⊤_ C) ▸ terminalIsTerminal)
          (𝓖.obj (op U))) =
    (if h : p₀ ∈ U then
        Presheaf.germ 𝓕 { val := p₀, property := h } ≫
          𝟙 (Presheaf.stalk 𝓕 p₀) ≫
            eqToHom (_ : Presheaf.stalk 𝓕 p₀ = if p₀ ∈ (op U).unop then Presheaf.stalk 𝓕 p₀ else ⊤_ C)
      else
        IsTerminal.from ((_ : (⊤_ C) = if p₀ ∈ (op U).unop then Presheaf.stalk 𝓕 p₀ else ⊤_ C) ▸ terminalIsTerminal)
          (𝓕.obj (op U))) ≫
      if h : p₀ ∈ U then
        eqToHom (_ : (if p₀ ∈ (op U).unop then Presheaf.stalk 𝓕 p₀ else ⊤_ C) = Presheaf.stalk 𝓕 p₀) ≫
          (Presheaf.stalkFunctor C p₀).map f ≫
            eqToHom (_ : Presheaf.stalk 𝓖 p₀ = if p₀ ∈ (op U).unop then Presheaf.stalk 𝓖 p₀ else ⊤_ C)
      else
        IsTerminal.from ((_ : (⊤_ C) = if p₀ ∈ (op U).unop then Presheaf.stalk 𝓖 p₀ else ⊤_ C) ▸ terminalIsTerminal)
          (if p₀ ∈ U then Presheaf.stalk 𝓕 p₀ else ⊤_ C)

Next tactic:
split_ifs with h
/-- The unit in `Presheaf.stalkFunctor ⊣ skyscraperPresheafFunctor`
-/
@[simps]
protected def unit : 𝟭 (Presheaf C X) ⟶ Presheaf.stalkFunctor C p₀ ⋙ skyscraperPresheafFunctor p₀
    where
  app 𝓕 := toSkyscraperPresheaf _ <| 𝟙 _
  naturality 𝓕 𝓖 f := by
    ext U; dsimp
    -- Porting note : added the following `rw` and `dsimp` to make it compile
    rw [NatTrans.comp_app, toSkyscraperPresheaf_app, NatTrans.comp_app, toSkyscraperPresheaf_app]
    dsimp only [skyscraperPresheaf_obj, unop_op, Eq.ndrec, SkyscraperPresheafFunctor.map'_app]
    split_ifs with h
    · 

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
f : 𝓕 ⟶ 𝓖
U : Opens ↑X
h : p₀ ∈ U
⊢ f.app (op U) ≫
      Presheaf.germ 𝓖 { val := p₀, property := h } ≫
        𝟙 (Presheaf.stalk 𝓖 p₀) ≫
          eqToHom (_ : Presheaf.stalk 𝓖 p₀ = if p₀ ∈ (op U).unop then Presheaf.stalk 𝓖 p₀ else ⊤_ C) =
    (Presheaf.germ 𝓕 { val := p₀, property := h } ≫
        𝟙 (Presheaf.stalk 𝓕 p₀) ≫
          eqToHom (_ : Presheaf.stalk 𝓕 p₀ = if p₀ ∈ (op U).unop then Presheaf.stalk 𝓕 p₀ else ⊤_ C)) ≫
      eqToHom (_ : (if p₀ ∈ (op U).unop then Presheaf.stalk 𝓕 p₀ else ⊤_ C) = Presheaf.stalk 𝓕 p₀) ≫
        (Presheaf.stalkFunctor C p₀).map f ≫
          eqToHom (_ : Presheaf.stalk 𝓖 p₀ = if p₀ ∈ (op U).unop then Presheaf.stalk 𝓖 p₀ else ⊤_ C)

Next tactic:
simp only [Category.id_comp, ← Category.assoc]
/-- The unit in `Presheaf.stalkFunctor ⊣ skyscraperPresheafFunctor`
-/
@[simps]
protected def unit : 𝟭 (Presheaf C X) ⟶ Presheaf.stalkFunctor C p₀ ⋙ skyscraperPresheafFunctor p₀
    where
  app 𝓕 := toSkyscraperPresheaf _ <| 𝟙 _
  naturality 𝓕 𝓖 f := by
    ext U; dsimp
    -- Porting note : added the following `rw` and `dsimp` to make it compile
    rw [NatTrans.comp_app, toSkyscraperPresheaf_app, NatTrans.comp_app, toSkyscraperPresheaf_app]
    dsimp only [skyscraperPresheaf_obj, unop_op, Eq.ndrec, SkyscraperPresheafFunctor.map'_app]
    split_ifs with h
    · simp only [Category.id_comp, ← Category.assoc]; 

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
f : 𝓕 ⟶ 𝓖
U : Opens ↑X
h : p₀ ∈ U
⊢ (f.app (op U) ≫ Presheaf.germ 𝓖 { val := p₀, property := h }) ≫
      eqToHom (_ : Presheaf.stalk 𝓖 p₀ = if p₀ ∈ (op U).unop then Presheaf.stalk 𝓖 p₀ else ⊤_ C) =
    (((Presheaf.germ 𝓕 { val := p₀, property := h } ≫
            eqToHom (_ : Presheaf.stalk 𝓕 p₀ = if p₀ ∈ (op U).unop then Presheaf.stalk 𝓕 p₀ else ⊤_ C)) ≫
          eqToHom (_ : (if p₀ ∈ (op U).unop then Presheaf.stalk 𝓕 p₀ else ⊤_ C) = Presheaf.stalk 𝓕 p₀)) ≫
        (Presheaf.stalkFunctor C p₀).map f) ≫
      eqToHom (_ : Presheaf.stalk 𝓖 p₀ = if p₀ ∈ (op U).unop then Presheaf.stalk 𝓖 p₀ else ⊤_ C)

Next tactic:
rw [comp_eqToHom_iff]