module Cat.Total {o β„“} (C : Precategory o β„“) where
open import Cat.Functor.Hom C

Total precategoriesπŸ”—

A precategory is total if its Yoneda embedding has a left adjoint. We call this adjoint さ(sa), a reading for ε·¦, which means β€œleft”.

record is-total : Type (o βŠ” lsuc β„“) where
  field
    {さ} : Functor Cat[ C ^op , Sets β„“ ] C
    has-γ‚ˆ-adj : さ ⊣ γ‚ˆ
  open module さ = Cat.Functor.Reasoning さ using () renaming
    (Fβ‚€ to さ₀; F₁ to さ₁) public

MotivationπŸ”—

Total categories represent a particularly nice site in which to do logic, as they are a reflective subcategory of their category of presheaves. In particular, total categories are cocomplete with many useful limits. However, a category being total is a slightly weaker requirement than a category being a topos, as all topoi are both total and cototal.

Free objects relative to γ‚ˆπŸ”—

Before we investigate the properties of a total category, it’s worth considering the action of such a functor on objects, if it exists. Given some presheaf an object could be if it is free with respect to

Since is a presheaf, it can be written as a colimit of representable functors by the coyoneda lemma.

    F-is-colimit : is-colimit (γ‚ˆ F∘ Ο€β‚š C F) F _
    F-is-colimit = coyoneda _ F

As left adjoints preserve colimits, we can imagine that a partial left adjoint (a free object) of a colimit should also be a colimit. Indeed this is true as is fully faithful.

We call a free object with respect to a realising object for

  free-is-colimit : is-colimit (Ο€β‚š C F) free _
  free-is-colimit =
    free-objectβ†’is-colimit γ‚ˆ γ‚ˆ-is-fully-faithful (to-colimit F-is-colimit) c

さ on valuesπŸ”—

For each yields a free value on relative to As we have proved, this is a colimit.

  さ₀-is-colimit : (F : ⌞ PSh β„“ C ⌟) β†’ is-colimit (Ο€β‚š C F) (さ₀ F) _
  さ₀-is-colimit F = free-is-colimit F $ left-adjointβ†’free-objects has-γ‚ˆ-adj F

CocompletenessπŸ”—

Thus, all total categories are cocomplete as their colimits can be computed in

  cocomplete : is-cocomplete β„“ β„“ C
  cocomplete F = natural-isoβ†’colimit γ•βˆ˜γ‚ˆβˆ˜F≅ⁿF
    $ left-adjoint-colimit has-γ‚ˆ-adj
    $ PSh-cocomplete β„“ C (γ‚ˆ F∘ F)

Terminal objectπŸ”—

Total categories also have many limits. For example, the terminal presheaf has a realisation in Furthermore, the projection functor from the category of elements of the terminal presheaf is an equivalence. A colimit of an equivalence is equivalent to a colimit of the identityβ€”i.e., a terminal object.

  β˜… : C.Ob
  β˜… = さ.β‚€ (⊀PSh _ _)

  private
    β˜…-is-colimit-id : is-colimit (Id {C = C}) β˜… _
    β˜…-is-colimit-id =
      extend-is-colimit _
        (right-adjoint-is-final (elements-terminal-is-equivalence.F⁻¹⊣F {s = β„“})) _
        col'
      where
        open is-equivalence
        col : is-colimit (Ο€β‚š C $ ⊀PSh _ _) β˜… _
        col = さ₀-is-colimit _

        col' : is-colimit (Id F∘ Ο€β‚š C (⊀PSh _ _)) β˜… _
        col' = natural-iso-ext→is-lan
          (left-adjoint-is-cocontinuous (Id-is-equivalence .F⊣F⁻¹) col)
          (!const-isoⁿ id-iso)

  total-terminal : Terminal C
  total-terminal = Id-colimitβ†’Terminal $ to-colimit β˜…-is-colimit-id
  module total-terminal = Terminal total-terminal

CopowersπŸ”—

As C is cocomplete, it has all set-indexed coproducts and is thus copowered.
  open Cat.Diagram.Colimit.Coproduct C

  has-set-indexed-coproducts : (S : Set β„“) β†’ has-coproducts-indexed-by C ∣ S ∣
  has-set-indexed-coproducts S F = Colimitβ†’IC F (cocomplete $ Π₁-adjunct C F)

  open Copowers has-set-indexed-coproducts public
  open Consts total-terminal has-set-indexed-coproducts public