module Cat.Instances.Shape.Terminal where
open Precategory
The terminal category is the category with a single object, and only trivial morphisms.
: Precategory lzero lzero
⊤Cat .Ob = ⊤
⊤Cat .Hom _ _ = ⊤
⊤Cat .Hom-set _ _ _ _ _ _ _ _ = tt
⊤Cat .Precategory.id = tt
⊤Cat .Precategory._∘_ _ _ = tt
⊤Cat .idr _ _ = tt
⊤Cat .idl _ _ = tt
⊤Cat .assoc _ _ _ _ = tt ⊤Cat
The ony morphism in the terminal category is the identity, so the terminal category is a pregroupoid.
: is-pregroupoid ⊤Cat
⊤Cat-is-pregroupoid _ = id-invertible ⊤Cat ⊤Cat-is-pregroupoid
module _ {o h} {C : Precategory o h} where
private module C = Cat.Reasoning C
open Functor
open _=>_
There is a unique functor from any category into the terminal category.
: Functor C ⊤Cat
!F .F₀ _ = tt
!F .F₁ _ = tt
!F .F-id = refl
!F .F-∘ _ _ = refl
!F
: ∀ {F : Functor C ⊤Cat} → F ≡ !F
!F-unique = Functor-path (λ _ → refl) (λ _ → refl) !F-unique
Conversely, functors are determined by their behaviour on a single object.
: C.Ob → Functor ⊤Cat C
!Const .F₀ _ = c
!Const c .F₁ _ = C.id
!Const c .F-id = refl
!Const c .F-∘ _ _ = sym (C.idl _)
!Const c
: ∀ (F G : Functor ⊤Cat C) → F .F₀ tt ≡ G .F₀ tt → F ≡ G
!Const-η =
!Const-η F G p
Functor-path(λ _ → p)
(λ _ i → hcomp (∂ i) λ where
(i = i0) → F .F-id (~ j)
j (i = i1) → G .F-id (~ j)
j (j = i0) → C.id) j
Natural isomorphisms between functors correspond to isomorphisms in
!constⁿ: ∀ {F G : Functor ⊤Cat C}
→ C.Hom (F .F₀ tt) (G .F₀ tt)
→ F => G
{F = F} {G = G} f .η _ = f
!constⁿ {F = F} {G = G} f .is-natural _ _ _ =
!constⁿ .elimr (F .F-id) ∙ C.introl (G .F-id)
C
!const-isoⁿ: ∀ {F G : Functor ⊤Cat C}
→ F .F₀ tt C.≅ G .F₀ tt
→ F ≅ⁿ G
{F = F} {G = G} f =
!const-isoⁿ (λ _ → f) (λ _ → C.eliml (G .F-id) ∙ C.intror (F .F-id)) iso→isoⁿ