l3lab/ntp-mathlib huggingface dataset:
theorem isPullback_of_cofan_isVanKampen [HasInitial C] {ι : Type*} {X : ι → C}
    {c : Cofan X} (hc : IsVanKampenColimit c) (i j : ι) [DecidableEq ι] :
    IsPullback (P := (if j = i then X i else ⊥_ C))
      (if h : j = i then eqToHom (if_pos h) else eqToHom (if_neg h) ≫ initial.to (X i))
      (if h : j = i then eqToHom ((if_pos h).trans (congr_arg X h.symm))
        else eqToHom (if_neg h) ≫ initial.to (X j))
      (Cofan.inj c i) (Cofan.inj c j) := by
  refine (hc (Cofan.mk (X i) (f := fun k ↦ if k = i then X i else ⊥_ C)
    (fun k ↦ if h : k = i then (eqToHom $ if_pos h) else (eqToHom $ if_neg h) ≫ initial.to _))
    (Discrete.natTrans (fun k ↦ if h : k.1 = i then (eqToHom $ (if_pos h).trans
      (congr_arg X h.symm)) else (eqToHom $ if_neg h) ≫ initial.to _))
    (c.inj i) ?_ (NatTrans.equifibered_of_discrete _)).mp ⟨?_⟩ ⟨j⟩
  · ext ⟨k⟩
    simp only [Discrete.functor_obj, Functor.const_obj_obj, NatTrans.comp_app,
      Discrete.natTrans_app, Cofan.mk_pt, Cofan.mk_ι_app, Functor.const_map_app]
    split
    · subst ‹k = i›; rfl
    · simp
  · refine mkCofanColimit _ (fun t ↦ (eqToHom (if_pos rfl).symm) ≫ t.inj i) ?_ ?_
    · intro t j
      

Proof state:
case refine_2.refine_1
J : Type v'
inst✝⁵ : Category.{u', v'} J
C : Type u
inst✝⁴ : Category.{v, u} C
K : Type u_1
inst✝³ : Category.{?u.341177, u_1} K
D : Type u_2
inst✝² : Category.{?u.341184, u_2} D
inst✝¹ : HasInitial C
ι : Type u_3
X : ι → C
c : Cofan X
hc : IsVanKampenColimit c
i j✝ : ι
inst✝ : DecidableEq ι
t : Cofan fun k => if k = i then X i else ⊥_ C
j : ι
⊢ Cofan.inj
        (Cofan.mk (X i) fun k =>
          if h : k = i then eqToHom (_ : (if k = i then X i else ⊥_ C) = X i)
          else eqToHom (_ : (if k = i then X i else ⊥_ C) = ⊥_ C) ≫ initial.to (X i))
        j ≫
      (fun t =>
          eqToHom
              (_ :
                (Cofan.mk (X i) fun k =>
                      if h : k = i then eqToHom (_ : (if k = i then X i else ⊥_ C) = X i)
                      else eqToHom (_ : (if k = i then X i else ⊥_ C) = ⊥_ C) ≫ initial.to (X i)).pt =
                  if i = i then
                    (Cofan.mk (X i) fun k =>
                        if h : k = i then eqToHom (_ : (if k = i then X i else ⊥_ C) = X i)
                        else eqToHom (_ : (if k = i then X i else ⊥_ C) = ⊥_ C) ≫ initial.to (X i)).pt
                  else ⊥_ C) ≫
            Cofan.inj t i)
        t =
    Cofan.inj t j

Next tactic:
simp only [Cofan.mk_pt, cofan_mk_inj]
theorem isPullback_of_cofan_isVanKampen [HasInitial C] {ι : Type*} {X : ι → C}
    {c : Cofan X} (hc : IsVanKampenColimit c) (i j : ι) [DecidableEq ι] :
    IsPullback (P := (if j = i then X i else ⊥_ C))
      (if h : j = i then eqToHom (if_pos h) else eqToHom (if_neg h) ≫ initial.to (X i))
      (if h : j = i then eqToHom ((if_pos h).trans (congr_arg X h.symm))
        else eqToHom (if_neg h) ≫ initial.to (X j))
      (Cofan.inj c i) (Cofan.inj c j) := by
  refine (hc (Cofan.mk (X i) (f := fun k ↦ if k = i then X i else ⊥_ C)
    (fun k ↦ if h : k = i then (eqToHom $ if_pos h) else (eqToHom $ if_neg h) ≫ initial.to _))
    (Discrete.natTrans (fun k ↦ if h : k.1 = i then (eqToHom $ (if_pos h).trans
      (congr_arg X h.symm)) else (eqToHom $ if_neg h) ≫ initial.to _))
    (c.inj i) ?_ (NatTrans.equifibered_of_discrete _)).mp ⟨?_⟩ ⟨j⟩
  · ext ⟨k⟩
    simp only [Discrete.functor_obj, Functor.const_obj_obj, NatTrans.comp_app,
      Discrete.natTrans_app, Cofan.mk_pt, Cofan.mk_ι_app, Functor.const_map_app]
    split
    · subst ‹k = i›; rfl
    · simp
  · refine mkCofanColimit _ (fun t ↦ (eqToHom (if_pos rfl).symm) ≫ t.inj i) ?_ ?_
    · intro t j
      simp only [Cofan.mk_pt, cofan_mk_inj]
      

Proof state:
case refine_2.refine_1
J : Type v'
inst✝⁵ : Category.{u', v'} J
C : Type u
inst✝⁴ : Category.{v, u} C
K : Type u_1
inst✝³ : Category.{?u.341177, u_1} K
D : Type u_2
inst✝² : Category.{?u.341184, u_2} D
inst✝¹ : HasInitial C
ι : Type u_3
X : ι → C
c : Cofan X
hc : IsVanKampenColimit c
i j✝ : ι
inst✝ : DecidableEq ι
t : Cofan fun k => if k = i then X i else ⊥_ C
j : ι
⊢ (if h : j = i then eqToHom (_ : (if j = i then X i else ⊥_ C) = X i)
      else eqToHom (_ : (if j = i then X i else ⊥_ C) = ⊥_ C) ≫ initial.to (X i)) ≫
      eqToHom
          (_ :
            (Cofan.mk (X i) fun k =>
                  if h : k = i then eqToHom (_ : (if k = i then X i else ⊥_ C) = X i)
                  else eqToHom (_ : (if k = i then X i else ⊥_ C) = ⊥_ C) ≫ initial.to (X i)).pt =
              if i = i then
                (Cofan.mk (X i) fun k =>
                    if h : k = i then eqToHom (_ : (if k = i then X i else ⊥_ C) = X i)
                    else eqToHom (_ : (if k = i then X i else ⊥_ C) = ⊥_ C) ≫ initial.to (X i)).pt
              else ⊥_ C) ≫
        Cofan.inj t i =
    Cofan.inj t j

Next tactic:
split
theorem isPullback_of_cofan_isVanKampen [HasInitial C] {ι : Type*} {X : ι → C}
    {c : Cofan X} (hc : IsVanKampenColimit c) (i j : ι) [DecidableEq ι] :
    IsPullback (P := (if j = i then X i else ⊥_ C))
      (if h : j = i then eqToHom (if_pos h) else eqToHom (if_neg h) ≫ initial.to (X i))
      (if h : j = i then eqToHom ((if_pos h).trans (congr_arg X h.symm))
        else eqToHom (if_neg h) ≫ initial.to (X j))
      (Cofan.inj c i) (Cofan.inj c j) := by
  refine (hc (Cofan.mk (X i) (f := fun k ↦ if k = i then X i else ⊥_ C)
    (fun k ↦ if h : k = i then (eqToHom $ if_pos h) else (eqToHom $ if_neg h) ≫ initial.to _))
    (Discrete.natTrans (fun k ↦ if h : k.1 = i then (eqToHom $ (if_pos h).trans
      (congr_arg X h.symm)) else (eqToHom $ if_neg h) ≫ initial.to _))
    (c.inj i) ?_ (NatTrans.equifibered_of_discrete _)).mp ⟨?_⟩ ⟨j⟩
  · ext ⟨k⟩
    simp only [Discrete.functor_obj, Functor.const_obj_obj, NatTrans.comp_app,
      Discrete.natTrans_app, Cofan.mk_pt, Cofan.mk_ι_app, Functor.const_map_app]
    split
    · subst ‹k = i›; rfl
    · simp
  · refine mkCofanColimit _ (fun t ↦ (eqToHom (if_pos rfl).symm) ≫ t.inj i) ?_ ?_
    · intro t j
      simp only [Cofan.mk_pt, cofan_mk_inj]
      split
      · 

Proof state:
case refine_2.refine_1.inl
J : Type v'
inst✝⁵ : Category.{u', v'} J
C : Type u
inst✝⁴ : Category.{v, u} C
K : Type u_1
inst✝³ : Category.{?u.341177, u_1} K
D : Type u_2
inst✝² : Category.{?u.341184, u_2} D
inst✝¹ : HasInitial C
ι : Type u_3
X : ι → C
c : Cofan X
hc : IsVanKampenColimit c
i j✝ : ι
inst✝ : DecidableEq ι
t : Cofan fun k => if k = i then X i else ⊥_ C
j : ι
h✝ : j = i
⊢ eqToHom (_ : (if j = i then X i else ⊥_ C) = X i) ≫
      eqToHom
          (_ :
            (Cofan.mk (X i) fun k =>
                  if h : k = i then eqToHom (_ : (if k = i then X i else ⊥_ C) = X i)
                  else eqToHom (_ : (if k = i then X i else ⊥_ C) = ⊥_ C) ≫ initial.to (X i)).pt =
              if i = i then
                (Cofan.mk (X i) fun k =>
                    if h : k = i then eqToHom (_ : (if k = i then X i else ⊥_ C) = X i)
                    else eqToHom (_ : (if k = i then X i else ⊥_ C) = ⊥_ C) ≫ initial.to (X i)).pt
              else ⊥_ C) ≫
        Cofan.inj t i =
    Cofan.inj t j

Next tactic:
subst ‹j = i›
theorem isPullback_of_cofan_isVanKampen [HasInitial C] {ι : Type*} {X : ι → C}
    {c : Cofan X} (hc : IsVanKampenColimit c) (i j : ι) [DecidableEq ι] :
    IsPullback (P := (if j = i then X i else ⊥_ C))
      (if h : j = i then eqToHom (if_pos h) else eqToHom (if_neg h) ≫ initial.to (X i))
      (if h : j = i then eqToHom ((if_pos h).trans (congr_arg X h.symm))
        else eqToHom (if_neg h) ≫ initial.to (X j))
      (Cofan.inj c i) (Cofan.inj c j) := by
  refine (hc (Cofan.mk (X i) (f := fun k ↦ if k = i then X i else ⊥_ C)
    (fun k ↦ if h : k = i then (eqToHom $ if_pos h) else (eqToHom $ if_neg h) ≫ initial.to _))
    (Discrete.natTrans (fun k ↦ if h : k.1 = i then (eqToHom $ (if_pos h).trans
      (congr_arg X h.symm)) else (eqToHom $ if_neg h) ≫ initial.to _))
    (c.inj i) ?_ (NatTrans.equifibered_of_discrete _)).mp ⟨?_⟩ ⟨j⟩
  · ext ⟨k⟩
    simp only [Discrete.functor_obj, Functor.const_obj_obj, NatTrans.comp_app,
      Discrete.natTrans_app, Cofan.mk_pt, Cofan.mk_ι_app, Functor.const_map_app]
    split
    · subst ‹k = i›; rfl
    · simp
  · refine mkCofanColimit _ (fun t ↦ (eqToHom (if_pos rfl).symm) ≫ t.inj i) ?_ ?_
    · intro t j
      simp only [Cofan.mk_pt, cofan_mk_inj]
      split
      · subst ‹j = i›; 

Proof state:
case refine_2.refine_1.inl
J : Type v'
inst✝⁵ : Category.{u', v'} J
C : Type u
inst✝⁴ : Category.{v, u} C
K : Type u_1
inst✝³ : Category.{?u.341177, u_1} K
D : Type u_2
inst✝² : Category.{?u.341184, u_2} D
inst✝¹ : HasInitial C
ι : Type u_3
X : ι → C
c : Cofan X
hc : IsVanKampenColimit c
j✝ : ι
inst✝ : DecidableEq ι
j : ι
t : Cofan fun k => if k = j then X j else ⊥_ C
⊢ eqToHom (_ : (if j = j then X j else ⊥_ C) = X j) ≫
      eqToHom
          (_ :
            (Cofan.mk (X j) fun k =>
                  if h : k = j then eqToHom (_ : (if k = j then X j else ⊥_ C) = X j)
                  else eqToHom (_ : (if k = j then X j else ⊥_ C) = ⊥_ C) ≫ initial.to (X j)).pt =
              if j = j then
                (Cofan.mk (X j) fun k =>
                    if h : k = j then eqToHom (_ : (if k = j then X j else ⊥_ C) = X j)
                    else eqToHom (_ : (if k = j then X j else ⊥_ C) = ⊥_ C) ≫ initial.to (X j)).pt
              else ⊥_ C) ≫
        Cofan.inj t j =
    Cofan.inj t j

Next tactic:
simp
theorem isPullback_of_cofan_isVanKampen [HasInitial C] {ι : Type*} {X : ι → C}
    {c : Cofan X} (hc : IsVanKampenColimit c) (i j : ι) [DecidableEq ι] :
    IsPullback (P := (if j = i then X i else ⊥_ C))
      (if h : j = i then eqToHom (if_pos h) else eqToHom (if_neg h) ≫ initial.to (X i))
      (if h : j = i then eqToHom ((if_pos h).trans (congr_arg X h.symm))
        else eqToHom (if_neg h) ≫ initial.to (X j))
      (Cofan.inj c i) (Cofan.inj c j) := by
  refine (hc (Cofan.mk (X i) (f := fun k ↦ if k = i then X i else ⊥_ C)
    (fun k ↦ if h : k = i then (eqToHom $ if_pos h) else (eqToHom $ if_neg h) ≫ initial.to _))
    (Discrete.natTrans (fun k ↦ if h : k.1 = i then (eqToHom $ (if_pos h).trans
      (congr_arg X h.symm)) else (eqToHom $ if_neg h) ≫ initial.to _))
    (c.inj i) ?_ (NatTrans.equifibered_of_discrete _)).mp ⟨?_⟩ ⟨j⟩
  · ext ⟨k⟩
    simp only [Discrete.functor_obj, Functor.const_obj_obj, NatTrans.comp_app,
      Discrete.natTrans_app, Cofan.mk_pt, Cofan.mk_ι_app, Functor.const_map_app]
    split
    · subst ‹k = i›; rfl
    · simp
  · refine mkCofanColimit _ (fun t ↦ (eqToHom (if_pos rfl).symm) ≫ t.inj i) ?_ ?_
    · intro t j
      simp only [Cofan.mk_pt, cofan_mk_inj]
      split
      · subst ‹j = i›; simp
      · 

Proof state:
case refine_2.refine_1.inr
J : Type v'
inst✝⁵ : Category.{u', v'} J
C : Type u
inst✝⁴ : Category.{v, u} C
K : Type u_1
inst✝³ : Category.{?u.341177, u_1} K
D : Type u_2
inst✝² : Category.{?u.341184, u_2} D
inst✝¹ : HasInitial C
ι : Type u_3
X : ι → C
c : Cofan X
hc : IsVanKampenColimit c
i j✝ : ι
inst✝ : DecidableEq ι
t : Cofan fun k => if k = i then X i else ⊥_ C
j : ι
h✝ : ¬j = i
⊢ (eqToHom (_ : (if j = i then X i else ⊥_ C) = ⊥_ C) ≫ initial.to (X i)) ≫
      eqToHom
          (_ :
            (Cofan.mk (X i) fun k =>
                  if h : k = i then eqToHom (_ : (if k = i then X i else ⊥_ C) = X i)
                  else eqToHom (_ : (if k = i then X i else ⊥_ C) = ⊥_ C) ≫ initial.to (X i)).pt =
              if i = i then
                (Cofan.mk (X i) fun k =>
                    if h : k = i then eqToHom (_ : (if k = i then X i else ⊥_ C) = X i)
                    else eqToHom (_ : (if k = i then X i else ⊥_ C) = ⊥_ C) ≫ initial.to (X i)).pt
              else ⊥_ C) ≫
        Cofan.inj t i =
    Cofan.inj t j

Next tactic:
rw [Category.assoc, ← IsIso.eq_inv_comp]
theorem isPullback_of_cofan_isVanKampen [HasInitial C] {ι : Type*} {X : ι → C}
    {c : Cofan X} (hc : IsVanKampenColimit c) (i j : ι) [DecidableEq ι] :
    IsPullback (P := (if j = i then X i else ⊥_ C))
      (if h : j = i then eqToHom (if_pos h) else eqToHom (if_neg h) ≫ initial.to (X i))
      (if h : j = i then eqToHom ((if_pos h).trans (congr_arg X h.symm))
        else eqToHom (if_neg h) ≫ initial.to (X j))
      (Cofan.inj c i) (Cofan.inj c j) := by
  refine (hc (Cofan.mk (X i) (f := fun k ↦ if k = i then X i else ⊥_ C)
    (fun k ↦ if h : k = i then (eqToHom $ if_pos h) else (eqToHom $ if_neg h) ≫ initial.to _))
    (Discrete.natTrans (fun k ↦ if h : k.1 = i then (eqToHom $ (if_pos h).trans
      (congr_arg X h.symm)) else (eqToHom $ if_neg h) ≫ initial.to _))
    (c.inj i) ?_ (NatTrans.equifibered_of_discrete _)).mp ⟨?_⟩ ⟨j⟩
  · ext ⟨k⟩
    simp only [Discrete.functor_obj, Functor.const_obj_obj, NatTrans.comp_app,
      Discrete.natTrans_app, Cofan.mk_pt, Cofan.mk_ι_app, Functor.const_map_app]
    split
    · subst ‹k = i›; rfl
    · simp
  · refine mkCofanColimit _ (fun t ↦ (eqToHom (if_pos rfl).symm) ≫ t.inj i) ?_ ?_
    · intro t j
      simp only [Cofan.mk_pt, cofan_mk_inj]
      split
      · subst ‹j = i›; simp
      · rw [Category.assoc, ← IsIso.eq_inv_comp]
        

Proof state:
case refine_2.refine_1.inr
J : Type v'
inst✝⁵ : Category.{u', v'} J
C : Type u
inst✝⁴ : Category.{v, u} C
K : Type u_1
inst✝³ : Category.{?u.341177, u_1} K
D : Type u_2
inst✝² : Category.{?u.341184, u_2} D
inst✝¹ : HasInitial C
ι : Type u_3
X : ι → C
c : Cofan X
hc : IsVanKampenColimit c
i j✝ : ι
inst✝ : DecidableEq ι
t : Cofan fun k => if k = i then X i else ⊥_ C
j : ι
h✝ : ¬j = i
⊢ initial.to (X i) ≫
      eqToHom
          (_ :
            (Cofan.mk (X i) fun k =>
                  if h : k = i then eqToHom (_ : (if k = i then X i else ⊥_ C) = X i)
                  else eqToHom (_ : (if k = i then X i else ⊥_ C) = ⊥_ C) ≫ initial.to (X i)).pt =
              if i = i then
                (Cofan.mk (X i) fun k =>
                    if h : k = i then eqToHom (_ : (if k = i then X i else ⊥_ C) = X i)
                    else eqToHom (_ : (if k = i then X i else ⊥_ C) = ⊥_ C) ≫ initial.to (X i)).pt
              else ⊥_ C) ≫
        Cofan.inj t i =
    inv (eqToHom (_ : (if j = i then X i else ⊥_ C) = ⊥_ C)) ≫ Cofan.inj t j

Next tactic:
exact initialIsInitial.hom_ext _ _
theorem isPullback_of_cofan_isVanKampen [HasInitial C] {ι : Type*} {X : ι → C}
    {c : Cofan X} (hc : IsVanKampenColimit c) (i j : ι) [DecidableEq ι] :
    IsPullback (P := (if j = i then X i else ⊥_ C))
      (if h : j = i then eqToHom (if_pos h) else eqToHom (if_neg h) ≫ initial.to (X i))
      (if h : j = i then eqToHom ((if_pos h).trans (congr_arg X h.symm))
        else eqToHom (if_neg h) ≫ initial.to (X j))
      (Cofan.inj c i) (Cofan.inj c j) := by
  refine (hc (Cofan.mk (X i) (f := fun k ↦ if k = i then X i else ⊥_ C)
    (fun k ↦ if h : k = i then (eqToHom $ if_pos h) else (eqToHom $ if_neg h) ≫ initial.to _))
    (Discrete.natTrans (fun k ↦ if h : k.1 = i then (eqToHom $ (if_pos h).trans
      (congr_arg X h.symm)) else (eqToHom $ if_neg h) ≫ initial.to _))
    (c.inj i) ?_ (NatTrans.equifibered_of_discrete _)).mp ⟨?_⟩ ⟨j⟩
  · ext ⟨k⟩
    simp only [Discrete.functor_obj, Functor.const_obj_obj, NatTrans.comp_app,
      Discrete.natTrans_app, Cofan.mk_pt, Cofan.mk_ι_app, Functor.const_map_app]
    split
    · subst ‹k = i›; rfl
    · simp
  · refine mkCofanColimit _ (fun t ↦ (eqToHom (if_pos rfl).symm) ≫ t.inj i) ?_ ?_
    · intro t j
      simp only [Cofan.mk_pt, cofan_mk_inj]
      split
      · subst ‹j = i›; simp
      · rw [Category.assoc, ← IsIso.eq_inv_comp]
        exact initialIsInitial.hom_ext _ _
    · 

Proof state:
case refine_2.refine_2
J : Type v'
inst✝⁵ : Category.{u', v'} J
C : Type u
inst✝⁴ : Category.{v, u} C
K : Type u_1
inst✝³ : Category.{?u.341177, u_1} K
D : Type u_2
inst✝² : Category.{?u.341184, u_2} D
inst✝¹ : HasInitial C
ι : Type u_3
X : ι → C
c : Cofan X
hc : IsVanKampenColimit c
i j : ι
inst✝ : DecidableEq ι
⊢ ∀ (t : Cofan fun k => if k = i then X i else ⊥_ C)
    (m :
      (Cofan.mk (X i) fun k =>
            if h : k = i then eqToHom (_ : (if k = i then X i else ⊥_ C) = X i)
            else eqToHom (_ : (if k = i then X i else ⊥_ C) = ⊥_ C) ≫ initial.to (X i)).pt ⟶
        t.pt),
    (∀ (j : ι),
        Cofan.inj
              (Cofan.mk (X i) fun k =>
                if h : k = i then eqToHom (_ : (if k = i then X i else ⊥_ C) = X i)
                else eqToHom (_ : (if k = i then X i else ⊥_ C) = ⊥_ C) ≫ initial.to (X i))
              j ≫
            m =
          Cofan.inj t j) →
      m =
        (fun t =>
            eqToHom
                (_ :
                  (Cofan.mk (X i) fun k =>
                        if h : k = i then eqToHom (_ : (if k = i then X i else ⊥_ C) = X i)
                        else eqToHom (_ : (if k = i then X i else ⊥_ C) = ⊥_ C) ≫ initial.to (X i)).pt =
                    if i = i then
                      (Cofan.mk (X i) fun k =>
                          if h : k = i then eqToHom (_ : (if k = i then X i else ⊥_ C) = X i)
                          else eqToHom (_ : (if k = i then X i else ⊥_ C) = ⊥_ C) ≫ initial.to (X i)).pt
                    else ⊥_ C) ≫
              Cofan.inj t i)
          t

Next tactic:
intro t m hm
theorem isPullback_of_cofan_isVanKampen [HasInitial C] {ι : Type*} {X : ι → C}
    {c : Cofan X} (hc : IsVanKampenColimit c) (i j : ι) [DecidableEq ι] :
    IsPullback (P := (if j = i then X i else ⊥_ C))
      (if h : j = i then eqToHom (if_pos h) else eqToHom (if_neg h) ≫ initial.to (X i))
      (if h : j = i then eqToHom ((if_pos h).trans (congr_arg X h.symm))
        else eqToHom (if_neg h) ≫ initial.to (X j))
      (Cofan.inj c i) (Cofan.inj c j) := by
  refine (hc (Cofan.mk (X i) (f := fun k ↦ if k = i then X i else ⊥_ C)
    (fun k ↦ if h : k = i then (eqToHom $ if_pos h) else (eqToHom $ if_neg h) ≫ initial.to _))
    (Discrete.natTrans (fun k ↦ if h : k.1 = i then (eqToHom $ (if_pos h).trans
      (congr_arg X h.symm)) else (eqToHom $ if_neg h) ≫ initial.to _))
    (c.inj i) ?_ (NatTrans.equifibered_of_discrete _)).mp ⟨?_⟩ ⟨j⟩
  · ext ⟨k⟩
    simp only [Discrete.functor_obj, Functor.const_obj_obj, NatTrans.comp_app,
      Discrete.natTrans_app, Cofan.mk_pt, Cofan.mk_ι_app, Functor.const_map_app]
    split
    · subst ‹k = i›; rfl
    · simp
  · refine mkCofanColimit _ (fun t ↦ (eqToHom (if_pos rfl).symm) ≫ t.inj i) ?_ ?_
    · intro t j
      simp only [Cofan.mk_pt, cofan_mk_inj]
      split
      · subst ‹j = i›; simp
      · rw [Category.assoc, ← IsIso.eq_inv_comp]
        exact initialIsInitial.hom_ext _ _
    · intro t m hm
      

Proof state:
case refine_2.refine_2
J : Type v'
inst✝⁵ : Category.{u', v'} J
C : Type u
inst✝⁴ : Category.{v, u} C
K : Type u_1
inst✝³ : Category.{?u.341177, u_1} K
D : Type u_2
inst✝² : Category.{?u.341184, u_2} D
inst✝¹ : HasInitial C
ι : Type u_3
X : ι → C
c : Cofan X
hc : IsVanKampenColimit c
i j : ι
inst✝ : DecidableEq ι
t : Cofan fun k => if k = i then X i else ⊥_ C
m :
  (Cofan.mk (X i) fun k =>
        if h : k = i then eqToHom (_ : (if k = i then X i else ⊥_ C) = X i)
        else eqToHom (_ : (if k = i then X i else ⊥_ C) = ⊥_ C) ≫ initial.to (X i)).pt ⟶
    t.pt
hm :
  ∀ (j : ι),
    Cofan.inj
          (Cofan.mk (X i) fun k =>
            if h : k = i then eqToHom (_ : (if k = i then X i else ⊥_ C) = X i)
            else eqToHom (_ : (if k = i then X i else ⊥_ C) = ⊥_ C) ≫ initial.to (X i))
          j ≫
        m =
      Cofan.inj t j
⊢ m =
    (fun t =>
        eqToHom
            (_ :
              (Cofan.mk (X i) fun k =>
                    if h : k = i then eqToHom (_ : (if k = i then X i else ⊥_ C) = X i)
                    else eqToHom (_ : (if k = i then X i else ⊥_ C) = ⊥_ C) ≫ initial.to (X i)).pt =
                if i = i then
                  (Cofan.mk (X i) fun k =>
                      if h : k = i then eqToHom (_ : (if k = i then X i else ⊥_ C) = X i)
                      else eqToHom (_ : (if k = i then X i else ⊥_ C) = ⊥_ C) ≫ initial.to (X i)).pt
                else ⊥_ C) ≫
          Cofan.inj t i)
      t

Next tactic:
simp [← hm i]
theorem isPullback_initial_to_of_cofan_isVanKampen [HasInitial C] {ι : Type*} {F : Discrete ι ⥤ C}
    {c : Cocone F} (hc : IsVanKampenColimit c) (i j : Discrete ι) (hi : i ≠ j) :
    IsPullback (initial.to _) (initial.to _) (c.ι.app i) (c.ι.app j) := by
  

Proof state:
J : Type v'
inst✝⁴ : Category.{u', v'} J
C : Type u
inst✝³ : Category.{v, u} C
K : Type u_1
inst✝² : Category.{?u.350544, u_1} K
D : Type u_2
inst✝¹ : Category.{?u.350551, u_2} D
inst✝ : HasInitial C
ι : Type u_3
F : Discrete ι ⥤ C
c : Cocone F
hc : IsVanKampenColimit c
i j : Discrete ι
hi : i ≠ j
⊢ IsPullback (initial.to (F.obj i)) (initial.to (F.obj j)) (c.ι.app i) (c.ι.app j)

Next tactic:
classical
  let f : ι → C := F.obj ∘ Discrete.mk
  have : F = Discrete.functor f :=
    Functor.hext (fun i ↦ rfl) (by rintro ⟨i⟩ ⟨j⟩ ⟨⟨rfl : i = j⟩⟩; simp)
  clear_value f
  subst this
  convert isPullback_of_cofan_isVanKampen hc i.as j.as
  exact (if_neg (mt (Discrete.ext _ _) hi.symm)).symm
theorem isPullback_initial_to_of_cofan_isVanKampen [HasInitial C] {ι : Type*} {F : Discrete ι ⥤ C}
    {c : Cocone F} (hc : IsVanKampenColimit c) (i j : Discrete ι) (hi : i ≠ j) :
    IsPullback (initial.to _) (initial.to _) (c.ι.app i) (c.ι.app j) := by
  classical
  

Proof state:
J : Type v'
inst✝⁴ : Category.{u', v'} J
C : Type u
inst✝³ : Category.{v, u} C
K : Type u_1
inst✝² : Category.{?u.350544, u_1} K
D : Type u_2
inst✝¹ : Category.{?u.350551, u_2} D
inst✝ : HasInitial C
ι : Type u_3
F : Discrete ι ⥤ C
c : Cocone F
hc : IsVanKampenColimit c
i j : Discrete ι
hi : i ≠ j
⊢ IsPullback (initial.to (F.obj i)) (initial.to (F.obj j)) (c.ι.app i) (c.ι.app j)

Next tactic:
let f : ι → C := F.obj ∘ Discrete.mk
theorem isPullback_initial_to_of_cofan_isVanKampen [HasInitial C] {ι : Type*} {F : Discrete ι ⥤ C}
    {c : Cocone F} (hc : IsVanKampenColimit c) (i j : Discrete ι) (hi : i ≠ j) :
    IsPullback (initial.to _) (initial.to _) (c.ι.app i) (c.ι.app j) := by
  classical
  let f : ι → C := F.obj ∘ Discrete.mk
  

Proof state:
J : Type v'
inst✝⁴ : Category.{u', v'} J
C : Type u
inst✝³ : Category.{v, u} C
K : Type u_1
inst✝² : Category.{?u.350544, u_1} K
D : Type u_2
inst✝¹ : Category.{?u.350551, u_2} D
inst✝ : HasInitial C
ι : Type u_3
F : Discrete ι ⥤ C
c : Cocone F
hc : IsVanKampenColimit c
i j : Discrete ι
hi : i ≠ j
f : ι → C := F.obj ∘ Discrete.mk
⊢ IsPullback (initial.to (F.obj i)) (initial.to (F.obj j)) (c.ι.app i) (c.ι.app j)

Next tactic:
have : F = Discrete.functor f :=
    Functor.hext (fun i ↦ rfl) (by rintro ⟨i⟩ ⟨j⟩ ⟨⟨rfl : i = j⟩⟩; simp)
theorem isPullback_initial_to_of_cofan_isVanKampen [HasInitial C] {ι : Type*} {F : Discrete ι ⥤ C}
    {c : Cocone F} (hc : IsVanKampenColimit c) (i j : Discrete ι) (hi : i ≠ j) :
    IsPullback (initial.to _) (initial.to _) (c.ι.app i) (c.ι.app j) := by
  classical
  let f : ι → C := F.obj ∘ Discrete.mk
  have : F = Discrete.functor f :=
    Functor.hext (fun i ↦ rfl) (by 

Proof state:
J : Type v'
inst✝⁴ : Category.{u', v'} J
C : Type u
inst✝³ : Category.{v, u} C
K : Type u_1
inst✝² : Category.{?u.350544, u_1} K
D : Type u_2
inst✝¹ : Category.{?u.350551, u_2} D
inst✝ : HasInitial C
ι : Type u_3
F : Discrete ι ⥤ C
c : Cocone F
hc : IsVanKampenColimit c
i j : Discrete ι
hi : i ≠ j
f : ι → C := F.obj ∘ Discrete.mk
⊢ ∀ (X Y : Discrete ι) (f_1 : X ⟶ Y), HEq (F.map f_1) ((Discrete.functor f).map f_1)

Next tactic:
rintro ⟨i⟩ ⟨j⟩ ⟨⟨rfl : i = j⟩⟩
theorem isPullback_initial_to_of_cofan_isVanKampen [HasInitial C] {ι : Type*} {F : Discrete ι ⥤ C}
    {c : Cocone F} (hc : IsVanKampenColimit c) (i j : Discrete ι) (hi : i ≠ j) :
    IsPullback (initial.to _) (initial.to _) (c.ι.app i) (c.ι.app j) := by
  classical
  let f : ι → C := F.obj ∘ Discrete.mk
  have : F = Discrete.functor f :=
    Functor.hext (fun i ↦ rfl) (by rintro ⟨i⟩ ⟨j⟩ ⟨⟨rfl : i = j⟩⟩; 

Proof state:
case mk.mk.up.up
J : Type v'
inst✝⁴ : Category.{u', v'} J
C : Type u
inst✝³ : Category.{v, u} C
K : Type u_1
inst✝² : Category.{?u.350544, u_1} K
D : Type u_2
inst✝¹ : Category.{?u.350551, u_2} D
inst✝ : HasInitial C
ι : Type u_3
F : Discrete ι ⥤ C
c : Cocone F
hc : IsVanKampenColimit c
i✝ j : Discrete ι
hi : i✝ ≠ j
f : ι → C := F.obj ∘ Discrete.mk
i : ι
⊢ HEq (F.map { down := { down := (_ : i = i) } }) ((Discrete.functor f).map { down := { down := (_ : i = i) } })

Next tactic:
simp