Lean4
/-- Given a functor `F` and a collection of colimit cocones for each diagram `X ↦ F X k`, we can stitch
them together to give a cocone for the diagram `F`.
`combinedIsColimit` shows that the new cocone is colimiting, and `evalCombined` shows it is
(essentially) made up of the original cocones.
-/
@[simps]
def combineCocones (F : J ⥤ K ⥤ C) (c : ∀ k : K, ColimitCocone (F.flip.obj k)) : Cocone F
where
pt :=
{ obj := fun k => (c k).cocone.pt
map := fun {k₁} {k₂} f => (c k₁).isColimit.desc ⟨_, F.flip.map f ≫ (c k₂).cocone.ι⟩
map_id := fun k => (c k).isColimit.hom_ext fun j => by simp
map_comp := fun {k₁} {k₂} {k₃} f₁ f₂ => (c k₁).isColimit.hom_ext fun j => by simp }
ι :=
{ app := fun j => { app := fun k => (c k).cocone.ι.app j }
naturality := fun j₁ j₂ g => by ext k; exact (c k).cocone.ι.naturality g }