module Cat.Diagram.Terminal where

Terminal objects🔗

An object of a category is said to be terminal if it admits a unique map from any other object:

  is-terminal : Ob  Type _
  is-terminal ob =  x  is-contr (Hom x ob)
  
  record Terminal : Type (o ⊔ h) where
    field
      top : Ob
      has⊤ : is-terminal top

We refer to the centre of contraction as !. Since it inhabits a contractible type, it is unique.

    ! :  {x}  Hom x top
    ! = has⊤ _ .centre
  
    !-unique :  {x} (h : Hom x top)  ! ≡ h
    !-unique = has⊤ _ .paths
  
    !-unique₂ :  {x} (f g : Hom x top)  f ≡ g
    !-unique₂ = is-contr→is-prop (has⊤ _)
  
  open Terminal

Uniqueness🔗

If a category has two terminal objects and then there is a unique isomorphism We first establish the isomorphism: Since (resp. is terminal, there is a unique map (resp. To show these maps are inverses, we must show that is But these morphisms inhabit a contractible space, namely the space of maps into so they are equal.

  !-invertible : (t1 t2 : Terminal)  is-invertible (! t1 {top t2})
  !-invertible t1 t2 = make-invertible (! t2) (!-unique₂ t1 _ _) (!-unique₂ t2 _ _)
  
  ⊤-unique : (t1 t2 : Terminal)  top t1 ≅ top t2
  ⊤-unique t1 t2 = invertible→iso (! t2) (!-invertible t2 t1)

Hence, if is additionally a category, it has a propositional space of terminal objects:

  ⊤-contractible : is-category C  is-prop Terminal
  ⊤-contractible ccat x1 x2 i .top =
    ccat .to-path (⊤-unique x1 x2) i
  
  ⊤-contractible ccat x1 x2 i .has⊤ ob =
    is-prop→pathp
       i  is-contr-is-prop {A = Hom _
        (ccat .to-path (⊤-unique x1 x2) i)})
      (x1 .has⊤ ob) (x2 .has⊤ ob) i
  
  is-terminal-iso :  {A B}  A ≅ B  is-terminal A  is-terminal B
  is-terminal-iso isom term x = contr (isom .to ∘ term x .centre) λ h 
    isom .to ∘ term x .centre ≡⟨ ap (isom .to_) (term x .paths _)
    isom .to ∘ isom .from ∘ h ≡⟨ cancell (isom .invl)
    h                         ∎

In terms of right adjoints🔗

We prove that the inclusion functor of an object of is right adjoint to the unique functor if and only if is terminal.

  module _ (x : Ob) (term : is-terminal x) where
    terminal→inclusion-is-right-adjoint : !F ⊣ const! {A = C} x
    terminal→inclusion-is-right-adjoint =
      hom-iso→adjoints (e _ .fst) (e _ .snd)
        λ _ _ _  term _ .paths _
      where
        e :  y  ⊤ ≃ Hom y x
        e y = is-contr→≃ (hlevel 0) (term y)
  
  module _ (x : Ob) (adj : !F ⊣ const! {A = C} x) where
    inclusion-is-right-adjoint→terminal : is-terminal x
    inclusion-is-right-adjoint→terminal y = Equiv→is-hlevel 0
      (Σ-contract  _  hlevel 0) e⁻¹)
      (R-adjunct-is-equiv adj .is-eqv _)