module Cat.Total.Instances.Set {β} whereopen Terminal (Sets-terminal {β}) renaming (top to β
)
open _β£_
open _=>_
open Functor
privateTotal cocompleteness of setsπ
If we are to show that the category of sets is total, we must give a colimit over the category of elements of every presheaf.
Suppose What would a colimit of look like? Let We require a universal function Notice that any element of a set is equivalent to a subobject sending the single element to Furthermore, sends this to a function Thus, setting we have a function from to as desired.
Now, let in the category of elements. Our cocone commutes as, for any as
γ : Functor (PSh β (Sets β)) (Sets β)
γ = eval-at β
has-γ-adj : γ β£ γ (Sets β)
has-γ-adj .unit .Ξ· P .Ξ· X p s = P βͺ (Ξ» _ β s) β« p
has-γ-adj .unit .Ξ· P .is-natural x y f = ext Ξ» r s β sym $ unext (P .F-β _ _) _
has-γ-adj .unit .is-natural F G nt = ext Ξ» X s r β
G βͺ (Ξ» _ β r) β« (nt .Ξ· X s) β‘Λβ¨ unext (nt .is-natural _ _ _) _ β©
(nt .Ξ· β
(F βͺ (Ξ» _ β r) β« s)) β‘Λβ¨ unext (G .F-id) _ β©
G βͺ (Ξ» x β x) β« (nt .Ξ· β
(F βͺ (Ξ» _ β r) β« s)) β
has-γ-adj .counit .Ξ· X s = s _
has-γ-adj .counit .is-natural _ _ _ = refl
has-γ-adj .zig {F} = F .F-id
has-γ-adj .zag = trivial!
Sets-total : is-total (Sets β)
Sets-total .is-total.γ = γ
Sets-total .is-total.has-γ-adj = has-γ-adj