l3lab/ntp-mathlib huggingface dataset:
theorem binaryCofan_isColimit_iff {X Y : TopCat} (c : BinaryCofan X Y) :
    Nonempty (IsColimit c) ↔
      OpenEmbedding c.inl ∧ OpenEmbedding c.inr ∧ IsCompl (Set.range c.inl) (Set.range c.inr) := by
  classical
    constructor
    · rintro ⟨h⟩
      rw [← show _ = c.inl from
          h.comp_coconePointUniqueUpToIso_inv (binaryCofanIsColimit X Y) ⟨WalkingPair.left⟩,
        ← show _ = c.inr from
          h.comp_coconePointUniqueUpToIso_inv (binaryCofanIsColimit X Y) ⟨WalkingPair.right⟩]
      dsimp
      refine' ⟨(homeoOfIso <| h.coconePointUniqueUpToIso
        (binaryCofanIsColimit X Y)).symm.openEmbedding.comp openEmbedding_inl,
          (homeoOfIso <| h.coconePointUniqueUpToIso
            (binaryCofanIsColimit X Y)).symm.openEmbedding.comp openEmbedding_inr, _⟩
      erw [Set.range_comp, ← eq_compl_iff_isCompl, coe_comp, coe_comp, Set.range_comp _ Sum.inr,
        ← Set.image_compl_eq (homeoOfIso <| h.coconePointUniqueUpToIso
            (binaryCofanIsColimit X Y)).symm.bijective, Set.compl_range_inr, Set.image_comp]
      aesop
    · rintro ⟨h₁, h₂, h₃⟩
      have : ∀ x, x ∈ Set.range c.inl ∨ x ∈ Set.range c.inr := by
        rw [eq_compl_iff_isCompl.mpr h₃.symm]
        exact fun _ => or_not
      

Proof state:
case mpr.intro.intro
J : Type v
inst✝ : SmallCategory J
X Y : TopCat
c : BinaryCofan X Y
h₁ : OpenEmbedding ⇑(BinaryCofan.inl c)
h₂ : OpenEmbedding ⇑(BinaryCofan.inr c)
h₃ : IsCompl (Set.range ⇑(BinaryCofan.inl c)) (Set.range ⇑(BinaryCofan.inr c))
this :
  ∀ (x : (forget TopCat).obj (((Functor.const (Discrete WalkingPair)).obj c.pt).obj { as := WalkingPair.left })),
    x ∈ Set.range ⇑(BinaryCofan.inl c) ∨ x ∈ Set.range ⇑(BinaryCofan.inr c)
⊢ Nonempty (IsColimit c)

Next tactic:
refine' ⟨BinaryCofan.IsColimit.mk _ _ _ _ _⟩
theorem binaryCofan_isColimit_iff {X Y : TopCat} (c : BinaryCofan X Y) :
    Nonempty (IsColimit c) ↔
      OpenEmbedding c.inl ∧ OpenEmbedding c.inr ∧ IsCompl (Set.range c.inl) (Set.range c.inr) := by
  classical
    constructor
    · rintro ⟨h⟩
      rw [← show _ = c.inl from
          h.comp_coconePointUniqueUpToIso_inv (binaryCofanIsColimit X Y) ⟨WalkingPair.left⟩,
        ← show _ = c.inr from
          h.comp_coconePointUniqueUpToIso_inv (binaryCofanIsColimit X Y) ⟨WalkingPair.right⟩]
      dsimp
      refine' ⟨(homeoOfIso <| h.coconePointUniqueUpToIso
        (binaryCofanIsColimit X Y)).symm.openEmbedding.comp openEmbedding_inl,
          (homeoOfIso <| h.coconePointUniqueUpToIso
            (binaryCofanIsColimit X Y)).symm.openEmbedding.comp openEmbedding_inr, _⟩
      erw [Set.range_comp, ← eq_compl_iff_isCompl, coe_comp, coe_comp, Set.range_comp _ Sum.inr,
        ← Set.image_compl_eq (homeoOfIso <| h.coconePointUniqueUpToIso
            (binaryCofanIsColimit X Y)).symm.bijective, Set.compl_range_inr, Set.image_comp]
      aesop
    · rintro ⟨h₁, h₂, h₃⟩
      have : ∀ x, x ∈ Set.range c.inl ∨ x ∈ Set.range c.inr := by
        rw [eq_compl_iff_isCompl.mpr h₃.symm]
        exact fun _ => or_not
      refine' ⟨BinaryCofan.IsColimit.mk _ _ _ _ _⟩
      · 

Proof state:
case mpr.intro.intro.refine'_1
J : Type v
inst✝ : SmallCategory J
X Y : TopCat
c : BinaryCofan X Y
h₁ : OpenEmbedding ⇑(BinaryCofan.inl c)
h₂ : OpenEmbedding ⇑(BinaryCofan.inr c)
h₃ : IsCompl (Set.range ⇑(BinaryCofan.inl c)) (Set.range ⇑(BinaryCofan.inr c))
this :
  ∀ (x : (forget TopCat).obj (((Functor.const (Discrete WalkingPair)).obj c.pt).obj { as := WalkingPair.left })),
    x ∈ Set.range ⇑(BinaryCofan.inl c) ∨ x ∈ Set.range ⇑(BinaryCofan.inr c)
⊢ {T : TopCat} → (X ⟶ T) → (Y ⟶ T) → (c.pt ⟶ T)

Next tactic:
intro T f g
theorem binaryCofan_isColimit_iff {X Y : TopCat} (c : BinaryCofan X Y) :
    Nonempty (IsColimit c) ↔
      OpenEmbedding c.inl ∧ OpenEmbedding c.inr ∧ IsCompl (Set.range c.inl) (Set.range c.inr) := by
  classical
    constructor
    · rintro ⟨h⟩
      rw [← show _ = c.inl from
          h.comp_coconePointUniqueUpToIso_inv (binaryCofanIsColimit X Y) ⟨WalkingPair.left⟩,
        ← show _ = c.inr from
          h.comp_coconePointUniqueUpToIso_inv (binaryCofanIsColimit X Y) ⟨WalkingPair.right⟩]
      dsimp
      refine' ⟨(homeoOfIso <| h.coconePointUniqueUpToIso
        (binaryCofanIsColimit X Y)).symm.openEmbedding.comp openEmbedding_inl,
          (homeoOfIso <| h.coconePointUniqueUpToIso
            (binaryCofanIsColimit X Y)).symm.openEmbedding.comp openEmbedding_inr, _⟩
      erw [Set.range_comp, ← eq_compl_iff_isCompl, coe_comp, coe_comp, Set.range_comp _ Sum.inr,
        ← Set.image_compl_eq (homeoOfIso <| h.coconePointUniqueUpToIso
            (binaryCofanIsColimit X Y)).symm.bijective, Set.compl_range_inr, Set.image_comp]
      aesop
    · rintro ⟨h₁, h₂, h₃⟩
      have : ∀ x, x ∈ Set.range c.inl ∨ x ∈ Set.range c.inr := by
        rw [eq_compl_iff_isCompl.mpr h₃.symm]
        exact fun _ => or_not
      refine' ⟨BinaryCofan.IsColimit.mk _ _ _ _ _⟩
      · intro T f g
        

Proof state:
case mpr.intro.intro.refine'_1
J : Type v
inst✝ : SmallCategory J
X Y : TopCat
c : BinaryCofan X Y
h₁ : OpenEmbedding ⇑(BinaryCofan.inl c)
h₂ : OpenEmbedding ⇑(BinaryCofan.inr c)
h₃ : IsCompl (Set.range ⇑(BinaryCofan.inl c)) (Set.range ⇑(BinaryCofan.inr c))
this :
  ∀ (x : (forget TopCat).obj (((Functor.const (Discrete WalkingPair)).obj c.pt).obj { as := WalkingPair.left })),
    x ∈ Set.range ⇑(BinaryCofan.inl c) ∨ x ∈ Set.range ⇑(BinaryCofan.inr c)
T : TopCat
f : X ⟶ T
g : Y ⟶ T
⊢ c.pt ⟶ T

Next tactic:
refine' ContinuousMap.mk _ _
theorem binaryCofan_isColimit_iff {X Y : TopCat} (c : BinaryCofan X Y) :
    Nonempty (IsColimit c) ↔
      OpenEmbedding c.inl ∧ OpenEmbedding c.inr ∧ IsCompl (Set.range c.inl) (Set.range c.inr) := by
  classical
    constructor
    · rintro ⟨h⟩
      rw [← show _ = c.inl from
          h.comp_coconePointUniqueUpToIso_inv (binaryCofanIsColimit X Y) ⟨WalkingPair.left⟩,
        ← show _ = c.inr from
          h.comp_coconePointUniqueUpToIso_inv (binaryCofanIsColimit X Y) ⟨WalkingPair.right⟩]
      dsimp
      refine' ⟨(homeoOfIso <| h.coconePointUniqueUpToIso
        (binaryCofanIsColimit X Y)).symm.openEmbedding.comp openEmbedding_inl,
          (homeoOfIso <| h.coconePointUniqueUpToIso
            (binaryCofanIsColimit X Y)).symm.openEmbedding.comp openEmbedding_inr, _⟩
      erw [Set.range_comp, ← eq_compl_iff_isCompl, coe_comp, coe_comp, Set.range_comp _ Sum.inr,
        ← Set.image_compl_eq (homeoOfIso <| h.coconePointUniqueUpToIso
            (binaryCofanIsColimit X Y)).symm.bijective, Set.compl_range_inr, Set.image_comp]
      aesop
    · rintro ⟨h₁, h₂, h₃⟩
      have : ∀ x, x ∈ Set.range c.inl ∨ x ∈ Set.range c.inr := by
        rw [eq_compl_iff_isCompl.mpr h₃.symm]
        exact fun _ => or_not
      refine' ⟨BinaryCofan.IsColimit.mk _ _ _ _ _⟩
      · intro T f g
        refine' ContinuousMap.mk _ _
        · 

Proof state:
case mpr.intro.intro.refine'_1.refine'_1
J : Type v
inst✝ : SmallCategory J
X Y : TopCat
c : BinaryCofan X Y
h₁ : OpenEmbedding ⇑(BinaryCofan.inl c)
h₂ : OpenEmbedding ⇑(BinaryCofan.inr c)
h₃ : IsCompl (Set.range ⇑(BinaryCofan.inl c)) (Set.range ⇑(BinaryCofan.inr c))
this :
  ∀ (x : (forget TopCat).obj (((Functor.const (Discrete WalkingPair)).obj c.pt).obj { as := WalkingPair.left })),
    x ∈ Set.range ⇑(BinaryCofan.inl c) ∨ x ∈ Set.range ⇑(BinaryCofan.inr c)
T : TopCat
f : X ⟶ T
g : Y ⟶ T
⊢ ↑c.pt → ↑T

Next tactic:
exact fun x =>
            if h : x ∈ Set.range c.inl then f ((Equiv.ofInjective _ h₁.inj).symm ⟨x, h⟩)
            else g ((Equiv.ofInjective _ h₂.inj).symm ⟨x, (this x).resolve_left h⟩)
theorem binaryCofan_isColimit_iff {X Y : TopCat} (c : BinaryCofan X Y) :
    Nonempty (IsColimit c) ↔
      OpenEmbedding c.inl ∧ OpenEmbedding c.inr ∧ IsCompl (Set.range c.inl) (Set.range c.inr) := by
  classical
    constructor
    · rintro ⟨h⟩
      rw [← show _ = c.inl from
          h.comp_coconePointUniqueUpToIso_inv (binaryCofanIsColimit X Y) ⟨WalkingPair.left⟩,
        ← show _ = c.inr from
          h.comp_coconePointUniqueUpToIso_inv (binaryCofanIsColimit X Y) ⟨WalkingPair.right⟩]
      dsimp
      refine' ⟨(homeoOfIso <| h.coconePointUniqueUpToIso
        (binaryCofanIsColimit X Y)).symm.openEmbedding.comp openEmbedding_inl,
          (homeoOfIso <| h.coconePointUniqueUpToIso
            (binaryCofanIsColimit X Y)).symm.openEmbedding.comp openEmbedding_inr, _⟩
      erw [Set.range_comp, ← eq_compl_iff_isCompl, coe_comp, coe_comp, Set.range_comp _ Sum.inr,
        ← Set.image_compl_eq (homeoOfIso <| h.coconePointUniqueUpToIso
            (binaryCofanIsColimit X Y)).symm.bijective, Set.compl_range_inr, Set.image_comp]
      aesop
    · rintro ⟨h₁, h₂, h₃⟩
      have : ∀ x, x ∈ Set.range c.inl ∨ x ∈ Set.range c.inr := by
        rw [eq_compl_iff_isCompl.mpr h₃.symm]
        exact fun _ => or_not
      refine' ⟨BinaryCofan.IsColimit.mk _ _ _ _ _⟩
      · intro T f g
        refine' ContinuousMap.mk _ _
        · exact fun x =>
            if h : x ∈ Set.range c.inl then f ((Equiv.ofInjective _ h₁.inj).symm ⟨x, h⟩)
            else g ((Equiv.ofInjective _ h₂.inj).symm ⟨x, (this x).resolve_left h⟩)
        

Proof state:
case mpr.intro.intro.refine'_1.refine'_2
J : Type v
inst✝ : SmallCategory J
X Y : TopCat
c : BinaryCofan X Y
h₁ : OpenEmbedding ⇑(BinaryCofan.inl c)
h₂ : OpenEmbedding ⇑(BinaryCofan.inr c)
h₃ : IsCompl (Set.range ⇑(BinaryCofan.inl c)) (Set.range ⇑(BinaryCofan.inr c))
this :
  ∀ (x : (forget TopCat).obj (((Functor.const (Discrete WalkingPair)).obj c.pt).obj { as := WalkingPair.left })),
    x ∈ Set.range ⇑(BinaryCofan.inl c) ∨ x ∈ Set.range ⇑(BinaryCofan.inr c)
T : TopCat
f : X ⟶ T
g : Y ⟶ T
⊢ Continuous fun x =>
    if h : x ∈ Set.range ⇑(BinaryCofan.inl c) then
      f
        ((Equiv.ofInjective ⇑(BinaryCofan.inl c) (_ : Function.Injective ⇑(BinaryCofan.inl c))).symm
          { val := x, property := h })
    else
      g
        ((Equiv.ofInjective ⇑(BinaryCofan.inr c) (_ : Function.Injective ⇑(BinaryCofan.inr c))).symm
          { val := x, property := (_ : x ∈ Set.range ⇑(BinaryCofan.inr c)) })

Next tactic:
rw [continuous_iff_continuousAt]
theorem binaryCofan_isColimit_iff {X Y : TopCat} (c : BinaryCofan X Y) :
    Nonempty (IsColimit c) ↔
      OpenEmbedding c.inl ∧ OpenEmbedding c.inr ∧ IsCompl (Set.range c.inl) (Set.range c.inr) := by
  classical
    constructor
    · rintro ⟨h⟩
      rw [← show _ = c.inl from
          h.comp_coconePointUniqueUpToIso_inv (binaryCofanIsColimit X Y) ⟨WalkingPair.left⟩,
        ← show _ = c.inr from
          h.comp_coconePointUniqueUpToIso_inv (binaryCofanIsColimit X Y) ⟨WalkingPair.right⟩]
      dsimp
      refine' ⟨(homeoOfIso <| h.coconePointUniqueUpToIso
        (binaryCofanIsColimit X Y)).symm.openEmbedding.comp openEmbedding_inl,
          (homeoOfIso <| h.coconePointUniqueUpToIso
            (binaryCofanIsColimit X Y)).symm.openEmbedding.comp openEmbedding_inr, _⟩
      erw [Set.range_comp, ← eq_compl_iff_isCompl, coe_comp, coe_comp, Set.range_comp _ Sum.inr,
        ← Set.image_compl_eq (homeoOfIso <| h.coconePointUniqueUpToIso
            (binaryCofanIsColimit X Y)).symm.bijective, Set.compl_range_inr, Set.image_comp]
      aesop
    · rintro ⟨h₁, h₂, h₃⟩
      have : ∀ x, x ∈ Set.range c.inl ∨ x ∈ Set.range c.inr := by
        rw [eq_compl_iff_isCompl.mpr h₃.symm]
        exact fun _ => or_not
      refine' ⟨BinaryCofan.IsColimit.mk _ _ _ _ _⟩
      · intro T f g
        refine' ContinuousMap.mk _ _
        · exact fun x =>
            if h : x ∈ Set.range c.inl then f ((Equiv.ofInjective _ h₁.inj).symm ⟨x, h⟩)
            else g ((Equiv.ofInjective _ h₂.inj).symm ⟨x, (this x).resolve_left h⟩)
        rw [continuous_iff_continuousAt]
        

Proof state:
case mpr.intro.intro.refine'_1.refine'_2
J : Type v
inst✝ : SmallCategory J
X Y : TopCat
c : BinaryCofan X Y
h₁ : OpenEmbedding ⇑(BinaryCofan.inl c)
h₂ : OpenEmbedding ⇑(BinaryCofan.inr c)
h₃ : IsCompl (Set.range ⇑(BinaryCofan.inl c)) (Set.range ⇑(BinaryCofan.inr c))
this :
  ∀ (x : (forget TopCat).obj (((Functor.const (Discrete WalkingPair)).obj c.pt).obj { as := WalkingPair.left })),
    x ∈ Set.range ⇑(BinaryCofan.inl c) ∨ x ∈ Set.range ⇑(BinaryCofan.inr c)
T : TopCat
f : X ⟶ T
g : Y ⟶ T
⊢ ∀ (x : ↑c.pt),
    ContinuousAt
      (fun x =>
        if h : x ∈ Set.range ⇑(BinaryCofan.inl c) then
          f
            ((Equiv.ofInjective ⇑(BinaryCofan.inl c) (_ : Function.Injective ⇑(BinaryCofan.inl c))).symm
              { val := x, property := h })
        else
          g
            ((Equiv.ofInjective ⇑(BinaryCofan.inr c) (_ : Function.Injective ⇑(BinaryCofan.inr c))).symm
              { val := x, property := (_ : x ∈ Set.range ⇑(BinaryCofan.inr c)) }))
      x

Next tactic:
intro x
theorem binaryCofan_isColimit_iff {X Y : TopCat} (c : BinaryCofan X Y) :
    Nonempty (IsColimit c) ↔
      OpenEmbedding c.inl ∧ OpenEmbedding c.inr ∧ IsCompl (Set.range c.inl) (Set.range c.inr) := by
  classical
    constructor
    · rintro ⟨h⟩
      rw [← show _ = c.inl from
          h.comp_coconePointUniqueUpToIso_inv (binaryCofanIsColimit X Y) ⟨WalkingPair.left⟩,
        ← show _ = c.inr from
          h.comp_coconePointUniqueUpToIso_inv (binaryCofanIsColimit X Y) ⟨WalkingPair.right⟩]
      dsimp
      refine' ⟨(homeoOfIso <| h.coconePointUniqueUpToIso
        (binaryCofanIsColimit X Y)).symm.openEmbedding.comp openEmbedding_inl,
          (homeoOfIso <| h.coconePointUniqueUpToIso
            (binaryCofanIsColimit X Y)).symm.openEmbedding.comp openEmbedding_inr, _⟩
      erw [Set.range_comp, ← eq_compl_iff_isCompl, coe_comp, coe_comp, Set.range_comp _ Sum.inr,
        ← Set.image_compl_eq (homeoOfIso <| h.coconePointUniqueUpToIso
            (binaryCofanIsColimit X Y)).symm.bijective, Set.compl_range_inr, Set.image_comp]
      aesop
    · rintro ⟨h₁, h₂, h₃⟩
      have : ∀ x, x ∈ Set.range c.inl ∨ x ∈ Set.range c.inr := by
        rw [eq_compl_iff_isCompl.mpr h₃.symm]
        exact fun _ => or_not
      refine' ⟨BinaryCofan.IsColimit.mk _ _ _ _ _⟩
      · intro T f g
        refine' ContinuousMap.mk _ _
        · exact fun x =>
            if h : x ∈ Set.range c.inl then f ((Equiv.ofInjective _ h₁.inj).symm ⟨x, h⟩)
            else g ((Equiv.ofInjective _ h₂.inj).symm ⟨x, (this x).resolve_left h⟩)
        rw [continuous_iff_continuousAt]
        intro x
        

Proof state:
case mpr.intro.intro.refine'_1.refine'_2
J : Type v
inst✝ : SmallCategory J
X Y : TopCat
c : BinaryCofan X Y
h₁ : OpenEmbedding ⇑(BinaryCofan.inl c)
h₂ : OpenEmbedding ⇑(BinaryCofan.inr c)
h₃ : IsCompl (Set.range ⇑(BinaryCofan.inl c)) (Set.range ⇑(BinaryCofan.inr c))
this :
  ∀ (x : (forget TopCat).obj (((Functor.const (Discrete WalkingPair)).obj c.pt).obj { as := WalkingPair.left })),
    x ∈ Set.range ⇑(BinaryCofan.inl c) ∨ x ∈ Set.range ⇑(BinaryCofan.inr c)
T : TopCat
f : X ⟶ T
g : Y ⟶ T
x : ↑c.pt
⊢ ContinuousAt
    (fun x =>
      if h : x ∈ Set.range ⇑(BinaryCofan.inl c) then
        f
          ((Equiv.ofInjective ⇑(BinaryCofan.inl c) (_ : Function.Injective ⇑(BinaryCofan.inl c))).symm
            { val := x, property := h })
      else
        g
          ((Equiv.ofInjective ⇑(BinaryCofan.inr c) (_ : Function.Injective ⇑(BinaryCofan.inr c))).symm
            { val := x, property := (_ : x ∈ Set.range ⇑(BinaryCofan.inr c)) }))
    x

Next tactic:
by_cases h : x ∈ Set.range c.inl
theorem binaryCofan_isColimit_iff {X Y : TopCat} (c : BinaryCofan X Y) :
    Nonempty (IsColimit c) ↔
      OpenEmbedding c.inl ∧ OpenEmbedding c.inr ∧ IsCompl (Set.range c.inl) (Set.range c.inr) := by
  classical
    constructor
    · rintro ⟨h⟩
      rw [← show _ = c.inl from
          h.comp_coconePointUniqueUpToIso_inv (binaryCofanIsColimit X Y) ⟨WalkingPair.left⟩,
        ← show _ = c.inr from
          h.comp_coconePointUniqueUpToIso_inv (binaryCofanIsColimit X Y) ⟨WalkingPair.right⟩]
      dsimp
      refine' ⟨(homeoOfIso <| h.coconePointUniqueUpToIso
        (binaryCofanIsColimit X Y)).symm.openEmbedding.comp openEmbedding_inl,
          (homeoOfIso <| h.coconePointUniqueUpToIso
            (binaryCofanIsColimit X Y)).symm.openEmbedding.comp openEmbedding_inr, _⟩
      erw [Set.range_comp, ← eq_compl_iff_isCompl, coe_comp, coe_comp, Set.range_comp _ Sum.inr,
        ← Set.image_compl_eq (homeoOfIso <| h.coconePointUniqueUpToIso
            (binaryCofanIsColimit X Y)).symm.bijective, Set.compl_range_inr, Set.image_comp]
      aesop
    · rintro ⟨h₁, h₂, h₃⟩
      have : ∀ x, x ∈ Set.range c.inl ∨ x ∈ Set.range c.inr := by
        rw [eq_compl_iff_isCompl.mpr h₃.symm]
        exact fun _ => or_not
      refine' ⟨BinaryCofan.IsColimit.mk _ _ _ _ _⟩
      · intro T f g
        refine' ContinuousMap.mk _ _
        · exact fun x =>
            if h : x ∈ Set.range c.inl then f ((Equiv.ofInjective _ h₁.inj).symm ⟨x, h⟩)
            else g ((Equiv.ofInjective _ h₂.inj).symm ⟨x, (this x).resolve_left h⟩)
        rw [continuous_iff_continuousAt]
        intro x
        by_cases h : x ∈ Set.range c.inl
        · 

Proof state:
case pos
J : Type v
inst✝ : SmallCategory J
X Y : TopCat
c : BinaryCofan X Y
h₁ : OpenEmbedding ⇑(BinaryCofan.inl c)
h₂ : OpenEmbedding ⇑(BinaryCofan.inr c)
h₃ : IsCompl (Set.range ⇑(BinaryCofan.inl c)) (Set.range ⇑(BinaryCofan.inr c))
this :
  ∀ (x : (forget TopCat).obj (((Functor.const (Discrete WalkingPair)).obj c.pt).obj { as := WalkingPair.left })),
    x ∈ Set.range ⇑(BinaryCofan.inl c) ∨ x ∈ Set.range ⇑(BinaryCofan.inr c)
T : TopCat
f : X ⟶ T
g : Y ⟶ T
x : ↑c.pt
h : x ∈ Set.range ⇑(BinaryCofan.inl c)
⊢ ContinuousAt
    (fun x =>
      if h : x ∈ Set.range ⇑(BinaryCofan.inl c) then
        f
          ((Equiv.ofInjective ⇑(BinaryCofan.inl c) (_ : Function.Injective ⇑(BinaryCofan.inl c))).symm
            { val := x, property := h })
      else
        g
          ((Equiv.ofInjective ⇑(BinaryCofan.inr c) (_ : Function.Injective ⇑(BinaryCofan.inr c))).symm
            { val := x, property := (_ : x ∈ Set.range ⇑(BinaryCofan.inr c)) }))
    x

Next tactic:
revert h x
theorem binaryCofan_isColimit_iff {X Y : TopCat} (c : BinaryCofan X Y) :
    Nonempty (IsColimit c) ↔
      OpenEmbedding c.inl ∧ OpenEmbedding c.inr ∧ IsCompl (Set.range c.inl) (Set.range c.inr) := by
  classical
    constructor
    · rintro ⟨h⟩
      rw [← show _ = c.inl from
          h.comp_coconePointUniqueUpToIso_inv (binaryCofanIsColimit X Y) ⟨WalkingPair.left⟩,
        ← show _ = c.inr from
          h.comp_coconePointUniqueUpToIso_inv (binaryCofanIsColimit X Y) ⟨WalkingPair.right⟩]
      dsimp
      refine' ⟨(homeoOfIso <| h.coconePointUniqueUpToIso
        (binaryCofanIsColimit X Y)).symm.openEmbedding.comp openEmbedding_inl,
          (homeoOfIso <| h.coconePointUniqueUpToIso
            (binaryCofanIsColimit X Y)).symm.openEmbedding.comp openEmbedding_inr, _⟩
      erw [Set.range_comp, ← eq_compl_iff_isCompl, coe_comp, coe_comp, Set.range_comp _ Sum.inr,
        ← Set.image_compl_eq (homeoOfIso <| h.coconePointUniqueUpToIso
            (binaryCofanIsColimit X Y)).symm.bijective, Set.compl_range_inr, Set.image_comp]
      aesop
    · rintro ⟨h₁, h₂, h₃⟩
      have : ∀ x, x ∈ Set.range c.inl ∨ x ∈ Set.range c.inr := by
        rw [eq_compl_iff_isCompl.mpr h₃.symm]
        exact fun _ => or_not
      refine' ⟨BinaryCofan.IsColimit.mk _ _ _ _ _⟩
      · intro T f g
        refine' ContinuousMap.mk _ _
        · exact fun x =>
            if h : x ∈ Set.range c.inl then f ((Equiv.ofInjective _ h₁.inj).symm ⟨x, h⟩)
            else g ((Equiv.ofInjective _ h₂.inj).symm ⟨x, (this x).resolve_left h⟩)
        rw [continuous_iff_continuousAt]
        intro x
        by_cases h : x ∈ Set.range c.inl
        · revert h x
          

Proof state:
case pos
J : Type v
inst✝ : SmallCategory J
X Y : TopCat
c : BinaryCofan X Y
h₁ : OpenEmbedding ⇑(BinaryCofan.inl c)
h₂ : OpenEmbedding ⇑(BinaryCofan.inr c)
h₃ : IsCompl (Set.range ⇑(BinaryCofan.inl c)) (Set.range ⇑(BinaryCofan.inr c))
this :
  ∀ (x : (forget TopCat).obj (((Functor.const (Discrete WalkingPair)).obj c.pt).obj { as := WalkingPair.left })),
    x ∈ Set.range ⇑(BinaryCofan.inl c) ∨ x ∈ Set.range ⇑(BinaryCofan.inr c)
T : TopCat
f : X ⟶ T
g : Y ⟶ T
⊢ ∀ x ∈ Set.range ⇑(BinaryCofan.inl c),
    ContinuousAt
      (fun x =>
        if h : x ∈ Set.range ⇑(BinaryCofan.inl c) then
          f
            ((Equiv.ofInjective ⇑(BinaryCofan.inl c) (_ : Function.Injective ⇑(BinaryCofan.inl c))).symm
              { val := x, property := h })
        else
          g
            ((Equiv.ofInjective ⇑(BinaryCofan.inr c) (_ : Function.Injective ⇑(BinaryCofan.inr c))).symm
              { val := x, property := (_ : x ∈ Set.range ⇑(BinaryCofan.inr c)) }))
      x

Next tactic:
apply (IsOpen.continuousOn_iff _).mp
theorem binaryCofan_isColimit_iff {X Y : TopCat} (c : BinaryCofan X Y) :
    Nonempty (IsColimit c) ↔
      OpenEmbedding c.inl ∧ OpenEmbedding c.inr ∧ IsCompl (Set.range c.inl) (Set.range c.inr) := by
  classical
    constructor
    · rintro ⟨h⟩
      rw [← show _ = c.inl from
          h.comp_coconePointUniqueUpToIso_inv (binaryCofanIsColimit X Y) ⟨WalkingPair.left⟩,
        ← show _ = c.inr from
          h.comp_coconePointUniqueUpToIso_inv (binaryCofanIsColimit X Y) ⟨WalkingPair.right⟩]
      dsimp
      refine' ⟨(homeoOfIso <| h.coconePointUniqueUpToIso
        (binaryCofanIsColimit X Y)).symm.openEmbedding.comp openEmbedding_inl,
          (homeoOfIso <| h.coconePointUniqueUpToIso
            (binaryCofanIsColimit X Y)).symm.openEmbedding.comp openEmbedding_inr, _⟩
      erw [Set.range_comp, ← eq_compl_iff_isCompl, coe_comp, coe_comp, Set.range_comp _ Sum.inr,
        ← Set.image_compl_eq (homeoOfIso <| h.coconePointUniqueUpToIso
            (binaryCofanIsColimit X Y)).symm.bijective, Set.compl_range_inr, Set.image_comp]
      aesop
    · rintro ⟨h₁, h₂, h₃⟩
      have : ∀ x, x ∈ Set.range c.inl ∨ x ∈ Set.range c.inr := by
        rw [eq_compl_iff_isCompl.mpr h₃.symm]
        exact fun _ => or_not
      refine' ⟨BinaryCofan.IsColimit.mk _ _ _ _ _⟩
      · intro T f g
        refine' ContinuousMap.mk _ _
        · exact fun x =>
            if h : x ∈ Set.range c.inl then f ((Equiv.ofInjective _ h₁.inj).symm ⟨x, h⟩)
            else g ((Equiv.ofInjective _ h₂.inj).symm ⟨x, (this x).resolve_left h⟩)
        rw [continuous_iff_continuousAt]
        intro x
        by_cases h : x ∈ Set.range c.inl
        · revert h x
          apply (IsOpen.continuousOn_iff _).mp
          · 

Proof state:
case pos
J : Type v
inst✝ : SmallCategory J
X Y : TopCat
c : BinaryCofan X Y
h₁ : OpenEmbedding ⇑(BinaryCofan.inl c)
h₂ : OpenEmbedding ⇑(BinaryCofan.inr c)
h₃ : IsCompl (Set.range ⇑(BinaryCofan.inl c)) (Set.range ⇑(BinaryCofan.inr c))
this :
  ∀ (x : (forget TopCat).obj (((Functor.const (Discrete WalkingPair)).obj c.pt).obj { as := WalkingPair.left })),
    x ∈ Set.range ⇑(BinaryCofan.inl c) ∨ x ∈ Set.range ⇑(BinaryCofan.inr c)
T : TopCat
f : X ⟶ T
g : Y ⟶ T
⊢ ContinuousOn
    (fun x =>
      if h : x ∈ Set.range ⇑(BinaryCofan.inl c) then
        f
          ((Equiv.ofInjective ⇑(BinaryCofan.inl c) (_ : Function.Injective ⇑(BinaryCofan.inl c))).symm
            { val := x, property := h })
      else
        g
          ((Equiv.ofInjective ⇑(BinaryCofan.inr c) (_ : Function.Injective ⇑(BinaryCofan.inr c))).symm
            { val := x, property := (_ : x ∈ Set.range ⇑(BinaryCofan.inr c)) }))
    (Set.range ⇑(BinaryCofan.inl c))

Next tactic:
rw [continuousOn_iff_continuous_restrict]