open import Cat.Univalent
open import Cat.Prelude

module Cat.Diagram.Initial {o h} (C : Precategory o h) where

Initial objectsπŸ”—

An object βŠ₯\bot of a category C\mathcal{C} is said to be initial if there exists a unique map to any other object:

is-initial : Ob β†’ Type _
is-initial ob = βˆ€ x β†’ is-contr (Hom ob x)

record Initial : Type (o βŠ” h) where
  field
    bot  : Ob
    hasβŠ₯ : is-initial bot

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

  Β‘ : βˆ€ {x} β†’ Hom bot x
  Β‘ = hasβŠ₯ _ .centre

  Β‘-unique : βˆ€ {x} (h : Hom bot x) β†’ Β‘ ≑ h
  Β‘-unique = hasβŠ₯ _ .paths

  Β‘-uniqueβ‚‚ : βˆ€ {x} (f g : Hom bot x) β†’ f ≑ g
  Β‘-uniqueβ‚‚ = is-contrβ†’is-prop (hasβŠ₯ _)

open Initial

IntuitionπŸ”—

The intuition here is that we ought to think about an initial object as having β€œthe least amount of structure possible,” insofar that it can be mapped into any other object. For the category of Sets, this is the empty set; there is no required structure beyond β€œbeing a set,” so the empty set sufficies.

In more structured categories, the situation becomes a bit more interesting. Once our category has enough structure that we can’t build maps from a totally trivial thing, the initial object begins to behave like a notion of Syntax for our category. The idea here is that we have a unique means of interpreting our syntax into any other object, which is exhibited by the universal map Β‘

UniquenessπŸ”—

One important fact about initial objects is that they are unique up to isomorphism:

βŠ₯-unique : (i iβ€² : Initial) β†’ bot i β‰… bot iβ€²
βŠ₯-unique i iβ€² = make-iso (Β‘ i) (Β‘ iβ€²) (Β‘-uniqueβ‚‚ iβ€² _ _) (Β‘-uniqueβ‚‚ i _ _)

Additionally, if CC is a category, then the space of initial objects is a proposition:

βŠ₯-contractible : is-category C β†’ is-prop Initial
βŠ₯-contractible ccat x1 x2 i .bot =
  isoβ†’path C ccat (βŠ₯-unique x1 x2) i

βŠ₯-contractible ccat x1 x2 i .hasβŠ₯ ob =
  is-prop→pathp
    (Ξ» i β†’ is-contr-is-prop
      {A = Hom (isoβ†’path C ccat (βŠ₯-unique x1 x2) i) _})
    (x1 .hasβŠ₯ ob) (x2 .hasβŠ₯ ob) i