module Cat.Displayed.Diagram.Total.Terminal
  {o  o' ℓ'} {B : Precategory o } (E : Displayed B o' ℓ')
  where

Total terminal objects🔗

If is a displayed category over a base admitting a terminal object we say that an object is a total terminal object, if, for every there exists a unique morphism displayed over

record is-terminal-over {top} (term : is-terminal B top) (top' : E ʻ top) : Type (o  o'  ℓ') where
  open Terminal {C = B} record{ has⊤ = term } hiding (top)
  field
    !'        : {y :  B } {y' : E ʻ y}  E.Hom[ ! ] y' top'
    !-unique' : {y :  B } {y' : E ʻ y} (h : E.Hom[ ! ] y' top')  !'  h

  opaque
    !ₚ :  {y} {m : B.Hom y top} {y' : E ʻ y}  E.Hom[ m ] y' top'
    !ₚ {m = m} = E.hom[ !-unique m ] !'

    abstract
      !ₚ-unique :  {y} {m : B.Hom y top} {y' : E ʻ y} (h : E.Hom[ m ] y' top')  !ₚ  h
      !ₚ-unique {m = m} {y'} = J
         m p  (h : E.Hom[ m ] y' top')  E.hom[ p ] !'  h)
         h  E.from-pathp[] (!-unique' h))
        (!-unique m)

  abstract
    !'-unique₂
      :  {y} {m m' : B.Hom y top} {y' : E ʻ y} {h : E.Hom[ m ] y' top'} {h' : E.Hom[ m' ] y' top'}
       {p : m  m'}
       h E.≡[ p ] h'
    !'-unique₂ {h = h} {h' = h'} = to-pathp (sym (!ₚ-unique _)  !ₚ-unique _)

record TerminalP (t : Terminal B) : Type (o  o'  ℓ') where
  open Terminal t
  field
    top'  : E ʻ top
    has⊤' : is-terminal-over has⊤ top'
  open is-terminal-over has⊤' public