module Order.Instances.Disjoint where
Indexed coproducts of posetsπ
If is a family of partial orders indexed by a set then we can equip the with a βfibrewiseβ partial order: this is the coproduct of these orders in the category of posets.
private module D = Displayed module _ {β ββ βα΅£} (I : Set β) (F : β I β β Poset ββ βα΅£) where private open module F {i : β I β} = Pr (F i) βFβ : β I β β Type ββ βFβ e = β F e β
Since the indices are drawn from completely arbitrary sets, we canβt exactly define the order by pattern matching, as in the binary coproduct of posets. Instead, we must define what it means to compare two totally arbitrary pairs 1.
Considering that we only know how to compare elements in the same fibre, the natural solution is to require, as part of proving some evidence We can then transport across to obtain a value in which can be compared against
The concerns of defining the ordering in each fibre, and then defining the ordering on the entire total space, are mostly orthogonal. Indeed, these can be handled in a modular way: the construction weβre interested in naturally arises as the total (thin) category of a particular displayed order β over the discrete partial order on the index set
_β€[_]'_ : {i j : β I β} β βFβ i β i β‘α΅’ j β βFβ j β Type βα΅£ x β€[ p ]' y = substα΅’ βFβ p x β€ y substα΅ : β {i j} β i β‘α΅’ j β Monotone (F i) (F j) substα΅ reflα΅’ .hom x = x substα΅ reflα΅’ .pres-β€ xβ€y = xβ€y Disjoint-over : Displayed _ _ (Discα΅’ I) Disjoint-over .D.Ob[_] = βFβ Disjoint-over .D.Rel[_] p x y = x β€[ p ]' y Disjoint-over .D.β€-thin' _ = hlevel 1 Disjoint-over .D.β€-refl' = F.β€-refl Disjoint-over .D.β€-antisym' = F.β€-antisym Disjoint-over .D.β€-trans' {f = reflα΅’} {g = reflα΅’} = F.β€-trans
To differentiate from the binary coproducts, we refer to the indexed
coproduct of a family as disjoint coproducts, or Disjoint
for short.
Disjoint : Poset _ _ Disjoint = β« Disjoint-over
_β€[_]_ : β {β ββ βα΅£} {I : Set β} {F : β I β β Poset ββ βα΅£} {i j : β I β} β β F i β β i β‘α΅’ j β β F j β β Type βα΅£ _β€[_]_ {I = I} {F = F} x p y = _β€[_]'_ I F x p y {-# DISPLAY _β€[_]'_ I F x p y = x β€[ p ] y #-} module _ {β ββ βα΅£} {I : Set β} {F : β I β β Poset ββ βα΅£} where private open module F {i : β I β} = Pr (F i) βFβ : β I β β Type ββ βFβ e = β F e β
injα΅ : (i : β I β) β Monotone (F i) (Disjoint I F) injα΅ i .hom x = i , x injα΅ i .pres-β€ xβ€y = reflα΅’ , xβ€y
The name Disjoint
is justified by the
observation that each of the coprojections injα΄Ύ
is actually an order embedding. This
identifies each factor
with its image in
injα΅-is-order-embedding : β i β is-order-embedding (F i) (Disjoint I F) (apply (injα΅ i)) injα΅-is-order-embedding i .fst = injα΅ i .pres-β€ injα΅-is-order-embedding i .snd = biimp-is-equiv! (injα΅ i .pres-β€) Ξ» { (p , q) β β€-trans (β€-refl' (substα΅’-filler-set _ (hlevel 2) p _)) q }
To complete the construction of the coproduct, we have the following function for mapping out, by cases:
matchα΅ : β {o β} {R : Poset o β} β (β i β Monotone (F i) R) β Monotone (Disjoint I F) R matchα΅ cases .hom (i , x) = cases i # x matchα΅ cases .pres-β€ (reflα΅’ , xβ€y) = cases _ .pres-β€ xβ€y
Straightforward calculations finish the proof that has all set-indexed coproducts.
Posets-has-set-indexed-coproducts : β {o β ΞΊ} (I : Set ΞΊ) β has-coproducts-indexed-by (Posets (o β ΞΊ) (β β ΞΊ)) β I β Posets-has-set-indexed-coproducts I F = mk where mk : Indexed-coproduct (Posets _ _) F mk .Ξ£F = Disjoint I F mk .ΞΉ = injα΅ mk .has-is-ic .match = matchα΅ mk .has-is-ic .commute = trivial! mk .has-is-ic .unique f p = ext Ξ» i x β p i #β x
Binary coproducts are a special case of indexed coproductsπ
ββ‘Disjoint-bool : β {o β} (P Q : Poset o β) β P βα΅ Q β‘ Disjoint (el! Bool) (if_then P else Q) ββ‘Disjoint-bool P Q = Poset-path Ξ» where .to β matchβα΅ (injα΅ true) (injα΅ false) .from β matchα΅ (Bool-elim _ inlα΅ inrα΅) .inverses .invl β ext Ξ» where true x β refl false x β refl .inverses .invr β ext Ξ» where (inl x) β refl (inr x) β refl
where and β©οΈ