Ayberk Tosun

Started on 22 September 2023.
Proof of bijection completed on 29 September 2023.

This module contains the proof that points of a locale are in bijection with the
completely prime filters.

\begin{code}[hide]

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

open import MLTT.Spartan
open import UF.PropTrunc
open import UF.FunExt
open import UF.Logic
open import UF.Subsingletons
open import UF.Retracts

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

open import Locales.ContinuousMap.Definition pt fe
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
open import Locales.Point.Definition pt fe
open import Slice.Family
open import UF.Equiv
open import UF.Powerset-MultiUniverse
open import UF.Sets
open import UF.SubtypeClassifier

open AllCombinators pt fe
open ContinuousMaps
open DefnOfCPF
open FrameHomomorphismProperties
open FrameHomomorphisms
open Locale
open PropositionalTruncation pt

\end{code}

We denote by `𝟏L` the terminal locale.

\begin{code}

𝟏L : Locale (𝓀 ⁺) 𝓀 𝓀
𝟏L = 𝟏Loc pe

\end{code}

The map sending a CPF to a continuous map `𝟏 β†’ X` is called `𝔯` (for "retract")
and its section is called `𝔰` (for "section"). We first define the underlying
functions of these and call them `𝔯₀` and `𝔰₀`. We then prove separately that
the results they give satisfy the desired conditions of being a continuous map
and being a completely prime filter (respectively).

\begin{code}

𝔯₀ : (X : Locale (𝓀 ⁺) 𝓀 𝓀) β†’ Point X β†’ ⟨ π’ͺ X ⟩ β†’ ⟨ π’ͺ 𝟏L ⟩
𝔯₀ X (Ο• , cpf) U = Ο• U

𝔰₀ : (X : Locale (𝓀 ⁺) 𝓀 𝓀) β†’ (𝟏L ─cβ†’ X) β†’ π“Ÿ {𝓀} ⟨ π’ͺ X ⟩
𝔰₀ X 𝒻 U = 𝒻 β‹†βˆ™ U
 where
  open ContinuousMapNotation 𝟏L X using (_β‹†βˆ™_)

\end{code}

\begin{code}

𝔯₀-gives-frame-homomorphism : (X : Locale (𝓀 ⁺) 𝓀 𝓀) (x : Point X)
                            β†’ is-a-frame-homomorphism (π’ͺ X) (π’ͺ 𝟏L) (𝔯₀ X x) holds
𝔯₀-gives-frame-homomorphism X 𝓍@(Ο• , cpf) = Ξ± , Ξ² , Ξ³
 where
  open Pointα΅£
  open Joins (Ξ» U V β†’ U ≀[ poset-of (π’ͺ 𝟏L) ] V)

  𝓍′ : Pointα΅£ X
  𝓍′ = to-pointα΅£ X 𝓍

  Ο„ : (𝟏[ π’ͺ X ] βˆˆβ‚š Ο•) holds
  Ο„ = point-contains-top 𝓍′

  ΞΌ : closed-under-binary-meets X Ο• holds
  ΞΌ = point-is-closed-under-∧ 𝓍′

  Ο… : is-monotonic (poset-of (π’ͺ X)) (poset-of (π’ͺ 𝟏L)) Ο• holds
  Ο… (U , V) =  point-is-upwards-closed 𝓍′ U V

  Ξ± : Ο• 𝟏[ π’ͺ X ] = ⊀
  Ξ± = only-𝟏-is-above-𝟏 (π’ͺ 𝟏L) (Ο• 𝟏[ π’ͺ X ]) (Ξ» _ β†’ Ο„)

  Ξ² : (U V : ⟨ π’ͺ X ⟩) β†’ Ο• (U ∧[ π’ͺ X ] V) = Ο• U ∧[ π’ͺ 𝟏L ] Ο• V
  Ξ² U V = ≀-is-antisymmetric (poset-of (π’ͺ 𝟏L)) β₁ Ξ²β‚‚
   where
    β₁ : Ο• (U ∧[ π’ͺ X ] V) holds β†’ (Ο• U ∧[ π’ͺ 𝟏L ] Ο• V) holds
    β₁ p = Ο… ((U ∧[ π’ͺ X ] V) , U) (∧[ π’ͺ X ]-lower₁ U V) p
         , Ο… ((U ∧[ π’ͺ X ] V) , V) (∧[ π’ͺ X ]-lowerβ‚‚ U V) p

    Ξ²β‚‚ : (Ο• U ∧[ π’ͺ 𝟏L ] Ο• V) holds β†’ Ο• (U ∧[ π’ͺ X ] V) holds
    Ξ²β‚‚ (p , q) = ΞΌ U V p q

  Ξ³β‚€ : (S : Fam 𝓀 ⟨ π’ͺ X ⟩) β†’ Ο• (⋁[ π’ͺ X ] S) = ⋁[ π’ͺ 𝟏L ] ⁅ Ο• U ∣ U Ξ΅ S ⁆
  Ξ³β‚€ S = ≀-is-antisymmetric (poset-of (π’ͺ 𝟏L)) † ‑
   where
    open PosetNotation (poset-of (π’ͺ 𝟏L))

    † : (Ο• (⋁[ π’ͺ X ] S) ≀ (⋁[ π’ͺ 𝟏L ] ⁅ Ο• U ∣ U Ξ΅ S ⁆)) holds
    † = point-is-completely-prime 𝓍′ S

    ‑ : ((⋁[ π’ͺ 𝟏L ] ⁅ Ο• U ∣ U Ξ΅ S ⁆) ≀ Ο• (⋁[ π’ͺ X ] S)) holds
    ‑ p = βˆ₯βˆ₯Ξ©-rec β€» p
     where
      β€» : (Ξ£ i κž‰ index S , Ο• (S [ i ]) holds) β†’ Ο• (⋁[ π’ͺ X ] S) holds
      β€» (i , q) = Ο… (S [ i ] , ⋁[ π’ͺ X ] S) (⋁[ π’ͺ X ]-upper S i) q

  Ξ³ : (S : Fam 𝓀 ⟨ π’ͺ X ⟩) β†’ (Ο• (⋁[ π’ͺ X ] S) is-lub-of ⁅ Ο• U ∣ U Ξ΅ S ⁆) holds
  Ξ³ S = transport (Ξ» - β†’ (- is-lub-of ⁅ Ο• U ∣ U Ξ΅ S ⁆) holds) (Ξ³β‚€ S ⁻¹) β€»
   where
    β€» : ((⋁[ π’ͺ 𝟏L ] ⁅ Ο• U ∣ U Ξ΅ S ⁆) is-lub-of ⁅ Ο• U ∣ U Ξ΅ S ⁆) holds
    β€» = ⋁[ π’ͺ 𝟏L ]-upper ⁅ Ο• U ∣ U Ξ΅ S ⁆ , ⋁[ π’ͺ 𝟏L ]-least ⁅ Ο• U ∣ U Ξ΅ S ⁆

\end{code}

\begin{code}

open DefnOfCPF

𝔰₀-gives-cpf : (X : Locale (𝓀 ⁺) 𝓀 𝓀) (𝒻 : 𝟏L ─cβ†’ X)
                β†’ is-cpf X (𝔰₀ X 𝒻) holds
𝔰₀-gives-cpf X 𝒻 = Pointβ€²α΅£.point-is-cpf 𝓍
 where
  open ContinuousMapNotation 𝟏L X using (_β‹†βˆ™_)

  Ο… : is-upwards-closed X (𝒻 β‹†βˆ™_) holds
  Ο… U V p q =
   frame-morphisms-are-monotonic (π’ͺ X) (π’ͺ 𝟏L) (𝒻 β‹†βˆ™_) (𝒻 .prβ‚‚) (U , V) p q

  Ο„ : 𝟏[ π’ͺ X ] ∈ (𝒻 β‹†βˆ™_)
  Ο„ = equal-⊀-gives-holds
       (𝒻 β‹†βˆ™ 𝟏[ π’ͺ X ])
       (frame-homomorphisms-preserve-top (π’ͺ X) (π’ͺ 𝟏L) 𝒻)

  ΞΌ : closed-under-binary-meets X (𝒻 β‹†βˆ™_) holds
  ΞΌ U V p q = equal-⊀-gives-holds (𝒻 β‹†βˆ™ (U ∧[ π’ͺ X ] V)) †
   where
    † : 𝒻 β‹†βˆ™ meet-of (π’ͺ X) U V = ⊀
    † = (𝒻 β‹†βˆ™ (U ∧[ π’ͺ X ] V))
         =⟨ frame-homomorphisms-preserve-meets (π’ͺ X) (π’ͺ 𝟏L) 𝒻 U V ⟩
        𝒻 β‹†βˆ™ U ∧[ π’ͺ 𝟏L ] (𝒻 β‹†βˆ™ V)
         =⟨ ap (Ξ» - β†’ - ∧ (𝒻 β‹†βˆ™ V)) (holds-gives-equal-⊀ pe fe (𝒻 β‹†βˆ™ U) p) ⟩
        ⊀      ∧[ π’ͺ 𝟏L ] (𝒻 β‹†βˆ™ V)
         =⟨ ap (Ξ» - β†’ ⊀ ∧ -) (holds-gives-equal-⊀ pe fe (𝒻 β‹†βˆ™ V) q) ⟩
        ⊀      ∧[ π’ͺ 𝟏L ] ⊀        =⟨ ∧[ π’ͺ 𝟏L ]-is-idempotent ⊀ ⁻¹ ⟩
        ⊀ ∎

  cp : is-completely-prime X (𝒻 β‹†βˆ™_) holds
  cp S p = equal-⊀-gives-holds (⋁[ π’ͺ 𝟏L ] ⁅ 𝒻 β‹†βˆ™ U ∣ U Ξ΅ S ⁆) q
   where
    Ο‚ : is-set ⟨ π’ͺ 𝟏L ⟩
    Ο‚ = carrier-of-[ poset-of (π’ͺ 𝟏L) ]-is-set

    β…  = frame-homomorphisms-preserve-all-joinsβ€² (π’ͺ X) (π’ͺ 𝟏L) 𝒻 S ⁻¹
    β…‘ = holds-gives-equal-⊀ pe fe (𝒻 β‹†βˆ™ (⋁[ π’ͺ X ] S)) p

    pβ€² : 𝒻 β‹†βˆ™ (⋁[ π’ͺ X ] S) = ⊀
    pβ€² = holds-gives-equal-⊀ pe fe (𝒻 β‹†βˆ™ (⋁[ π’ͺ X ] S)) p

    q : ⋁[ π’ͺ 𝟏L ] ⁅ 𝒻 β‹†βˆ™ U ∣ U Ξ΅ S ⁆ = ⊀
    q = ⋁[ π’ͺ 𝟏L ] ⁅ 𝒻 β‹†βˆ™ U ∣ U Ξ΅ S ⁆   =⟨ β…  ⟩
        𝒻 β‹†βˆ™ (⋁[ π’ͺ X ] S)              =⟨ β…‘ ⟩
        ⊀                              ∎

  𝓍 : Pointβ€²α΅£ X
  𝓍 = record
       { point                     = 𝒻 β‹†βˆ™_
       ; point-is-upwards-closed   = Ο…
       ; point-contains-top        = Ο„
       ; point-is-closed-under-∧   = μ
       ; point-is-completely-prime = cp
       }

\end{code}

\begin{code}

𝔯 : (X : Locale (𝓀 ⁺) 𝓀 𝓀) β†’ Point X β†’ 𝟏L ─cβ†’ X
𝔯 X 𝓍 = 𝔯₀ X 𝓍 , 𝔯₀-gives-frame-homomorphism X 𝓍

𝔰 : (X : Locale (𝓀 ⁺) 𝓀 𝓀) β†’ 𝟏L ─cβ†’ X β†’ Point X
𝔰 X 𝒻 = 𝔰₀ X 𝒻 , 𝔰₀-gives-cpf X 𝒻

cpf-equiv-continuous-map-into-Ξ© : (X : Locale (𝓀 ⁺) 𝓀 𝓀) β†’ Point X ≃ 𝟏L ─cβ†’ X
cpf-equiv-continuous-map-into-Ξ© X = 𝔯 X , † , ‑
 where
  sec : (𝔯 X ∘ 𝔰 X) ∼ id
  sec 𝒻 = to-frame-homomorphism-= (π’ͺ X) (π’ͺ 𝟏L) (𝔯 X (𝔰 X 𝒻)) 𝒻 Ξ» _ β†’ refl

  ret : (𝔰 X ∘ 𝔯 X) ∼ id
  ret 𝓍 = to-subtype-= (holds-is-prop ∘ is-cpf X) (dfunext fe Ξ» _ β†’ refl)

  † : has-section (𝔯 X)
  † = 𝔰 X , sec

  ‑ : is-section (𝔯 X)
  ‑ = 𝔰 X , ret

\end{code}