module Cat.Diagram.Colimit.Representable where

Representability of colimitsπŸ”—

Since colimits are defined by universal property, we can also phrase the definition in terms of an equivalence between

Let be some diagram in If has a colimit then that means that maps out of are in bijection with a product of maps subject to some conditions.

  Lim[C[F-,=]] : Functor C (Sets β„“)
  Lim[C[F-,=]] .Fβ‚€ c = el (Dia => Const c) Nat-is-set
  Lim[C[F-,=]] .F₁ f Ξ± = constⁿ f ∘nt Ξ±
  Lim[C[F-,=]] .F-id = ext Ξ» _ _ β†’ C.idl _
  Lim[C[F-,=]] .F-∘ _ _ = ext Ξ» _ _ β†’ sym $ C.assoc _ _ _

  Hom-into-inj
    : βˆ€ {c : C.Ob} (eta : Dia => Const c)
    β†’ Hom-from C c => Lim[C[F-,=]]
  Hom-into-inj eta .η x f = constⁿ f ∘nt eta
  Hom-into-inj eta .is-natural x y f = ext Ξ» g _ β†’
    sym $ C.assoc _ _ _

  represents→is-colimit
    : βˆ€ {c : C.Ob} {eta : Dia => Const c}
    β†’ is-invertibleⁿ (Hom-into-inj eta)
    β†’ is-colimit Dia c eta
  represents→is-colimit {c} {eta} nat-inv = colim where
    module nat-inv = is-invertibleⁿ nat-inv

    colim : is-colimit Dia c eta
    colim .Οƒ {M} Ξ± =
      !constⁿ (nat-inv.inv .η _ (to-coconeⁿ α))
    colim .Οƒ-comm {M} {Ξ±} = ext Ξ» j β†’ unext nat-inv.invl _ _ j
    colim .Οƒ-uniq {M} {Ξ±} {Οƒ'} q = ext Ξ» j β†’
      nat-inv.inv .Ξ· _ (to-coconeⁿ ⌜ Ξ± ⌝)                  β‰‘βŸ¨ ap! q βŸ©β‰‘
      nat-inv.inv .Ξ· _ ⌜ to-coconeⁿ ((Οƒ' β—‚ !F) ∘nt eta) ⌝  β‰‘βŸ¨ ap! trivial! βŸ©β‰‘
      nat-inv.inv .Ξ· _ ((!constⁿ (Οƒ' .Ξ· tt) β—‚ !F) ∘nt eta) β‰‘βŸ¨ unext nat-inv.invr _ _ βŸ©β‰‘
      Οƒ' .Ξ· tt                                             ∎