module Cat.Functor.Adjoint.ConstD {o ℓ} {C : Precategory o ℓ}  where

(Partial) adjoints to the diagonal functor🔗

Suppose that is a free object with respect to and then is a colimit of

const-free→colim : Free-object ConstD F → Colimit F
const-free→colim {F} free-ob = to-colimit $ to-is-colimit $ record where
  open module free = Free-object free-ob
  ψ = unit .η
  universal {x} eta commutes = fold {x} (NT eta λ j k f → commutes f ∙ sym (idl _))

  commutes {j} {k} f = unit .is-natural _ _ f ∙ idl _
  factors {j} eta p = commute {f = NT eta λ x y f → p f ∙ sym (idl _)} ηₚ j
  unique eta p other commutes = unique other $ ext commutes

colim→const-free : Colimit F → Free-object ConstD F
colim→const-free {F} colim = record where
  open module colim = Colimit colim using (coapex; cocone)
  open make-is-colimit (unmake-colimit colim.has-colimit)
  free = coapex
  unit = cocone
  fold eta = universal (eta .η) λ f → eta .is-natural _ _ f ∙ idl _

  commute {x} {nt} = ext λ j → factors (nt .η) λ _ → nt .is-natural _ _ _ ∙ idl _
  unique {x} {nt} g p = unique (nt .η) (λ _ → nt .is-natural _ _ _ ∙ idl _) g
    λ j → p ηₚ  j

const-cofree→lim : Cofree-object ConstD F → Limit F
lim→const-cofree : Limit F → Cofree-object ConstD F

The (co)limit functor🔗

Any functor which is a right (resp: left) colimit to computes as (co)limits.

const-adj→has-colimits-of-shape
  : ∀ {J : Precategory o' ℓ'} {Colim} → Colim ⊣ ConstD {C = C} {J = J}
  → (F : Functor J C) → Colimit F
const-adj→has-colimits-of-shape has-adj =
  const-free→colim ⊙ left-adjoint→free-objects has-adj

const-adj→has-limits-of-shape
  : ∀ {J : Precategory o' ℓ'} {Lim} → ConstD {C = C} {J = J} ⊣ Lim
  → (F : Functor J C) → Limit F
const-adj→has-limits-of-shape has-adj =
  const-cofree→lim ⊙ right-adjoint→cofree-objects has-adj

Thus, any category which has adjoints to its generalized diagonal functor for any is (co)complete.

has-const-adjs→is-cocomplete : ∀ {o' ℓ'} → ({J : Precategory o' ℓ'} → Σ[ Colim ∈ Functor _ C ] Colim ⊣ ConstD {C = C} {J = J}) → is-cocomplete o' ℓ' C
has-const-adjs→is-cocomplete adjs = const-adj→has-colimits-of-shape (adjs .snd)

has-const-adjs→is-complete : ∀ {o' ℓ'} → ({J : Precategory o' ℓ'} → Σ[ Lim ∈ Functor _ C ] ConstD {C = C} {J = J} ⊣ Lim) → is-complete o' ℓ' C
has-const-adjs→is-complete adjs = const-adj→has-limits-of-shape (adjs .snd)

Connected (co)limits of constant diagrams🔗

If is a connected category, then the diagonal functor is fully faithful: all components of a natural transformation between constant diagrams of a connected shape are forced to be the same by naturality.

connected→ConstD-ff
  : is-connected-cat J
  → is-fully-faithful (ConstD {C = C} {J = J})
connected→ConstD-ff {J = J} conn {c} {d} = is-iso→is-equiv record where
  module conn = is-connected-groupoid conn

  go : (α : Const c => Const d) → ∥ ⌞ J ⌟ ∥ → Hom c d
  go α = connected-∥-∥-rec! conn (α .η) λ f →
    sym (idl _) ∙∙ sym (α .is-natural _ _ f) ∙∙ idr _

  from α = go α conn.point
  rinv α = ext λ j → ap (go α) (squash conn.point (inc j))
  linv f = case conn.point return (λ j → go (constⁿ f) j ≡ f) of λ j → refl

By the results above, this implies that the (co)limit of a connected constant diagram at some object is just itself.

connected→constant-limit
  : is-connected-cat J
  → (X : ⌞ C ⌟)
  → is-limit {J = J} {C = C} (Const X) X idnt
connected→constant-limit conn X = generalize-limitp
  (Limit.has-limit (const-cofree→lim
    (ff→cofree-object ConstD (connected→ConstD-ff conn) X)))
  refl

connected→constant-colimit
  : is-connected-cat J
  → (X : ⌞ C ⌟)
  → is-colimit {J = J} {C = C} (Const X) X idnt
connected→constant-colimit conn X = generalize-colimitp
  (Colimit.has-colimit (const-free→colim
    (ff→free-object ConstD (connected→ConstD-ff conn) X)))
  refl