Skip to content

Locales.LawsonLocale.SharpElementsCoincideWithSpectralPoints

---
title:          Equivalence of sharp elements with spectral points
author:         Ayberk Tosun
date-started:   2024-05-22
date-completed: 2024-05-28
dates-updated:  [2024-06-03]
---

This module contains the proof of equivalence between the sharp elements of a
Scott domain and the โ€œspectral pointsโ€ of its Scott locale. This equivalence was
conjectured by Martรญn Escardรณ and proved by Ayberk Tosun on 2024-03-15.

The formalization of the proof was completed on 2024-05-28.


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

open import MLTT.List hiding ([_])
open import MLTT.Spartan
open import UF.FunExt
open import UF.PropTrunc
open import UF.Size
open import UF.Subsingletons
open import UF.UA-FunExt
open import UF.Univalence

module Locales.LawsonLocale.SharpElementsCoincideWithSpectralPoints
        (๐“ค  : Universe)
        (ua : Univalence)
        (pt : propositional-truncations-exist)
        (sr : Set-Replacement pt)
       where

private
 fe : Fun-Ext
 fe {๐“ค} {๐“ฅ} = univalence-gives-funext' ๐“ค ๐“ฅ (ua ๐“ค) (ua (๐“ค โŠ” ๐“ฅ))

 pe : Prop-Ext
 pe {๐“ค} = univalence-gives-propext (ua ๐“ค)

open import DomainTheory.BasesAndContinuity.Bases pt fe ๐“ค
open import DomainTheory.BasesAndContinuity.Continuity pt fe ๐“ค
open import DomainTheory.BasesAndContinuity.ScottDomain pt fe ๐“ค
open import DomainTheory.Basics.Dcpo pt fe ๐“ค renaming (โŸจ_โŸฉ to โŸจ_โŸฉโˆ™)
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.ContinuousMap.FrameHomomorphism-Definition pt fe
open import Locales.ContinuousMap.FrameHomomorphism-Properties pt fe
open import Locales.Frame pt fe
open import Locales.InitialFrame pt fe hiding (_โŠ‘_)
open import Locales.LawsonLocale.CompactElementsOfPoint ๐“ค fe pe pt sr
open import Locales.Point.SpectralPoint-Definition pt fe
open import Locales.ScottLocale.Properties pt fe ๐“ค
open import Locales.ScottLocale.ScottLocalesOfScottDomains pt fe sr ๐“ค
open import Locales.SmallBasis pt fe sr
open import Locales.Spectrality.SpectralMap pt fe
open import Locales.TerminalLocale.Properties pt fe sr
open import NotionsOfDecidability.Decidable
open import Slice.Family
open import UF.Equiv
open import UF.Logic
open import UF.Subsingletons-FunExt
open import UF.SubtypeClassifier renaming (โŠฅ to โŠฅโ‚š)

open AllCombinators pt fe
open DefinitionOfScottDomain
open Locale
open PropositionalTruncation pt hiding (_โˆจ_)


\section{Preliminaries}

We define a version of the predicate `is-compact` that is packaged up with the
proof that it is a proposition.


is-compactโ‚š : (๐““ : DCPO {๐“ค โบ} {๐“ค}) โ†’ โŸจ ๐““ โŸฉโˆ™ โ†’ ฮฉ (๐“ค โบ)
is-compactโ‚š ๐““ x = is-compact ๐““ x , being-compact-is-prop ๐““ x


Similarly, we define a version of the predicate `is-decidable` that is packaged
up with the proof that it is a proposition.


is-decidableโ‚š : ฮฉ ๐“ค โ†’ ฮฉ ๐“ค
is-decidableโ‚š P =
 is-decidable (P holds) , decidability-of-prop-is-prop fe (holds-is-prop P)


\section{Introduction}

We work in a module parameterized by

 - a large and locally small Scott domain `๐““`,
 - assumed to satisfy the `decidability-condition` which says that upper
   boundedness of its compact elements is a decidable property.


module Sharp-Element-Spectral-Point-Equivalence
        (๐““    : DCPO {๐“ค โบ} {๐“ค})
        (hl   : has-least (underlying-order ๐““))
        (sd   : is-scott-domain ๐““ holds)
        (dc   : decidability-condition ๐““)
       where

 open Construction ๐““ ua hl sd dc
 open DefinitionOfBoundedCompleteness hiding (_โŠ‘_)


The following is a bit of preparation for the proofs. We open up relevant
modules and define abbreviations for constructions that we use for the sake of
readability and self-containment.


 ๐’ทโ‚€ : has-unspecified-small-compact-basis ๐““
 ๐’ทโ‚€ = prโ‚ sd


We denote by `Scottโฆ…๐““โฆ†` the Scott locale of domain `๐““`.


 open SpectralScottLocaleConstructionโ‚‚ ๐““ ua hl sd dc pe renaming (ฯƒโฆ…๐““โฆ† to Scottโฆ…๐““โฆ†)


For the frame of opens of the Scott locale `Scottโฆ…๐““โฆ†`, we reserve the notation
`ฯƒโฆ…๐““โฆ†`. This notation differs from other uses in TypeTopology, but it should be
the standard one and the notation elsewhere should be updated to use this one.


 ฯƒโฆ…๐““โฆ† : Frame (๐“ค โบ) ๐“ค ๐“ค
 ฯƒโฆ…๐““โฆ† = ๐’ช Scottโฆ…๐““โฆ†

 open SpectralScottLocaleConstruction  ๐““ hl hscb dc bc pe hiding (scb; ฯƒแดฐ)

 open ScottLocaleProperties ๐““ hl hscb pe renaming (โŠค-is-compact to Scottโฆ…๐““โฆ†-is-compact)
 open is-small-compact-basis scb
 open structurally-algebraic

 ฯƒแดฐ : spectralแดฐ Scottโฆ…๐““โฆ†
 ฯƒแดฐ = scott-locale-spectralแดฐ


The family `basis` given below is the basis of the Scott locale of domain `๐““`.


 basis : Fam ๐“ค โŸจ ๐’ช Scottโฆ…๐““โฆ† โŸฉ
 basis = basisโ‚› Scottโฆ…๐““โฆ† ฯƒแดฐ

 Bฯƒ : ๐“ค ฬ‡
 Bฯƒ = index basis

 ฮฒฯƒ : Bฯƒ โ†’ โŸจ ๐’ช Scottโฆ…๐““โฆ† โŸฉ
 ฮฒฯƒ = basis [_]

 ฮบฯƒ : (i : Bฯƒ) โ†’ is-compact-open Scottโฆ…๐““โฆ† (ฮฒฯƒ i) holds
 ฮบฯƒ = basisโ‚›-consists-of-compact-opens Scottโฆ…๐““โฆ† ฯƒแดฐ


We define a version of the order of `๐““` that is packaged up with the proof that
it is a proposition (called `prop-valuedness` in the domain theory development).


 _โŠ‘_ : โŸจ ๐““ โŸฉโˆ™ โ†’ โŸจ ๐““ โŸฉโˆ™ โ†’ ฮฉ ๐“ค
 x โŠ‘ y = (x โŠ‘โŸจ ๐““ โŸฉ y) , prop-valuedness ๐““ x y


\section{Definition of sharpness}

We now define what it means for an element to be _sharp_, following the work of
de Jong [1].


 is-sharp : โŸจ ๐““ โŸฉโˆ™ โ†’ ฮฉ (๐“ค โบ)
 is-sharp x = โฑฏ c ๊ž‰ โŸจ ๐““ โŸฉโˆ™ , is-compactโ‚š ๐““ c โ‡’ is-decidableโ‚š (c โŠ‘ x)


This definition of the notion of sharpness is a predicate with large truth
values as it quantifies over the compact opens. Because we are working with an
algebraic dcpo, however, we can define a small version which we denote
`is-sharpโป`.


 is-sharpโป : โŸจ ๐““ โŸฉโˆ™ โ†’ ฮฉ ๐“ค
 is-sharpโป x = โฑฏ i ๊ž‰ index B๐““ , is-decidableโ‚š ((B๐““ [ i ]) โŠ‘ x)


These two are equivalent.


 sharp-implies-sharpโป : (โฑฏ x ๊ž‰ โŸจ ๐““ โŸฉโˆ™ , is-sharp x โ‡’ is-sharpโป x) holds
 sharp-implies-sharpโป x ๐•ค i = ๐•ค (B๐““ [ i ]) (basis-is-compact i)

 sharpโป-implies-sharp : (โฑฏ x ๊ž‰ โŸจ ๐““ โŸฉโˆ™ , is-sharpโป x โ‡’ is-sharp x) holds
 sharpโป-implies-sharp x ๐•ค c ฯ‡ =
  โˆฅโˆฅ-rec (holds-is-prop (is-decidableโ‚š (c โŠ‘ x))) โ€  ฮผ
   where
    ฮผ : โˆƒ i ๊ž‰ index B๐““ , B๐““ [ i ] ๏ผ c
    ฮผ = small-compact-basis-contains-all-compact-elements ๐““ (B๐““ [_]) scb c ฯ‡

    โ€  : ฮฃ i ๊ž‰ index B๐““ , B๐““ [ i ] ๏ผ c โ†’ is-decidableโ‚š (c โŠ‘ x) holds
    โ€  (i , p) = transport (ฮป - โ†’ is-decidableโ‚š (- โŠ‘ x) holds) p (๐•ค i)

 sharp-is-equivalent-to-sharpโป : (โฑฏ x ๊ž‰ โŸจ ๐““ โŸฉโˆ™ , is-sharp x โ‡” is-sharpโป x) holds
 sharp-is-equivalent-to-sharpโป x =
  sharp-implies-sharpโป x , sharpโป-implies-sharp x


We now define the type `โ™ฏ๐““` of sharp elements of the Scott domain `๐““`.


 โ™ฏ๐““ : ๐“ค โบ ฬ‡
 โ™ฏ๐““ = ฮฃ x ๊ž‰ โŸจ ๐““ โŸฉโˆ™ , is-sharp x holds


We usually pattern match on the inhabitants of `โ™ฏ๐““` to refer to the first
component. But if the need arises, we denote the underlying element of a sharp
element `๐“` by `โฆ… ๐“ โฆ†`.


 โฆ…_โฆ† : โ™ฏ๐““ โ†’ โŸจ ๐““ โŸฉโˆ™
 โฆ…_โฆ† (x , _) = x

 abstract
  to-sharp-๏ผ : (๐“ ๐“Ž : โ™ฏ๐““) โ†’ prโ‚ ๐“ ๏ผ prโ‚ ๐“Ž โ†’ ๐“ ๏ผ ๐“Ž
  to-sharp-๏ผ ๐“ ๐“Ž = to-subtype-๏ผ (holds-is-prop โˆ˜ is-sharp)

 open Preliminaries
 open Locale
 open DefnOfScottTopology ๐““ ๐“ค


\section{Characterization of sharp elements}

In this section, we give a characterization of sharp elements which we use
when constructing the equivalence (in the next section).

We define the following predicate expressing that an element `x` has decidable
membership in compact Scott opens.


 open Properties ๐““

 admits-decidable-membership-in-compact-scott-opens : โŸจ ๐““ โŸฉโˆ™ โ†’ ฮฉ (๐“ค โบ)
 admits-decidable-membership-in-compact-scott-opens x =
  โฑฏ ๐’ฆ ๊ž‰ โŸจ ๐’ช Scottโฆ…๐““โฆ† โŸฉ , is-compact-open Scottโฆ…๐““โฆ† ๐’ฆ โ‡’ is-decidableโ‚š (x โˆˆโ‚› ๐’ฆ)


Every sharp element admits decidable membership in compact Scott opens.


 sharp-implies-admits-decidable-membership-in-compact-scott-opens
  : (x : โŸจ ๐““ โŸฉโˆ™)
  โ†’ (is-sharp x โ‡’ admits-decidable-membership-in-compact-scott-opens x) holds
 sharp-implies-admits-decidable-membership-in-compact-scott-opens x ๐“ˆ๐’ฝ ๐’ฆ ๐•œ =
  โˆฅโˆฅ-rec (holds-is-prop (is-decidableโ‚š (x โˆˆโ‚› ๐’ฆ))) (uncurry โ€ก) โ™ข
   where
    โ™ข : is-basic Scottโฆ…๐““โฆ† ๐’ฆ (spectralแดฐ-implies-directed-basisแดฐ Scottโฆ…๐““โฆ† ฯƒแดฐ) holds
    โ™ข = compact-opens-are-basic
         Scottโฆ…๐““โฆ†
         (spectralแดฐ-implies-directed-basisแดฐ Scottโฆ…๐““โฆ† ฯƒแดฐ)
         ๐’ฆ
         ๐•œ

    lemma : (xs : List (index B๐““)) โ†’ is-decidableโ‚š (x โˆˆโ‚› ฮฒฯƒ xs) holds
    lemma []       = inr ๐Ÿ˜-elim
    lemma (i โˆท is) =
     โˆจ-preserves-decidability pt (x โˆˆโ‚› โ†‘หข[ ฮฒโ‚– i ]) (x โˆˆโ‚› ๐œธ is) โ€  IH
      where
       โ€  : is-decidableโ‚š (x โˆˆโ‚› โ†‘หข[ ฮฒโ‚– i ]) holds
       โ€  = ๐“ˆ๐’ฝ (ฮฒ i) (basis-is-compact i)

       IH : is-decidableโ‚š (x โˆˆโ‚› ๐œธ is) holds
       IH = lemma is

    โ€ก : (xs : List (index B๐““)) โ†’ ฮฒฯƒ xs ๏ผ ๐’ฆ โ†’ is-decidableโ‚š (x โˆˆโ‚› ๐’ฆ) holds
    โ€ก xs p = transport (ฮป - โ†’ is-decidableโ‚š (x โˆˆโ‚› -) holds) p (lemma xs)


The converse also holds meaning elements that admit decidable membership in
compact Scott opens are _exactly_ the sharp elements.


 admits-decidable-membership-in-compact-scott-opens-implies-is-sharp
  : (x : โŸจ ๐““ โŸฉโˆ™)
  โ†’ admits-decidable-membership-in-compact-scott-opens x holds
  โ†’ is-sharp x holds
 admits-decidable-membership-in-compact-scott-opens-implies-is-sharp x ฯ† c ๐•œ =
  ฯ† โ†‘หข[ (c , ๐•œ) ] (principal-filter-is-compactโ‚€ c ๐•œ)

 characterization-of-sharp-elements
  : (x : โŸจ ๐““ โŸฉโˆ™)
  โ†’ (admits-decidable-membership-in-compact-scott-opens x โ‡” is-sharp x) holds
 characterization-of-sharp-elements x = โ€  , โ€ก
  where
   โ€  = admits-decidable-membership-in-compact-scott-opens-implies-is-sharp x
   โ€ก = sharp-implies-admits-decidable-membership-in-compact-scott-opens x


\section{The equivalence}

We now start constructing an equivalence between the type
`Spectral-Point Scottโฆ…๐““โฆ†` and the type `โ™ฏ๐““`.

This equivalence consists of the maps:

  1. `๐“…๐“‰[_] : โ™ฏ๐““ โ†’ Spectral-Point Scottโฆ…๐““โฆ†`, and
  2. `sharp : Spectral-Point Scottโฆ…๐““โฆ† โ†’ โ™ฏ๐““`.

We now construct these maps in this order.

\subsection{Definition of the map `๐“…๐“‰`}

We follow our usual convention of distinguishing the preliminary version of the
construction of interest using the subscript `โ‚€`, which we then package up with
the proof that it satisfies some property.


 ptโ‚€[_] : โŸจ ๐““ โŸฉโˆ™ โ†’ โŸจ ๐’ช Scottโฆ…๐““โฆ† โŸฉ โ†’ ฮฉ ๐“ค
 ptโ‚€[_] x U = x โˆˆโ‚› U

 open FrameHomomorphismProperties (๐’ช Scottโฆ…๐““โฆ†) (๐ŸŽ-๐”ฝ๐•ฃ๐•ž pe)
 open FrameHomomorphisms

 pt[_] : โ™ฏ๐““ โ†’ Point Scottโฆ…๐““โฆ†
 pt[_] ๐“@(x , ๐•ค) = ptโ‚€[ x ] , โ€ 
  where
   โ€ก : preserves-joins (๐’ช Scottโฆ…๐““โฆ†) (๐ŸŽ-๐”ฝ๐•ฃ๐•ž pe) ptโ‚€[ x ] holds
   โ€ก S = โ‹[ ๐ŸŽ-๐”ฝ๐•ฃ๐•ž pe ]-upper โ… ptโ‚€[ x ] y โˆฃ y ฮต S โ†
       , โ‹[ ๐ŸŽ-๐”ฝ๐•ฃ๐•ž pe ]-least โ… ptโ‚€[ x ] y โˆฃ y ฮต S โ†

   โ€  : is-a-frame-homomorphism (๐’ช Scottโฆ…๐““โฆ†) (๐ŸŽ-๐”ฝ๐•ฃ๐•ž pe) ptโ‚€[ x ] holds
   โ€  = refl , (ฮป _ _ โ†’ refl) , โ€ก

 open BottomLemma ๐““ ๐•’ hl


Given any sharp element `๐“`, the point `pt ๐“` is a spectral map.


 pt-is-spectral : (๐“ : โ™ฏ๐““) โ†’ is-spectral-map Scottโฆ…๐““โฆ† (๐ŸLoc pe) pt[ ๐“ ] holds
 pt-is-spectral ๐“@(x , ๐“ˆ๐’ฝ) ๐’ฆ@(K , ฯƒ) ๐•œ = decidable-implies-compact pe (x โˆˆโ‚› ๐’ฆ) โ€ 
  where
   โ€  : is-decidableโ‚š (x โˆˆโ‚› (K , ฯƒ)) holds
   โ€  = sharp-implies-admits-decidable-membership-in-compact-scott-opens x ๐“ˆ๐’ฝ ๐’ฆ ๐•œ

 open Notion-Of-Spectral-Point pe


We package `pt[_]` up with this proof of spectrality and denote it `๐“…๐“‰[_]`.


 ๐“…๐“‰[_] : โ™ฏ๐““ โ†’ Spectral-Point Scottโฆ…๐““โฆ†
 ๐“…๐“‰[_] ๐“ = to-spectral-point Scottโฆ…๐““โฆ† โ„ฑ
  where
   โ„ฑ : Spectral-Map (๐ŸLoc pe) Scottโฆ…๐““โฆ†
   โ„ฑ = pt[ ๐“ ] , pt-is-spectral ๐“


\subsection{Definition of the map `sharp`}

We now define the map `sharp` going in the opposite direction.


 sharpโ‚€ : Point Scottโฆ…๐““โฆ† โ†’ โŸจ ๐““ โŸฉโˆ™
 sharpโ‚€ โ„ฑ = โˆ ๐““ (๐’ฆ-in-point-is-directed โ„ฑ)


The following lemma says if `sharp(โ„ฑ) โˆˆ ๐”˜` then `U โˆˆ โ„ฑ`, for every point `โ„ฑ` and
every Scott open `๐”˜`.


 open PropertiesAlgebraic ๐““ ๐•’ hiding (is-compactโ‚š)

 sharp-in-scott-open-implies-in-point
  : (๐”˜ : โŸจ ๐’ช Scottโฆ…๐““โฆ† โŸฉ)
  โ†’ (โ„ฑ@(F , _) : Point Scottโฆ…๐““โฆ†)
  โ†’ (sharpโ‚€ โ„ฑ โˆˆโ‚› ๐”˜ โ‡’ F ๐”˜) holds
 sharp-in-scott-open-implies-in-point ๐”˜ โ„ฑ@(F , ๐’ฝ) = โ€ 
  where
   open ๐’ชโ‚›แดฟ (to-๐’ชโ‚›แดฟ ๐”˜)

   โ€  : (sharpโ‚€ โ„ฑ โˆˆโ‚› ๐”˜ โ‡’ F ๐”˜) holds
   โ€  p = โˆฅโˆฅ-rec (holds-is-prop (F ๐”˜)) โ€ก ฮณ
    where
     โ€ก : ฮฃ (i , _) ๊ž‰ index (๐’ฆ-in-point โ„ฑ) , ((B๐““ [ i ]) โˆˆโ‚› ๐”˜) holds
       โ†’ F ๐”˜ holds
     โ€ก ((a , b) , c) = frame-morphisms-are-monotonic F ๐’ฝ (โ†‘หข[ ฮฒโ‚– a ] , ๐”˜) q b
      where
       q : (โ†‘หข[ ฮฒโ‚– a ] โ‰ค[ poset-of (๐’ช Scottโฆ…๐““โฆ†) ] ๐”˜) holds
       q x = pred-is-upwards-closed (B๐““ [ a ]) (B๐““ [ x ]) c

     ฮณ : โˆฅ ฮฃ (i , _) ๊ž‰ index (๐’ฆ-in-point โ„ฑ) , ((B๐““ [ i ]) โˆˆโ‚› ๐”˜) holds โˆฅ
     ฮณ = pred-is-inaccessible-by-dir-joins (๐’ฆ-in-pointโ†‘ โ„ฑ) p


As an immediate special case of this lemma, we obtain the following.


 below-sharp-implies-in-point
  : (โ„ฑ@(F , _) : Point Scottโฆ…๐““โฆ†)
  โ†’ (c : โŸจ ๐““ โŸฉโˆ™)
  โ†’ (๐•œ : is-compact ๐““ c)
  โ†’ c โŠ‘โŸจ ๐““ โŸฉ sharpโ‚€ โ„ฑ
  โ†’ F โ†‘หข[ c , ๐•œ ] holds
 below-sharp-implies-in-point โ„ฑ@(F , ๐’ฝ) c ๐•œ =
  sharp-in-scott-open-implies-in-point โ†‘หข[ ๐”  ] โ„ฑ
   where
    ๐”  = (c , ๐•œ)


The converse of this special case also holds. In fact, the converse holds
for _all_ compact Scott opens.


 in-point-implies-contains-sharpโ‹†
  : (ks : List (index B๐““))
  โ†’ (โ„ฑ@(F , _) : Point Scottโฆ…๐““โฆ†)
  โ†’ (F (๐œธ ks) โ‡’ sharpโ‚€ โ„ฑ โˆˆโ‚› ๐œธ ks) holds
 in-point-implies-contains-sharpโ‹† [] โ„ฑ@(F , _) p = ๐Ÿ˜-elim โ… 
  where
   ฯ† : F ๐ŸŽ[ ๐’ช Scottโฆ…๐““โฆ† ] holds
   ฯ† = transport (ฮป - โ†’ (F -) holds) (๐œธ-equal-to-๐œธโ‚ []) p

   โ…ก : ๐ŸŽ[ ๐ŸŽ-๐”ฝ๐•ฃ๐•ž pe ] holds
   โ…ก = transport _holds (frame-homomorphisms-preserve-bottom โ„ฑ) ฯ†

   โ…  : โŠฅโ‚š holds
   โ…  = transport (ฮป - โ†’ - holds) (๐ŸŽ-is-โŠฅ pe โปยน) โ…ก

 in-point-implies-contains-sharpโ‹† (k โˆท ks) โ„ฑ@(F , _) p =
  โˆฅโˆฅ-rec (holds-is-prop ((sharpโ‚€ โ„ฑ โˆˆโ‚› ๐œธ (k โˆท ks)))) โ€ก (transport _holds โ™  p)
   where
    โ™  : F (๐œธ (k โˆท ks)) ๏ผ F โ†‘แต[ k ] โˆจ F (๐œธ ks)
    โ™  = F (๐œธ (k โˆท ks))                     ๏ผโŸจ โ…  โŸฉ
        F (๐œธโ‚ (k โˆท ks))                    ๏ผโŸจ โ…ก โŸฉ
        F โ†‘แต[ k ] โˆจ[ ๐ŸŽ-๐”ฝ๐•ฃ๐•ž pe ] F (๐œธโ‚ ks)  ๏ผโŸจ โ…ข โŸฉ
        F โ†‘แต[ k ] โˆจ[ ๐ŸŽ-๐”ฝ๐•ฃ๐•ž pe ] F (๐œธ ks)   ๏ผโŸจ โ…ฃ โŸฉ
        F โ†‘แต[ k ] โˆจ F (๐œธ ks)               โˆŽ
         where
          โ…  = ap F (๐œธ-equal-to-๐œธโ‚ (k โˆท ks))
          โ…ก = frame-homomorphisms-preserve-binary-joins โ„ฑ _ _
          โ…ข = ap (ฮป - โ†’ F โ†‘แต[ k ] โˆจ[ ๐ŸŽ-๐”ฝ๐•ฃ๐•ž pe ] F -) (๐œธ-equal-to-๐œธโ‚ ks โปยน)
          โ…ฃ = binary-join-is-disjunction pe (F โ†‘แต[ k ]) (F (๐œธ ks))

    โ€ก : F โ†‘แต[ k ] holds + F (๐œธ ks) holds โ†’ (sharpโ‚€ โ„ฑ โˆˆโ‚› ๐œธ (k โˆท ks)) holds
    โ€ก (inl p) = โˆฃ inl (โˆ-is-upperbound ๐““ (๐’ฆ-in-point-is-directed โ„ฑ) (k , p)) โˆฃ
    โ€ก (inr q) = โˆฃ inr (in-point-implies-contains-sharpโ‹† ks โ„ฑ q) โˆฃ


We can reformulate this more concisely to say the same thing for any compact
Scott open `K` since a Scott open is compact iff it is a finite join of
principal filters on compact opens.


 in-point-implies-contains-sharp
  : (โ„ฑ@(F , _) : Point Scottโฆ…๐““โฆ†)
  โ†’ (K : โŸจ ฯƒโฆ…๐““โฆ† โŸฉ)
  โ†’ (๐•œ : is-compact-open Scottโฆ…๐““โฆ† K holds)
  โ†’ (F K โ‡’ sharpโ‚€ โ„ฑ โˆˆโ‚› K) holds
 in-point-implies-contains-sharp โ„ฑ@(F , ฯˆ) K ๐•œ ฯ‡ =
  โˆฅโˆฅ-rec (holds-is-prop (sharpโ‚€ โ„ฑ โˆˆโ‚› K)) โ€  ฮณ
   where
    โ„ฌโ†‘ : directed-basisแดฐ (๐’ช Scottโฆ…๐““โฆ†)
    โ„ฌโ†‘ = spectralแดฐ-implies-directed-basisแดฐ Scottโฆ…๐““โฆ† ฯƒแดฐ

    ฮณ : is-basic Scottโฆ…๐““โฆ† K (spectralแดฐ-implies-directed-basisแดฐ Scottโฆ…๐““โฆ† ฯƒแดฐ) holds
    ฮณ = compact-opens-are-basic Scottโฆ…๐““โฆ† โ„ฌโ†‘ K ๐•œ

    โ€  : ฮฃ i ๊ž‰ Bฯƒ , ฮฒฯƒ i ๏ผ K โ†’ (sharpโ‚€ โ„ฑ โˆˆโ‚› K) holds
    โ€  (i , p) = transport (ฮป - โ†’ (sharpโ‚€ โ„ฑ โˆˆโ‚› -) holds) p โ€ก
     where
      ฮผ : F (๐œธ i) holds
      ฮผ = transport (ฮป - โ†’ F - holds) (p โปยน) ฯ‡

      โ€ก : (sharpโ‚€ (F , ฯˆ) โˆˆโ‚› ฮฒฯƒ i) holds
      โ€ก = in-point-implies-contains-sharpโ‹† i โ„ฑ ฮผ


We now prove that the map `sharpโ‚€` always gives sharp elements.


 sharpโ‚€-gives-sharp-elements : (F : Point Scottโฆ…๐““โฆ†)
                             โ†’ is-spectral-map Scottโฆ…๐““โฆ† (๐ŸLoc pe) F holds
                             โ†’ is-sharp (sharpโ‚€ F) holds
 sharpโ‚€-gives-sharp-elements โ„ฑ@(F , _) ฯƒ c ๐•œ = cases caseโ‚ caseโ‚‚ ฮณ
  where
   ฯ‡ : is-compact-open (๐ŸLoc pe) (F โ†‘หข[ c , ๐•œ ]) holds
   ฯ‡ = ฯƒ โ†‘หข[ c , ๐•œ ] (principal-filter-is-compactโ‚€ c ๐•œ )

   ฮณ : is-decidableโ‚š (F โ†‘หข[ c , ๐•œ ]) holds
   ฮณ = compact-implies-boolean pe (F โ†‘หข[ c , ๐•œ ]) ฯ‡

   ฮบ : is-compact-open Scottโฆ…๐““โฆ† โ†‘หข[ c , ๐•œ ] holds
   ฮบ = principal-filter-is-compactโ‚€ c ๐•œ

   caseโ‚ : F โ†‘หข[ c , ๐•œ ] holds โ†’ is-decidableโ‚š (c โŠ‘ sharpโ‚€ โ„ฑ) holds
   caseโ‚ = inl โˆ˜ in-point-implies-contains-sharp โ„ฑ โ†‘หข[ (c , ๐•œ) ] ฮบ

   caseโ‚‚ : ยฌ (F โ†‘หข[ c , ๐•œ ] holds) โ†’ is-decidableโ‚š (c โŠ‘ sharpโ‚€ โ„ฑ) holds
   caseโ‚‚ ฯ‡ = inr (ฯ‡ โˆ˜ below-sharp-implies-in-point โ„ฑ c ๐•œ)


We denote by `sharp` the version of `sharpโ‚€` that is packaged up with the proof
that it always gives sharp elements.


 sharp : Spectral-Point Scottโฆ…๐““โฆ† โ†’ โ™ฏ๐““
 sharp โ„ฑ = sharpโ‚€ Fยท , sharpโ‚€-gives-sharp-elements Fยท ฯƒ
  where
   open Spectral-Point Scottโฆ…๐““โฆ† โ„ฑ
    renaming (point-fn to F; point to Fยท; point-preserves-compactness to ฯƒ)


\subsection{A useful lemma}

We now prove a lemma which we use when showing that these two maps form an
equivalence.

Given a sharp element `๐“`, the element `sharp (pt ๐“)` is exactly the join of
the compact approximants of `๐“`.


 sharp-equal-to-join-of-covering-family
  : (๐“ : โ™ฏ๐““)
  โ†’ โˆ ๐““ (โ†“แดฎโ‚›-is-directed โฆ… ๐“ โฆ†) ๏ผ sharpโ‚€ pt[ ๐“ ]
 sharp-equal-to-join-of-covering-family (x , ๐•ค) =
  antisymmetry ๐““ (โˆ ๐““ (โ†“แดฎโ‚›-is-directed x)) (โ‹ ๐’ฆ-in-pointโ†‘ pt[ (x , ๐•ค) ]) โ€  โ€ก
   where
    ฮณ : ((i , _) : โ†“แดฎโ‚› x) โ†’ (sharpโ‚€ pt[ x , ๐•ค ] โˆˆโ‚› โ†‘หข[ ฮฒโ‚– i ]) holds
    ฮณ (i , q) = in-point-implies-contains-sharp
                 pt[ x , ๐•ค ]
                 โ†‘หข[ ฮฒโ‚– i ]
                 (principal-filter-is-compact i)
                 (โŠ‘แดฎโ‚›-to-โŠ‘แดฎ q)

    ฮด : is-upperbound
         (underlying-order ๐““)
         (โˆ ๐““ (โ†“แดฎโ‚›-is-directed x))
         (๐’ฆ-in-point pt[ x , ๐•ค ] [_])
    ฮด (i , q) = โˆ-is-upperbound ๐““ (โ†“แดฎโ‚›-is-directed x) (i , โŠ‘แดฎ-to-โŠ‘แดฎโ‚› q)

    โ€  : (โˆ ๐““ (โ†“แดฎโ‚›-is-directed x)) โŠ‘โŸจ ๐““ โŸฉ (โ‹ ๐’ฆ-in-pointโ†‘ pt[ (x , ๐•ค) ])
    โ€  = โˆ-is-lowerbound-of-upperbounds
         ๐““
         (โ†“แดฎโ‚›-is-directed x)
         (โ‹ ๐’ฆ-in-pointโ†‘ pt[ x , ๐•ค ])
         ฮณ

    โ€ก : ((โ‹ ๐’ฆ-in-pointโ†‘ pt[ (x , ๐•ค) ]) โŠ‘โŸจ ๐““ โŸฉ โˆ ๐““ (โ†“แดฎโ‚›-is-directed x))
    โ€ก = sup-is-lowerbound-of-upperbounds
         (underlying-order ๐““)
         (โ‹-is-sup (๐’ฆ-in-pointโ†‘ pt[ (x , ๐•ค) ]))
         (โˆ ๐““ (โ†“แดฎโ‚›-is-directed x))
         ฮด


\subsection{The equivalence proof}

The fact that `sharp` is a retraction of `๐“…๐“‰[_]` follows easily from the lemma
`sharp-equal-to-join-of-covering-family` above.


 sharp-cancels-pt : (๐“ : โ™ฏ๐““) โ†’ sharp ๐“…๐“‰[ ๐“ ] ๏ผ ๐“
 sharp-cancels-pt ๐“ = to-sharp-๏ผ (sharp ๐“…๐“‰[ ๐“ ]) ๐“ โ€ 
  where
   โ€  : โฆ… sharp ๐“…๐“‰[ ๐“ ] โฆ† ๏ผ โฆ… ๐“ โฆ†
   โ€  = โฆ… sharp ๐“…๐“‰[ ๐“ ] โฆ†           ๏ผโŸจ โ…  โŸฉ
       โˆ ๐““ (โ†“แดฎโ‚›-is-directed โฆ… ๐“ โฆ†) ๏ผโŸจ โ…ก โŸฉ
       โฆ… ๐“ โฆ†                       โˆŽ
        where
         โ…  = sharp-equal-to-join-of-covering-family ๐“ โปยน
         โ…ก = โ†“แดฎโ‚›-โˆ-๏ผ โฆ… ๐“ โฆ†


The map `๐“…๐“‰[_]` is a retraction of the map `sharp`.


 pt-cancels-sharp : (โ„ฑ : Spectral-Point Scottโฆ…๐““โฆ†) โ†’ ๐“…๐“‰[ sharp โ„ฑ ] ๏ผ โ„ฑ
 pt-cancels-sharp โ„ฑ =
  to-spectral-point-๏ผ Scottโฆ…๐““โฆ† ๐“…๐“‰[ sharp โ„ฑ ] โ„ฑ (dfunext fe โ€ )
   where
    open Spectral-Point Scottโฆ…๐““โฆ† โ„ฑ renaming (point-fn to F; point to โ„ฑโ‚€)

    โ€  : (๐”˜ : โŸจ ๐’ช Scottโฆ…๐““โฆ† โŸฉ) โ†’ (sharpโ‚€ โ„ฑโ‚€ โˆˆโ‚› ๐”˜) ๏ผ F ๐”˜
    โ€  ๐”˜@(U , s) = transport (ฮป - โ†’ (sharpโ‚€ โ„ฑโ‚€ โˆˆโ‚› -) ๏ผ F -) (q โปยน) โ€ก
     where
      S : Fam ๐“ค โŸจ ๐’ช Scottโฆ…๐““โฆ† โŸฉ
      S = covering-familyโ‚› Scottโฆ…๐““โฆ† ฯƒแดฐ ๐”˜

      q : ๐”˜ ๏ผ โ‹[ ๐’ช Scottโฆ…๐““โฆ† ] S
      q = basisโ‚›-covers-do-cover-eq Scottโฆ…๐““โฆ† ฯƒแดฐ ๐”˜

      โ€กโ‚ : cofinal-in (๐ŸŽ-๐”ฝ๐•ฃ๐•ž pe) โ… sharpโ‚€ โ„ฑโ‚€ โˆˆโ‚› ๐”˜ โˆฃ ๐”˜ ฮต S โ† โ… F ๐”˜ โˆฃ ๐”˜ ฮต S โ† holds
      โ€กโ‚ k = โˆฃ k , sharp-in-scott-open-implies-in-point (S [ k ]) โ„ฑโ‚€ โˆฃ

      โ€กโ‚‚ : cofinal-in (๐ŸŽ-๐”ฝ๐•ฃ๐•ž pe) โ… F ๐”˜ โˆฃ ๐”˜ ฮต S โ† โ… sharpโ‚€ โ„ฑโ‚€ โˆˆโ‚› ๐”˜ โˆฃ ๐”˜ ฮต S โ† holds
      โ€กโ‚‚ (ks , p) = โˆฃ (ks , p) , in-point-implies-contains-sharpโ‹† ks โ„ฑโ‚€ โˆฃ

      โ€ก : sharpโ‚€ โ„ฑโ‚€ โˆˆโ‚› (โ‹[ ๐’ช Scottโฆ…๐““โฆ† ] S) ๏ผ F (โ‹[ ๐’ช Scottโฆ…๐““โฆ† ] S)
      โ€ก = sharpโ‚€ โ„ฑโ‚€ โˆˆโ‚› (โ‹[ ๐’ช Scottโฆ…๐““โฆ† ] S)               ๏ผโŸจreflโŸฉ
          ptโ‚€[ sharpโ‚€ โ„ฑโ‚€ ] (โ‹[ ๐’ช Scottโฆ…๐““โฆ† ] S)           ๏ผโŸจ โ…     โŸฉ
          โ‹[ ๐ŸŽ-๐”ฝ๐•ฃ๐•ž pe ] โ… ptโ‚€[ sharpโ‚€ โ„ฑโ‚€ ] ๐”˜ โˆฃ ๐”˜  ฮต S โ†  ๏ผโŸจreflโŸฉ
          โ‹[ ๐ŸŽ-๐”ฝ๐•ฃ๐•ž pe ] โ… sharpโ‚€ โ„ฑโ‚€ โˆˆโ‚› ๐”˜ โˆฃ ๐”˜ ฮต S โ†       ๏ผโŸจ โ…ก    โŸฉ
          โ‹[ ๐ŸŽ-๐”ฝ๐•ฃ๐•ž pe ] โ… F ๐”˜ โˆฃ ๐”˜ ฮต S โ†                  ๏ผโŸจ โ…ข    โŸฉ
          F (โ‹[ ๐’ช Scottโฆ…๐““โฆ† ] S)                          โˆŽ
           where
            โ…  = frame-homomorphisms-preserve-all-joinsโ€ฒ
                 (๐’ช Scottโฆ…๐““โฆ†)
                 (๐ŸŽ-๐”ฝ๐•ฃ๐•ž pe)
                 pt[ sharp โ„ฑ ]
                 S
            โ…ก = bicofinal-implies-same-join
                 (๐ŸŽ-๐”ฝ๐•ฃ๐•ž pe)
                 โ… sharpโ‚€ โ„ฑโ‚€ โˆˆโ‚› ๐”˜ โˆฃ ๐”˜ ฮต S โ†
                 โ… F ๐”˜ โˆฃ ๐”˜ ฮต S โ†
                 โ€กโ‚
                 โ€กโ‚‚
            โ…ข = frame-homomorphisms-preserve-all-joinsโ€ฒ
                 (๐’ช Scottโฆ…๐““โฆ†)
                 (๐ŸŽ-๐”ฝ๐•ฃ๐•ž pe)
                 โ„ฑโ‚€
                 S โปยน


Finally, we conclude this development by giving the equivalence between the
sharp elements and the spectral points.


 โ™ฏ๐““-equivalent-to-spectral-points-of-Scottโฆ…๐““โฆ† : โ™ฏ๐““ โ‰ƒ Spectral-Point Scottโฆ…๐““โฆ†
 โ™ฏ๐““-equivalent-to-spectral-points-of-Scottโฆ…๐““โฆ† = ๐“…๐“‰[_] , qinvs-are-equivs ๐“…๐“‰[_] โ€ 
  where
   โ€  : qinv ๐“…๐“‰[_]
   โ€  = sharp , sharp-cancels-pt , pt-cancels-sharp


\section{Acknowledgements}

I am grateful to Tom de Jong for his comments on a write-up of the proof
formalized in this module.

\section{References}

- [1]: Tom de Jong. *Apartness, sharp elements, and the Scott topology of
  domains*.

  Mathematical Structures in Computer Science, vol. 33, no. 7,
  pp 573-604, August 2023. doi:10.1017/S0960129523000282

  https://doi.org/10.1017/S0960129523000282