/-- (Implementation) An auxiliary lemma for the proof that `TopCat` is finitary extensive. -/
-- Porting note : needs to add noncomputable modifier
noncomputable def finitaryExtensiveTopCatAux (Z : TopCat.{u})
    (f : Z ⟶ TopCat.of (Sum PUnit.{u + 1} PUnit.{u + 1})) :
    IsColimit (BinaryCofan.mk
      (TopCat.pullbackFst f (TopCat.binaryCofan (TopCat.of PUnit) (TopCat.of PUnit)).inl)
      (TopCat.pullbackFst f (TopCat.binaryCofan (TopCat.of PUnit) (TopCat.of PUnit)).inr)) := by
  have : ∀ x, f x = Sum.inl PUnit.unit ∨ f x = Sum.inr PUnit.unit := by
    intro x
    rcases f x with (⟨⟨⟩⟩ | ⟨⟨⟩⟩)
    exacts [Or.inl rfl, Or.inr rfl]
  letI eX : { p : Z × PUnit // f p.fst = Sum.inl p.snd } ≃ { x : Z // f x = Sum.inl PUnit.unit } :=
    ⟨fun p => ⟨p.1.1, p.2.trans (congr_arg Sum.inl <| Subsingleton.elim _ _)⟩,
      fun x => ⟨⟨_, PUnit.unit⟩, x.2⟩, fun _ => by ext; rfl, fun _ => by ext; rfl⟩
  letI eY : { p : Z × PUnit // f p.fst = Sum.inr p.snd } ≃ { x : Z // f x = Sum.inr PUnit.unit } :=
    ⟨fun p => ⟨p.1.1, p.2.trans (congr_arg Sum.inr <| Subsingleton.elim _ _)⟩,
      fun x => ⟨⟨_, PUnit.unit⟩, x.2⟩, fun _ => by ext; rfl, fun _ => by ext; rfl⟩
  fapply BinaryCofan.isColimitMk
  classical -- Porting note: Added
  · refine' fun s => ⟨fun x => dite _
      (fun h => s.inl <| eX.symm ⟨x, h⟩) fun h => s.inr <| eY.symm ⟨x, (this x).resolve_left h⟩, _⟩
    rw [continuous_iff_continuousAt]
    intro x
    by_cases h : f x = Sum.inl PUnit.unit
    · revert h x
      apply (IsOpen.continuousOn_iff _).mp
      · rw [continuousOn_iff_continuous_restrict]
        convert_to Continuous fun x : { x | f x = Sum.inl PUnit.unit } =>
            s.inl ⟨(x.1, PUnit.unit), x.2⟩
        · ext ⟨x, hx⟩
          exact dif_pos hx
        -- Porting note : this `(BinaryCofan.inl s).2` was unnecessary
        have := (BinaryCofan.inl s).2
        continuity
      · convert f.2.1 _ openEmbedding_inl.open_range
        rename_i x
        exact ⟨fun h => ⟨_, h.symm⟩,
          fun ⟨e, h⟩ => h.symm.trans (congr_arg Sum.inl <| Subsingleton.elim _ _)⟩
    · revert h x
      apply (IsOpen.continuousOn_iff _).mp
      · rw [continuousOn_iff_continuous_restrict]
        convert_to Continuous fun x : { x | f x ≠ Sum.inl PUnit.unit } =>
            s.inr ⟨(x.1, PUnit.unit), (this _).resolve_left x.2⟩
        · 

Proof state:
case h.e'_5.h
J : Type v'
inst✝² : Category.{u', v'} J
C : Type u
inst✝¹ : Category.{v, u} C
D : Type u''
inst✝ : Category.{v'', u''} D
X Y : C
Z : TopCat
f : Z ⟶ TopCat.of (PUnit.{u + 1} ⊕ PUnit.{u + 1})
this : ∀ (x : (forget TopCat).obj Z), f x = Sum.inl PUnit.unit ∨ f x = Sum.inr PUnit.unit
eX : { p // f p.1 = Sum.inl p.2 } ≃ { x // f x = Sum.inl PUnit.unit } :=
  { toFun := fun p => { val := (↑p).1, property := (_ : f (↑p).1 = Sum.inl PUnit.unit) },
    invFun := fun x => { val := (x.1, PUnit.unit), property := (_ : f ↑x = Sum.inl PUnit.unit) },
    left_inv :=
      (_ :
        ∀ (x : { p // f p.1 = Sum.inl p.2 }),
          (fun x => { val := (x.1, PUnit.unit), property := (_ : f ↑x = Sum.inl PUnit.unit) })
              ((fun p => { val := (↑p).1, property := (_ : f (↑p).1 = Sum.inl PUnit.unit) }) x) =
            x),
    right_inv :=
      (_ :
        ∀ (x : { x // f x = Sum.inl PUnit.unit }),
          (fun p => { val := (↑p).1, property := (_ : f (↑p).1 = Sum.inl PUnit.unit) })
              ((fun x => { val := (x.1, PUnit.unit), property := (_ : f ↑x = Sum.inl PUnit.unit) }) x) =
            x) }
eY : { p // f p.1 = Sum.inr p.2 } ≃ { x // f x = Sum.inr PUnit.unit } :=
  { toFun := fun p => { val := (↑p).1, property := (_ : f (↑p).1 = Sum.inr PUnit.unit) },
    invFun := fun x => { val := (x.1, PUnit.unit), property := (_ : f ↑x = Sum.inr PUnit.unit) },
    left_inv :=
      (_ :
        ∀ (x : { p // f p.1 = Sum.inr p.2 }),
          (fun x => { val := (x.1, PUnit.unit), property := (_ : f ↑x = Sum.inr PUnit.unit) })
              ((fun p => { val := (↑p).1, property := (_ : f (↑p).1 = Sum.inr PUnit.unit) }) x) =
            x),
    right_inv :=
      (_ :
        ∀ (x : { x // f x = Sum.inr PUnit.unit }),
          (fun p => { val := (↑p).1, property := (_ : f (↑p).1 = Sum.inr PUnit.unit) })
              ((fun x => { val := (x.1, PUnit.unit), property := (_ : f ↑x = Sum.inr PUnit.unit) }) x) =
            x) }
s :
  BinaryCofan
    (TopCat.of
      { p // f p.1 = (BinaryCofan.inl (TopCat.binaryCofan (TopCat.of PUnit.{u + 1}) (TopCat.of PUnit.{u + 1}))) p.2 })
    (TopCat.of
      { p // f p.1 = (BinaryCofan.inr (TopCat.binaryCofan (TopCat.of PUnit.{u + 1}) (TopCat.of PUnit.{u + 1}))) p.2 })
e_1✝ : (↑fun a => f a = Sum.inl PUnit.unit → False) = ↑{x | f x ≠ Sum.inl PUnit.unit}
e_2✝ : ↑s.pt = (forget TopCat).obj (((Functor.const (Discrete WalkingPair)).obj s.pt).obj { as := WalkingPair.right })
⊢ (Set.restrict (fun a => f a = Sum.inl PUnit.unit → False) fun x =>
      if h : f x = Sum.inl PUnit.unit then (BinaryCofan.inl s) (eX.symm { val := x, property := h })
      else (BinaryCofan.inr s) (eY.symm { val := x, property := (_ : f x = Sum.inr PUnit.unit) })) =
    fun x =>
    (BinaryCofan.inr s) { val := (↑x, PUnit.unit), property := (_ : f (↑x, PUnit.unit).1 = Sum.inr PUnit.unit) }

Next tactic:
ext ⟨x, hx⟩