Ayberk Tosun, 30 June 2023 This module contains a definition of the Scott locale of a dcpo, using the definition of dcpo from the `DomainTheory` development due to Tom de Jong. \begin{code}[hide] {-# OPTIONS --safe --without-K --lossy-unification #-} open import MLTT.Spartan open import Slice.Family open import UF.FunExt open import UF.Logic open import UF.PropTrunc open import UF.SubtypeClassifier open import UF.Subsingletons open import UF.Subsingletons-FunExt \end{code} We assume the existence of propositional truncations as well as function extensionality. \begin{code} module Locales.ScottLocale.Definition (pt : propositional-truncations-exist) (fe : Fun-Ext) (π₯ : Universe) where open Universal fe open Implication fe open Existential pt open Conjunction open import Locales.Frame pt fe open import DomainTheory.Basics.Dcpo pt fe π₯ renaming (β¨_β© to β¨_β©β) open import DomainTheory.Topology.ScottTopology pt fe π₯ open PropositionalTruncation pt \end{code} We carry out the construction in the following submodule which is parametrised by 1. a dcpo `π` whose (a) carrier set lives in universe `π€`, (b) whose relation lives in universe `π£`, and (c) whose directed joins are over families with index types living in universe `π₯`. 2. a universe `π¦` where the Scott-open subsets are to live, 3. an assumption that `π¦` satisfies propositional extensionality. \begin{code} module DefnOfScottLocale (π : DCPO {π€} {π£}) (π¦ : Universe) (pe : propext π¦) where open DefnOfScottTopology π π¦ \end{code} `πͺβ` is the type of π¦-Scott-opens over dcpo `π`. \begin{code} πͺβ-equality : (π π : πͺβ) β _ββ π οΌ _ββ π β π οΌ π πͺβ-equality U V = to-subtype-οΌ (holds-is-prop β is-scott-open) \end{code} These are ordered by inclusion. The subscript `β` in the symbol `ββ` is intended be mnemonic for "Scott open". \begin{code} _ββ_ : πͺβ β πͺβ β Ξ© (π€ β π¦) (U , _) ββ (V , _) = β±― x κ β¨ π β©β , U x β V x ββ-is-reflexive : is-reflexive _ββ_ holds ββ-is-reflexive (U , Ξ΄) _ = id ββ-is-transitive : is-transitive _ββ_ holds ββ-is-transitive (U , Ξ΄) (V , Ο΅) (W , ΞΆ) p q x = q x β p x ββ-is-antisymmetric : is-antisymmetric _ββ_ ββ-is-antisymmetric {U} {V} p q = πͺβ-equality U V (dfunext fe Ξ» x β to-subtype-οΌ (Ξ» _ β being-prop-is-prop fe) (pe (holds-is-prop (x ββ U)) (holds-is-prop (x ββ V)) (p x) (q x))) ββ-is-partial-order : is-partial-order πͺβ _ββ_ ββ-is-partial-order = (ββ-is-reflexive , ββ-is-transitive) , ββ-is-antisymmetric \end{code} The top Scott open. \begin{code} β€β : πͺβ β€β = (Ξ» _ β β€ {π¦}) , Ο , ΞΉ where Ο : is-upwards-closed (Ξ» _ β β€) holds Ο _ _ _ _ = β ΞΉ : is-inaccessible-by-directed-joins (Ξ» _ β β€) holds ΞΉ (S , (β£iβ£ , Ξ³)) β = β₯β₯-rec β-is-prop β β£iβ£ where β : index S β β _ κ index S , β€ holds β i = β£ i , β β£ β€β-is-top : (U : πͺβ) β (U ββ β€β) holds β€β-is-top U = Ξ» _ _ β β \end{code} The meet of two Scott opens. \begin{code} _β§β_ : πͺβ β πͺβ β πͺβ (U , (Ο β , ΞΉβ)) β§β (V , (Ο β , ΞΉβ)) = (Ξ» x β U x β§ V x) , Ο , ΞΉ where Ο : is-upwards-closed (Ξ» x β U x β§ V x) holds Ο x y (pβ , pβ) q = Ο β x y pβ q , Ο β x y pβ q ΞΉ : is-inaccessible-by-directed-joins (Ξ» x β U x β§ V x) holds ΞΉ (S , Ξ΄) (p , q) = β₯β₯-recβ β-is-prop Ξ³ (ΞΉβ (S , Ξ΄) p) (ΞΉβ (S , Ξ΄) q) where Ξ³ : Ξ£ i κ index S , U (S [ i ]) holds β Ξ£ j κ index S , V (S [ j ]) holds β β k κ index S , (U (S [ k ]) β§ V (S [ k ])) holds Ξ³ (i , rβ) (j , rβ) = β₯β₯-rec β-is-prop β (prβ Ξ΄ i j) where β : Ξ£ kβ κ index S , ((S [ i ]) ββ¨ π β©β (S [ kβ ]) β§ (S [ j ]) ββ¨ π β©β (S [ kβ ])) holds β β k κ index S , (U (S [ k ]) β§ V (S [ k ])) holds β (kβ , Ο , Ο) = β£ kβ , Ο β (S [ i ]) (S [ kβ ]) rβ Ο , Ο β (S [ j ]) (S [ kβ ]) rβ Ο β£ open Meets _ββ_ β§β-is-meet : (U V : πͺβ) β ((U β§β V) is-glb-of ((U , V))) holds β§β-is-meet U V = β , β‘ where β : ((U β§β V) is-a-lower-bound-of (U , V)) holds β = (Ξ» _ (p , _) β p) , (Ξ» _ (_ , q) β q) β‘ : ((W , _) : lower-bound (U , V)) β (W ββ (U β§β V)) holds β‘ (W , p) x q = prβ p x q , prβ p x q \end{code} The union of a π¦-family of Scott opens. \begin{code} ββ_ : Fam π¦ πͺβ β πͺβ ββ_ S = βS , Ο , ΞΉ where βS : β¨ π β©β β Ξ© π¦ βS = Ξ» x β Ζ i κ index S , prβ (S [ i ]) x holds Ο : is-upwards-closed βS holds Ο x y p q = β₯β₯-rec (holds-is-prop (βS y)) β p where β : Ξ£ i κ index S , (S [ i ]) .prβ x holds β βS y holds β (i , r) = β£ i , prβ (prβ (S [ i ])) x y r q β£ ΞΉ : is-inaccessible-by-directed-joins βS holds ΞΉ (T , Ξ΄) p = β₯β₯-rec β-is-prop β p where β : Ξ£ i κ index S , (S [ i ]) .prβ (β (T , Ξ΄)) holds β β k κ index T , βS (T [ k ]) holds β (i , q) = β₯β₯-rec β-is-prop β‘ (prβ (prβ (S [ i ])) (T , Ξ΄) q) where β‘ : (Ξ£ k κ index T , (S [ i ]) .prβ (T [ k ]) holds) β β k κ index T , βS (T [ k ]) holds β‘ (k , r) = β£ k , β£ i , r β£ β£ open Joins _ββ_ ββ-is-join : (S : Fam π¦ πͺβ) β ((ββ S) is-lub-of S) holds ββ-is-join S = β , β‘ where β : ((ββ S) is-an-upper-bound-of S) holds β i y p = β£ i , p β£ β‘ : ((U , _) : upper-bound S) β ((ββ S) ββ U) holds β‘ ((U , Ξ΄) , p) x q = β₯β₯-rec (holds-is-prop (U x) ) Ξ³ q where Ξ³ : Ξ£ i κ index S , (S [ i ]) .prβ x holds β U x holds Ξ³ (i , r) = p i x r \end{code} Distributivity is trivial as this is a lattice of subsets. \begin{code} distributivityβ : (U : πͺβ) (S : Fam π¦ πͺβ) β U β§β (ββ S) οΌ ββ β U β§β V β£ V Ξ΅ S β distributivityβ U S = ββ-is-antisymmetric β β‘ where β : ((U β§β (ββ S)) ββ (ββ β U β§β V β£ V Ξ΅ S β)) holds β x (p , q) = β₯β₯-rec (holds-is-prop ((ββ β U β§β V β£ V Ξ΅ S β) .prβ x)) β β q where β β : Ξ£ i κ index S , ((S [ i ]) .prβ x) holds β (ββ β U β§β V β£ V Ξ΅ S β) .prβ x holds β β (i , r) = β£ i , (p , r) β£ β‘ : ((ββ β U β§β V β£ V Ξ΅ S β) ββ (U β§β (ββ S))) holds β‘ x p = β₯β₯-rec (holds-is-prop ((U β§β (ββ S)) .prβ x)) β‘β p where β‘β : (Ξ£ i κ index S , ((U β§β (S [ i ])) .prβ x holds)) β (U β§β (ββ S)) .prβ x holds β‘β (i , (q , r)) = q , β£ i , r β£ \end{code} We now have everything we need to write down the Scott locale of `π`. \begin{code} πͺβ-frame-structure : frame-structure (π€ β π¦) π¦ πͺβ πͺβ-frame-structure = (_ββ_ , β€β , _β§β_ , ββ_) , ββ-is-partial-order , β€β-is-top , (Ξ» (U , V) β β§β-is-meet U V) , ββ-is-join , Ξ» (U , S) β distributivityβ U S ScottLocale : Locale (π₯ βΊ β π€ β π£ β π¦ βΊ) (π€ β π¦) π¦ ScottLocale = record { β¨_β©β = πͺβ ; frame-str-of = πͺβ-frame-structure } \end{code} For clarity, we define the special case of `ScottLocale` for the large and locally small case. \begin{code} module DefnOfScottLocaleLocallySmallCase (π : DCPO {π₯ βΊ} {π₯}) (pe : propext π₯) where open DefnOfScottLocale π π₯ pe ScottLocale' : Locale (π₯ βΊ) (π₯ βΊ) π₯ ScottLocale' = ScottLocale \end{code}