module Order.Base where
Partially ordered setsπ
A poset is a set equipped with a relation , called a partial order, which is reflexive, transitive, and antisymmetric. Put another way, a poset is a univalent category which has at most one morphism between each pair of its objects: a thin category.
Posets are a simultaneous generalisation of many naturally occurring notions of βorderβ in mathematics:
The βusualβ ordering relations on familiar number systems like the natural numbers, the integers, the rationals, or the reals.
When ordering the naturals, the integers, and the rationals, we can say more: they are linear orders. That is, in addition to the properties of required to be a poset, we have, for any pair of elements and ,
The divisibility order on the natural numbers is also a poset, as detailed in that page. More than just a poset, itβs actually a lattice: the meet of a pair of numbers is their greatest common divisor, and the join is their least common multiple.
The divisibility ordering is also interesting as a counterexample: even though it is decidable, it fails to be a linear order: any pair of coprime numbers is unrelated by the divisibility order.
Moving away from numbers, partial orders are also intimately connected with the study of logic.
To each theory in a given fragment of propositional logic, we can build a set of sentences in the language of ; The entailment (or provability) relation is almost a partial order: we certainly have , and the transitivity requirement is the βcutβ rule,
However, this fails to be a poset, because inter-provable formulas and need not be syntactically equal. However, if we quotient the set by the inter-provability relation, then we do obtain a poset: the Lindenbaum-Tarski algebra of .
This poset will inherit order-theoretic structure from the logical structure of : For example, if is expressed in a fragment of logic which has conjunction, then will be a meet-semilattice; if it also has infinitary disjunction, then its Lindenbaum-Tarski algebra is a frame.
As mentioned in the opening paragraph, the notion of poset specialises that of univalent category.
In particular, to every univalent category , we can universally associate a poset: Its set of elements is the set truncation of βs groupoid of objects, and the relation is the propositional truncation .
This process can actually be extended to any precategory: however, instead of merely truncating the space of objects, we must instead take its set-quotient by the relation .
With the motivating examples out of the way, we can finally move onto the formalised definition of poset, which is a straightforward translation.
record Poset o β : Type (lsuc (o β β)) where
no-eta-equality
field
: Type o
Ob _β€_ : Ob β Ob β Type β
: β {x y} β is-prop (x β€ y) β€-thin
We note, as usual, that each fibre of the order relation should be a proposition: this is precisely the formalisation of having at most one element. The reflexivity, transitivity, and antisymmetry properties are literal:
: β {x} β x β€ x
β€-refl : β {x y z} β x β€ y β y β€ z β x β€ z
β€-trans : β {x y} β x β€ y β y β€ x β x β‘ y β€-antisym
Note that the type of β€-antisym
ends in a path in Ob
, which, a
priori, might not be a proposition: we have not included the
assumption that Ob
is actually a
set. Therefore, it might be the case that an identification between
posets does not correspond to an identification of the
underlying types and one of the relation. However, since the βsymmetric
partβ of
,
the relation iff.
is a reflexive mere relation which implies identity, the type of objects is automatically a set.
abstract
: is-set Ob
Ob-is-set =
Ob-is-set 1
identity-systemβhlevel {r = Ξ» _ β β€-refl , β€-refl}
(set-identity-system
(Ξ» a b β Γ-is-hlevel 1 β€-thin β€-thin)
(Ξ» {a} {b} (p , q) β β€-antisym {a} {b} p q))
(Ξ» a b β Γ-is-hlevel 1 β€-thin β€-thin)
Monotone mapsπ
Since we are considering posets to be categories satisfying a property, it follows that the category of posets should be a full subcategory of ; i.e., the maps should be precisely the functors . However, since there is at most one inhabitant of each , we are free to drop the functoriality assumptions, and consider instead the monotone maps:
record
{o o' β β'} (P : Poset o β) (Q : Poset o' β')
Monotone : Type (o β o' β β β β') where
no-eta-equality
field
: P.Ob β Q.Ob
hom : β {x y} β x P.β€ y β hom x Q.β€ hom y pres-β€
A monotone map between posets is a map between their underlying sets which preserves the order relation. This is the most natural choice: for example, the monotone functions are precisely nondecreasing sequences of elements in .
Itβs immediate to see that the identity function is monotone, and that monotone maps are closed under composition. Since identity of monotone maps is given by identity of the underlying functions, there is a set of monotone maps , and the laws of a category are trivial.
: Monotone P P
idβ .hom x = x
idβ .pres-β€ xβ€y = xβ€y
idβ
_ββ_ : Monotone Q R β Monotone P Q β Monotone P R
(f ββ g) .hom x = f # (g # x)
(f ββ g) .pres-β€ xβ€y = f .pres-β€ (g .pres-β€ xβ€y)
: β (o β : Level) β Precategory (lsuc o β lsuc β) (o β β)
Posets .Precategory.Ob = Poset o β
Posets o β .Precategory.Hom = Monotone
Posets o β .Precategory.Hom-set = hlevel!
Posets o β
.Precategory.id = idβ
Posets o β .Precategory._β_ = _ββ_
Posets o β
.Precategory.idr f = trivial!
Posets o β .Precategory.idl f = trivial!
Posets o β .Precategory.assoc f g h = trivial! Posets o β
Simple constructionsπ
The simplest thing we can do to a poset is to forget the order. This evidently extends to a faithful functor .
: β {o β} β Functor (Posets o β) (Sets o)
Forget-poset .Functor.Fβ P β£ = β P β
β£ Forget-poset .Functor.Fβ P .is-tr = hlevel!
Forget-poset
.Functor.Fβ = hom
Forget-poset
.Functor.F-id = refl
Forget-poset .Functor.F-β _ _ = refl Forget-poset
Slightly less trivial, we can extend the opposite category construction to posets as well, by transposing the order relation and making sure to flip the direction of transitivity:
_^opp : β {β β'} β Poset β β' β Poset β β'
(P ^opp) .Poset.Ob = Poset.Ob P
(P ^opp) .Poset._β€_ x y = Poset._β€_ P y x
(P ^opp) .Poset.β€-thin = Poset.β€-thin P
(P ^opp) .Poset.β€-refl = Poset.β€-refl P
(P ^opp) .Poset.β€-trans xβ₯y yβ₯z = Poset.β€-trans P yβ₯z xβ₯y
(P ^opp) .Poset.β€-antisym xβ₯y yβ₯x = Poset.β€-antisym P yβ₯x xβ₯y
We can construct the trivial posets with one and zero (object(s), ordering(s)) respectively
: β {o β} β Poset o β
πα΅ .Poset.Ob = Lift _ β€
πα΅ .Poset._β€_ _ _ = Lift _ β€
πα΅ .Poset.β€-thin = hlevel!
πα΅ .Poset.β€-refl = lift tt
πα΅ .Poset.β€-trans = Ξ» _ _ β lift tt
πα΅ .Poset.β€-antisym = Ξ» _ _ β refl
πα΅
: β {o β} β Poset o β
πα΅ .Poset.Ob = Lift _ β₯
πα΅ .Poset._β€_ _ _ = Lift _ β₯
πα΅ .Poset.β€-thin ()
πα΅ .Poset.β€-refl {()}
πα΅ .Poset.β€-trans ()
πα΅ .Poset.β€-antisym () πα΅