module Order.Instances.Discrete where

Discrete orders🔗

Every set can be turned into a poset by defining to be

Disc :  {}  Set   Poset  
Disc A .Ob =  A 
Disc A ._≤_ = _≡_
Disc A .≤-thin = A .is-tr _ _
Disc A .≤-refl = refl
Disc A .≤-trans = _∙_
Disc A .≤-antisym p _ = p

We can do that same thing using the inductive identity type.

Discᵢ :  {}  Set   Poset  
Discᵢ A .Ob =  A 
Discᵢ A ._≤_ = _≡ᵢ_
Discᵢ A .≤-thin = hlevel 1
Discᵢ A .≤-refl = reflᵢ
Discᵢ A .≤-trans = _∙ᵢ_
Discᵢ A .≤-antisym reflᵢ _ = refl

This extends to a functor from into the category of posets.

DiscF :  {}  Functor (Sets ) (Posets  )
DiscF .F₀ = Disc
DiscF .F₁ f .hom = f
DiscF .F₁ f .pres-≤ = ap f
DiscF .F-id = trivial!
DiscF .F-∘ f g = trivial!

Furthermore, this functor is a left adjoint to the forgetful functor into

DiscF⊣Forget :  {}  DiscF {}  Posets↪Sets
DiscF⊣Forget .unit .η A x = x
DiscF⊣Forget .unit .is-natural _ _ _ = refl
DiscF⊣Forget .counit .η P .hom x  = x
DiscF⊣Forget .counit .η P .pres-≤ = Poset.≤-refl' P
DiscF⊣Forget .counit .is-natural P Q f = trivial!
DiscF⊣Forget .zig = trivial!
DiscF⊣Forget .zag = refl

Least upper bounds🔗

If has a least upper bound in the discrete poset on then must be a constant family.

disc-is-lub→const
  :  { iℓ} {Ix : Type iℓ} {A : Set }
   {f : Ix   A } {x :  A }
   is-lub (Disc A) f x
    i  f i  x
disc-is-lub→const x-lub i = is-lub.fam≤lub x-lub i

disc-lub→const
  :  { iℓ} {Ix : Type iℓ} {A : Set }
   {f : Ix   A }
   Lub (Disc A) f
    i j  f i  f j
disc-lub→const x-lub i j =
  Lub.fam≤lub x-lub i  sym (Lub.fam≤lub x-lub j)