module Order.Diagram.Lub where
Least upper boundsπ
A lub (short for least upper bound) for a family of elements is, as the name implies, a least elemnet among the upper boudns of the Being an upper bound means that we have for all Being the least upper bound means that if weβre given some other satisfying (for each then we have
The same observation about the naming of glbs vs meets applies to lubs, with the binary name being join.
record is-lub {βα΅’} {I : Type βα΅’} (F : I β Ob) (lub : Ob) : Type (o β β β βα΅’) where no-eta-equality field famβ€lub : β i β F i β€ lub least : (ub' : Ob) β (β i β F i β€ ub') β lub β€ ub' record Lub {βα΅’} {I : Type βα΅’} (F : I β Ob) : Type (o β β β βα΅’) where no-eta-equality field lub : Ob has-lub : is-lub F lub open is-lub has-lub public
unquoteDecl H-Level-is-lub = declare-record-hlevel 1 H-Level-is-lub (quote is-lub) module _ {o β} {P : Poset o β} where open Order.Reasoning P open is-lub lub-unique : β {βα΅’} {I : Type βα΅’} {F : I β Ob} {x y} β is-lub P F x β is-lub P F y β x β‘ y lub-unique {x = x} {y = y} lub lub' = β€-antisym (lub .least y (lub' .famβ€lub)) (lub' .least x (lub .famβ€lub)) Lub-is-prop : β {βα΅’} {I : Type βα΅’} {F : I β Ob} β is-prop (Lub P F) Lub-is-prop p q i .Lub.lub = lub-unique (Lub.has-lub p) (Lub.has-lub q) i Lub-is-prop {F = F} p q i .Lub.has-lub = is-propβpathp (Ξ» i β hlevel {T = is-lub _ _ (lub-unique (Lub.has-lub p) (Lub.has-lub q) i)} 1) (Lub.has-lub p) (Lub.has-lub q) i instance H-Level-Lub : β {βα΅’} {I : Type βα΅’} {F : I β Ob} {n} β H-Level (Lub P F) (suc n) H-Level-Lub = prop-instance Lub-is-prop lift-is-lub : β {βα΅’ βα΅’'} {I : Type βα΅’} {F : I β Ob} {lub} β is-lub P F lub β is-lub P (F β lower {β = βα΅’'}) lub lift-is-lub is .famβ€lub (lift ix) = is .famβ€lub ix lift-is-lub is .least ub' le = is .least ub' (le β lift) lift-lub : β {βα΅’ βα΅’'} {I : Type βα΅’} {F : I β Ob} β Lub P F β Lub P (F β lower {β = βα΅’'}) lift-lub lub .Lub.lub = Lub.lub lub lift-lub lub .Lub.has-lub = lift-is-lub (Lub.has-lub lub) lower-is-lub : β {βα΅’ βα΅’'} {I : Type βα΅’} {F : I β Ob} {lub} β is-lub P (F β lower {β = βα΅’'}) lub β is-lub P F lub lower-is-lub is .famβ€lub ix = is .famβ€lub (lift ix) lower-is-lub is .least ub' le = is .least ub' (le β lower) lower-lub : β {βα΅’ βα΅’'} {I : Type βα΅’} {F : I β Ob} β Lub P (F β lower {β = βα΅’'}) β Lub P F lower-lub lub .Lub.lub = Lub.lub lub lower-lub lub .Lub.has-lub = lower-is-lub (Lub.has-lub lub)
module _ {βα΅’ βα΅’'} {Ix : Type βα΅’} {Im : Type βα΅’'} {f : Ix β Im} {F : Im β Ob} (surj : is-surjective f) where cover-preserves-is-lub : β {lub} β is-lub P F lub β is-lub P (F β f) lub cover-preserves-is-lub l .famβ€lub x = l .famβ€lub (f x) cover-preserves-is-lub l .least ub' le = l .least ub' Ξ» i β β₯-β₯-out! do (i' , p) β surj i pure (β€-trans (β€-refl' (ap F (sym p))) (le i')) cover-preserves-lub : Lub P F β Lub P (F β f) cover-preserves-lub l .Lub.lub = _ cover-preserves-lub l .Lub.has-lub = cover-preserves-is-lub (l .Lub.has-lub) cover-reflects-is-lub : β {lub} β is-lub P (F β f) lub β is-lub P F lub cover-reflects-is-lub l .famβ€lub x = β₯-β₯-out! do (y , p) β surj x pure (β€-trans (β€-refl' (ap F (sym p))) (l .famβ€lub y)) cover-reflects-is-lub l .least ub' le = l .least ub' Ξ» i β le (f i) cover-reflects-lub : Lub P (F β f) β Lub P F cover-reflects-lub l .Lub.lub = _ cover-reflects-lub l .Lub.has-lub = cover-reflects-is-lub (l .Lub.has-lub) cast-is-lub : β {βα΅’ βα΅’'} {I : Type βα΅’} {I' : Type βα΅’'} {F : I β Ob} {G : I' β Ob} {lub} β (e : I β I') β (β i β F i β‘ G (Equiv.to e i)) β is-lub P F lub β is-lub P G lub cast-is-lub {G = G} e p has-lub .famβ€lub i' = β€-trans (β€-refl' (sym (p (Equiv.from e i') β ap G (Equiv.Ξ΅ e i')))) (has-lub .famβ€lub (Equiv.from e i')) cast-is-lub e p has-lub .least ub Gβ€ub = has-lub .least ub (Ξ» i β β€-trans (β€-refl' (p i)) (Gβ€ub (Equiv.to e i))) cast-is-lubαΆ : β {βα΅’} {I : Type βα΅’} {F G : I β Ob} {lub} β (β i β F i β‘ G i) β is-lub P F lub β is-lub P G lub cast-is-lubαΆ {lub = lub} p has-lub = cast-is-lub (_ , id-equiv) p has-lub
Let be a family. If there is some such that for all then is the least upper bound of
fam-boundβis-lub : β {βα΅’} {I : Type βα΅’} {F : I β Ob} β (i : I) β (β j β F j β€ F i) β is-lub P F (F i) fam-boundβis-lub i ge .famβ€lub = ge fam-boundβis-lub i ge .least y le = le i
If is the least upper bound of a constant family, then must be equal to every member of the family.
lub-of-const-fam : β {βα΅’} {I : Type βα΅’} {F : I β Ob} {x} β (β i j β F i β‘ F j) β is-lub P F x β β i β F i β‘ x lub-of-const-fam {F = F} is-const x-lub i = β€-antisym (famβ€lub x-lub i) (least x-lub (F i) Ξ» j β β€-refl' (sym (is-const i j)))
Furthermore, if is a constant family and is merely inhabited, then has a least upper bound.
const-inhabited-famβis-lub : β {βα΅’} {I : Type βα΅’} {F : I β Ob} {x} β (β i β F i β‘ x) β β₯ I β₯ β is-lub P F x const-inhabited-famβis-lub {I = I} {F = F} {x = x} is-const = rec! mk-is-lub where mk-is-lub : I β is-lub P F x mk-is-lub i .is-lub.famβ€lub j = β€-refl' (is-const j) mk-is-lub i .is-lub.least y le = x =Λβ¨ is-const i β©=Λ F i β€β¨ le i β©β€ y β€β const-inhabited-famβlub : β {βα΅’} {I : Type βα΅’} {F : I β Ob} β (β i j β F i β‘ F j) β β₯ I β₯ β Lub P F const-inhabited-famβlub {I = I} {F = F} is-const = rec! mk-lub where mk-lub : I β Lub P F mk-lub i .Lub.lub = F i mk-lub i .Lub.has-lub = const-inhabited-famβis-lub (Ξ» j β is-const j i) (inc i)