---
title:          Some properties of the SierpiΕ„ski locale
author:         Ayberk Tosun
date-completed: 2024-02-12
---

\begin{code}

{-# OPTIONS --safe --without-K --lossy-unification #-}

open import UF.FunExt
open import UF.Logic
open import MLTT.Spartan hiding (𝟚; β‚€; ₁)
open import UF.PropTrunc
open import UF.Subsingletons
open import UF.Size

module Locales.Sierpinski.Properties
        (𝓀  : Universe)
        (pe : Prop-Ext)
        (pt : propositional-truncations-exist)
        (fe : Fun-Ext)
        (sr : Set-Replacement pt)
       where

open import DomainTheory.Basics.Dcpo    pt fe 𝓀 renaming (⟨_⟩ to ⟨_βŸ©βˆ™)
open import DomainTheory.Basics.Pointed pt fe 𝓀 renaming (βŠ₯ to βŠ₯βˆ™)
open import DomainTheory.Topology.ScottTopology pt fe 𝓀
open import Lifting.Construction 𝓀
open import Locales.Frame pt fe hiding (is-directed)
open import Locales.InitialFrame pt fe
open import Locales.ScottLocale.Definition pt fe 𝓀
open import Locales.ScottLocale.Properties pt fe 𝓀
open import Locales.ScottLocale.ScottLocalesOfAlgebraicDcpos pt fe 𝓀
open import Locales.Sierpinski.Definition 𝓀 pe pt fe sr
open import Locales.SmallBasis pt fe sr
open import Locales.Spectrality.SpectralLocale pt fe
open import MLTT.List hiding ([_])
open import Slice.Family
open import UF.Subsingletons-FunExt
open import UF.SubtypeClassifier

open AllCombinators pt fe
open Locale
open PropositionalTruncation pt

\end{code}

We show that `π•Šπ““` is a Scott domain. We have already shown that it is an
algebraic lattice, so it remains to show that it is bounded complete.

\begin{code}

open import DomainTheory.BasesAndContinuity.ScottDomain pt fe 𝓀

open DefinitionOfBoundedCompleteness

βŠ‘β‚€-implies-βŠ‘ : (x y : ⟨ π•Šπ““ βŸ©βˆ™)
             β†’ x βŠ‘βŸ¨ π•Šπ““ ⟩ y
             β†’ (to-Ξ© x ≀[ poset-of (𝟎-π”½π•£π•ž pe) ] to-Ξ© y) holds
βŠ‘β‚€-implies-βŠ‘ _ _ (g , q) p = g p

βŠ‘-implies-βŠ‘β‚€ : (x y : ⟨ π•Šπ““ βŸ©βˆ™)
             β†’ (to-Ξ© x ≀[ poset-of (𝟎-π”½π•£π•ž pe) ] to-Ξ© y) holds
             β†’ x βŠ‘βŸ¨ π•Šπ““ ⟩ y
βŠ‘-implies-βŠ‘β‚€ (P , f , h) (Pβ€² , fβ€² , hβ€²) p = p , (Ξ» _ β†’ πŸ™-is-prop ⋆ ⋆)

π•Šπ““-bounded-complete : bounded-complete π•Šπ““ holds
π•Šπ““-bounded-complete S _ = sup , Ο†
 where
  Sβ‚€ : Fam 𝓀 (Ξ© 𝓀)
  Sβ‚€ = ⁅ to-Ξ© P ∣ P Ξ΅ S ⁆

  supβ‚€ : Ξ© 𝓀
  supβ‚€ = ⋁[ (𝟎-π”½π•£π•ž pe) ] Sβ‚€

  sup : ⟨ π•Šπ““ βŸ©βˆ™
  sup = supβ‚€ holds , (Ξ» _ β†’ ⋆) , βˆƒ-is-prop

  Ο… : is-upperbound (underlying-order π•Šπ““) sup (S [_])
  Ο… i = † , ‑
   where
    † : is-defined (S [ i ]) β†’ is-defined sup
    † p = ∣ i , p ∣

    ‑ : value (S [ i ]) ∼ (Ξ» x₁ β†’ value sup († x₁))
    ‑ _ = πŸ™-is-prop ⋆ ⋆

  Ο‘ : is-lowerbound-of-upperbounds (underlying-order π•Šπ““) sup (S [_])
  Ο‘ (P , f , h) q = βŠ‘-implies-βŠ‘β‚€ sup (P , f , h) (⋁[ 𝟎-π”½π•£π•ž pe ]-least Sβ‚€ ((P , h) , (Ξ» i β†’ pr₁ (q i))))

  Ο† : is-sup (underlying-order π•Šπ““) sup (S [_])
  Ο† = Ο… , Ο‘

\end{code}

Finally, we show that `π•Šπ““` trivially satisfies the decidability condition that
we assume in the proof that Scott locales of Scott domains are spectral.

\begin{code}

open import Locales.ScottLocale.ScottLocalesOfScottDomains pt fe sr 𝓀

π•Šπ““-satisfies-dc : decidability-condition π•Šπ““
π•Šπ““-satisfies-dc 𝒫₀@(Pβ‚€ , hβ‚€ , fβ‚€) 𝒫₁@(P₁ , h₁ , f₁) ΞΊc ΞΊd =
 inl ∣ up , ‑ ∣
  where
   up : ⟨ π•Šπ““ βŸ©βˆ™
   up = to-π•Šπ““ (to-Ξ© 𝒫₀ ∨[ 𝟎-π”½π•£π•ž pe ] to-Ξ© 𝒫₁)

   open Joins {A = ⟨ π•Šπ““ βŸ©βˆ™} (Ξ» x y β†’ (x βŠ‘βŸ¨ π•Šπ““ ⟩ y) , prop-valuedness π•Šπ““ x y)

   ‑ : (up is-an-upper-bound-of (binary-family 𝓀 𝒫₀ 𝒫₁)) holds
   ‑ (inl ⋆) = (Ξ» p β†’ ∣ inl ⋆ , p ∣) , Ξ» _ β†’ πŸ™-is-prop ⋆ ⋆
   ‑ (inr ⋆) = (Ξ» p β†’ ∣ inr ⋆ , p ∣) , Ξ» _ β†’ πŸ™-is-prop ⋆ ⋆

\end{code}

From all these, we obtain the fact that `π•Š` is a spectral locale, which we call
`π•Š-is-spectral` below.

\begin{code}

π•Šπ““-has-least : has-least (underlying-order π•Šπ““)
π•Šπ““-has-least = (βŠ₯βˆ™ π•Šπ““βŠ₯) , βŠ₯-is-least π•Šπ““βŠ₯

open ScottLocaleConstruction π•Šπ““ hscb pe
open SpectralScottLocaleConstruction π•Šπ““ π•Šπ““-has-least hscb π•Šπ““-satisfies-dc π•Šπ““-bounded-complete pe
open ScottLocaleProperties π•Šπ““ π•Šπ““-has-least hscb pe
open DefnOfScottLocale π•Šπ““ 𝓀 pe using (π’ͺβ‚›-equality; _βŠ†β‚›_)

β„¬π•Š : Fam 𝓀 ⟨ π’ͺ π•Š ⟩
β„¬π•Š = List (𝟚 𝓀) , 𝜸

principal-filter-on-₁-is-truth : ↑ᡏ[ ₁ ] = truth
principal-filter-on-₁-is-truth = ≀-is-antisymmetric (poset-of (π’ͺ π•Š)) † ‑
 where
  †₀ : (↑ᡏ[ ₁ ] βŠ†β‚› truth) holds
  †₀ (P , f , Ο†) (p , _) = p ⋆

  † : (↑ᡏ[ ₁ ] βŠ†β‚– truth) holds
  † = βŠ†β‚›-implies-βŠ†β‚– ↑ᡏ[ ₁ ] truth †₀

  ‑₀ : (truth βŠ†β‚› ↑ᡏ[ ₁ ]) holds
  ‑₀ (P , f , Ο†) p = (Ξ» x β†’ p) , Ξ» { _ β†’ πŸ™-is-prop ⋆ ⋆ }

  ‑ : (truth βŠ†β‚– ↑ᡏ[ ₁ ]) holds
  ‑ = βŠ†β‚›-implies-βŠ†β‚– truth ↑ᡏ[ ₁ ] ‑₀

π•Š-is-spectralα΄° : spectralα΄° π•Š
π•Š-is-spectralα΄° = Οƒα΄°


π•Š-is-spectral : is-spectral π•Š holds
π•Š-is-spectral = spectralα΄°-gives-spectrality π•Š Οƒα΄°

π•Š-has-small-𝒦 : has-small-𝒦 π•Š
π•Š-has-small-𝒦 = spectralα΄°-implies-small-𝒦 π•Š Οƒα΄°

\end{code}

Added on 2024-03-09.

A basic open of the SierpiΕ„ski locale is either `𝟏`, `truth`, or `𝟎`. In fact,
because the basic open coincide with the compact opens in spectral locales, a
corollary of this is that these three elements form a basis for SierpiΕ„ski.

\begin{code}

basis-trichotomy : (bs : List (𝟚 𝓀))
                 β†’ (𝜸 bs = 𝟏[ π’ͺ π•Š ]) + (𝜸 bs = truth) + (𝜸 bs = 𝟎[ π’ͺ π•Š ])
basis-trichotomy []       = inr (inr p)
                             where
                              p : 𝜸 [] = 𝟎[ π’ͺ π•Š ]
                              p = 𝜸 []     =⟨ 𝜸-equal-to-πœΈβ‚ [] ⟩
                                  πœΈβ‚ []    =⟨ refl             ⟩
                                  𝟎[ π’ͺ π•Š ] ∎
basis-trichotomy (β‚€ ∷ bs) = inl p
                             where
                              β…  = 𝜸-equal-to-πœΈβ‚ (β‚€ ∷ bs)
                              β…‘ = ap (Ξ» - β†’ - ∨[ π’ͺ π•Š ] πœΈβ‚ bs) ↑βŠ₯-is-top
                              β…’ = 𝟏-left-annihilator-for-∨ (π’ͺ π•Š) (πœΈβ‚ bs)

                              p : 𝜸 (β‚€ ∷ bs) = 𝟏[ π’ͺ π•Š ]
                              p = 𝜸 (β‚€ ∷ bs)               =⟨ β…     ⟩
                                  πœΈβ‚ (β‚€ ∷ bs)              =⟨ refl ⟩
                                  ↑ᡏ[ β‚€ ] ∨[ π’ͺ π•Š ] πœΈβ‚ bs   =⟨ β…‘    ⟩
                                  𝟏[ π’ͺ π•Š ] ∨[ π’ͺ π•Š ] πœΈβ‚ bs  =⟨ β…’    ⟩
                                  𝟏[ π’ͺ π•Š ]                 ∎
basis-trichotomy (₁ ∷ bs) = cases₃ case₁ caseβ‚‚ case₃ IH
 where
  IH : (𝜸 bs = 𝟏[ π’ͺ π•Š ]) + (𝜸 bs = truth) + (𝜸 bs = 𝟎[ π’ͺ π•Š ])
  IH = basis-trichotomy bs

  case₁ : 𝜸 bs = 𝟏[ π’ͺ π•Š ]
        β†’ (𝜸 (₁ ∷ bs) = 𝟏[ π’ͺ π•Š ]) + (𝜸 (₁ ∷ bs) = truth) + (𝜸 (₁ ∷ bs) = 𝟎[ π’ͺ π•Š ])
  case₁ q = inl r
   where
    β…‘ = ap
         (Ξ» - β†’ ↑ᡏ[ ₁ ] ∨[ π’ͺ π•Š ] -)
         (πœΈβ‚ bs =⟨ 𝜸-equal-to-πœΈβ‚ bs ⁻¹ ⟩ 𝜸 bs =⟨ q ⟩ 𝟏[ π’ͺ π•Š ] ∎ )
    β…’ = 𝟏-right-annihilator-for-∨ (π’ͺ π•Š) ↑ᡏ[ ₁ ]

    r : 𝜸 (₁ ∷ bs) = 𝟏[ π’ͺ π•Š ]
    r = 𝜸 (₁ ∷ bs)                =⟨ 𝜸-equal-to-πœΈβ‚ (₁ ∷ bs) ⟩
        πœΈβ‚ (₁ ∷ bs)               =⟨ refl ⟩
        ↑ᡏ[ ₁ ] ∨[ π’ͺ π•Š ] πœΈβ‚ bs    =⟨ β…‘ ⟩
        ↑ᡏ[ ₁ ] ∨[ π’ͺ π•Š ] 𝟏[ π’ͺ π•Š ] =⟨ β…’ ⟩
        𝟏[ π’ͺ π•Š ]                  ∎

  caseβ‚‚ : 𝜸 bs = truth
        β†’ (𝜸 (₁ ∷ bs) = 𝟏[ π’ͺ π•Š ]) + (𝜸 (₁ ∷ bs) = truth) + (𝜸 (₁ ∷ bs) = 𝟎[ π’ͺ π•Š ])
  caseβ‚‚ q = inr (inl r)
   where
    β…‘ = ap (Ξ» - β†’ - ∨[ π’ͺ π•Š ] πœΈβ‚ bs) principal-filter-on-₁-is-truth
    β…’ = ap (Ξ» - β†’ truth ∨[ π’ͺ π•Š ] -) (𝜸-equal-to-πœΈβ‚ bs ⁻¹)
    β…£ = ap (Ξ» - β†’ truth ∨[ π’ͺ π•Š ] -) q
    β…€ = ∨[ π’ͺ π•Š ]-is-idempotent truth ⁻¹

    r : 𝜸 (₁ ∷ bs) = truth
    r = 𝜸 (₁ ∷ bs)               =⟨ 𝜸-equal-to-πœΈβ‚ (₁ ∷ bs) ⟩
        πœΈβ‚ (₁ ∷ bs)              =⟨ refl                   ⟩
        ↑ᡏ[ ₁ ] ∨[ π’ͺ π•Š ] πœΈβ‚ bs   =⟨ β…‘                      ⟩
        truth ∨[ π’ͺ π•Š ] πœΈβ‚ bs     =⟨ β…’                      ⟩
        truth ∨[ π’ͺ π•Š ] 𝜸 bs      =⟨ β…£                      ⟩
        truth ∨[ π’ͺ π•Š ] truth     =⟨ β…€                      ⟩
        truth                    ∎

  case₃ : 𝜸 bs = 𝟎[ π’ͺ π•Š ]
        β†’ (𝜸 (₁ ∷ bs) = 𝟏[ π’ͺ π•Š ]) + (𝜸 (₁ ∷ bs) = truth) + (𝜸 (₁ ∷ bs) = 𝟎[ π’ͺ π•Š ])
  case₃ q = inr (inl r)
   where
    β…  = 𝜸-equal-to-πœΈβ‚ (₁ ∷ bs)
    β…‘ = ap
         (Ξ» - β†’ ↑ᡏ[ ₁ ] ∨[ π’ͺ π•Š ] -)
         (πœΈβ‚ bs =⟨ 𝜸-equal-to-πœΈβ‚ bs ⁻¹ ⟩ 𝜸 bs =⟨ q ⟩ 𝟎[ π’ͺ π•Š ] ∎)
    β…’ = 𝟎-left-unit-of-∨ (π’ͺ π•Š) ↑ᡏ[ ₁ ]
    β…£ = principal-filter-on-₁-is-truth

    r : 𝜸 (₁ ∷ bs) = truth
    r = 𝜸 (₁ ∷ bs)                =⟨ β…      ⟩
        πœΈβ‚ (₁ ∷ bs)               =⟨ refl  ⟩
        ↑ᡏ[ ₁ ] ∨[ π’ͺ π•Š ] πœΈβ‚ bs    =⟨ β…‘     ⟩
        ↑ᡏ[ ₁ ] ∨[ π’ͺ π•Š ] 𝟎[ π’ͺ π•Š ] =⟨ β…’     ⟩
        ↑ᡏ[ ₁ ]                   =⟨ β…£     ⟩
        truth                     ∎

\end{code}

Added on 2024-03-11.

\begin{code}

open DefnOfScottTopology π•Šπ““ 𝓀

contains-βŠ₯β‚›-implies-contains-βŠ€β‚› : (π”˜ : ⟨ π’ͺ π•Š ⟩) β†’ (βŠ₯β‚› βˆˆβ‚› π”˜ β‡’ βŠ€β‚› βˆˆβ‚› π”˜) holds
contains-βŠ₯β‚›-implies-contains-βŠ€β‚› π”˜ ΞΌ = transport (Ξ» - β†’ (βŠ€β‚› βˆˆβ‚› -) holds) (q ⁻¹) ⋆
 where
  open π’ͺβ‚›α΄Ώ

  q : π”˜ = 𝟏[ π’ͺ π•Š ]
  q = contains-bottom-implies-is-𝟏 π”˜ ΞΌ

holds-gives-equal-βŠ€β‚› : (P : ⟨ π•Šπ““ βŸ©βˆ™) β†’ (P βˆˆβ‚› truth) holds β†’ P = βŠ€β‚›
holds-gives-equal-βŠ€β‚› (P , f , Ο†) p =
 to-subtype-=
  (Ξ» Q β†’ Γ—-is-prop (Ξ -is-prop fe (Ξ» _ β†’ πŸ™-is-prop)) (being-prop-is-prop fe))
  (holds-gives-equal-πŸ™ pe P Ο† p)

contains-βŠ€β‚›-implies-above-truth : (π”˜ : ⟨ π’ͺ π•Š ⟩)
                                β†’ (βŠ€β‚› βˆˆβ‚› π”˜) holds
                                β†’ (truth ≀[ poset-of (π’ͺ π•Š) ] π”˜) holds
contains-βŠ€β‚›-implies-above-truth π”˜ ΞΌβ‚œ = βŠ†β‚›-implies-βŠ†β‚– truth π”˜ †
 where
  † : (truth βŠ†β‚› π”˜) holds
  † P ΞΌβ‚š = transport (Ξ» - β†’ (- βˆˆβ‚› π”˜) holds) (holds-gives-equal-βŠ€β‚› P ΞΌβ‚š ⁻¹) ΞΌβ‚œ

\end{code}

Added on 2024-03-11.

If a Scott open `π”˜` is above truth, then it obviously contains the true
proposition `βŠ€β‚›`.

\begin{code}

above-truth-implies-contains-βŠ€β‚› : (π”˜ : ⟨ π’ͺ π•Š ⟩)
                                β†’ (truth ≀[ poset-of (π’ͺ π•Š) ] π”˜) holds
                                β†’ (βŠ€β‚› βˆˆβ‚› π”˜) holds
above-truth-implies-contains-βŠ€β‚› π”˜ p = βŠ†β‚–-implies-βŠ†β‚› truth π”˜ p βŠ€β‚› ⋆

\end{code}