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
          · rw [continuousOn_iff_continuous_restrict]
            convert_to Continuous (f ∘ (Homeomorph.ofEmbedding _ h₁.toEmbedding).symm)
            · ext ⟨x, hx⟩
              exact dif_pos hx
            apply Continuous.comp
            · exact f.continuous_toFun
            · continuity
          · exact h₁.open_range
        · revert h x
          apply (IsOpen.continuousOn_iff _).mp
          · rw [continuousOn_iff_continuous_restrict]
            have : ∀ a, a ∉ Set.range c.inl → a ∈ Set.range c.inr := by
              rintro a (h : a ∈ (Set.range c.inl)ᶜ)
              rwa [eq_compl_iff_isCompl.mpr h₃.symm]
            convert_to Continuous
                (g ∘ (Homeomorph.ofEmbedding _ h₂.toEmbedding).symm ∘ Subtype.map _ this)
            · 

Proof state:
case h.e'_5.h
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
this : ∀ a ∉ Set.range ⇑(BinaryCofan.inl c), a ∈ Set.range ⇑(BinaryCofan.inr c)
e_1✝ : (↑fun a => a ∈ Set.range ⇑(BinaryCofan.inl c) → False) = { a // a ∉ Set.range ⇑(BinaryCofan.inl c) }
e_2✝ : ↑T = (forget TopCat).obj T
⊢ (Set.restrict (fun a => a ∈ Set.range ⇑(BinaryCofan.inl c) → False) 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)) })) =
    ⇑g ∘
      ⇑(Homeomorph.symm (Homeomorph.ofEmbedding ⇑(BinaryCofan.inr c) (_ : Embedding ⇑(BinaryCofan.inr c)))) ∘
        Subtype.map (fun a => a) this

Next tactic:
ext ⟨x, hx⟩