module Order.Frame where
Framesπ
A frame is a lattice with finite meets1 and arbitrary joins satisfying the infinite distributive law
In the study of frames, for simplicity, we assume propositional resizing: that way, it suffices for a frame to have joins of -indexed families, for an arbitrary type in the same universe as , to have joins for arbitrary subsets of .
record is-frame {o β} (P : Poset o β) : Type (lsuc o β β) where
no-eta-equality
open Poset P
field
_β©_ : Ob β Ob β Ob
: β x y β is-meet P x y (x β© y)
β©-meets
: Top P
has-top
: β {I : Type o} (k : I β Ob) β Ob
β : β {I : Type o} (k : I β Ob) β is-lub P k (β k)
β-lubs
: β {I} x (f : I β Ob) β x β© β f β‘ β Ξ» i β x β© f i β-distribl
We have explicitly required that a frame be a meet-semilattice, but itβs worth explicitly pointing out that the infinitary join operation can also be used for more mundane purposes: By taking a join over the type of booleans (and over the empty type), we can show that all frames are also join-semilattices.
Of course, a frame is not just a lattice, but a complete lattice. Since the infinite distributive law says exactly that βmeet with β preserves joins, this implies that it has a right adjoint, so frames are also complete Heyting algebras. Once again, the difference in naming reflects the morphisms we will consider these structures under: A frame homomorphism is a monotone map which preserves the finite meets and the infinitary joins, but not necessarily the infinitary meets (or the Heyting implication).
Since meets and joins are defined by a universal property, and we have assumed that homomorphisms are a priori monotone, it suffices to show the following inequalities:
- For every , we have ;
- ;
- and finally, for every family , we have
record
is-frame-hom{P : Poset o β} {Q : Poset o β'}
(f : Monotone P Q) (P-frame : is-frame P) (Q-frame : is-frame Q)
: Type (lsuc o β β') where
field
: β x y β (f # x) QαΆ .β© (f # y) Q.β€ f # (x PαΆ .β© y)
β©-β€ : QαΆ .top Q.β€ f # PαΆ .top
top-β€ : β {I : Type o} (k : I β β P β) β (f # PαΆ .β k) Q.β€ QαΆ .β (apply f β k) β-β€
If is a frame homomorphism, then it is also a homomorphism of meet semilattices.
: is-meet-slat-hom f PαΆ .has-meet-slat QαΆ .has-meet-slat
has-meet-slat-hom .is-meet-slat-hom.β©-β€ = β©-β€
has-meet-slat-hom .is-meet-slat-hom.top-β€ = top-β€
has-meet-slat-hom
open is-meet-slat-hom has-meet-slat-hom hiding (β©-β€; top-β€) public
Furthermore, we can actually show from the inequality required above that preserves all joins up to equality.
: β {I : Type o} (k : I β β P β) β (f # PαΆ .β k) β‘ QαΆ .β (apply f β k)
pres-β =
pres-β k .β€-antisym
Q(β-β€ k)
(QαΆ .β-universal _ (Ξ» i β f .pres-β€ (PαΆ .β-inj i)))
pres-lubs: β {I : Type o} {k : I β β P β} {l}
β is-lub P k l
β is-lub Q (apply f β k) (f # l)
{k = k} {l = l} l-lub .famβ€lub i = f .pres-β€ (l-lub .famβ€lub i)
pres-lubs {k = k} {l = l} l-lub .least ub p =
pres-lubs .β€β¨ f .pres-β€ (l-lub .least _ PαΆ .β-inj) β©
f # l Q.β k Q.β€β¨ β-β€ k β©
f # PαΆ .β (apply f β k) Q.β€β¨ QαΆ .β-universal ub p β©
QαΆ .β€β ub Q
As a corollary, is also a homomorphism of the underlying join semilattices.
opaque.βͺ-joins Lubs.has-bottom
unfolding Lubs
: is-join-slat-hom f PαΆ .has-join-slat QαΆ .has-join-slat
has-join-slat-hom .is-join-slat-hom.βͺ-β€ x y =
has-join-slat-hom .β€-trans (β-β€ _) $ QαΆ .β-universal _ Ξ» where
Q(lift true) β QαΆ .β-inj (lift true)
(lift false) β QαΆ .β-inj (lift false)
.is-join-slat-hom.bot-β€ =
has-join-slat-hom .β€-trans (β-β€ _) (QαΆ .β-universal _ (Ξ» ()))
Q
open is-join-slat-hom has-join-slat-hom public
open is-frame-hom
Clearly, the identity function is a frame homomorphism.
id-frame-hom: β (PαΆ : is-frame P)
β is-frame-hom idβ PαΆ PαΆ
{P = P} PαΆ .β©-β€ x y =
id-frame-hom .β€-refl P
Poset{P = P} PαΆ .top-β€ =
id-frame-hom .β€-refl P
Poset{P = P} PαΆ .β-β€ k =
id-frame-hom .β€-refl P Poset
Furthermore, frame homomorphisms are closed under composition.
β-frame-hom: β {Pβ Qβ Rβ} {f : Monotone Q R} {g : Monotone P Q}
β is-frame-hom f Qβ Rβ
β is-frame-hom g Pβ Qβ
β is-frame-hom (f ββ g) Pβ Rβ
{R = R} {f = f} {g = g} f-pres g-pres .β©-β€ x y =
β-frame-hom .Poset.β€-trans (f-pres .β©-β€ (g # x) (g # y)) (f .pres-β€ (g-pres .β©-β€ x y))
R {R = R} {f = f} {g = g} f-pres g-pres .top-β€ =
β-frame-hom .Poset.β€-trans (f-pres .top-β€) (f .pres-β€ (g-pres .top-β€))
R {R = R} {f = f} {g = g} f-pres g-pres .β-β€ k =
β-frame-hom .Poset.β€-trans (f .pres-β€ (g-pres .β-β€ k)) (f-pres .β-β€ (Ξ» i β g # k i)) R
This means that we can define the category of frames as a subcategory of the category of posets.
: β o β β Subcat (Posets o β) _ _
Frame-subcat .Subcat.is-ob = is-frame
Frame-subcat o β .Subcat.is-hom = is-frame-hom
Frame-subcat o β .Subcat.is-hom-prop = hlevel!
Frame-subcat o β .Subcat.is-hom-id = id-frame-hom
Frame-subcat o β .Subcat.is-hom-β = β-frame-hom
Frame-subcat o β
: β o β β Precategory _ _
Frames = Subcategory (Frame-subcat o β)
Frames o β
module Frames {o} {β} = Cat.Reasoning (Frames o β)
: β o β β Type _
Frame = Frames.Ob {o} {β} Frame o β
Power sets as framesπ
A canonical source of frames are power sets: The power set of any type is a frame, because it is a complete lattice satisfying the infinite distributive law; This can be seen by some computation, as is done below.
open is-frame
open is-meet-semilattice
: β {β} (A : Type β) β Frame β β
Power-frame {β = β} A .fst = Subsets A
Power-frame .snd ._β©_ P Q i = P i β§Ξ© Q i
Power-frame A .snd .β©-meets P Q =
Power-frame A Ξ» _ β Props-has-meets (P _) (Q _)
is-meet-pointwise .snd .has-top =
Power-frame A Ξ» _ β Props-has-top
has-top-pointwise .snd .β k i = βΞ© _ (Ξ» j β k j i)
Power-frame A .snd .β-lubs k = is-lub-pointwise _ _ Ξ» _ β
Power-frame A Ξ» i β k i _
Props-has-lubs .snd .β-distribl x f = funext Ξ» i β Ξ©-ua
Power-frame A (Ξ» (x , i) β β‘-map (Ξ» (y , z) β _ , x , z) i)
(Ξ» r β β‘-rec! (Ξ» { (x , y , z) β y , inc (_ , z) }) r)
So, in addition to the operation, we have a top elementβ©οΈ