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 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.
infixr 25 _β©_
module is-lubs {I} {k : I β Ob} = is-lub (β-lubs k)
open Meets β©-meets public
open Top has-top using (top; !) public
open Lubs P β-lubs public
: is-meet-semilattice P
has-meet-slat .is-meet-semilattice._β©_ = _β©_
has-meet-slat .is-meet-semilattice.β©-meets = β©-meets
has-meet-slat .is-meet-semilattice.has-top = has-top
has-meet-slat
: is-join-semilattice P
has-join-slat .is-join-semilattice._βͺ_ = _βͺ_
has-join-slat .is-join-semilattice.βͺ-joins = βͺ-joins
has-join-slat .is-join-semilattice.has-bottom = has-bottom
has-join-slat
: is-lattice P
has-lattice .is-lattice._β©_ = _β©_
has-lattice .is-lattice.β©-meets = β©-meets
has-lattice .is-lattice._βͺ_ = _βͺ_
has-lattice .is-lattice.βͺ-joins = βͺ-joins
has-lattice .is-lattice.has-top = has-top
has-lattice .is-lattice.has-bottom = has-bottom
has-lattice
private variable
: Level
o β o' β' : Poset o β
P Q R
abstract
: is-prop (is-frame P)
is-frame-is-prop {P = P} p q = path where
is-frame-is-prop open Order.Diagram.Top P using (H-Level-Top)
module p = is-frame p
module q = is-frame q
open is-frame
: β x y β x p.β© y β‘ x q.β© y
meetp = meet-unique (p.β©-meets x y) (q.β©-meets x y)
meetp x y
: β {I} (k : I β β P β) β p.β k β‘ q.β k
lubp = lub-unique (p.β-lubs k) (q.β-lubs k)
lubp k
: p β‘ q
path ._β©_ x y = meetp x y i
path i .β©-meets x y = is-propβpathp (Ξ» i β hlevel {T = is-meet P x y (meetp x y i)} 1) (p.β©-meets x y) (q.β©-meets x y) i
path i .has-top = hlevel {T = Top P} 1 p.has-top q.has-top i
path i .β k = lubp k i
path i .β-lubs k = is-propβpathp (Ξ» i β hlevel {T = is-lub P k (lubp k i)} 1) (p.β-lubs k) (q.β-lubs k) i
path i .β-distribl x f j = is-setβsquarep (Ξ» _ _ β Poset.Ob-is-set P)
path i (Ξ» i β meetp x (lubp f i) i)
(p.β-distribl x f) (q.β-distribl x f)
(Ξ» i β lubp (Ξ» e β meetp x (f e) i) i)
i j
instance
: β {n} β H-Level (is-frame P) (suc n)
H-Level-is-frame = prop-instance is-frame-is-prop H-Level-is-frame
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
private
module P = Poset P
module PαΆ = is-frame P-frame
module Q = Order.Reasoning Q
module QαΆ = is-frame Q-frame
open is-lub
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
unquoteDecl H-Level-is-frame-hom = declare-record-hlevel 1 H-Level-is-frame-hom (quote 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 1
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 = ext Ξ» i β biimp
Power-frame A (rec! Ξ» xi j j~i β inc (j , xi , j~i))
(rec! Ξ» j xi j~i β xi , inc (j , j~i))
So, in addition to the operation, we have a top elementβ©οΈ