module Cat.Internal.Instances.Discrete
  {o β„“} (C : Precategory o β„“)
  where

Discrete internal categoriesπŸ”—

Every object induces a category internal to where the object-of-objects and object-of-morphisms are both taken to be and the source/target maps are identities. The identity-assigning morphism is also given by the identity map, and the composition operator returns the intermediate map.

These internal categories are called discrete internal categories, and play the same role as discrete categories do in 1-category theory.

Disci-is-internal-cat : βˆ€ (I : Ob) β†’ Internal-cat-on (id {I}) (id {I})
Disci-is-internal-cat I = icat where
  open Internal-cat-on

  icat : Internal-cat-on id id
  icat .idi x .ihom = x
  icat .idi x .has-src = idl _
  icat .idi x .has-tgt = idl _
  _∘i_ icat {_} {x} {y} {z} f g .ihom = y
  _∘i_ icat {_} {x} {y} {z} f g .has-src =
    id ∘ y       β‰‘βŸ¨ idl _ βŸ©β‰‘
    y            β‰‘Λ˜βŸ¨ g .has-tgt βŸ©β‰‘Λ˜
    id ∘ g .ihom β‰‘βŸ¨ g .has-src βŸ©β‰‘
    x ∎
  _∘i_ icat {_} {x} {y} {z} f g .has-tgt =
    id ∘ y       β‰‘βŸ¨ idl _ βŸ©β‰‘
    y            β‰‘Λ˜βŸ¨ f .has-src βŸ©β‰‘Λ˜
    id ∘ f .ihom β‰‘βŸ¨ f .has-tgt βŸ©β‰‘
    z ∎
  icat .idli f = Internal-hom-path $ sym (f .has-tgt) βˆ™ idl _
  icat .idri f = Internal-hom-path $ sym (f .has-src) βˆ™ idl _
  icat .associ {_} {w} {x} {y} {z} f g h =
    Internal-hom-path $
    y            β‰‘Λ˜βŸ¨ g .has-tgt βŸ©β‰‘Λ˜
    id ∘ g .ihom β‰‘βŸ¨ g .has-src βŸ©β‰‘
    x ∎
  icat .idi-nat _ = Internal-hom-path refl
  icat .∘i-nat _ _ _ = Internal-hom-path refl

Disci : Ob β†’ Internal-cat
Disci I .Internal-cat.Cβ‚€ = I
Disci I .Internal-cat.C₁ = I
Disci I .Internal-cat.src = id
Disci I .Internal-cat.tgt = id
Disci I .Internal-cat.has-internal-cat = Disci-is-internal-cat I

Functors between discrete internal categories are given by morphisms between their objects of objects.

lift-disci : βˆ€ {I J : Ob} β†’ Hom I J β†’ Internal-functor (Disci I) (Disci J)
lift-disci f .Internal-functor.Fiβ‚€ g = f ∘ g
lift-disci f .Internal-functor.Fi₁ g .ihom = f ∘ g .ihom
lift-disci f .Internal-functor.Fi₁ g .has-src =
  extendl id-comm-sym βˆ™ ap (f ∘_) (g .has-src)
lift-disci f .Internal-functor.Fi₁ g .has-tgt =
  extendl id-comm-sym βˆ™ ap (f ∘_) (g .has-tgt)
lift-disci f .Internal-functor.Fi-id = Internal-hom-path refl
lift-disci f .Internal-functor.Fi-∘ _ _ = Internal-hom-path refl
lift-disci f .Internal-functor.Fiβ‚€-nat _ _ = sym (assoc _ _ _)
lift-disci f .Internal-functor.Fi₁-nat _ _ = Internal-hom-pathp _ _ (sym (assoc _ _ _))