l3lab/ntp-mathlib huggingface dataset:
theorem eqvGen_quot_rel_of_rel (x y : Σ j, F.obj j) :
    FilteredColimit.Rel.{v, u} F x y → EqvGen (Quot.Rel.{v, u} F) x y := fun ⟨k, f, g, h⟩ => by
  refine' EqvGen.trans _ ⟨k, F.map f x.2⟩ _ _ _
  · 

Proof state:
case refine'_1
J : Type v
inst✝ : SmallCategory J
F : J ⥤ TypeMax
x y : (j : J) × F.obj j
x✝ : FilteredColimit.Rel F x y
k : J
f : x.fst ⟶ k
g : y.fst ⟶ k
h : F.map f x.snd = F.map g y.snd
⊢ EqvGen (Quot.Rel F) x { fst := k, snd := F.map f x.snd }

Next tactic:
exact (EqvGen.rel _ _ ⟨f, rfl⟩)
theorem eqvGen_quot_rel_of_rel (x y : Σ j, F.obj j) :
    FilteredColimit.Rel.{v, u} F x y → EqvGen (Quot.Rel.{v, u} F) x y := fun ⟨k, f, g, h⟩ => by
  refine' EqvGen.trans _ ⟨k, F.map f x.2⟩ _ _ _
  · exact (EqvGen.rel _ _ ⟨f, rfl⟩)
  · 

Proof state:
case refine'_2
J : Type v
inst✝ : SmallCategory J
F : J ⥤ TypeMax
x y : (j : J) × F.obj j
x✝ : FilteredColimit.Rel F x y
k : J
f : x.fst ⟶ k
g : y.fst ⟶ k
h : F.map f x.snd = F.map g y.snd
⊢ EqvGen (Quot.Rel F) { fst := k, snd := F.map f x.snd } y

Next tactic:
exact (EqvGen.symm _ _ (EqvGen.rel _ _ ⟨g, h⟩))
/-- Recognizing filtered colimits of types. -/
noncomputable def isColimitOf (t : Cocone F) (hsurj : ∀ x : t.pt, ∃ i xi, x = t.ι.app i xi)
    (hinj :
      ∀ i j xi xj,
        t.ι.app i xi = t.ι.app j xj → ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f xi = F.map g xj) :
    IsColimit t := by
  -- Strategy: Prove that the map from "the" colimit of F (defined above) to t.X
  -- is a bijection.
  

Proof state:
J : Type v
inst✝ : SmallCategory J
F : J ⥤ TypeMax
t : Cocone F
hsurj : ∀ (x : t.pt), ∃ i xi, x = t.ι.app i xi
hinj : ∀ (i j : J) (xi : F.obj i) (xj : F.obj j), t.ι.app i xi = t.ι.app j xj → ∃ k f g, F.map f xi = F.map g xj
⊢ IsColimit t

Next tactic:
apply IsColimit.ofIsoColimit (colimit.isColimit F)
/-- Recognizing filtered colimits of types. -/
noncomputable def isColimitOf (t : Cocone F) (hsurj : ∀ x : t.pt, ∃ i xi, x = t.ι.app i xi)
    (hinj :
      ∀ i j xi xj,
        t.ι.app i xi = t.ι.app j xj → ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f xi = F.map g xj) :
    IsColimit t := by
  -- Strategy: Prove that the map from "the" colimit of F (defined above) to t.X
  -- is a bijection.
  apply IsColimit.ofIsoColimit (colimit.isColimit F)
  

Proof state:
J : Type v
inst✝ : SmallCategory J
F : J ⥤ TypeMax
t : Cocone F
hsurj : ∀ (x : t.pt), ∃ i xi, x = t.ι.app i xi
hinj : ∀ (i j : J) (xi : F.obj i) (xj : F.obj j), t.ι.app i xi = t.ι.app j xj → ∃ k f g, F.map f xi = F.map g xj
⊢ colimit.cocone F ≅ t

Next tactic:
refine' Cocones.ext (Equiv.toIso (Equiv.ofBijective _ _)) _
/-- Recognizing filtered colimits of types. -/
noncomputable def isColimitOf (t : Cocone F) (hsurj : ∀ x : t.pt, ∃ i xi, x = t.ι.app i xi)
    (hinj :
      ∀ i j xi xj,
        t.ι.app i xi = t.ι.app j xj → ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f xi = F.map g xj) :
    IsColimit t := by
  -- Strategy: Prove that the map from "the" colimit of F (defined above) to t.X
  -- is a bijection.
  apply IsColimit.ofIsoColimit (colimit.isColimit F)
  refine' Cocones.ext (Equiv.toIso (Equiv.ofBijective _ _)) _
  · 

Proof state:
case refine'_1
J : Type v
inst✝ : SmallCategory J
F : J ⥤ TypeMax
t : Cocone F
hsurj : ∀ (x : t.pt), ∃ i xi, x = t.ι.app i xi
hinj : ∀ (i j : J) (xi : F.obj i) (xj : F.obj j), t.ι.app i xi = t.ι.app j xj → ∃ k f g, F.map f xi = F.map g xj
⊢ (colimit.cocone F).pt → t.pt

Next tactic:
exact colimit.desc F t
/-- Recognizing filtered colimits of types. -/
noncomputable def isColimitOf (t : Cocone F) (hsurj : ∀ x : t.pt, ∃ i xi, x = t.ι.app i xi)
    (hinj :
      ∀ i j xi xj,
        t.ι.app i xi = t.ι.app j xj → ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f xi = F.map g xj) :
    IsColimit t := by
  -- Strategy: Prove that the map from "the" colimit of F (defined above) to t.X
  -- is a bijection.
  apply IsColimit.ofIsoColimit (colimit.isColimit F)
  refine' Cocones.ext (Equiv.toIso (Equiv.ofBijective _ _)) _
  · exact colimit.desc F t
  · 

Proof state:
case refine'_2
J : Type v
inst✝ : SmallCategory J
F : J ⥤ TypeMax
t : Cocone F
hsurj : ∀ (x : t.pt), ∃ i xi, x = t.ι.app i xi
hinj : ∀ (i j : J) (xi : F.obj i) (xj : F.obj j), t.ι.app i xi = t.ι.app j xj → ∃ k f g, F.map f xi = F.map g xj
⊢ Function.Bijective (colimit.desc F t)

Next tactic:
constructor
/-- Recognizing filtered colimits of types. -/
noncomputable def isColimitOf (t : Cocone F) (hsurj : ∀ x : t.pt, ∃ i xi, x = t.ι.app i xi)
    (hinj :
      ∀ i j xi xj,
        t.ι.app i xi = t.ι.app j xj → ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f xi = F.map g xj) :
    IsColimit t := by
  -- Strategy: Prove that the map from "the" colimit of F (defined above) to t.X
  -- is a bijection.
  apply IsColimit.ofIsoColimit (colimit.isColimit F)
  refine' Cocones.ext (Equiv.toIso (Equiv.ofBijective _ _)) _
  · exact colimit.desc F t
  · constructor
    · 

Proof state:
case refine'_2.left
J : Type v
inst✝ : SmallCategory J
F : J ⥤ TypeMax
t : Cocone F
hsurj : ∀ (x : t.pt), ∃ i xi, x = t.ι.app i xi
hinj : ∀ (i j : J) (xi : F.obj i) (xj : F.obj j), t.ι.app i xi = t.ι.app j xj → ∃ k f g, F.map f xi = F.map g xj
⊢ Function.Injective (colimit.desc F t)

Next tactic:
show Function.Injective _
/-- Recognizing filtered colimits of types. -/
noncomputable def isColimitOf (t : Cocone F) (hsurj : ∀ x : t.pt, ∃ i xi, x = t.ι.app i xi)
    (hinj :
      ∀ i j xi xj,
        t.ι.app i xi = t.ι.app j xj → ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f xi = F.map g xj) :
    IsColimit t := by
  -- Strategy: Prove that the map from "the" colimit of F (defined above) to t.X
  -- is a bijection.
  apply IsColimit.ofIsoColimit (colimit.isColimit F)
  refine' Cocones.ext (Equiv.toIso (Equiv.ofBijective _ _)) _
  · exact colimit.desc F t
  · constructor
    · show Function.Injective _
      

Proof state:
case refine'_2.left
J : Type v
inst✝ : SmallCategory J
F : J ⥤ TypeMax
t : Cocone F
hsurj : ∀ (x : t.pt), ∃ i xi, x = t.ι.app i xi
hinj : ∀ (i j : J) (xi : F.obj i) (xj : F.obj j), t.ι.app i xi = t.ι.app j xj → ∃ k f g, F.map f xi = F.map g xj
⊢ Function.Injective (colimit.desc F t)

Next tactic:
intro a b h
/-- Recognizing filtered colimits of types. -/
noncomputable def isColimitOf (t : Cocone F) (hsurj : ∀ x : t.pt, ∃ i xi, x = t.ι.app i xi)
    (hinj :
      ∀ i j xi xj,
        t.ι.app i xi = t.ι.app j xj → ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f xi = F.map g xj) :
    IsColimit t := by
  -- Strategy: Prove that the map from "the" colimit of F (defined above) to t.X
  -- is a bijection.
  apply IsColimit.ofIsoColimit (colimit.isColimit F)
  refine' Cocones.ext (Equiv.toIso (Equiv.ofBijective _ _)) _
  · exact colimit.desc F t
  · constructor
    · show Function.Injective _
      intro a b h
      

Proof state:
case refine'_2.left
J : Type v
inst✝ : SmallCategory J
F : J ⥤ TypeMax
t : Cocone F
hsurj : ∀ (x : t.pt), ∃ i xi, x = t.ι.app i xi
hinj : ∀ (i j : J) (xi : F.obj i) (xj : F.obj j), t.ι.app i xi = t.ι.app j xj → ∃ k f g, F.map f xi = F.map g xj
a b : (colimit.cocone F).pt
h : colimit.desc F t a = colimit.desc F t b
⊢ a = b

Next tactic:
rcases jointly_surjective.{v, u} F (colimit.isColimit F) a with ⟨i, xi, rfl⟩
/-- Recognizing filtered colimits of types. -/
noncomputable def isColimitOf (t : Cocone F) (hsurj : ∀ x : t.pt, ∃ i xi, x = t.ι.app i xi)
    (hinj :
      ∀ i j xi xj,
        t.ι.app i xi = t.ι.app j xj → ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f xi = F.map g xj) :
    IsColimit t := by
  -- Strategy: Prove that the map from "the" colimit of F (defined above) to t.X
  -- is a bijection.
  apply IsColimit.ofIsoColimit (colimit.isColimit F)
  refine' Cocones.ext (Equiv.toIso (Equiv.ofBijective _ _)) _
  · exact colimit.desc F t
  · constructor
    · show Function.Injective _
      intro a b h
      rcases jointly_surjective.{v, u} F (colimit.isColimit F) a with ⟨i, xi, rfl⟩
      

Proof state:
case refine'_2.left.intro.intro
J : Type v
inst✝ : SmallCategory J
F : J ⥤ TypeMax
t : Cocone F
hsurj : ∀ (x : t.pt), ∃ i xi, x = t.ι.app i xi
hinj : ∀ (i j : J) (xi : F.obj i) (xj : F.obj j), t.ι.app i xi = t.ι.app j xj → ∃ k f g, F.map f xi = F.map g xj
b : (colimit.cocone F).pt
i : J
xi : F.obj i
h : colimit.desc F t ((colimit.cocone F).ι.app i xi) = colimit.desc F t b
⊢ (colimit.cocone F).ι.app i xi = b

Next tactic:
rcases jointly_surjective.{v, u} F (colimit.isColimit F) b with ⟨j, xj, rfl⟩
/-- Recognizing filtered colimits of types. -/
noncomputable def isColimitOf (t : Cocone F) (hsurj : ∀ x : t.pt, ∃ i xi, x = t.ι.app i xi)
    (hinj :
      ∀ i j xi xj,
        t.ι.app i xi = t.ι.app j xj → ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f xi = F.map g xj) :
    IsColimit t := by
  -- Strategy: Prove that the map from "the" colimit of F (defined above) to t.X
  -- is a bijection.
  apply IsColimit.ofIsoColimit (colimit.isColimit F)
  refine' Cocones.ext (Equiv.toIso (Equiv.ofBijective _ _)) _
  · exact colimit.desc F t
  · constructor
    · show Function.Injective _
      intro a b h
      rcases jointly_surjective.{v, u} F (colimit.isColimit F) a with ⟨i, xi, rfl⟩
      rcases jointly_surjective.{v, u} F (colimit.isColimit F) b with ⟨j, xj, rfl⟩
      

Proof state:
case refine'_2.left.intro.intro.intro.intro
J : Type v
inst✝ : SmallCategory J
F : J ⥤ TypeMax
t : Cocone F
hsurj : ∀ (x : t.pt), ∃ i xi, x = t.ι.app i xi
hinj : ∀ (i j : J) (xi : F.obj i) (xj : F.obj j), t.ι.app i xi = t.ι.app j xj → ∃ k f g, F.map f xi = F.map g xj
i : J
xi : F.obj i
j : J
xj : F.obj j
h : colimit.desc F t ((colimit.cocone F).ι.app i xi) = colimit.desc F t ((colimit.cocone F).ι.app j xj)
⊢ (colimit.cocone F).ι.app i xi = (colimit.cocone F).ι.app j xj

Next tactic:
replace h : (colimit.ι F i ≫ colimit.desc F t) xi = (colimit.ι F j ≫ colimit.desc F t) xj := h
/-- Recognizing filtered colimits of types. -/
noncomputable def isColimitOf (t : Cocone F) (hsurj : ∀ x : t.pt, ∃ i xi, x = t.ι.app i xi)
    (hinj :
      ∀ i j xi xj,
        t.ι.app i xi = t.ι.app j xj → ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f xi = F.map g xj) :
    IsColimit t := by
  -- Strategy: Prove that the map from "the" colimit of F (defined above) to t.X
  -- is a bijection.
  apply IsColimit.ofIsoColimit (colimit.isColimit F)
  refine' Cocones.ext (Equiv.toIso (Equiv.ofBijective _ _)) _
  · exact colimit.desc F t
  · constructor
    · show Function.Injective _
      intro a b h
      rcases jointly_surjective.{v, u} F (colimit.isColimit F) a with ⟨i, xi, rfl⟩
      rcases jointly_surjective.{v, u} F (colimit.isColimit F) b with ⟨j, xj, rfl⟩
      replace h : (colimit.ι F i ≫ colimit.desc F t) xi = (colimit.ι F j ≫ colimit.desc F t) xj := h
      

Proof state:
case refine'_2.left.intro.intro.intro.intro
J : Type v
inst✝ : SmallCategory J
F : J ⥤ TypeMax
t : Cocone F
hsurj : ∀ (x : t.pt), ∃ i xi, x = t.ι.app i xi
hinj : ∀ (i j : J) (xi : F.obj i) (xj : F.obj j), t.ι.app i xi = t.ι.app j xj → ∃ k f g, F.map f xi = F.map g xj
i : J
xi : F.obj i
j : J
xj : F.obj j
h : (colimit.ι F i ≫ colimit.desc F t) xi = (colimit.ι F j ≫ colimit.desc F t) xj
⊢ (colimit.cocone F).ι.app i xi = (colimit.cocone F).ι.app j xj

Next tactic:
rw [colimit.ι_desc, colimit.ι_desc] at h
/-- Recognizing filtered colimits of types. -/
noncomputable def isColimitOf (t : Cocone F) (hsurj : ∀ x : t.pt, ∃ i xi, x = t.ι.app i xi)
    (hinj :
      ∀ i j xi xj,
        t.ι.app i xi = t.ι.app j xj → ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f xi = F.map g xj) :
    IsColimit t := by
  -- Strategy: Prove that the map from "the" colimit of F (defined above) to t.X
  -- is a bijection.
  apply IsColimit.ofIsoColimit (colimit.isColimit F)
  refine' Cocones.ext (Equiv.toIso (Equiv.ofBijective _ _)) _
  · exact colimit.desc F t
  · constructor
    · show Function.Injective _
      intro a b h
      rcases jointly_surjective.{v, u} F (colimit.isColimit F) a with ⟨i, xi, rfl⟩
      rcases jointly_surjective.{v, u} F (colimit.isColimit F) b with ⟨j, xj, rfl⟩
      replace h : (colimit.ι F i ≫ colimit.desc F t) xi = (colimit.ι F j ≫ colimit.desc F t) xj := h
      rw [colimit.ι_desc, colimit.ι_desc] at h
      

Proof state:
case refine'_2.left.intro.intro.intro.intro
J : Type v
inst✝ : SmallCategory J
F : J ⥤ TypeMax
t : Cocone F
hsurj : ∀ (x : t.pt), ∃ i xi, x = t.ι.app i xi
hinj : ∀ (i j : J) (xi : F.obj i) (xj : F.obj j), t.ι.app i xi = t.ι.app j xj → ∃ k f g, F.map f xi = F.map g xj
i : J
xi : F.obj i
j : J
xj : F.obj j
h : t.ι.app i xi = t.ι.app j xj
⊢ (colimit.cocone F).ι.app i xi = (colimit.cocone F).ι.app j xj

Next tactic:
rcases hinj i j xi xj h with ⟨k, f, g, h'⟩
/-- Recognizing filtered colimits of types. -/
noncomputable def isColimitOf (t : Cocone F) (hsurj : ∀ x : t.pt, ∃ i xi, x = t.ι.app i xi)
    (hinj :
      ∀ i j xi xj,
        t.ι.app i xi = t.ι.app j xj → ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f xi = F.map g xj) :
    IsColimit t := by
  -- Strategy: Prove that the map from "the" colimit of F (defined above) to t.X
  -- is a bijection.
  apply IsColimit.ofIsoColimit (colimit.isColimit F)
  refine' Cocones.ext (Equiv.toIso (Equiv.ofBijective _ _)) _
  · exact colimit.desc F t
  · constructor
    · show Function.Injective _
      intro a b h
      rcases jointly_surjective.{v, u} F (colimit.isColimit F) a with ⟨i, xi, rfl⟩
      rcases jointly_surjective.{v, u} F (colimit.isColimit F) b with ⟨j, xj, rfl⟩
      replace h : (colimit.ι F i ≫ colimit.desc F t) xi = (colimit.ι F j ≫ colimit.desc F t) xj := h
      rw [colimit.ι_desc, colimit.ι_desc] at h
      rcases hinj i j xi xj h with ⟨k, f, g, h'⟩
      

Proof state:
case refine'_2.left.intro.intro.intro.intro.intro.intro.intro
J : Type v
inst✝ : SmallCategory J
F : J ⥤ TypeMax
t : Cocone F
hsurj : ∀ (x : t.pt), ∃ i xi, x = t.ι.app i xi
hinj : ∀ (i j : J) (xi : F.obj i) (xj : F.obj j), t.ι.app i xi = t.ι.app j xj → ∃ k f g, F.map f xi = F.map g xj
i : J
xi : F.obj i
j : J
xj : F.obj j
h : t.ι.app i xi = t.ι.app j xj
k : J
f : i ⟶ k
g : j ⟶ k
h' : F.map f xi = F.map g xj
⊢ (colimit.cocone F).ι.app i xi = (colimit.cocone F).ι.app j xj

Next tactic:
change colimit.ι F i xi = colimit.ι F j xj
/-- Recognizing filtered colimits of types. -/
noncomputable def isColimitOf (t : Cocone F) (hsurj : ∀ x : t.pt, ∃ i xi, x = t.ι.app i xi)
    (hinj :
      ∀ i j xi xj,
        t.ι.app i xi = t.ι.app j xj → ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f xi = F.map g xj) :
    IsColimit t := by
  -- Strategy: Prove that the map from "the" colimit of F (defined above) to t.X
  -- is a bijection.
  apply IsColimit.ofIsoColimit (colimit.isColimit F)
  refine' Cocones.ext (Equiv.toIso (Equiv.ofBijective _ _)) _
  · exact colimit.desc F t
  · constructor
    · show Function.Injective _
      intro a b h
      rcases jointly_surjective.{v, u} F (colimit.isColimit F) a with ⟨i, xi, rfl⟩
      rcases jointly_surjective.{v, u} F (colimit.isColimit F) b with ⟨j, xj, rfl⟩
      replace h : (colimit.ι F i ≫ colimit.desc F t) xi = (colimit.ι F j ≫ colimit.desc F t) xj := h
      rw [colimit.ι_desc, colimit.ι_desc] at h
      rcases hinj i j xi xj h with ⟨k, f, g, h'⟩
      change colimit.ι F i xi = colimit.ι F j xj
      

Proof state:
case refine'_2.left.intro.intro.intro.intro.intro.intro.intro
J : Type v
inst✝ : SmallCategory J
F : J ⥤ TypeMax
t : Cocone F
hsurj : ∀ (x : t.pt), ∃ i xi, x = t.ι.app i xi
hinj : ∀ (i j : J) (xi : F.obj i) (xj : F.obj j), t.ι.app i xi = t.ι.app j xj → ∃ k f g, F.map f xi = F.map g xj
i : J
xi : F.obj i
j : J
xj : F.obj j
h : t.ι.app i xi = t.ι.app j xj
k : J
f : i ⟶ k
g : j ⟶ k
h' : F.map f xi = F.map g xj
⊢ colimit.ι F i xi = colimit.ι F j xj

Next tactic:
rw [← colimit.w F f, ← colimit.w F g]
/-- Recognizing filtered colimits of types. -/
noncomputable def isColimitOf (t : Cocone F) (hsurj : ∀ x : t.pt, ∃ i xi, x = t.ι.app i xi)
    (hinj :
      ∀ i j xi xj,
        t.ι.app i xi = t.ι.app j xj → ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f xi = F.map g xj) :
    IsColimit t := by
  -- Strategy: Prove that the map from "the" colimit of F (defined above) to t.X
  -- is a bijection.
  apply IsColimit.ofIsoColimit (colimit.isColimit F)
  refine' Cocones.ext (Equiv.toIso (Equiv.ofBijective _ _)) _
  · exact colimit.desc F t
  · constructor
    · show Function.Injective _
      intro a b h
      rcases jointly_surjective.{v, u} F (colimit.isColimit F) a with ⟨i, xi, rfl⟩
      rcases jointly_surjective.{v, u} F (colimit.isColimit F) b with ⟨j, xj, rfl⟩
      replace h : (colimit.ι F i ≫ colimit.desc F t) xi = (colimit.ι F j ≫ colimit.desc F t) xj := h
      rw [colimit.ι_desc, colimit.ι_desc] at h
      rcases hinj i j xi xj h with ⟨k, f, g, h'⟩
      change colimit.ι F i xi = colimit.ι F j xj
      rw [← colimit.w F f, ← colimit.w F g]
      

Proof state:
case refine'_2.left.intro.intro.intro.intro.intro.intro.intro
J : Type v
inst✝ : SmallCategory J
F : J ⥤ TypeMax
t : Cocone F
hsurj : ∀ (x : t.pt), ∃ i xi, x = t.ι.app i xi
hinj : ∀ (i j : J) (xi : F.obj i) (xj : F.obj j), t.ι.app i xi = t.ι.app j xj → ∃ k f g, F.map f xi = F.map g xj
i : J
xi : F.obj i
j : J
xj : F.obj j
h : t.ι.app i xi = t.ι.app j xj
k : J
f : i ⟶ k
g : j ⟶ k
h' : F.map f xi = F.map g xj
⊢ (F.map f ≫ colimit.ι F k) xi = (F.map g ≫ colimit.ι F k) xj

Next tactic:
change colimit.ι F k (F.map f xi) = colimit.ι F k (F.map g xj)
/-- Recognizing filtered colimits of types. -/
noncomputable def isColimitOf (t : Cocone F) (hsurj : ∀ x : t.pt, ∃ i xi, x = t.ι.app i xi)
    (hinj :
      ∀ i j xi xj,
        t.ι.app i xi = t.ι.app j xj → ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f xi = F.map g xj) :
    IsColimit t := by
  -- Strategy: Prove that the map from "the" colimit of F (defined above) to t.X
  -- is a bijection.
  apply IsColimit.ofIsoColimit (colimit.isColimit F)
  refine' Cocones.ext (Equiv.toIso (Equiv.ofBijective _ _)) _
  · exact colimit.desc F t
  · constructor
    · show Function.Injective _
      intro a b h
      rcases jointly_surjective.{v, u} F (colimit.isColimit F) a with ⟨i, xi, rfl⟩
      rcases jointly_surjective.{v, u} F (colimit.isColimit F) b with ⟨j, xj, rfl⟩
      replace h : (colimit.ι F i ≫ colimit.desc F t) xi = (colimit.ι F j ≫ colimit.desc F t) xj := h
      rw [colimit.ι_desc, colimit.ι_desc] at h
      rcases hinj i j xi xj h with ⟨k, f, g, h'⟩
      change colimit.ι F i xi = colimit.ι F j xj
      rw [← colimit.w F f, ← colimit.w F g]
      change colimit.ι F k (F.map f xi) = colimit.ι F k (F.map g xj)
      

Proof state:
case refine'_2.left.intro.intro.intro.intro.intro.intro.intro
J : Type v
inst✝ : SmallCategory J
F : J ⥤ TypeMax
t : Cocone F
hsurj : ∀ (x : t.pt), ∃ i xi, x = t.ι.app i xi
hinj : ∀ (i j : J) (xi : F.obj i) (xj : F.obj j), t.ι.app i xi = t.ι.app j xj → ∃ k f g, F.map f xi = F.map g xj
i : J
xi : F.obj i
j : J
xj : F.obj j
h : t.ι.app i xi = t.ι.app j xj
k : J
f : i ⟶ k
g : j ⟶ k
h' : F.map f xi = F.map g xj
⊢ colimit.ι F k (F.map f xi) = colimit.ι F k (F.map g xj)

Next tactic:
rw [h']
/-- Recognizing filtered colimits of types. -/
noncomputable def isColimitOf (t : Cocone F) (hsurj : ∀ x : t.pt, ∃ i xi, x = t.ι.app i xi)
    (hinj :
      ∀ i j xi xj,
        t.ι.app i xi = t.ι.app j xj → ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f xi = F.map g xj) :
    IsColimit t := by
  -- Strategy: Prove that the map from "the" colimit of F (defined above) to t.X
  -- is a bijection.
  apply IsColimit.ofIsoColimit (colimit.isColimit F)
  refine' Cocones.ext (Equiv.toIso (Equiv.ofBijective _ _)) _
  · exact colimit.desc F t
  · constructor
    · show Function.Injective _
      intro a b h
      rcases jointly_surjective.{v, u} F (colimit.isColimit F) a with ⟨i, xi, rfl⟩
      rcases jointly_surjective.{v, u} F (colimit.isColimit F) b with ⟨j, xj, rfl⟩
      replace h : (colimit.ι F i ≫ colimit.desc F t) xi = (colimit.ι F j ≫ colimit.desc F t) xj := h
      rw [colimit.ι_desc, colimit.ι_desc] at h
      rcases hinj i j xi xj h with ⟨k, f, g, h'⟩
      change colimit.ι F i xi = colimit.ι F j xj
      rw [← colimit.w F f, ← colimit.w F g]
      change colimit.ι F k (F.map f xi) = colimit.ι F k (F.map g xj)
      rw [h']
    · 

Proof state:
case refine'_2.right
J : Type v
inst✝ : SmallCategory J
F : J ⥤ TypeMax
t : Cocone F
hsurj : ∀ (x : t.pt), ∃ i xi, x = t.ι.app i xi
hinj : ∀ (i j : J) (xi : F.obj i) (xj : F.obj j), t.ι.app i xi = t.ι.app j xj → ∃ k f g, F.map f xi = F.map g xj
⊢ Function.Surjective (colimit.desc F t)

Next tactic:
show Function.Surjective _
/-- Recognizing filtered colimits of types. -/
noncomputable def isColimitOf (t : Cocone F) (hsurj : ∀ x : t.pt, ∃ i xi, x = t.ι.app i xi)
    (hinj :
      ∀ i j xi xj,
        t.ι.app i xi = t.ι.app j xj → ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f xi = F.map g xj) :
    IsColimit t := by
  -- Strategy: Prove that the map from "the" colimit of F (defined above) to t.X
  -- is a bijection.
  apply IsColimit.ofIsoColimit (colimit.isColimit F)
  refine' Cocones.ext (Equiv.toIso (Equiv.ofBijective _ _)) _
  · exact colimit.desc F t
  · constructor
    · show Function.Injective _
      intro a b h
      rcases jointly_surjective.{v, u} F (colimit.isColimit F) a with ⟨i, xi, rfl⟩
      rcases jointly_surjective.{v, u} F (colimit.isColimit F) b with ⟨j, xj, rfl⟩
      replace h : (colimit.ι F i ≫ colimit.desc F t) xi = (colimit.ι F j ≫ colimit.desc F t) xj := h
      rw [colimit.ι_desc, colimit.ι_desc] at h
      rcases hinj i j xi xj h with ⟨k, f, g, h'⟩
      change colimit.ι F i xi = colimit.ι F j xj
      rw [← colimit.w F f, ← colimit.w F g]
      change colimit.ι F k (F.map f xi) = colimit.ι F k (F.map g xj)
      rw [h']
    · show Function.Surjective _
      

Proof state:
case refine'_2.right
J : Type v
inst✝ : SmallCategory J
F : J ⥤ TypeMax
t : Cocone F
hsurj : ∀ (x : t.pt), ∃ i xi, x = t.ι.app i xi
hinj : ∀ (i j : J) (xi : F.obj i) (xj : F.obj j), t.ι.app i xi = t.ι.app j xj → ∃ k f g, F.map f xi = F.map g xj
⊢ Function.Surjective (colimit.desc F t)

Next tactic:
intro x
/-- Recognizing filtered colimits of types. -/
noncomputable def isColimitOf (t : Cocone F) (hsurj : ∀ x : t.pt, ∃ i xi, x = t.ι.app i xi)
    (hinj :
      ∀ i j xi xj,
        t.ι.app i xi = t.ι.app j xj → ∃ (k : _) (f : i ⟶ k) (g : j ⟶ k), F.map f xi = F.map g xj) :
    IsColimit t := by
  -- Strategy: Prove that the map from "the" colimit of F (defined above) to t.X
  -- is a bijection.
  apply IsColimit.ofIsoColimit (colimit.isColimit F)
  refine' Cocones.ext (Equiv.toIso (Equiv.ofBijective _ _)) _
  · exact colimit.desc F t
  · constructor
    · show Function.Injective _
      intro a b h
      rcases jointly_surjective.{v, u} F (colimit.isColimit F) a with ⟨i, xi, rfl⟩
      rcases jointly_surjective.{v, u} F (colimit.isColimit F) b with ⟨j, xj, rfl⟩
      replace h : (colimit.ι F i ≫ colimit.desc F t) xi = (colimit.ι F j ≫ colimit.desc F t) xj := h
      rw [colimit.ι_desc, colimit.ι_desc] at h
      rcases hinj i j xi xj h with ⟨k, f, g, h'⟩
      change colimit.ι F i xi = colimit.ι F j xj
      rw [← colimit.w F f, ← colimit.w F g]
      change colimit.ι F k (F.map f xi) = colimit.ι F k (F.map g xj)
      rw [h']
    · show Function.Surjective _
      intro x
      

Proof state:
case refine'_2.right
J : Type v
inst✝ : SmallCategory J
F : J ⥤ TypeMax
t : Cocone F
hsurj : ∀ (x : t.pt), ∃ i xi, x = t.ι.app i xi
hinj : ∀ (i j : J) (xi : F.obj i) (xj : F.obj j), t.ι.app i xi = t.ι.app j xj → ∃ k f g, F.map f xi = F.map g xj
x : t.pt
⊢ ∃ a, colimit.desc F t a = x

Next tactic:
rcases hsurj x with ⟨i, xi, rfl⟩