Category
--- title: Category of formal topologies author: Ayberk Tosun date-started: 2026-08-27 date-completed: 2026-09-02 --- This module defines the category of formal topologies as well as that of quasi formal topologies, following [1] as a reference.{-# OPTIONS --safe --without-K #-} open import UF.FunExt open import UF.PropTrunc open import UF.Subsingletons module Locales.FormalTopology.Category (pt : propositional-truncations-exist) (fe : Fun-Ext) (pe : Prop-Ext) where open import Categories.Pre open import Categories.Wild open import Locales.FormalTopology.Definition pt fe open import Locales.FormalTopology.Morphism pt fe pe open import Locales.Frame pt fe hiding (β¨_β©) open import MLTT.Spartan open import Notation.CanonicalMap open import Notation.UnderlyingType open import UF.Base open import UF.Powerset open import UF.SubtypeClassifier open Formal-Topology-Morphism open Quasi-Formal-Topology-Morphism\section{Preliminaries} We first prove a lemma establishing that `relational-image` commutes with composition.open PropositionalTruncation pt relational-image-commutes-with-composition : {A B C : π€ Μ} β (f : A β π B) β (g : B β π C) β (U : π A) β g β¦ f β¦ U β¦ β¦ οΌ (Ξ» - β g β¦ f - β¦) β¦ U β¦ relational-image-commutes-with-composition f g U = subset-extensionality pe fe β β‘ where β : g β¦ f β¦ U β¦ β¦ β (Ξ» - β g β¦ f - β¦) β¦ U β¦ β c = β₯β₯-rec (holds-is-prop (c ββ ((Ξ» - β g β¦ f - β¦) β¦ U β¦))) β where β : Ξ£ (b , _) κ π (f β¦ U β¦) , c β g b β c β ((Ξ» - β g β¦ f - β¦) β¦ U β¦) β ((b , h) , p) = β₯β₯-rec (holds-is-prop (c ββ ((Ξ» - β g β¦ f - β¦) β¦ U β¦))) β ‘ h where β ‘ : (Ξ£ (a , _) κ π U , b β f a) β c β ((Ξ» - β g β¦ f - β¦) β¦ U β¦) β ‘ ((a , ΞΌ) , q) = β£ (a , ΞΌ) , β ’ β£ where β ’ : c β (g β¦ f a β¦) β ’ = β£ (b , q) , p β£ β‘ : (Ξ» - β g β¦ f - β¦) β¦ U β¦ β g β¦ f β¦ U β¦ β¦ β‘ c = β₯β₯-rec (holds-is-prop (c ββ (g β¦ f β¦ U β¦ β¦))) β where β : Ξ£ (a , _) κ π U , c β (g β¦ f a β¦) β c β (g β¦ f β¦ U β¦ β¦) β ((a , p) , h) = β₯β₯-rec (holds-is-prop (c ββ (g β¦ f β¦ U β¦ β¦))) β ‘ h where β ‘ : Ξ£ (b , _) κ π (f a) , c β g b β c β (g β¦ f β¦ U β¦ β¦) β ‘ ((b , q) , hβ²) = β£ (b , β£ (a , p) , q β£) , hβ² β£\section{Category of quasi formal topologies} We start by defining composition of quasi formal topology morphisms.qftop-composition : (π β¬ π : Quasi-Formal-Topology π€) β (β¬ βqftβ π) β (π βqftβ β¬) β (π βqftβ π) qftop-composition π β¬ π β π» = h , h-preserves-top , h-preserves-covering where f = fun π β¬ π» g = fun β¬ π β h : β¨ π β© β π β¨ π β© h = Ξ» - β g β¦ f - β¦ h-preserves-top : (full βQβΊ[ π ] h β¦ full β¦) holds h-preserves-top = β € where β : (full βQβΊ[ β¬ ] f β¦ full β¦) holds β = fun-preserves-top π β¬ π» β ‘ : (full βQβΊ[ π ] g β¦ full β¦) holds β ‘ = fun-preserves-top β¬ π β β ’ : (g β¦ full β¦ βQβΊ[ π ] g β¦ f β¦ full β¦ β¦) holds β ’ = fun-preserves-covering-plus β¬ π β full (f β¦ full β¦) β β £ : (full βQβΊ[ π ] g β¦ f β¦ full β¦ β¦) holds β £ = transitivity-of-quasi-cover-plus π full _ _ β ‘ β ’ β € : (full βQβΊ[ π ] h β¦ full β¦) holds β € = transport (Ξ» - β (full βQβΊ[ π ] -) holds) (relational-image-commutes-with-composition f g full) β £ h-preserves-covering : preserves-covering π π h holds h-preserves-covering a U ΞΊ = β ’ where β : (f a βQβΊ[ β¬ ] f β¦ U β¦) holds β = fun-preserves-covering π β¬ π» a U ΞΊ β ‘ : (g β¦ f a β¦ βQβΊ[ π ] g β¦ f β¦ U β¦ β¦) holds β ‘ = fun-preserves-covering-plus β¬ π β (f a) (f β¦ U β¦) β β ’ : (g β¦ f a β¦ βQβΊ[ π ] h β¦ U β¦) holds β ’ = transport (Ξ» - β (g β¦ f a β¦ βQβΊ[ π ] -) holds) (relational-image-commutes-with-composition f g U) β ‘The identity morphism is neutral for composition.id-qftop-is-left-neutral : (π β¬ : Quasi-Formal-Topology π€) β (π» : π βqftβ β¬) β qftop-composition π β¬ β¬ (identity-morphism-qft β¬) π» οΌ π» id-qftop-is-left-neutral π β¬ π» = to-quasi-formal-topology-morphism-οΌ π β¬ (qftop-composition π β¬ β¬ (identity-morphism-qft β¬) π») π» β where open singleton-subsets (carrier-of-quasi-formal-topology-is-set β¬) f = fun π β¬ π» β : (a : β¨ π β©) β (Ξ» - β β΄ - β΅) β¦ f a β¦ οΌ f a β a = subset-extensionality pe fe β β ‘ where β : β΄_β΅ β¦ f a β¦ β f a β b = β₯β₯-rec (holds-is-prop (b ββ f a)) β‘ where β‘ : (Ξ£ (aβ² , _) κ π (f a) , b β β΄ aβ² β΅) β b β f a β‘ ((aβ² , p) , h) = transport (Ξ» - β - β f a) h p β ‘ : f a β β΄_β΅ β¦ f a β¦ β ‘ b ΞΌ = β£ (b , ΞΌ) , refl β£ id-qftop-is-right-neutral : (π β¬ : Quasi-Formal-Topology π€) β (π» : π βqftβ β¬) β qftop-composition π π β¬ π» (identity-morphism-qft π) οΌ π» id-qftop-is-right-neutral π β¬ π» = to-quasi-formal-topology-morphism-οΌ π β¬ (qftop-composition π π β¬ π» (identity-morphism-qft π)) π» β where open singleton-subsets (carrier-of-quasi-formal-topology-is-set π) f = fun π β¬ π» β : (a : β¨ π β©) β f β¦ β΄ a β΅ β¦ οΌ f a β a = subset-extensionality pe fe β β ‘ β»ΒΉ where β = Ξ» b p β β£ (a , refl) , p β£ β ‘ : f β¦ β΄ a β΅ β¦ β f a β ‘ b = β₯β₯-rec (holds-is-prop (f a b)) Ξ³ where Ξ³ : Ξ£ (aβ² , _) κ π β΄ a β΅ , b β f aβ² β b β f a Ξ³ ((aβ² , h) , q) = transport (Ξ» - β b β f -) (h β»ΒΉ) qAssociativity of `qftop-composition` stated with extensional equality of functions. This follows directly from `relational-image-commutes-with-composition`.qftop-composition-is-associative-extensional : (π β¬ π π : Quasi-Formal-Topology π€) β (π» : π βqftβ β¬) β (β : β¬ βqftβ π) β (π½ : π βqftβ π) β fun π π (qftop-composition π π π π½ (qftop-composition π β¬ π β π»)) βΌ fun π π (qftop-composition π β¬ π (qftop-composition β¬ π π π½ β) π») qftop-composition-is-associative-extensional π β¬ π π π» β π½ = relational-image-commutes-with-composition g h β f where f = fun π β¬ π» g = fun β¬ π β h = fun π π π½Now, the actual associativity of composition for quasi formal topology morphisms.qftop-composition-is-associative : (π β¬ π π : Quasi-Formal-Topology π€) β (π» : π βqftβ β¬) β (β : β¬ βqftβ π) β (π½ : π βqftβ π) β qftop-composition π π π π½ (qftop-composition π β¬ π β π») οΌ qftop-composition π β¬ π (qftop-composition β¬ π π π½ β) π» qftop-composition-is-associative π β¬ π π π» β π½ = to-quasi-formal-topology-morphism-οΌ π π _ _ β where open Quasi-Formal-Topology-Morphism π π hiding (to-quasi-formal-topology-morphism-οΌ; fun) β : [ qftop-composition π π π π½ (qftop-composition π β¬ π β π») ] βΌ [ qftop-composition π β¬ π (qftop-composition β¬ π π π½ β) π» ] β = qftop-composition-is-associative-extensional π β¬ π π π» β π½We now have everything we need to define the precategory of quasi formal topologies.QFTopWildCategory : (π€ : Universe) β WildCategory (π€ βΊ) (π€ βΊ) QFTopWildCategory π€ = wildcategory (Quasi-Formal-Topology π€) _βqftβ_ (Ξ» {π} β identity-morphism-qft π) (Ξ» {π} {β¬} {π} β qftop-composition π β¬ π) (Ξ» {π} {β¬} β id-qftop-is-left-neutral π β¬) (Ξ» {π} {β¬} β id-qftop-is-right-neutral π β¬) (Ξ» {π} {β¬} {π} {π} β qftop-composition-is-associative π β¬ π π) QFTopPrecategory : (π€ : Universe) β Precategory (π€ βΊ) (π€ βΊ) QFTopPrecategory π€ = QFTopWildCategory π€ , _βqftβ_-is-set\section{Category of formal topologies} We define the category of formal topologies in this section, building atop the category of quasi formal topologies.ftop-composition : (π β¬ π : Formal-Topology π€) β (β¬ βftβ π) β (π βftβ β¬) β (π βftβ π) ftop-composition π β¬ π β π» = from-qft-morphism π π (qftop-composition πβ β¬β πβ ββ π»β) Ξ² where πβ = underlying-quasi-formal-topology π β¬β = underlying-quasi-formal-topology β¬ πβ = underlying-quasi-formal-topology π R = underlying-poset-of-formal-topology π π»β = to-qft-morphism π β¬ π» ββ = to-qft-morphism β¬ π β f = ft-fun π β¬ π» g = ft-fun β¬ π β open Downward-Closure-Intersection-Syntax (Ξ» x y β x β[ β¬ ] y) renaming (_β_ to _ββ_; β_ to ββ_) open Downward-Closure-Intersection-Syntax (Ξ» x y β x β[ π ] y) renaming (_β_ to _ββ_; β_ to ββ_) Ξ² : preserves-binary-meets π π (relational-image g β f) holds Ξ² aβ aβ c (ΞΌβ , ΞΌβ) = β₯β₯-recβ (holds-is-prop (_ β[ π ] _)) β ΞΌβ ΞΌβ where β : Ξ£ cβ κ β¨ π β© , cβ β (relational-image g β f) aβ Γ (c β€[ R ] cβ) holds β Ξ£ cβ κ β¨ π β© , cβ β (relational-image g β f) aβ Γ (c β€[ R ] cβ) holds β (c β[ π ] (relational-image g β f) β¦ lower-bounds π π aβ aβ β¦) holds β (cβ , Ξ½β , pβ) (cβ , Ξ½β , pβ) = β₯β₯-recβ (holds-is-prop (_ β[ π ] _)) Ξ³ Ξ½β Ξ½β where Ξ³ : (Ξ£ (bβ , _) κ π (f aβ) , cβ β g bβ) β (Ξ£ (bβ , _) κ π (f aβ) , cβ β g bβ) β (c β[ π ] (relational-image g β f) β¦ lower-bounds π π aβ aβ β¦) holds Ξ³ ((bβ , ΞΈβ) , qβ) ((bβ , ΞΈβ) , qβ) = c ββ¨ β β© g bβ ββ g bβ ββΊβ¨ β ‘ β© g β¦ lower-bounds β¬ β¬ bβ bβ β¦ ββΊβ¨ β ’ β© g β¦ f β¦ lower-bounds π π aβ aβ β¦ β¦ οΌβ¨ β £ β©c (relational-image g β f) β¦ lower-bounds π π aβ aβ β¦ β where β : (c β[ π ] g bβ ββ g bβ) holds β = reflexivity-of-quasi-cover πβ c (g bβ ββ g bβ) (β£ cβ , qβ , pβ β£ , β£ cβ , qβ , pβ β£) β ‘ : (g bβ ββ g bβ ββΊ[ π ] g β¦ lower-bounds β¬ β¬ bβ bβ β¦) holds β ‘ = ft-fun-preserves-binary-meets β¬ π β bβ bβ ΞΎ : (lower-bounds β¬ β¬ bβ bβ ββΊ[ β¬ ] f β¦ lower-bounds π π aβ aβ β¦) holds ΞΎ = lower-bounds β¬ β¬ bβ bβ ββΊβ¨ β ₯ β© f aβ ββ f aβ ββΊβ¨ β ¦ β© f β¦ lower-bounds π π aβ aβ β¦ β where open Quasi-Cover-Reasoning β¬β β ₯ : (lower-bounds β¬ β¬ bβ bβ ββΊ[ β¬ ] f aβ ββ f aβ) holds β ₯ b (rβ , rβ) = reflexivity-of-quasi-cover β¬β b (f aβ ββ f aβ) (β£ bβ , ΞΈβ , rβ β£ , β£ bβ , ΞΈβ , rβ β£) β ¦ : (f aβ ββ f aβ ββΊ[ β¬ ] f β¦ lower-bounds π π aβ aβ β¦) holds β ¦ = ft-fun-preserves-binary-meets π β¬ π» aβ aβ β ’ : (g β¦ lower-bounds β¬ β¬ bβ bβ β¦ ββΊ[ π ] g β¦ f β¦ lower-bounds π π aβ aβ β¦ β¦) holds β ’ = fun-preserves-covering-plus β¬β πβ ββ (lower-bounds β¬ β¬ bβ bβ) _ ΞΎ β £ = relational-image-commutes-with-composition f g (lower-bounds π π aβ aβ) open Quasi-Cover-Reasoning πβThe identity morphism is left neutral for composition.id-ftop-is-left-neutral : (π β¬ : Formal-Topology π€) β (π» : π βftβ β¬) β ftop-composition π β¬ β¬ (identity-morphism-ft β¬) π» οΌ π» id-ftop-is-left-neutral π β¬ π» = to-formal-topology-morphism-οΌ π β¬ _ π» β where πβ = underlying-quasi-formal-topology π β¬β = underlying-quasi-formal-topology β¬ π»β = to-qft-morphism π β¬ π» β : ft-fun π β¬ (ftop-composition π β¬ β¬ (identity-morphism-ft β¬) π») βΌ ft-fun π β¬ π» β = happly (ap (fun πβ β¬β) (id-qftop-is-left-neutral πβ β¬β π»β))The identity morphism is right neutral for composition.id-ftop-is-right-neutral : (π β¬ : Formal-Topology π€) β (π» : π βftβ β¬) β ftop-composition π π β¬ π» (identity-morphism-ft π) οΌ π» id-ftop-is-right-neutral π β¬ π» = to-formal-topology-morphism-οΌ π β¬ _ π» β where πβ = underlying-quasi-formal-topology π β¬β = underlying-quasi-formal-topology β¬ π»β = to-qft-morphism π β¬ π» β : ft-fun π β¬ (ftop-composition π π β¬ π» (identity-morphism-ft π)) βΌ ft-fun π β¬ π» β = happly (ap (fun πβ β¬β) (id-qftop-is-right-neutral πβ β¬β π»β))Composition of formal topology morphisms is associative.ftop-composition-is-associative : (π β¬ π π : Formal-Topology π€) β (π» : π βftβ β¬) β (β : β¬ βftβ π) β (π½ : π βftβ π) β ftop-composition π π π π½ (ftop-composition π β¬ π β π») οΌ ftop-composition π β¬ π (ftop-composition β¬ π π π½ β) π» ftop-composition-is-associative π β¬ π π π» β π½ = to-formal-topology-morphism-οΌ π π _ _ β where open Formal-Topology-Morphism π π hiding (to-formal-topology-morphism-οΌ; to-qft-morphism) πβ = underlying-quasi-formal-topology π β¬β = underlying-quasi-formal-topology β¬ πβ = underlying-quasi-formal-topology π πβ = underlying-quasi-formal-topology π π»β = to-qft-morphism π β¬ π» ββ = to-qft-morphism β¬ π β π½β = to-qft-morphism π π π½ β : [ (ftop-composition π π π π½ (ftop-composition π β¬ π β π»)) ] βΌ [ (ftop-composition π β¬ π (ftop-composition β¬ π π π½ β) π») ] β = qftop-composition-is-associative-extensional πβ β¬β πβ πβ π»β ββ π½βFinally, we write down the precategory of formal topologies.FTopWildCategory : (π€ : Universe) β WildCategory (π€ βΊ) (π€ βΊ) FTopWildCategory π€ = wildcategory (Formal-Topology π€) _βftβ_ (Ξ» {π} β identity-morphism-ft π) (Ξ» {π} {β¬} {π} β ftop-composition π β¬ π) (Ξ» {π} {β¬} β id-ftop-is-left-neutral π β¬) (Ξ» {π} {β¬} β id-ftop-is-right-neutral π β¬) (Ξ» {π} {β¬} {π} {π} β ftop-composition-is-associative π β¬ π π) FTopPrecategory : (π€ : Universe) β Precategory (π€ βΊ) (π€ βΊ) FTopPrecategory π€ = FTopWildCategory π€ , β where β : is-precategory (FTopWildCategory π€) β π β¬ = _βftβ_-is-set π β¬[1]: Sara Negri. _Continuous domains as formal spaces_. Mathematical Structures in Computer Science, Volume 12, No. 1, pp. 19β52, 2002. DOI:10.1017/S0960129501003450