Skip to content

Locales.Compactness.Properties

---
title:          Properties of compactness
author:         Ayberk Tosun
date-started:   2024-07-19
date-completed: 2024-07-31
dates-updated:  [2024-09-05]
---

We collect properties related to compactness in locale theory in this module.
This includes the equivalences to two alternative definitions of the notion of
compactness, which we denote `is-compact-open'` and `is-compact-open''`.


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

open import MLTT.Spartan hiding (J)
open import UF.Base
open import UF.Classifiers
open import UF.FunExt
open import UF.PropTrunc
open import UF.Sets
open import UF.Subsingletons
open import UF.Subsingletons-FunExt
open import UF.Subsingletons-Properties
open import UF.SubtypeClassifier

module Locales.Compactness.Properties
        (pt : propositional-truncations-exist)
        (fe : Fun-Ext)
        (pe : Prop-Ext)
       where

open import Fin.Kuratowski pt
open import Fin.Type
open import Locales.Compactness.Definition pt fe
open import Locales.Frame pt fe renaming (⟨_⟩ to ⟨_βŸ©βˆ™) hiding (βˆ…)
open import Locales.WayBelowRelation.Definition  pt fe
open import MLTT.List using (member; []; _∷_; List; in-head; in-tail; length)
open import MLTT.List-Properties
open import Slice.Family
open import Taboos.FiniteSubsetTaboo pt fe
open import UF.Equiv hiding (_β– )
open import UF.EquivalenceExamples
open import UF.ImageAndSurjection pt
open import UF.Logic
open import UF.Powerset-Fin pt
open import UF.Powerset-MultiUniverse
open import UF.Sets-Properties
open import Notation.UnderlyingType

open AllCombinators pt fe
open Locale
open PropositionalTruncation pt


\section{Preliminaries}

We define a frame instance of the `Underlying-Type` typeclass to avoid name
clashes.


instance
 underlying-type-of-frame : Underlying-Type (Frame 𝓀 π“₯ 𝓦) (𝓀 Μ‡ )
 ⟨_⟩ {{underlying-type-of-frame}} (A , _) = A


Given a family `S`, we denote the type of its subfamilies by `SubFam S`.


SubFam : {A : 𝓀 Μ‡ } {𝓦 : Universe} β†’ Fam 𝓦 A β†’ 𝓦 ⁺ Μ‡
SubFam {_} {A} {𝓦} (I , Ξ±) = Ξ£ J κž‰ 𝓦 Μ‡ , (J β†’ I)


Given any list, the type of elements that fall in the list is a
Kuratowski-finite type.


list-members-is-Kuratowski-finite : {X : 𝓀 Μ‡ }
                                  β†’ (xs : List X)
                                  β†’ is-Kuratowski-finite
                                     (Ξ£ x κž‰ X , βˆ₯ member x xs βˆ₯)
list-members-is-Kuratowski-finite {𝓀} {A} xs =
 ∣ length xs , nth xs , nth-is-surjection xs ∣
  where
   open list-indexing pt


TODO: The function `nth` above should be placed in a more appropriate module.

\section{Alternative definition of compactness}

Compactness could have been alternatively defined as:


is-compact-open' : (X : Locale 𝓀 π“₯ 𝓦) β†’ ⟨ π’ͺ X ⟩ β†’ Ξ© (𝓀 βŠ” π“₯ βŠ” 𝓦 ⁺)
is-compact-open' {𝓀} {π“₯} {𝓦} X U =
 β±― S κž‰ Fam 𝓦 ⟨ π’ͺ X ⟩ ,
  U ≀ (⋁[ π’ͺ X ] S) β‡’
   (Ǝ (J , h) κž‰ SubFam S , is-Kuratowski-finite J
                         Γ— (U ≀ (⋁[ π’ͺ X ] ⁅  S [ h j ] ∣ j ∢ J ⁆)) holds)
   where
    open PosetNotation (poset-of (π’ͺ X))


This is much closer to the β€œevery cover has a finite subcover” definition from
point-set topology.

It is easy to show that this implies the standard definition of compactness, but
we need a bit of preparation first.

Given a family `S`, we denote by `family-of-lists S` the family of families
of lists of `S`.


module some-lemmas-on-directification (F : Frame 𝓀 π“₯ 𝓦) where

 family-of-lists : Fam 𝓦 ⟨ F ⟩ β†’ Fam 𝓦 (Fam 𝓦 ⟨ F ⟩)
 family-of-lists S = List (index S) , h
  where
   h : List (index S) β†’ Fam 𝓦 ⟨ F ⟩
   h is = (Ξ£ i κž‰ index S , βˆ₯ member i is βˆ₯) , S [_] ∘ pr₁


Using this, we can give an alternative definition of the directification of
a family:


 directifyβ‚‚ : Fam 𝓦 ⟨ F ⟩ β†’ Fam 𝓦 ⟨ F ⟩
 directifyβ‚‚ S = ⁅ ⋁[ F ] T ∣ T Ξ΅ family-of-lists S ⁆


The function `directifyβ‚‚` is equal to `directify` as expected.


 directifyβ‚‚-is-equal-to-directify
  : (S : Fam 𝓦 ⟨ F ⟩)
  β†’ directifyβ‚‚ S [_] ∼ directify F S [_]

 directifyβ‚‚-is-equal-to-directify S [] =
  directifyβ‚‚ S [ [] ]   =⟨ β…     ⟩
  𝟎[ F ]                =⟨refl⟩
  directify F S [ [] ]   ∎
   where

    † : (directifyβ‚‚ S [ [] ] ≀[ poset-of F ] 𝟎[ F ]) holds
    † = ⋁[ F ]-least
         (family-of-lists S [ [] ])
         (𝟎[ F ] , Ξ» { (_ , ΞΌ) β†’ 𝟘-elim (βˆ₯βˆ₯-rec 𝟘-is-prop not-in-empty-list ΞΌ)})

    β…  = only-𝟎-is-below-𝟎 F (directifyβ‚‚ S [ [] ]) †

 directifyβ‚‚-is-equal-to-directify S (i ∷ is) =
  directifyβ‚‚ S [ i ∷ is ]                =⟨ β…     ⟩
  S [ i ] ∨[ F ] directifyβ‚‚ S [ is ]     =⟨ β…‘    ⟩
  S [ i ] ∨[ F ] directify  F S [ is ]   =⟨refl⟩
  directify F S [ i ∷ is ]               ∎
   where
    open PosetNotation (poset-of F)
    open PosetReasoning (poset-of F)
    open Joins (Ξ» x y β†’ x ≀[ poset-of F ] y)

    IH = directifyβ‚‚-is-equal-to-directify S is

    Ξ² : ((S [ i ] ∨[ F ] directifyβ‚‚ S [ is ])
          is-an-upper-bound-of
         (family-of-lists S [ i ∷ is ]))
         holds
    β (j , ∣μ∣) =
     βˆ₯βˆ₯-rec (holds-is-prop (S [ j ] ≀ (S [ i ] ∨[ F ] directifyβ‚‚ S [ is ]))) † ∣μ∣
      where
       † : member j (i ∷ is)
         β†’ (S [ j ] ≀ (S [ i ] ∨[ F ] directifyβ‚‚ S [ is ]))
            holds
       † in-head     = ∨[ F ]-upper₁ (S [ j ]) (directifyβ‚‚ S [ is ])
       † (in-tail ΞΌ) =
        family-of-lists S [ i ∷ is ] [ j , ΞΌβ€² ]  =⟨ refl βŸ©β‚š
        S [ j ]                                  β‰€βŸ¨ β…      ⟩
        directifyβ‚‚ S [ is ]                      β‰€βŸ¨ β…‘     ⟩
        S [ i ] ∨[ F ] directifyβ‚‚ S [ is ]       β– 
         where
          ΞΌβ€² : βˆ₯ member j (i ∷ is) βˆ₯
          ΞΌβ€² = ∣ in-tail ΞΌ ∣

          β…  = ⋁[ F ]-upper (family-of-lists S [ is ]) (j , ∣ ΞΌ ∣)
          β…‘ = ∨[ F ]-upperβ‚‚ (S [ i ]) (directifyβ‚‚ S [ is ])

    Ξ³ : ((directifyβ‚‚ S [ i ∷ is ])
          is-an-upper-bound-of
         (family-of-lists S [ is ]))
        holds
    Ξ³ (k , ΞΌ) = βˆ₯βˆ₯-rec (holds-is-prop (S [ k ] ≀ directifyβ‚‚ S [ i ∷ is ])) β™’ ΞΌ
     where
      β™’ : member k is β†’ (S [ k ] ≀ directifyβ‚‚ S [ i ∷ is ]) holds
      β™’ ΞΌ = ⋁[ F ]-upper (family-of-lists S [ i ∷ is ]) (k , ∣ in-tail ΞΌ ∣)

    † : (directifyβ‚‚ S [ i ∷ is ] ≀ (S [ i ] ∨[ F ] directifyβ‚‚ S [ is ]))
         holds
    † = ⋁[ F ]-least
         (family-of-lists S [ i ∷ is ])
         ((S [ i ] ∨[ F ] directifyβ‚‚ S [ is ]) , Ξ²)

    ‑ : ((S [ i ] ∨[ F ] directifyβ‚‚ S [ is ]) ≀ directifyβ‚‚ S [ i ∷ is ])
         holds
    ‑ = ∨[ F ]-least ‑₁ ‑₂
     where
      ‑₁ : (S [ i ] ≀ directifyβ‚‚ S [ i ∷ is ]) holds
      ‑₁ = ⋁[ F ]-upper (family-of-lists S [ i ∷ is ]) (i , ∣ in-head ∣)

      ‑₂ : (directifyβ‚‚ S [ is ] ≀ directifyβ‚‚ S [ i ∷ is ]) holds
      ‑₂ = ⋁[ F ]-least
            (family-of-lists S [ is ])
            (directifyβ‚‚ S [ i ∷ is ] , Ξ³)

    β…   = ≀-is-antisymmetric (poset-of F) † ‑
    β…‘  = ap (Ξ» - β†’ S [ i ] ∨[ F ] -) IH


Using the equality between `directify` and `directifyβ‚‚`, we can now easily show
how to obtain a subcover, from which it follows that `is-compact` implies
`is-compact'`.


module characterization-of-compactness₁ (X : Locale 𝓀 π“₯ 𝓦) where

 open PosetNotation (poset-of (π’ͺ X))
 open PosetReasoning (poset-of (π’ͺ X))
 open some-lemmas-on-directification (π’ͺ X)

 finite-subcover-through-directification
  : (U : ⟨ π’ͺ X ⟩)
  β†’ (S : Fam 𝓦 ⟨ π’ͺ X ⟩)
  β†’ (is : List (index S))
  β†’ (U ≀ directify (π’ͺ X) S [ is ]) holds
  β†’ Ξ£ (J , Ξ²) κž‰ SubFam S ,
     is-Kuratowski-finite J Γ— (U ≀ (⋁[ π’ͺ X ] ⁅  S [ Ξ² j ] ∣ j ∢ J ⁆)) holds
 finite-subcover-through-directification U S is p = T , 𝕗 , q
  where
   T : SubFam S
   T = (Ξ£ i κž‰ index S , βˆ₯ member i is βˆ₯) , pr₁

   𝕗 : is-Kuratowski-finite (index T)
   𝕗 = list-members-is-Kuratowski-finite is

   † = directifyβ‚‚-is-equal-to-directify S is ⁻¹

   q : (U ≀ (⋁[ π’ͺ X ] ⁅ S [ T [ x ] ] ∣ x ∢ index T ⁆)) holds
   q = U                                          β‰€βŸ¨ p     ⟩
       directify (π’ͺ X) S [ is ]                   =⟨ †    βŸ©β‚š
       directifyβ‚‚ S [ is ]                        =⟨ refl βŸ©β‚š
       ⋁[ π’ͺ X ] ⁅ S [ T [ x ] ] ∣ x ∢ index T ⁆   β– 


It follows from this that `is-compact-open` implies `is-compact-open'`.


 compact-open-implies-compact-open' : (U : ⟨ π’ͺ X ⟩)
                                    β†’ is-compact-open  X U holds
                                    β†’ is-compact-open' X U holds
 compact-open-implies-compact-open' U ΞΊ S q = βˆ₯βˆ₯-functor † (ΞΊ S↑ Ξ΄ p)
  where
   open JoinNotation (join-of (π’ͺ X))

   Xβ‚š = poset-of (π’ͺ X)

   S↑ : Fam 𝓦 ⟨ π’ͺ X ⟩
   S↑ = directify (π’ͺ X) S

   Ξ΄ : is-directed (π’ͺ X) (directify (π’ͺ X) S) holds
   Ξ΄ = directify-is-directed (π’ͺ X) S

   p : (U ≀[ Xβ‚š ] (⋁[ π’ͺ X ] S↑)) holds
   p = U             β‰€βŸ¨ β…  ⟩
       ⋁[ π’ͺ X ] S    =⟨ β…‘ βŸ©β‚š
       ⋁[ π’ͺ X ] S↑   β– 
        where
         β…  = q
         β…‘ = directify-preserves-joins (π’ͺ X) S

   † : Ξ£ is κž‰ index S↑ , (U ≀[ Xβ‚š ] S↑ [ is ]) holds
     β†’ Ξ£ (J , Ξ²) κž‰ SubFam S , is-Kuratowski-finite J
                            Γ— (U ≀[ Xβ‚š ] (β‹βŸ¨ j ∢ J ⟩ S [ Ξ² j ])) holds
   † = uncurry (finite-subcover-through-directification U S)


We now prove the converse which is a bit more difficult. We start with some
preparation.

Given a subset `P : ⟨ π’ͺ X ⟩ β†’ Ξ©` and a family `S : Fam 𝓀 ⟨ π’ͺ X ⟩`, the type
`Upper-Bound-Data P S` is the type of indices `i` of `S` such that `S [ i ]` is
an upper bound of the subset `P`.


module characterization-of-compactnessβ‚‚ (X : Locale (𝓀 ⁺) 𝓀 𝓀) where

 open some-lemmas-on-directification (π’ͺ X)
 open PosetNotation (poset-of (π’ͺ X))
 open PosetReasoning (poset-of (π’ͺ X))
 open Joins (Ξ» x y β†’ x ≀ y)

 Upper-Bound-Data : π“Ÿ {𝓣} ⟨ π’ͺ X ⟩ β†’ Fam 𝓀 ⟨ π’ͺ X ⟩ β†’ 𝓀 ⁺ βŠ” 𝓣 Μ‡
 Upper-Bound-Data P S =
  Ξ£ i κž‰ index S , (β±― x κž‰ ⟨ π’ͺ X ⟩ , P x β‡’ x ≀ S [ i ]) holds


We now define the truncated version of this which we denote `has-upper-bound-in`:


 has-upper-bound-in :  π“Ÿ {𝓣} ⟨ π’ͺ X ⟩ β†’ Fam 𝓀 ⟨ π’ͺ X ⟩ β†’ Ξ© (𝓀 ⁺ βŠ” 𝓣)
 has-upper-bound-in P S = βˆ₯ Upper-Bound-Data P S βˆ₯Ξ©


Given a family `S`, we denote by `Ο‡βˆ™ S` the subset corresponding to the image of
the family.


 Ο‡βˆ™ : Fam 𝓀 ⟨ π’ͺ X ⟩ β†’ ⟨ π’ͺ X ⟩ β†’ Ξ© (𝓀 ⁺)
 Ο‡βˆ™ S U = U ∈image (S [_]) , being-in-the-image-is-prop U (S [_])
  where
   open Equality carrier-of-[ poset-of (π’ͺ X) ]-is-set


Given a Kuratowski-finite family `S`, the subset `Ο‡βˆ™ S` is a Kuratowski-finite
subset.


 Ο‡βˆ™-of-Kuratowski-finite-subset-is-Kuratowski-finite
  : (S : Fam 𝓀 ⟨ π’ͺ X ⟩)
  β†’ is-Kuratowski-finite (index S)
  β†’ is-Kuratowski-finite-subset (Ο‡βˆ™ S)
 Ο‡βˆ™-of-Kuratowski-finite-subset-is-Kuratowski-finite S = βˆ₯βˆ₯-functor †
  where
   † : Ξ£ n κž‰ β„• , Fin n β†  index S β†’ Ξ£ n κž‰ β„• , Fin n β†  image (S [_])
   † (n , h , Οƒ) = n , hβ€² , Ο†
    where
     hβ€² : Fin n β†’ image (S [_])
     hβ€² = corestriction (S [_]) ∘ h

     Ο† : is-surjection hβ€²
     Ο† = ∘-is-surjection Οƒ (corestrictions-are-surjections (S [_]))


We are now ready to prove our main lemma stating that every directed family `S`
contains at least one upper bound of every Kuratowski-finite subset.


 open binary-unions-of-subsets pt

 directed-families-have-upper-bounds-of-Kuratowski-finite-subsets
  : (S : Fam 𝓀 ⟨ π’ͺ X ⟩)
  β†’ is-directed (π’ͺ X) S holds
  β†’ (P : π“š ⟨ π’ͺ X ⟩)
  β†’ (⟨ P ⟩ βŠ† Ο‡βˆ™ S)
  β†’ has-upper-bound-in ⟨ P ⟩ S holds
 directed-families-have-upper-bounds-of-Kuratowski-finite-subsets S 𝒹 (P , 𝕗) Ο† =
  Kuratowski-finite-subset-induction pe fe ⟨ π’ͺ X ⟩ Οƒ R i Ξ² Ξ³ Ξ΄ (P , 𝕗) Ο†
   where
    R : π“š ⟨ π’ͺ X ⟩ β†’ 𝓀 ⁺ Μ‡
    R Q = ⟨ Q ⟩ βŠ† Ο‡βˆ™ S β†’ has-upper-bound-in ⟨ Q ⟩ S holds

    i : (Q : π“š ⟨ π’ͺ X ⟩) β†’ is-prop (R Q)
    i Q = Ξ -is-prop fe Ξ» _ β†’ holds-is-prop (has-upper-bound-in ⟨ Q ⟩ S)

    Οƒ : is-set ⟨ π’ͺ X ⟩
    Οƒ = carrier-of-[ poset-of (π’ͺ X) ]-is-set

    open singleton-Kuratowski-finite-subsets Οƒ

    Ξ² : R βˆ…[π“š]
    Ξ² _ = βˆ₯βˆ₯-functor
           (Ξ» i β†’ i , Ξ» _ β†’ 𝟘-elim)
           (directedness-entails-inhabitation (π’ͺ X) S 𝒹)

    Ξ³ : (U : ⟨ π’ͺ X ⟩) β†’ R ❴ U ❡[π“š]
    Ξ³ U ΞΌ = βˆ₯βˆ₯-functor † (ΞΌ U refl)
     where
      † : Ξ£ i κž‰ index S , S [ i ] = U
        β†’ Upper-Bound-Data ⟨ ❴ U ❡[π“š] ⟩ S
      † (i , q) = i , Ο‘
       where
        Ο‘ : (V : ⟨ π’ͺ X ⟩ ) β†’ U = V β†’ (V ≀ S [ i ]) holds
        Ο‘ V p = V          =⟨ p ⁻¹ βŸ©β‚š
                U          =⟨ q ⁻¹ βŸ©β‚š
                S [ i ]    β– 

    Ξ΄ : (π’œ ℬ : π“š ⟨ π’ͺ X ⟩) β†’ R π’œ β†’ R ℬ β†’ R (π’œ βˆͺ[π“š] ℬ)
    Ξ΄ π’œ@(A , _) ℬ@(B , _) ψ Ο‘ ΞΉ =
     βˆ₯βˆ₯-recβ‚‚ (holds-is-prop (has-upper-bound-in (A βˆͺ B) S)) † (ψ ι₁) (Ο‘ ΞΉβ‚‚)
      where
       ι₁ : A βŠ† Ο‡βˆ™ S
       ι₁ V ΞΌ = ΞΉ V ∣ inl ΞΌ ∣

       ΞΉβ‚‚ : B βŠ† Ο‡βˆ™ S
       ΞΉβ‚‚ V ΞΌ = ΞΉ V ∣ inr ΞΌ ∣

       † : Upper-Bound-Data A S
         β†’ Upper-Bound-Data B S
         β†’ has-upper-bound-in (A βˆͺ B) S holds
       † (i , ΞΎ) (j , ΞΆ) = βˆ₯βˆ₯-functor ‑ (prβ‚‚ 𝒹 i j)
        where
         ‑ : (Ξ£ k κž‰ index S , (S [ i ] ≀[ poset-of (π’ͺ X) ] S [ k ]) holds
                            Γ— (S [ j ] ≀[ poset-of (π’ͺ X) ] S [ k ]) holds)
           β†’ Upper-Bound-Data (A βˆͺ B) S
         ‑ (k , p , q) = k , β™’
          where
           β™’ : (U : ⟨ π’ͺ X ⟩) β†’ U ∈ (A βˆͺ B) β†’ (U ≀ S [ k ]) holds
           β™’ U = βˆ₯βˆ₯-rec (holds-is-prop (U ≀ S [ k ])) β™ 
            where
             β™  : A U holds + B U holds β†’ (U ≀ S [ k ]) holds
             β™  (inl ΞΌ) = U           β‰€βŸ¨ ΞΎ U ΞΌ ⟩
                         S [ i ]     β‰€βŸ¨ p     ⟩
                         S [ k ]     β– 
             β™  (inr ΞΌ) = U           β‰€βŸ¨ ΞΆ U ΞΌ ⟩
                         S [ j ]     β‰€βŸ¨ q     ⟩
                         S [ k ]     β– 


From this, we get that directed families contain at least one upper bound of
their Kuratowski-finite subfamilies.


 directed-families-have-upper-bounds-of-Kuratowski-finite-subfamilies
  : (S : Fam 𝓀 ⟨ π’ͺ X ⟩)
  β†’ is-directed (π’ͺ X) S holds
  β†’ (π’₯ : SubFam S)
  β†’ is-Kuratowski-finite (index π’₯)
  β†’ has-upper-bound-in (Ο‡βˆ™ ⁅ S [ π’₯ [ j ] ] ∣ j ∢ index π’₯ ⁆) S holds
 directed-families-have-upper-bounds-of-Kuratowski-finite-subfamilies S 𝒹 π’₯ 𝕗 =
  directed-families-have-upper-bounds-of-Kuratowski-finite-subsets
   S
   𝒹
   (Ο‡βˆ™ ⁅ S [ π’₯ [ j ] ] ∣ j ∢ index π’₯ ⁆ , 𝕗′)
   †
    where
     𝕗′ : is-Kuratowski-finite-subset (Ο‡βˆ™ ⁅ S [ π’₯ [ j ] ] ∣ j ∢ index π’₯ ⁆)
     𝕗′ = Ο‡βˆ™-of-Kuratowski-finite-subset-is-Kuratowski-finite
           ⁅ S [ π’₯ [ j ] ] ∣ j ∢ index π’₯ ⁆
           𝕗

     † : Ο‡βˆ™ ⁅ S [ π’₯ [ j ] ] ∣ j ∢ index π’₯ ⁆ βŠ† Ο‡βˆ™ S
     † U = βˆ₯βˆ₯-functor ‑
      where
       ‑ : Ξ£ j κž‰ index π’₯ , S [ π’₯ [ j ] ] = U β†’ Ξ£ i κž‰ index S , S [ i ] = U
       ‑ (i , p) = π’₯ [ i ] , p


It easily follows from this that `is-compact-open'` implies `is-compact-open`.


 compact-open'-implies-compact-open : (U : ⟨ π’ͺ X ⟩)
                                    β†’ is-compact-open' X U holds
                                    β†’ is-compact-open  X U holds
 compact-open'-implies-compact-open U ΞΊ S Ξ΄ p = βˆ₯βˆ₯-rec βˆƒ-is-prop † (ΞΊ S p)
  where
   † : Ξ£ (J , h) κž‰ SubFam S , is-Kuratowski-finite J
                            Γ— (U ≀ (⋁[ π’ͺ X ] ⁅  S [ h j ] ∣ j ∢ J ⁆)) holds
     β†’ βˆƒ i κž‰ index S , (U ≀ S [ i ]) holds
   † ((J , h) , 𝕗 , c) = βˆ₯βˆ₯-functor ‑ Ξ³
    where
     Sβ€² : Fam 𝓀 ⟨ π’ͺ X ⟩
     Sβ€² = ⁅  S [ h j ] ∣ j ∢ J ⁆

     ‑ : Upper-Bound-Data (Ο‡βˆ™ Sβ€²) S β†’ Ξ£ (Ξ» i β†’ (U ≀ S [ i ]) holds)
     ‑ (i , q) = i , β™’
      where
       Ο† : ((S [ i ]) is-an-upper-bound-of Sβ€²) holds
       Ο† j = q (Sβ€² [ j ]) ∣ j , refl ∣

       β…  = c
       β…‘ = ⋁[ π’ͺ X ]-least ⁅ S [ h j ] ∣ j ∢ J ⁆ (S [ i ] , Ο†)

       β™’ : (U ≀ S [ i ]) holds
       β™’ = U                                 β‰€βŸ¨ β…  ⟩
           ⋁[ π’ͺ X ] ⁅ S [ h j ] ∣ j ∢ J ⁆    β‰€βŸ¨ β…‘ ⟩
           S [ i ]                           β– 

     Ξ³ : has-upper-bound-in (Ο‡βˆ™ Sβ€²) S holds
     Ξ³ = directed-families-have-upper-bounds-of-Kuratowski-finite-subfamilies
          S
          Ξ΄
          (J , h)
          𝕗


\section{Another alternative definition}

We now provide another variant of the definition `is-compact-open'`, which we
show to be equivalent. This one says exactly that every cover has a
Kuratowski-finite subcover.


is-compact-open'' : (X : Locale 𝓀 π“₯ 𝓦) β†’ ⟨ π’ͺ X ⟩ β†’ Ξ© (𝓀 βŠ” 𝓦 ⁺)
is-compact-open'' {𝓀} {π“₯} {𝓦} X U =
 β±― S κž‰ Fam 𝓦 ⟨ π’ͺ X ⟩ ,
  (U οΌβ‚š ⋁[ π’ͺ X ] S) β‡’
   (Ǝ (J , h) κž‰ SubFam S , is-Kuratowski-finite J
                         Γ— (U = ⋁[ π’ͺ X ] ⁅  S [ h j ] ∣ j ∢ J ⁆))
    where
     open PosetNotation (poset-of (π’ͺ X))
     open Equality carrier-of-[ poset-of (π’ͺ X) ]-is-set

module characterization-of-compactness₃ (X : Locale 𝓀 π“₯ 𝓦) where

 open PosetNotation (poset-of (π’ͺ X))
 open PosetReasoning (poset-of (π’ͺ X))
 open some-lemmas-on-directification (π’ͺ X)


To see that `is-compact-open'` implies `is-compact-open''`, notice first that
for every open `U : ⟨ π’ͺ X ⟩` and family `S`, we have that `U ≀ ⋁ S` if and
only if `U = ⋁ { U ∧ Sα΅’ ∣ i : index S}`.


 distribute-inside-cover₁ : (U : ⟨ π’ͺ X ⟩) (S : Fam 𝓦 ⟨ π’ͺ X ⟩)
                          β†’ U = ⋁[ π’ͺ X ] ⁅ U ∧[ π’ͺ X ] (S [ i ]) ∣ i ∢ index S ⁆
                          β†’ (U ≀ (⋁[ π’ͺ X ] S)) holds
 distribute-inside-cover₁ U S p = connecting-lemmaβ‚‚ (π’ͺ X) †
  where
   β…  = p

   β…‘ : ⋁[ π’ͺ X ] ⁅ U ∧[ π’ͺ X ] S [ i ] ∣ i ∢ index S ⁆ = U ∧[ π’ͺ X ] (⋁[ π’ͺ X ] S)
   β…‘ = distributivity (π’ͺ X) U S ⁻¹

   † : U = U ∧[ π’ͺ X ] (⋁[ π’ͺ X ] S)
   † = U                                               =⟨ β…  ⟩
       ⋁[ π’ͺ X ] ⁅ U ∧[ π’ͺ X ] S [ i ] ∣ i ∢ index S ⁆   =⟨ β…‘ ⟩
       U ∧[ π’ͺ X ] (⋁[ π’ͺ X ] S)                         ∎

 distribute-inside-coverβ‚‚
  : (U : ⟨ π’ͺ X ⟩) (S : Fam 𝓦 ⟨ π’ͺ X ⟩)
  β†’ (U ≀ (⋁[ π’ͺ X ] S)) holds
  β†’ U = ⋁[ π’ͺ X ] ⁅ U ∧[ π’ͺ X ] (S [ i ]) ∣ i ∢ index S ⁆
 distribute-inside-coverβ‚‚ U S p =
  U                                                 =⟨ β…  ⟩
  U ∧[ π’ͺ X ] (⋁[ π’ͺ X ] S)                           =⟨ β…‘ ⟩
  ⋁[ π’ͺ X ] ⁅ U ∧[ π’ͺ X ] (S [ i ]) ∣ i ∢ index S ⁆   ∎
  where
   β…  = connecting-lemma₁ (π’ͺ X) p
   β…‘ = distributivity (π’ͺ X) U S


The backward implication follows easily from these two lemmas.


 compact-open''-implies-compact-open' : (U : ⟨ π’ͺ X ⟩)
                                      β†’ is-compact-open'' X U holds
                                      β†’ is-compact-open'  X U holds
 compact-open''-implies-compact-open' U ΞΊ S p = βˆ₯βˆ₯-functor † β™’
  where
   q : U = ⋁[ π’ͺ X ] ⁅ U ∧[ π’ͺ X ] (S [ i ]) ∣ i ∢ index S ⁆
   q = distribute-inside-coverβ‚‚ U S p

   β™’ : βˆƒ (J , h) κž‰ SubFam S , is-Kuratowski-finite J
                            Γ— (U = ⋁[ π’ͺ X ] ⁅ U ∧[ π’ͺ X ] S [ h j ] ∣ j ∢ J ⁆)
   β™’ = ΞΊ ⁅ U ∧[ π’ͺ X ] (S [ i ]) ∣ i ∢ index S ⁆ q

   † : Ξ£ (J , h) κž‰ SubFam S , is-Kuratowski-finite J
                            Γ— (U = ⋁[ π’ͺ X ] ⁅ U ∧[ π’ͺ X ] S [ h j ] ∣ j ∢ J ⁆)
     β†’ Ξ£ (J , h) κž‰ SubFam S , is-Kuratowski-finite J
                            Γ— (U ≀ (⋁[ π’ͺ X ] ⁅ S [ h j ] ∣ j ∢ J ⁆)) holds
   † (π’₯@(J , h) , 𝕗 , p) =
    π’₯ , 𝕗 , distribute-inside-cover₁ U ⁅ S [ h j ] ∣ j ∢ J ⁆ p


Now, the forward implication:


 compact-open'-implies-compact-open'' : (U : ⟨ π’ͺ X ⟩)
                                      β†’ is-compact-open'  X U holds
                                      β†’ is-compact-open'' X U holds
 compact-open'-implies-compact-open'' U ΞΊ S p = βˆ₯βˆ₯-functor † (ΞΊ S c)
  where
   open Joins (Ξ» x y β†’ x ≀ y)
   open PosetNotation (poset-of (π’ͺ X)) renaming (_≀_ to _β‰€βˆ™_)

   c : (U β‰€βˆ™ (⋁[ π’ͺ X ] S)) holds
   c = reflexivity+ (poset-of (π’ͺ X)) p

   † : (Ξ£ F κž‰ SubFam S ,
         is-Kuratowski-finite (index F)
         Γ— (U β‰€βˆ™ (⋁[ π’ͺ X ] ⁅ S [ F [ j ] ] ∣ j ∢ index F ⁆)) holds)
     β†’ Ξ£ F κž‰ SubFam S ,
        is-Kuratowski-finite (index F)
        Γ— (U = ⋁[ π’ͺ X ] ⁅ S [ F [ j ] ] ∣ j ∢ index F ⁆)
   † (F , 𝕗 , q) = F , 𝕗 , r
    where
     ψ : cofinal-in (π’ͺ X) ⁅ S [ F [ j ] ] ∣ j ∢ index F ⁆ S holds
     ψ j = ∣ F [ j ] , ≀-is-reflexive (poset-of (π’ͺ X)) (S [ F [ j ] ]) ∣

     β™’ : ((⋁[ π’ͺ X ] ⁅ S [ F [ j ] ] ∣ j ∢ index F ⁆) β‰€βˆ™ U) holds
     β™’ = ⋁[ π’ͺ X ] ⁅ S [ F [ j ] ] ∣ j ∢ index F ⁆   β‰€βŸ¨  β…  ⟩
         ⋁[ π’ͺ X ] S                                 =⟨ β…‘ βŸ©β‚š
         U                                          β– 
          where
           β…  = cofinal-implies-join-covered (π’ͺ X) _ _ ψ
           β…‘ = p ⁻¹

     r : U = ⋁[ π’ͺ X ] ⁅ S [ F [ j ] ] ∣ j ∢ index F ⁆
     r = ≀-is-antisymmetric (poset-of (π’ͺ X)) q β™’


In the above proof, I have implemented a simplification that Tom de Jong
suggested in a code review.