module Order.Instances.Coproduct where
Coproducts of posetsπ
If weβre given two partially ordered sets then there is a universal way of equipping their coproduct (at the level of sets) with a partial order, which results in the categorical coproduct in the category
module _ {o o' β β'} (P : Poset o β) (Q : Poset o' β') where private module P = Pr P module Q = Pr Q
The ordering is defined by recursion, and itβs uniquely specified by saying that it is the coproduct of orders, and that each coprojection is an order embedding. We compute:
sum-β€ : β P β β β Q β β β P β β β Q β β Type (β β β') sum-β€ (inl x) (inl y) = Lift β' (x P.β€ y) sum-β€ (inl x) (inr y) = Lift _ β₯ sum-β€ (inr x) (inl y) = Lift _ β₯ sum-β€ (inr x) (inr y) = Lift β (x Q.β€ y)
A very straightforward case-bash shows that this is actually a partial order. After weβve established that everything is in a particular summand, each obligation is something we inherit from the underlying orders and
abstract sum-β€-thin : β {x y} β is-prop (sum-β€ x y) sum-β€-thin {inl x} {inl y} = hlevel 1 sum-β€-thin {inr x} {inr y} = hlevel 1 sum-β€-refl : β {x} β sum-β€ x x sum-β€-refl {inl x} = lift P.β€-refl sum-β€-refl {inr x} = lift Q.β€-refl sum-β€-trans : β {x y z} β sum-β€ x y β sum-β€ y z β sum-β€ x z sum-β€-trans {inl x} {inl y} {inl z} (lift p) (lift q) = lift (P.β€-trans p q) sum-β€-trans {inr x} {inr y} {inr z} (lift p) (lift q) = lift (Q.β€-trans p q) sum-β€-antisym : β {x y} β sum-β€ x y β sum-β€ y x β x β‘ y sum-β€-antisym {inl x} {inl y} (lift p) (lift q) = ap inl (P.β€-antisym p q) sum-β€-antisym {inr x} {inr y} (lift p) (lift q) = ap inr (Q.β€-antisym p q)
_βα΅_ : Poset (o β o') (β β β') _βα΅_ .Poset.Ob = P.Ob β Q.Ob _βα΅_ .Poset._β€_ = sum-β€ _βα΅_ .Poset.β€-thin = sum-β€-thin _βα΅_ .Poset.β€-refl = sum-β€-refl _βα΅_ .Poset.β€-trans = sum-β€-trans _βα΅_ .Poset.β€-antisym = sum-β€-antisym infixr 15 _βα΅_
As usual, we have two (monotone) coprojections and and, if we have maps and we can define a map out of the coproduct by cases:
inlα΅ : Monotone P (P βα΅ Q) inlα΅ .hom = inl inlα΅ .pres-β€ xβ€y = lift xβ€y inrα΅ : Monotone Q (P βα΅ Q) inrα΅ .hom = inr inrα΅ .pres-β€ xβ€y = lift xβ€y matchα΅ : β {o β} {R : Poset o β} β Monotone P R β Monotone Q R β Monotone (P βα΅ Q) R matchα΅ f g .hom (inl x) = f # x matchα΅ f g .hom (inr x) = g # x matchα΅ f g .pres-β€ {inl x} {inl y} (lift Ξ±) = f .pres-β€ Ξ± matchα΅ f g .pres-β€ {inr x} {inr y} (lift Ξ²) = g .pres-β€ Ξ²
A straightforward calculation shows that this really is the coproduct in
Posets-has-coproducts : β {o β} β has-coproducts (Posets o β) Posets-has-coproducts P Q .coapex = P βα΅ Q Posets-has-coproducts P Q .ΞΉβ = inlα΅ Posets-has-coproducts P Q .ΞΉβ = inrα΅ Posets-has-coproducts P Q .has-is-coproduct .is-coproduct.[_,_] = matchα΅ Posets-has-coproducts P Q .has-is-coproduct .[]βΞΉβ = trivial! Posets-has-coproducts P Q .has-is-coproduct .[]βΞΉβ = trivial! Posets-has-coproducts P Q .has-is-coproduct .unique Ξ± Ξ² = ext Ξ» where (inl x) β Ξ± #β x (inr x) β Ξ² #β x
As a related fact, we can show that the empty poset is the initial object in
Posets-initial : β {o β} β Initial (Posets o β) Posets-initial .bot = πα΅ Posets-initial .hasβ₯ P .centre .hom () Posets-initial .hasβ₯ P .centre .pres-β€ () Posets-initial .hasβ₯ P .paths f = ext Ξ» ()