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 β
The indexed coproduct is a special case of the lexicographic sum where the base poset is discrete. It means that there is no non-trivial relationship across fibres.
Disjoint : Poset _ _ Disjoint = Lexical-sum (Discα΅’ I) F
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α΅ = lexical-sum-injα΅ {I = Discα΅’ I} {F = F}
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 = lexical-sum-injα΅-is-order-embedding {I = Discα΅’ I} {F = F}
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 reflα΅’)
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