Tom de Jong, 3 June 2022
The poset reflection of a preorder, using (large) set quotients as constructed
in Quotient.Large.
\begin{code}
{-# OPTIONS --safe --without-K #-}
open import MLTT.Spartan
open import UF.FunExt
open import UF.PropTrunc
open import UF.Sets
open import UF.Subsingletons
open import UF.SubtypeClassifier
module OrderedTypes.PosetReflection
(pt : propositional-truncations-exist)
(fe : Fun-Ext)
(pe : Prop-Ext)
where
open import Quotient.Type
open import Quotient.Large pt fe pe
open import UF.Base hiding (_β_)
open import UF.ImageAndSurjection pt
open import UF.Subsingletons-FunExt
open general-set-quotients-exist large-set-quotients
open extending-relations-to-quotient fe pe
module poset-reflection
(X : π€ Μ )
(_β²_ : X β X β π£ Μ )
(β²-is-prop-valued : (x y : X) β is-prop (x β² y))
(β²-is-reflexive : (x : X) β x β² x)
(β²-is-transitive : (x y z : X) β x β² y β y β² z β x β² z)
where
private
_β²Ξ©_ : X β X β Ξ© π£
x β²Ξ© y = x β² y , β²-is-prop-valued x y
_β_ : X β X β π£ Μ
x β y = x β² y Γ y β² x
β-is-equiv-rel : is-equiv-relation _β_
β-is-equiv-rel = (Ξ» x y β Γ-is-prop (β²-is-prop-valued x y)
(β²-is-prop-valued y x))
, (Ξ» x β β²-is-reflexive x , β²-is-reflexive x)
, (Ξ» x y (k , l) β l , k)
, (Ξ» x y z (k , l) (u , v) β (β²-is-transitive x y z k u)
, (β²-is-transitive z y x v l))
β : EqRel X
β = _β_ , β-is-equiv-rel
private
β²-congruence : {x y x' y' : X} β x β x' β y β y' β x β²Ξ© y οΌ x' β²Ξ© y'
β²-congruence {x} {y} {x'} {y'} (k , l) (u , v) =
Ξ©-extensionality pe fe
(Ξ» m β β²-is-transitive x' x y' l
(β²-is-transitive x y y' m u))
(Ξ» m β β²-is-transitive x x' y k
(β²-is-transitive x' y' y m v))
_β€Ξ©_ : X / β β X / β β Ξ© π£
_β€Ξ©_ = extension-relβ β (Ξ» x y β x β²Ξ© y) β²-congruence
poset-reflection-carrier : π£ βΊ β π€ Μ
poset-reflection-carrier = X / β
poset-reflection-is-set : is-set poset-reflection-carrier
poset-reflection-is-set = /-is-set β
_β€_ : X / β β X / β β π£ Μ
x' β€ y' = (x' β€Ξ© y') holds
β€-is-prop-valued : (x' y' : X / β) β is-prop (x' β€ y')
β€-is-prop-valued x' y' = holds-is-prop (x' β€Ξ© y')
Ξ· : X β X / β
Ξ· = Ξ·/ β
Ξ·-is-surjection : is-surjection Ξ·
Ξ·-is-surjection = Ξ·/-is-surjection β pt
Ξ·-reflects-order : {x y : X} β Ξ· x β€ Ξ· y β x β² y
Ξ·-reflects-order {x} {y} =
Idtofun (ap prβ (extension-rel-triangleβ β _β²Ξ©_ β²-congruence x y))
Ξ·-preserves-order : {x y : X} β x β² y β Ξ· x β€ Ξ· y
Ξ·-preserves-order {x} {y} =
Idtofun (ap prβ ((extension-rel-triangleβ β _β²Ξ©_ β²-congruence x y) β»ΒΉ))
Ξ·-β-order : {x y : X} β x β² y β Ξ· x β€ Ξ· y
Ξ·-β-order = Ξ·-preserves-order , Ξ·-reflects-order
β€-is-reflexive : (x' : X / β) β x' β€ x'
β€-is-reflexive = /-induction β (Ξ» x' β β€-is-prop-valued x' x')
(Ξ» x β Ξ·-preserves-order (β²-is-reflexive x))
β€-is-transitive : (x' y' z' : X / β) β x' β€ y' β y' β€ z' β x' β€ z'
β€-is-transitive =
/-inductionβ fe β (Ξ» x' y' z' β Ξ β-is-prop fe (Ξ» _ _ β β€-is-prop-valued x' z'))
(Ξ» x y z k l β Ξ·-preserves-order
(β²-is-transitive x y z
(Ξ·-reflects-order k)
(Ξ·-reflects-order l)))
β€-is-antisymmetric : (x' y' : X / β) β x' β€ y' β y' β€ x' β x' οΌ y'
β€-is-antisymmetric =
/-inductionβ fe β (Ξ» x' q β Ξ β-is-prop fe (Ξ» _ _ β /-is-set β))
(Ξ» x y k l β Ξ·/-identifies-related-points β
( Ξ·-reflects-order k
, Ξ·-reflects-order l))
\end{code}
The requirement that Q is a set actually follows from the order assumptions, but
it is convenient to assume it (for now) anyway.
\begin{code}
universal-property :
{Q : π€' Μ } (_β_ : Q β Q β π£' Μ )
β is-set Q
β ((p q : Q) β is-prop (p β q))
β ((q : Q) β q β q)
β ((p q r : Q) β p β q β q β r β p β r)
β ((p q : Q) β p β q β q β p β p οΌ q)
β (f : X β Q)
β ((x y : X) β x β² y β f x β f y)
β β! fΜ κ (X / β β Q) , ((x' y' : X / β) β x' β€ y' β fΜ x' β fΜ y')
Γ (fΜ β Ξ· βΌ f)
universal-property {π€'} {π£'} {Q} _β_ Q-is-set β-prop β-refl β-trans
β-antisym f f-mon =
(fΜ , fΜ-mon , fΜ-eq) , Ο
where
ΞΌ : β! fΜ κ (X / β β Q), fΜ β Ξ· βΌ f
ΞΌ = /-universality β
Q-is-set f (Ξ» {x} {y} (k , l) β β-antisym (f x) (f y)
(f-mon x y k) (f-mon y x l))
fΜ : X / β β Q
fΜ = β!-witness ΞΌ
fΜ-eq : fΜ β Ξ· βΌ f
fΜ-eq = β!-is-witness ΞΌ
fΜ-mon : (x' y' : X / β) β x' β€ y' β fΜ x' β fΜ y'
fΜ-mon = /-inductionβ fe β
(Ξ» x' y' β Ξ -is-prop fe (Ξ» _ β β-prop (fΜ x') (fΜ y')))
(Ξ» x y l β transportβ _β_ ((fΜ-eq x) β»ΒΉ) ((fΜ-eq y) β»ΒΉ)
(f-mon x y (Ξ·-reflects-order l)))
fΜ-is-unique : (g : X / β β Q)
β ((x' y' : X / β) β x' β€ y' β g x' β g y')
β (g β Ξ· βΌ f)
β fΜ βΌ g
fΜ-is-unique g g-mon g-eq = happly e
where
e : fΜ οΌ g
e = ap prβ (β!-uniqueness' ΞΌ (g , g-eq))
Ο : is-central (Ξ£ g κ (X / β β Q)
, ((x' y' : X / β) β x' β€ y' β g x' β g y')
Γ g β Ξ· βΌ f)
(fΜ , fΜ-mon , fΜ-eq)
Ο (g , g-mon , g-eq) =
to-subtype-οΌ (Ξ» h β Γ-is-prop
(Ξ β-is-prop fe (Ξ» x' y' _ β β-prop (h x') (h y')))
(Ξ -is-prop fe (Ξ» _ β Q-is-set)))
(dfunext fe (fΜ-is-unique g g-mon g-eq))
\end{code}