---
title:         Properties of the Scott locale
author:        Ayberk Tosun
date-started:  2023-11-23
dates-updated: [2024-03-16]
---

\begin{code}[hide]

{-# OPTIONS --safe --without-K --exact-split --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

\end{code}

We assume the existence of propositional truncations as well as function
extensionality.

\begin{code}

module Locales.ScottLocale.Properties (pt : propositional-truncations-exist)
                                      (fe : Fun-Ext)
                                      (𝓀  : Universe) where

open import DomainTheory.BasesAndContinuity.Bases            pt fe 𝓀
open import DomainTheory.Basics.Dcpo                         pt fe 𝓀
 renaming (⟨_⟩ to ⟨_βŸ©βˆ™) hiding   (is-directed)
open import DomainTheory.Basics.WayBelow                     pt fe 𝓀
open import DomainTheory.Topology.ScottTopology              pt fe 𝓀
open import DomainTheory.Topology.ScottTopologyProperties    pt fe 𝓀
open import Locales.Compactness.Definition                              pt fe
 hiding (is-compact)
open import Locales.Frame                                    pt fe
open import Locales.ScottLocale.Definition                   pt fe 𝓀
open import Locales.ScottLocale.ScottLocalesOfAlgebraicDcpos pt fe 𝓀

open AllCombinators pt fe
open Locale
open PropositionalTruncation pt

\end{code}

Moved from the `ScottLocalesOfScottDomains` module to here on 2024-03-16.

\begin{code}

bounded-above : (𝓓 : DCPO {𝓀 ⁺} {𝓀}) β†’ ⟨ 𝓓 βŸ©βˆ™ β†’ ⟨ 𝓓 βŸ©βˆ™ β†’ Ξ© (𝓀 ⁺)
bounded-above 𝓓 x y = βˆ₯ upper-bound (binary-family 𝓀 x y) βˆ₯Ξ©
 where
  open Joins (Ξ» a b β†’ a βŠ‘βŸ¨ 𝓓 βŸ©β‚š b)

infix 30 bounded-above

syntax bounded-above 𝓓 x y = x ↑[ 𝓓 ] y

\end{code}

\begin{code}

module ScottLocaleProperties
        (𝓓    : DCPO {𝓀 ⁺} {𝓀})
        (hl   : has-least (underlying-order 𝓓))
        (hscb : has-specified-small-compact-basis 𝓓)
        (pe   : propext 𝓀)
       where

 open ScottLocaleConstruction 𝓓 hscb pe

 private
  B : 𝓀  Μ‡
  B = index-of-compact-basis 𝓓 hscb

  Ξ² : B β†’ ⟨ 𝓓 βŸ©βˆ™
  Ξ² i = family-of-compact-elements 𝓓 hscb i

 open Properties  𝓓
 open BottomLemma 𝓓 𝕒 hl

 βŠ₯ΞΊ : is-compact 𝓓 βŠ₯α΄°
 βŠ₯ΞΊ = βŠ₯-is-compact (𝓓 , hl)

 Σ⦅𝓓⦆ : Locale (𝓀 ⁺) 𝓀 𝓀
 Σ⦅𝓓⦆ = ScottLocale

 open DefnOfScottLocale 𝓓 𝓀 pe using (_βŠ†β‚›_)

\end{code}

Recall that `↑˒[ x , p ]` denotes the principal filter on a compact element `x`,
(where `p` is the proof that `x` is compact).

Below, we prove that `↑˒[ βŠ₯ᡈ , p ] = 𝟏` where `𝟏` is the top Scott open of the
Scott locale on `𝓓`.

\begin{code}

 ↑βŠ₯-is-below-𝟏 : (𝟏[ π’ͺ Σ⦅𝓓⦆ ] βŠ†β‚› ↑˒[ βŠ₯α΄° , βŠ₯ΞΊ ]) holds
 ↑βŠ₯-is-below-𝟏 = bottom-principal-filter-is-top 𝟏[ π’ͺ Σ⦅𝓓⦆ ]

 ↑βŠ₯-is-top : ↑˒[ βŠ₯α΄° , βŠ₯ΞΊ ] = 𝟏[ π’ͺ Σ⦅𝓓⦆ ]
 ↑βŠ₯-is-top = only-𝟏-is-above-𝟏 (π’ͺ Σ⦅𝓓⦆) ↑˒[ βŠ₯α΄° , βŠ₯ΞΊ ] †
  where
   † : (𝟏[ π’ͺ Σ⦅𝓓⦆ ] ≀[ poset-of (π’ͺ Σ⦅𝓓⦆) ] ↑˒[ βŠ₯α΄° , βŠ₯ΞΊ ]) holds
   † = βŠ†β‚›-implies-βŠ†β‚– 𝟏[ π’ͺ Σ⦅𝓓⦆ ] ↑˒[ βŠ₯α΄° , βŠ₯ΞΊ ] ↑βŠ₯-is-below-𝟏

 open DefnOfScottTopology 𝓓 𝓀

 contains-bottom-implies-is-𝟏 : (π”˜ : ⟨ π’ͺ Σ⦅𝓓⦆ ⟩)
                              β†’ (βŠ₯α΄° βˆˆβ‚› π”˜) holds
                              β†’ π”˜ = 𝟏[ π’ͺ Σ⦅𝓓⦆ ]
 contains-bottom-implies-is-𝟏 π”˜ ΞΌ = only-𝟏-is-above-𝟏 (π’ͺ Σ⦅𝓓⦆) π”˜ †
  where
   † : (𝟏[ π’ͺ ScottLocale ] βŠ†β‚– π”˜) holds
   † = βŠ†β‚›-implies-βŠ†β‚–
        𝟏[ π’ͺ ScottLocale ]
        π”˜
        (Ξ» { x ⋆ β†’ contains-bottom-implies-is-top π”˜ ΞΌ x})

\end{code}

Moved from the `ScottLocalesOfScottDomains` module to here on 2024-03-16.

The principal filter `↑(x)` on any `x : 𝓓` is a compact Scott open.

\begin{code}

 principal-filter-is-compactβ‚€ : (c : ⟨ 𝓓 βŸ©βˆ™)
                              β†’ (ΞΊ : is-compact 𝓓 c)
                              β†’ is-compact-open Σ⦅𝓓⦆ ↑˒[ (c , ΞΊ) ] holds
 principal-filter-is-compactβ‚€ c ΞΊ S Ξ΄ p = βˆ₯βˆ₯-functor † ΞΌ
  where
   ΞΌ : (c βˆˆβ‚› (⋁[ π’ͺ Σ⦅𝓓⦆ ] S)) holds
   ΞΌ = βŠ†β‚–-implies-βŠ†β‚› ↑˒[ (c , ΞΊ) ] (⋁[ π’ͺ Σ⦅𝓓⦆ ] S) p c (reflexivity 𝓓 c)

   † : Ξ£ i κž‰ index S , (c βˆˆβ‚› (S [ i ])) holds
     β†’ Ξ£ i κž‰ index S , (↑˒[ (c , ΞΊ) ] ≀[ poset-of (π’ͺ Σ⦅𝓓⦆) ] S [ i ]) holds
   † (i , r) = i , ‑
    where
     ‑ :  (↑˒[ c , ΞΊ ] ≀[ poset-of (π’ͺ Σ⦅𝓓⦆) ] (S [ i ])) holds
     ‑ d = upward-closure (S [ i ]) c (Ξ² d) r

\end{code}

Moved from the `ScottLocalesOfScottDomains` module to here on 2024-03-16.

The Scott locale is always compact.

\begin{code}

 ⊀-is-compact : is-compact-open Σ⦅𝓓⦆ 𝟏[ π’ͺ Σ⦅𝓓⦆ ] holds
 ⊀-is-compact = transport (Ξ» - β†’ is-compact-open Σ⦅𝓓⦆ - holds) ↑βŠ₯-is-top †
  where
   † : is-compact-open ScottLocale ↑˒[ βŠ₯α΄° , βŠ₯ΞΊ ] holds
   † = principal-filter-is-compactβ‚€ βŠ₯α΄° βŠ₯ΞΊ

\end{code}

Moved from the `ScottLocalesOfScottDomains` module to here on 2024-03-16.

If two compact elements `c` and `d` do not have an upper bound, then the meet
of their principal filters is the empty Scott open.

\begin{code}

 not-bounded-lemma : (c d : ⟨ 𝓓 βŸ©βˆ™)
                   β†’ (κᢜ : is-compact 𝓓 c)
                   β†’ (κᡈ : is-compact 𝓓 d)
                   β†’ Β¬ ((c ↑[ 𝓓 ] d) holds)
                   β†’ ↑˒[ c , κᢜ ] ∧[ π’ͺ Σ⦅𝓓⦆ ] ↑˒[ d , κᡈ ] = 𝟎[ π’ͺ Σ⦅𝓓⦆ ]
 not-bounded-lemma c d κᢜ κᡈ ν =
  only-𝟎-is-below-𝟎 (π’ͺ Σ⦅𝓓⦆) (↑˒[ c , κᢜ ] ∧[ π’ͺ Σ⦅𝓓⦆ ] ↑˒[ d , κᡈ ]) †
   where
    † : ((↑˒[ c , κᢜ ] ∧[ π’ͺ Σ⦅𝓓⦆ ] ↑˒[ d , κᡈ ]) βŠ†β‚– 𝟎[ π’ͺ Σ⦅𝓓⦆ ]) holds
    † i (p₁ , pβ‚‚) = 𝟘-elim (Ξ½ ∣ Ξ² i , (Ξ» { (inl ⋆) β†’ p₁ ; (inr ⋆) β†’ pβ‚‚}) ∣)

\end{code}