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 â©-meets : â x y â is-meet P x y (x â© y) has-top : Top P â : â {I : Type o} (k : I â Ob) â Ob â-lubs : â {I : Type o} (k : I â Ob) â is-lub P k (â k) â-distribl : â {I} x (f : I â Ob) â x â© â f â¡ â λ i â x â© f i
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 has-meet-slat : 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-join-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-lattice : 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 private variable o â o' â' : Level P Q R : Poset o â abstract is-frame-is-prop : is-prop (is-frame P) is-frame-is-prop {P = P} p q = path where open Order.Diagram.Top P using (H-Level-Top) module p = is-frame p module q = is-frame q open is-frame meetp : â x y â x p.â© y â¡ x q.â© y meetp x y = meet-unique (p.â©-meets x y) (q.â©-meets x y) lubp : â {I} (k : I â â P â) â p.â k â¡ q.â k lubp k = lub-unique (p.â-lubs k) (q.â-lubs k) path : p â¡ q path i ._â©_ 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) (λ 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 H-Level-is-frame : â {n} â H-Level (is-frame P) (suc n) H-Level-is-frame = prop-instance is-frame-is-prop
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) top-†: Qᶠ.top Q.†f # Pᶠ.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.
has-meet-slat-hom : 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-†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.
pres-â : â {I : Type o} (k : I â â P â) â (f # Pᶠ.â k) â¡ Qᶠ.â (apply f â k) pres-â k = Q.â€-antisym (â-†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) pres-lubs {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 = f # l Q.â€âš f .pres-†(l-lub .least _ Pᶠ.â-inj) â©Q.†f # Pᶠ.â k Q.â€âš â-†k â©Q.†Qᶠ.â (apply f â k) Q.â€âš Qᶠ.â-universal ub p â©Q.†ub Q.â€â
As a corollary, is also a homomorphism of the underlying join semilattices.
opaque unfolding Lubs.âª-joins Lubs.has-bottom has-join-slat-hom : is-join-slat-hom f Pᶠ.has-join-slat Qᶠ.has-join-slat has-join-slat-hom .is-join-slat-hom.âª-†x y = Q.â€-trans (â-†_) $ Qᶠ.â-universal _ λ where (lift true) â Qᶠ.â-inj (lift true) (lift false) â Qᶠ.â-inj (lift false) has-join-slat-hom .is-join-slat-hom.bot-†= Q.â€-trans (â-†_) (Qᶠ.â-universal _ (λ ())) 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ᶠid-frame-hom {P = P} Pᶠ.â©-†x y = Poset.â€-refl P id-frame-hom {P = P} Pᶠ.top-†= Poset.â€-refl P id-frame-hom {P = P} Pᶠ.â-†k = Poset.â€-refl P
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â â-frame-hom {R = R} {f = f} {g = g} f-pres g-pres .â©-†x y = R .Poset.â€-trans (f-pres .â©-†(g # x) (g # y)) (f .pres-†(g-pres .â©-†x y)) â-frame-hom {R = R} {f = f} {g = g} f-pres g-pres .top-†= R .Poset.â€-trans (f-pres .top-â€) (f .pres-†(g-pres .top-â€)) â-frame-hom {R = R} {f = f} {g = g} f-pres g-pres .â-†k = R .Poset.â€-trans (f .pres-†(g-pres .â-†k)) (f-pres .â-†(λ i â g # k i))
This means that we can define the category of frames as a subcategory of the category of posets.
Frame-subcat : â o â â Subcat (Posets o â) _ _ Frame-subcat o â .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 Frames : â o â â Precategory _ _ Frames o â = Subcategory (Frame-subcat o â) module Frames {o} {â} = Cat.Reasoning (Frames o â) Frame : â o â â Type _ Frame o â = Frames.Ob {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 Power-frame : â {â} (A : Type â) â Frame â â Power-frame {â = â} A .fst = Subsets A Power-frame A .snd ._â©_ P Q i = P i â§Î© Q i Power-frame A .snd .â©-meets P Q = is-meet-pointwise λ _ â Props-has-meets (P _) (Q _) Power-frame A .snd .has-top = has-top-pointwise λ _ â Props-has-top Power-frame A .snd .â k i = âΩ _ (λ j â k j i) Power-frame A .snd .â-lubs k = is-lub-pointwise _ _ λ _ â Props-has-lubs λ i â k i _ Power-frame A .snd .â-distribl x f = funext λ i â Ω-ua (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â©ïž