Ayberk Tosun, 10 March 2021. Based in part on `ayberkt/formal-topology-in-UF`. \begin{code}[hide] {-# OPTIONS --safe --without-K #-} open import MLTT.Spartan hiding (๐) open import UF.FunExt open import UF.PropTrunc module Locales.InitialFrame (pt : propositional-truncations-exist) (fe : Fun-Ext) where open import Locales.ContinuousMap.FrameHomomorphism-Definition pt fe open import Locales.ContinuousMap.FrameHomomorphism-Properties pt fe open import Locales.Frame pt fe open import Slice.Family open import UF.Logic open import UF.Sets open import UF.Subsingletons open import UF.SubtypeClassifier open AllCombinators pt fe \end{code} \section{The underlying poset} We start with the partial ordering on `ฮฉ`: \begin{code} _โ_ : ฮฉ ๐ฅ โ ฮฉ ๐ฆ โ ฮฉ (๐ฅ โ ๐ฆ) P โ Q = P โ Q โ-is-reflexive : is-reflexive {A = ฮฉ ๐ค} _โ_ holds โ-is-reflexive P = id โ-is-transitive : is-transitive {A = ฮฉ ๐ค} _โ_ holds โ-is-transitive _ _ _ p q = q โ p โ-is-antisymmetric : {๐ค : Universe} โ propext ๐ค โ is-antisymmetric {A = ฮฉ ๐ค} _โ_ โ-is-antisymmetric pe {P} {Q} ฯ ฯ = ฮฉ-ext pe fe โ โก where โ : P ๏ผ โค โ Q ๏ผ โค โ = holds-gives-equal-โค pe fe Q โ ฯ โ equal-โค-gives-true (P holds) (holds-is-prop P) โก : Q ๏ผ โค โ P ๏ผ โค โก = holds-gives-equal-โค pe fe P โ ฯ โ equal-โค-gives-true (Q holds) (holds-is-prop Q) โ-is-partial-order : {๐ค : Universe} โ propext ๐ค โ is-partial-order (ฮฉ ๐ค) _โ_ โ-is-partial-order pe = (โ-is-reflexive , โ-is-transitive) , โ-is-antisymmetric pe \end{code} This gives us a poset structure at universe ๐ค: \begin{code} ๐F-poset-str : {๐ค : Universe} โ propext ๐ค โ poset-structure ๐ค (ฮฉ ๐ค) ๐F-poset-str pe = _โ_ , (โ-is-reflexive , โ-is-transitive) , โ-is-antisymmetric pe ๐F-poset : {๐ค : Universe} โ propext ๐ค โ Poset (๐ค โบ) ๐ค ๐F-poset {๐ค = ๐ค} pe = ฮฉ ๐ค , ๐F-poset-str pe \end{code} \section{Definition of the initial frame} \begin{code} open propositional-truncations-exist pt ๐-๐ฝ๐ฃ๐ : {๐ค : Universe} โ propext ๐ค โ Frame (๐ค โบ) ๐ค ๐ค ๐-๐ฝ๐ฃ๐ {๐ค = ๐ค} pe = ฮฉ ๐ค , (_โ_ , โค {๐ค} , _โง_ , โ_) , โ-is-partial-order pe , top , meet , join , dist where โ_ : Fam ๐ค (ฮฉ ๐ค) โ ฮฉ ๐ค โ U = ฦ i ๊ index U , ((U [ i ]) holds) open Meets _โ_ renaming (is-top to is-the-top) top : is-the-top (โค {๐ค}) holds top _ _ = โ meet : (โฑฏ (P , Q) , (P โง Q) is-glb-of (P , Q)) holds meet (P , Q) = ฮฒ , ฮณ where ฮฒ : ((P โง Q) is-a-lower-bound-of (P , Q)) holds ฮฒ = prโ , prโ ฮณ : (โฑฏ (R , _) ๊ lower-bound (P , Q ) , R โ (P โง Q)) holds ฮณ (R , ฯ , ฯ) r = ฯ r , ฯ r open Joins _โ_ open JoinNotation โ_ join : (โฑฏ U ๊ Fam ๐ค (ฮฉ ๐ค) , ((โ U) is-lub-of U)) holds join U = (ฮป i u โ โฃ i , u โฃ) , ฮณ where ฮณ : (โฑฏ (P , _) ๊ upper-bound U , (โ U) โ P) holds ฮณ ((A , A-prop) , q) r = โฅโฅ-rec A-prop (uncurry q) r abstract iss : is-set (ฮฉ ๐ค) iss = carrier-of-[ ๐F-poset pe ]-is-set dist : (โฑฏ(P , U) ๊ ฮฉ ๐ค ร Fam ๐ค (ฮฉ ๐ค) , (P โง (โ U) ๏ผ[ iss ]๏ผ โโจ i โฉ P โง U [ i ])) holds dist (P , U) = โค-is-antisymmetric (๐F-poset pe) ฮฒ ฮณ where ฮฒ : (P โง โ U โ (โโจ i โฉ (P โง U [ i ]))) holds ฮฒ (p , u) = โฅโฅ-rec (holds-is-prop (โโจ i โฉ (P โง U [ i ]))) ฮฑ u where ฮฑ : ฮฃ i ๊ index U , (U [ i ]) holds โ (โโจ i โฉ P โง U [ i ]) holds ฮฑ (i , uแตข) = โฃ i , p , uแตข โฃ ฮณ : ((โโจ i โฉ P โง U [ i ]) โ P โง โ U) holds ฮณ p = โฅโฅ-rec (holds-is-prop (P โง (โ U))) ฮด p where ฮด : Sigma (index (index U , (ฮป i โ P โง U [ i ]))) (ฮป i โ ((index U , (ฮป iโ โ P โง U [ iโ ])) [ i ]) holds) โ (P โง (โ U)) holds ฮด (i , q , uแตข) = q , โฃ i , uแตข โฃ \end{code} \begin{code} ๐-of-IF-is-โฅ : {๐ฆ : Universe} โ (pe : propext ๐ฆ) โ ๐[ ๐-๐ฝ๐ฃ๐ pe ] ๏ผ โฅ ๐-of-IF-is-โฅ pe = โค-is-antisymmetric (poset-of (๐-๐ฝ๐ฃ๐ pe)) ฮณ ฮป () where ฮณ : (๐[ ๐-๐ฝ๐ฃ๐ pe ] โค[ poset-of (๐-๐ฝ๐ฃ๐ pe) ] โฅ) holds ฮณ x = โฅโฅ-rec ๐-is-prop (ฮป ()) x \end{code} \section{Proof of initiality} \begin{code} f : {๐ฆ : Universe} โ (pe : propext ๐ฆ) โ (A : Frame ๐ค ๐ฅ ๐ฆ) โ โจ ๐-๐ฝ๐ฃ๐ pe โฉ โ โจ A โฉ f pe A P = โ[ A ] โ ๐[ A ] โฃ x โถ P holds โ \end{code} \begin{code} f-respects-โค : {๐ฆ : Universe} (pe : propext ๐ฆ) (A : Frame ๐ค ๐ฅ ๐ฆ) โ f pe A ๐[ ๐-๐ฝ๐ฃ๐ pe ] ๏ผ ๐[ A ] f-respects-โค pe A = โค-is-antisymmetric (poset-of A) ฮฑ ฮฒ where open PosetNotation (poset-of A) renaming (_โค_ to _โคA_) ฮฑ : (f pe A ๐[ ๐-๐ฝ๐ฃ๐ pe ] โคA ๐[ A ]) holds ฮฑ = ๐-is-top A (f pe A ๐[ ๐-๐ฝ๐ฃ๐ pe ]) ฮฒ : (๐[ A ] โคA f pe A ๐[ ๐-๐ฝ๐ฃ๐ pe ]) holds ฮฒ = โ[ A ]-upper (โ ๐[ A ] โฃ x โถ โค holds โ) โ \end{code} \begin{code} f-respects-โง : {๐ฆ : Universe} (pe : propext ๐ฆ) โ (A : Frame ๐ค ๐ฅ ๐ฆ) โ (P Q : ฮฉ ๐ฆ) โ f pe A (P โง Q) ๏ผ (f pe A P) โง[ A ] (f pe A Q) f-respects-โง pe A P Q = f pe A (P โง Q) ๏ผโจ refl โฉ โ[ A ] โ ๐[ A ] โฃ _ โถ (P โง Q) holds โ ๏ผโจ i โฉ โ[ A ] โ ๐[ A ] โง[ A ] ๐[ A ] โฃ _ โถ (P โง Q) holds โ ๏ผโจ ii โฉ (f pe A P) โง[ A ] (f pe A Q) โ where i = ap (ฮป - โ โ[ A ] โ - โฃ _ โถ _ โ) (โง[ A ]-is-idempotent ๐[ A ]) ii = distributivity+ A โ ๐[ A ] โฃ _ โถ P holds โ โ ๐[ A ] โฃ _ โถ Q holds โ โปยน \end{code} \begin{code} f-respects-โ : {๐ฆ : Universe} โ (pe : propext ๐ฆ) โ (A : Frame ๐ค ๐ฅ ๐ฆ) (U : Fam ๐ฆ (ฮฉ ๐ฆ)) โ let open Joins (ฮป x y โ x โค[ poset-of A ] y) in ((f pe A (โ[ ๐-๐ฝ๐ฃ๐ pe ] U)) is-lub-of โ f pe A x โฃ x ฮต U โ) holds f-respects-โ pe A U = ฮฒ , ฮณ where open Joins (ฮป x y โ x โค[ poset-of A ] y) open PosetReasoning (poset-of A) renaming (_โ to _QED) open PosetNotation (poset-of A) ฮฒ : ((f pe A (โ[ ๐-๐ฝ๐ฃ๐ pe ] U)) is-an-upper-bound-of โ f pe A x โฃ x ฮต U โ) holds ฮฒ i = โ[ A ]-least โ ๐[ A ] โฃ _ โถ (U [ i ]) holds โ (_ , ฮป p โ โ[ A ]-upper _ โฃ i , p โฃ) ฮณ : (โฑฏ (x , _) ๊ upper-bound โ f pe A u โฃ u ฮต U โ , f pe A (โ[ ๐-๐ฝ๐ฃ๐ pe ] U) โค x) holds ฮณ (x , p) = โ[ A ]-least _ (_ , โฅโฅ-rec (holds-is-prop (_ โค _)) ฮน) where ฮน : (ฮฃ i ๊ index U , (U [ i ]) holds) โ (๐[ A ] โค x) holds ฮน (i , uแตข) = ๐[ A ] โคโจ โ[ A ]-upper _ uแตข โฉ _ โคโจ p i โฉ x QED \end{code} \begin{code} open FrameHomomorphisms open FrameHomomorphismProperties ๐ป : {๐ฆ : Universe} (pe : propext ๐ฆ) (F : Frame ๐ค ๐ฅ ๐ฆ) โ (๐-๐ฝ๐ฃ๐ pe) โfโ F ๐ป pe F = (f pe F) , f-respects-โค pe F , f-respects-โง pe F , f-respects-โ pe F \end{code} \begin{code} main-lemma : {๐ฆ : Universe} (pe : propext ๐ฆ) (P : ฮฉ ๐ฆ) โ (P โ (โ[ ๐-๐ฝ๐ฃ๐ pe ] โ ๐[ ๐-๐ฝ๐ฃ๐ pe ] โฃ x โถ P holds โ)) holds main-lemma pe P p = โ[ ๐-๐ฝ๐ฃ๐ pe ]-upper (โ ๐[ ๐-๐ฝ๐ฃ๐ pe ] โฃ x โถ P holds โ) p โ \end{code} \begin{code} ๐ป-is-unique : {๐ฆ : Universe} (pe : propext ๐ฆ) (F : Frame ๐ค ๐ฅ ๐ฆ) โ (โ : (๐-๐ฝ๐ฃ๐ pe) โfโ F) โ ๐ป pe F ๏ผ โ ๐ป-is-unique pe F โ@ (g , ฮถ@ (ฯ , ฯ , ฯ)) = to-subtype-๏ผ (holds-is-prop โ is-a-frame-homomorphism (๐-๐ฝ๐ฃ๐ pe) F) ฮฒ where open Joins (ฮป x y โ x โค[ poset-of F ] y) open PosetReasoning (poset-of F) renaming (_โ to _QED) g-is-monotonic : is-monotonic (๐F-poset pe) (poset-of F) g holds g-is-monotonic = frame-morphisms-are-monotonic (๐-๐ฝ๐ฃ๐ pe) F g ฮถ ฮณ : f pe F โผ g ฮณ P = โ[ F ]-unique _ _ (ฮด , ฮต) โปยน where ฮด : (g P is-an-upper-bound-of (P holds , ฮป _ โ ๐[ F ])) holds ฮด p = ๐[ F ] โคโจ reflexivity+ (poset-of F) (ฯ โปยน) โฉ g โค โคโจ g-is-monotonic (โค , P) (ฮป _ โ p) โฉ g P QED ฮต : (โฑฏ (u , _) ๊ upper-bound (P holds , ฮป _ โ ๐[ F ]) , g P โค[ poset-of F ] u) holds ฮต (u , q) = g P โคโจ i โฉ g (โ[ ๐-๐ฝ๐ฃ๐ pe ] โ โค โฃ _ โถ P holds โ) โคโจ ii โฉ โ[ F ] โ g โค โฃ _ โถ P holds โ โคโจ iii โฉ โ[ F ] โ ๐[ F ] โฃ _ โถ P holds โ โคโจ โ[ F ]-least _ (u , q) โฉ u QED where i = g-is-monotonic (P , (โ[ ๐-๐ฝ๐ฃ๐ pe ] โ โค โฃ _ โถ (P holds) โ)) (main-lemma pe P) ii = reflexivity+ (poset-of F) ((โ[ F ]-unique _ _ (ฯ (โ โค โฃ _ โถ (P holds) โ)))) iii = reflexivity+ (poset-of F) (ap (ฮป - โ โ[ F ] (P holds , -)) (dfunext fe ฯ )) where ฯ : (ฮป _ โ g โค) โผ (ฮป _ โ ๐[ F ]) ฯ _ = ฯ ฮฒ : f pe F ๏ผ g ฮฒ = dfunext fe ฮณ \end{code} \begin{code} ๐-๐ฝ๐ฃ๐-initial : {๐ฆ : Universe} (pe : propext ๐ฆ) (F : Frame ๐ค ๐ฅ ๐ฆ) โ is-singleton (๐-๐ฝ๐ฃ๐ pe โfโ F) ๐-๐ฝ๐ฃ๐-initial pe F = (๐ป pe F) , ๐ป-is-unique pe F \end{code} The initial frame is the terminal locale \begin{code} ๐Loc : {๐ค : Universe} (pe : propext ๐ค) โ Locale (๐ค โบ) ๐ค ๐ค ๐Loc {๐ค} pe = record { โจ_โฉโ = ฮฉ ๐ค ; frame-str-of = prโ (๐-๐ฝ๐ฃ๐ pe) } \end{code} \section{Spectrality} \begin{code} module Spectrality-of-๐ (๐ค : Universe) (pe : propext ๐ค) where โฌ๐ : Fam ๐ค โจ ๐-๐ฝ๐ฃ๐ pe โฉ โฌ๐ = ๐ ๐ค , h where h : ๐ ๐ค โ โจ ๐-๐ฝ๐ฃ๐ pe โฉ h (inl โ) = โฅ h (inr โ) = โค \end{code} \begin{code} ๐ฎ : โจ ๐-๐ฝ๐ฃ๐ pe โฉ โ Fam ๐ค (๐ ๐ค) ๐ฎ (P , p) = โ inr โ โฃ _ โถ P โ โฌ๐-is-basis-for-๐ : is-basis-for (๐-๐ฝ๐ฃ๐ pe) โฌ๐ โฌ๐-is-basis-for-๐ (P , p) = ๐ฎ (P , p) , ฮฒ , ฮณ where open Joins (ฮป x y โ x โค[ poset-of (๐-๐ฝ๐ฃ๐ pe) ] y) ฮฒ : ((P , p) is-an-upper-bound-of โ โฌ๐ [ b ] โฃ b ฮต ๐ฎ (P , p) โ) holds ฮฒ p โ = p open PosetReasoning (poset-of (๐-๐ฝ๐ฃ๐ pe)) ฮณ : ((u , _) : upper-bound โ โฌ๐ [ b ] โฃ b ฮต ๐ฎ (P , p) โ) โ ((P , p) โค[ poset-of (๐-๐ฝ๐ฃ๐ pe) ] u) holds ฮณ (U , q) p = q p โ โฌ๐โ : Fam ๐ค โจ ๐-๐ฝ๐ฃ๐ pe โฉ โฌ๐โ = directify (๐-๐ฝ๐ฃ๐ pe) โฌ๐ โฌ๐โ-is-basis : is-basis-for (๐-๐ฝ๐ฃ๐ pe) โฌ๐โ โฌ๐โ-is-basis = directified-basis-is-basis (๐-๐ฝ๐ฃ๐ pe) โฌ๐ โฌ๐-is-basis-for-๐ ๐ฎโ : โจ ๐-๐ฝ๐ฃ๐ pe โฉ โ Fam ๐ค โจ ๐-๐ฝ๐ฃ๐ pe โฉ ๐ฎโ U = โ โฌ๐โ [ b ] โฃ b ฮต prโ (โฌ๐โ-is-basis U) โ \end{code} \begin{code} โฌ๐-is-directed-basis-for-๐ : is-directed-basis (๐-๐ฝ๐ฃ๐ pe) โฌ๐โ โฌ๐-is-directed-basis-for-๐ = โฌ๐โ-is-basis , d where d : (U : โจ ๐-๐ฝ๐ฃ๐ pe โฉ) โ is-directed (๐-๐ฝ๐ฃ๐ pe) (๐ฎโ U) holds d = covers-of-directified-basis-are-directed (๐-๐ฝ๐ฃ๐ pe) โฌ๐ โฌ๐-is-basis-for-๐ \end{code} Added on 2024-05-17. It is sometimes conventient to refer to the initial frame as โฮฉ viewed as a frameโ, and we add some notation to highlight this. \begin{code} ฮฉ-Frm : Frame (๐ค โบ) ๐ค ๐ค ฮฉ-Frm = ๐-๐ฝ๐ฃ๐ pe \end{code}