Patch Locale of a Spectral Locale in Univalent Type Theory

Stone locales together with continuous maps form a coreflective subcategory of spectral locales and perfect maps. A proof in the internal language of an elementary topos was previously given by the second-named author. This proof can be easily translated to univalent type theory using resizing axioms. In this work, we show how to achieve such a translation without resizing axioms, by working with large, locally small, and small complete frames with small bases. This turns out to be nontrivial and involves predicative reformulations of several fundamental concepts of locale theory.


Introduction
The category Stone of Stone locales together with continuous maps forms a coreflective subcategory of the category Spec of spectral locales and perfect maps i.e. maps preserving compact opens.A proof in the internal language of an elementary topos was previously constructed in [7,9], defining the patch frame as the frame of Scott continuous nuclei on a given frame.
The objective of this paper is to carry out this construction in predicative, constructive univalent foundations.In the presence of Voevodsky's resizing axioms [15], it is straightforward to translate the above proof to univalent type theory.However, at the time of writing, there is no known constructive interpretation of the resizing axioms.In such a predicative situation, the usual approach to locale theory is to work with presentations of locales, known as formal topologies [2,3,13].However, we show that it is possible to work with locales directly, if we adopt large, locally small, and small complete frames with small bases [6].This requires a number of substantial modifications to the proofs and constructions of [7,9]: (i) The patch is defined as the frame of Scott continuous nuclei in [7,9].In order to prove that this is indeed a frame, one starts with the frame of all nuclei, and then exhibits the Scott continuous nuclei

16-2
Patch Locale of a Spectral Locale in Univalent Type Theory as a subframe.However, this procedure does not seem to be possible in our predicative setting as it is not clear whether all nuclei form a frame; so we construct the frame of Scott continuous nuclei directly, which requires reformulations of all proofs about it inherited from the frame of all nuclei.(ii) In the impredicative setting, any frame has all Heyting implications, which is needed to construct open nuclei.Again, this does not seem to be the case in the predicative setting.We show, however, that it is possible to construct Heyting implications in locally small frames with small bases, by an application of the Adjoint Functor Theorem for posets.(iii) Similar to (ii), we use the Adjoint Functor Theorem for posets to define the right adjoint of a frame homomorphism, using which we define the notion of a perfect map, namely, a map whose defining frame homomorphism's right adjoint is Scott continuous.This notion is used in [7,9].
For the purposes of this work, a spectral locale is a locale in which the compact opens form a small basis closed under finite meets.A continuous map of spectral locales is spectral if its defining frame homomorphism preserves compact opens.A Stone locale is one that is compact and zero-dimensional (i.e. whose clopens form a basis).Every Stone locale is spectral since the clopens coincide with the compact opens in Stone locales.The patch frame construction is the right adjoint to the inclusion Stone ֒→ Spec.The main contribution of our work is the construction of this right adjoint in the predicative context of univalent type theory.We have also formalised the development of this paper in the Agda proof assistant [1], though our presentation here is self-contained and can be followed independently of the formalisation.Although we have omitted some proofs for lack of space, we have included all the crucial differences from [7,9] in full.
The organisation of this paper is as follows.In Section 2, we present the type-theoretical context in which we work.In Section 3, we present our definitions of spectral and Stone locales that provide a suitable basis for a predicative development.In Section 4, we present a predicative version of the Adjoint Functor Theorem for the simplified context of locales that is central to our development.In Section 5, we define the meet-semilattice of perfect nuclei as preparation for the complete lattice of perfect nuclei, which we then construct in Section 6. Finally in Section 7, we prove the desired universal property, namely, that the patch locale exhibits the category Stone as a coreflective subcategory of Spec.

Foundations
In this section, we present the type-theoretical setting in which we work and then provide the typetheoretical formulations of some of the preliminary notions that form the basis of our work.Our typetheoretical conventions follow those of de Jong and Escardó [5] and the Univalent Foundations Programme [14].
We work in Martin-Löf Type Theory with binary sums − + −, dependent products , dependent sums , the identity type − = −, and inductive types including the empty type 0, the unit type 1, and the type List(A) of lists over any type A. We adhere to the convention of [14] of using − ≡ − for judgemental equality and − = − for the identity type.
We work explicitly with universes, for which we adopt the convention of using the variables U , V, W, and T .The ground universe is denoted U 0 and the successor of a given universe U is denoted U + .The least upper bound of two universes is given by the operator − ⊔ − which is assumed to be associative, commutative, and idempotent.Furthermore, (−) + is assumed to distribute over − ⊔ −.Universes are computed for the given type formers as follows: • Given types X : U and Y : V, the type X + Y inhabits universe U ⊔ V.
• Given a type X : U and an X-indexed family, Y : X → V, both x:X Y (x) and x:X Y (x) inhabit the universe U ⊔ V.
• Given a type X : U and inhabitants x, y : X, the identity type x = y inhabits universe U .
• The type N of natural numbers inhabits U 0 .
• The empty type 0 and the unit type 1 have copies in every universe U , which we occasionally make explicit using the notations 0 U and 1 U .
Tosun and Escardó 16-3 • Given a type A : U , the type List(A) inhabits U .We assume only function extensionality, propositional extensionality and quotients, and do not need full univalence for our development.We always maintain a distinction between structure and property, and reserve logical connectives for propositional types i.e. types A satisfying isProp (A) := x,y:A x = y.We denote by Ω U the type of propositional types in universe U i.e.Ω U := Σ A:U isProp (A).
We assume the existence of propositional truncation, given by a type former − : U → U and a unit operation |−| : A → A .The existential quantification operator is defined using propositional truncation as: When presenting proofs informally, we adopt the following conventions for avoiding ambiguity between propositional and non-propositional types: • For the anonymous inhabitation |A| of a type, we say that A is inhabited; • For truncated Σ types, we use the terminologies there is and there exists.

Directed families
We now proceed to define some preliminary notions in the type-theoretical setting that we have just presented.
Definition 2.1 (Family) A U -family on a type A is a pair (I, f ) where I : U and f : I → A. We denote the type of U -families on type A by Fam U (A) i.e.Fam U (A) := (I:U ) I → A.
We often use the shorthand {x i } i:I for families.In other words, instead of writing (I, f ) for a family, we write {x i } i:I where x i denotes the application f (i).Definition 2.2 (Subfamily) By a subfamily of some U -family (I, f ) we mean a family (J, f • g) where (J, g) is itself a U -family on I.
When considering a subfamily J of some family {x i } i:I , we often use the abbreviation {x j | j ∈ J}.As mentioned in the introduction, Scott continuity plays a central role in our development.To define Scott continuity, we define the notion of a directed family.The definition that we work with (also used by de Jong and Escardó [5]) is the following: Definition 2.3 (Directed family) Let {x i } i:I be a family in some type A that is equipped with a preorder − ≤ −.The family {x i } i:I is called directed if (1) I is inhabited, and (2) for every i, j : I, there exists some k : I such that x k is the upper bound of {x i , x j }.

Definition of locale
A locale is a notion of space characterised solely by its frame of opens.Our definition of a frame is parameterised by three universes: (1) for the carrier set, (2) for the order, and (3) for the index types of families on which the join operation is defined.We adopt the convention of using the universe variables U , V, and W for these respectively.We often omit universe levels in contexts where they are not relevant to the discussion.In cases where only the index universe W is relevant, we speak of a W-locale for the sake of brevity and omit universes U and V. Definition 2.4 (Frame) A (U , V, W)-frame L consists of: for every U : |L| and W-family {V i } i:I in |L|.
It follows automatically from the antisymmetry condition for partial orders that the underlying type of a frame is a set.Finally, we note that most of our results are restricted to (U + , U , U )-frames for a fixed universe U , which we refer to as large, locally small, and small complete frames.Even though some of our results apply to frames of a more general form, we refrain from presenting the specific level of generality for the sake of brevity.For the precise universe levels, we refer the reader to the formalisation.Definition 2.5 (Frame homomorphism) Let K and L be a (U , V, W)-frame and a (U ′ , V ′ , W)-frame respectively.A function h : |K| → |L| is called a frame homomorphism if it preserves the top element, binary meets, and joins of W-families.We denote the category of frames and their homomorphisms by Frm.
We adopt the notational conventions of [12].A locale is a frame considered in the opposite category called Loc := Frm op .To highlight this, we adopt the standard convention of using the letters X, Y, Z, . . .(or sometimes A, B, C, . ..) for locales and denoting by O(X) the frame corresponding to a locale X.For variables that range over the frame of opens of a locale X, we use the letters U, V, W, . . .We use the letters f and g for continuous maps Definition 2.6 (Nucleus) A nucleus on a locale X is an endofunction j : O(X) → O(X) that is inflationary, idempotent, and preserves binary meets.
In Section 6, we will work with inflationary and binary-meet-preserving functions that are not necessarily idempotent.Such functions are called prenuclei.We also note that, to show a prenucleus j to be idempotent, it suffices to show j(j(U )) ≤ j(U ) as the other direction follows from inflationarity.In fact, the notion of a nucleus could be defined as a prenucleus satisfying the inequality j(j(U )) ≤ j(U ), but we define it as in Definition 2.6 for the sake of simplicity and make implicit use of this fact in our proofs of idempotency.

Spectral and Stone locales
We start by defining the notion of a small basis for a frame.This is crucial not just for the definitions of spectral and Stone locales that we use in our development, but also for the Adjoint Functor Theorem that we present in Section 4.
A W-locale X is then said to have a small basis if there exists a W-family {B i } i:I in O(X) that forms a basis for O(X).
Given an open U : O(X) with a small basis, we refer to the family {B j | j ∈ J} giving U as its join as the basic covering family for U .
It is important to note here that we use propositional truncation when defining the notion of a locale having a basis.So even though we often speak of a "locale with some small basis {B i } i:I ", the existence of this basis is a property meaning we have access to it only in contexts where the goal is itself a proposition.
We often need covering families given by a basis to be directed.This is easy to achieve if we work with Tosun and Escardó 16-5 bases closed under finite joins, which we can do without loss of generality, as this closure produces another basis.
The standard impredicative definition of a spectral locale is as one in which the compact opens form a basis closed under binary meets.To talk about compactness, we define the way below relation: Definition 3.2 (Way below) Given a W-locale X and opens U, V : O(X), U is said to be way below Proposition 3.3 Given any two opens U and V of a locale, the type U ≪ V is a proposition.
The statement U ≪ V is thought of as expressing that U is compact relative to V .An open is said to be compact if it is compact relative to itself: We denote the type of compact opens of a locale X by K(X).We adopt the convention of using letters C, D, . . .for compact opens.
The standard definition of a spectral locale as one in which the compact opens form a basis closed under finite meets is problematic in our predicative setting, as it is not always the case that the type of compact opens of a (U , V, W)-locale lives in W. In particular, the type of compact opens of a (U + , U , U )-locale lives in U + and it is accordingly said to be large.To address this problem, we restrict attention to locales with small bases and express the notion of spectrality by imposing the conditions of interest on the basic elements instead.Definition 3.6 (Spectral locale) A locale X is said to be spectral if there exists a small basis {B i } i:I such that: (i) every B i is compact, and (ii) {B i } i:I is closed under finite meets i.e. there is t : I with B t = ⊤ and for any two i, j : I, there is k : We have previously remarked that we can assume without loss of generality that bases of locales are closed under finite joins.Note here that this assumption can also be made for bases of spectral locales as compact opens are also closed under finite joins.
Spectral locales together with spectral maps constitute the category Spec.We now define the notion of a spectral map.
A natural question to ask about our definition of spectral locale is whether it corresponds to the previous informal definition: can there be compact opens that do not fall in the basis?
Definition 3.10 (Clopen) An open U is called a clopen if it is well inside itself, which amounts to saying that it has a Boolean complement.
Before we proceed to defining zero-dimensionality, we record the following important fact about the well inside relation: Our definition of zero-dimensionality is analogous to the definition of a spectral locale where conditions of interest apply only to basic opens.Definition 3.12 (Zero-dimensional frame) A locale is called zero-dimensional if it has a small basis {B i } i:I with each B i clopen.
Zero-dimensionality can in fact be viewed as a special case of regularity.For purposes of our development, we need the result that U ≪ V implies U V in any zero-dimensional locale [11,Lemma VII.3.5,pg. 303].As this can be strengthened to apply to the more general case of regular locales, we now define the notion of regularity, using which we obtain a result slightly more general than needed.Definition 3.13 (Regular locale) A locale is called regular if it has some basis {B i } i:I such that for any open U , every B j in the covering family for U is well inside U .
Similar to the case of spectral locales, the basis of a regular locale can be assumed to be closed under finite joins without loss of generality as every basis can be closed under finite joins to obtain another basis satisfying the regularity condition of Definition 3.13.Proposition 3.14 Every zero-dimensional locale is regular.
Proof.Let X be a zero-dimensional locale and call its basis {B i } i:I .Consider some U : O(X).There must be a basic covering U = i∈J B j such that each B j is clopen for every j ∈ J. Clearly, B j ≤ U so we have B j B j ≤ U which implies B j U (by Proposition 3.11.i). ✷ The following two propositions are needed to prove that compact opens and clopens coincide in Stone locales, which we will need later.They are adaptations of standard proofs [11, pg.303, Lemma VII.3.5]into our predicative setting.Proposition 3.15 In any regular locale, U ≪ V implies U V for any two opens U, V .
Proof.Let {B i } i:I be the basis, closed under finite joins, of a regular locale X, let U, V : O(X) such that U ≪ V , and let {B j } j∈J be the basic family covering V .As V ≤ j∈J B j there must exist some k ∈ J such that U ≤ B k by the fact that U ≪ V .We then have U ≤ B k V which implies U V by Proposition 3.11.✷ Proposition 3.16 In any compact locale, U V implies U ≪ V for any two opens U, V .
The proof of Proposition 3.16 is omitted as it is exactly the same as in [11, pg. 303].
Definition 3.17 (Stone locale) A Stone locale is one that is compact and zero-dimensional.4 Adjoint Functor Theorem for frames with small bases We start with the definition of the notion of an adjunction in the simplified context of posetal categories.
Definition 4.1 Let P and Q be two posets.An adjunction between P and Q consists of a pair of monotonic maps f : P → Q and g : Q → P satisfying f ⊣ g := x:P y:Q f (x) ≤ y ↔ x ≤ g(y).
In locale theory, it is standard convention to denote by f * : O(X) → O(Y ) the right adjoint of a frame homomorphism f * : O(Y ) → O(X) corresponding to a continuous map of locales f : X → Y .The right adjoint of a frame homomorphism is defined using the Adjoint Functor Theorem which amounts to the definition: In the predicative setting of type theory however, it is not clear how the right adjoint of a frame homomorphism would be defined as the family {V : O(Y ) | f * (V ) ≤ U } might be too big in general, meaning it is not clear a priori that its join in O(X) exists.To resolve this problem, we restrict attention once again to frames with small bases in which we circumvent this problem by quantifying over only the basic elements.
we are done as the latter can be seen to hold directly from the fact that V is an upper bound of {f * (U i )} i:I .
For the converse, suppose f * ( i U i ) = i:I f * (U i ) for every family {U i } i:I .We define the right adjoint of f * as: We need to show that f * is the right adjoint of f * i.e. that f * (U ) ≤ V ↔ U ≤ f * (V ) for any two U, V : O(X).For the forward direction, assume f * (U ) ≤ V .We know that there exists a covering family {B j } j∈J for U with U = j∈J B j so it suffices to show that B j ≤ f * (V ) for every j ∈ J.It remains to show that f * (B j ) ≤ V .This follows from the fact that f * (B j ) ≤ f * ( j∈J B j ) ≤ f * (U ) ≤ V .For the backward direction, let U ≤ f * (V ).We have:

✷
Our primary use case for the Adjoint Functor Theorem is the construction of Heyting implications in locally small frames with small bases.Definition 4.3 (Heyting implication) Let X be a large, locally small, and small complete locale with a small basis and let U : O(X).As the map −∧U : O(X) → O(X) preserves joins by the frame distributivity law, it must have a right adjoint h : O(X) → O(X), by Theorem 4.2, that satisfies W ∧U ≤ V ↔ W ≤ h(V ) for all W, V : O(X).We then define the Heyting implication as: U ⇒ V := h(V ).
The Adjoint Functor Theorem also allows us to define the notion of a perfect frame homomorphism.

16-8
Patch Locale of a Spectral Locale in Univalent Type Theory Definition 4.4 (Perfect frame homomorphism) Let X and Y be two large, locally small, and small complete locales and assume that Y has a small basis.A continuous map f : X → Y is said to be perfect if the right adjoint f * of its defining frame homomorphism f * is Scott continuous.Proposition 4.5 Let f : X → Y be a perfect map where Y is a locale with small basis.The frame homomorphism f * respects the way below relation, that is, A proof of Proposition 4.5 can be found in [7].Our proof is mostly the same, once it is ensured that the Heyting implication exists through the small basis assumption.We thus omit the proof.
Corollary 4.6 Perfect maps are spectral as they preserve compact opens.
In fact, the converse is also true in the case of spectral locales so Corollary 4.6 can be strengthened to an equivalence in this case.Proposition 4.7 Let X and Y be two large, locally small, and small complete spectral locales and assume that Y has a small basis.A continuous map f : X → Y is perfect iff it is spectral.
Proof.The forward direction is given by Corollary 4.6.For the backward direction, assume f : X → Y to be a spectral map.We have to show that the right adjoint f * : O(X) → O(Y ) of its defining frame homomorphism is Scott continuous.Let {U i } i:I be a directed family in O(X).We have to show f * ( i: By the fact that f * ⊣ f * , it must be the case that f * (C) ≤ i:I U i and since f * (C) is compact, by the spectrality assumption of f * , there must exist some l :

Meet-semilattice of Scott continuous nuclei
In this section, we take the first step towards constructing the defining frame of the patch locale on a spectral locale i.e. the frame of Scott continuous nuclei.We construct the meet-semilattice of all nuclei on a frame.Proposition 5.1 The type of nuclei on a given frame O(X) forms a meet-semilattice under the pointwise order.
Proof.We need to show that the type O(X) has all finite meets.The top nucleus is defined as − → ⊤ and the meet of two nuclei as j ∧ k := U → j(U ) ∧ k(U ).It is easy to see that j ∧ k is the greatest lower bound of j and k so it remains to show that j ∧ k satisfies the nucleus laws.
The inflation property can be seen to be satisfied from the inflation properties of j and k combined with the fact that j(U ) ∧ k(U ) is the greatest lower bound of j(U ) and k(U ).To see that meet preservation holds, let U, V : O(X); we have: For idempotency, let U : O(X).We have: Tosun and Escardó 16-9

✷
We now show that this meet-semilattice can be refined to only those nuclei that are Scott continuous (i.e. the perfect nuclei).

Proposition 5.2
The Scott continuous nuclei on any locale form a meet-semilattice.
Proof.Let X be a locale.The construction is the same as the one from Proposition 5.1; the top element is − → ⊤ which is trivially Scott continuous so it remains to show that the meet of two Scott continuous nuclei is Scott continuous.Consider two Scott continuous nuclei j and k on O(X) and a directed small family {U i } i:I .We then have: where, for the † step, we use antisymmetry.The backwards direction is immediate.For the forwards direction, we need to show that (i,j):I×I j(U i ) ∧ k(U j ) ≤ i:I j(U i ) ∧ k(U i ), for which it suffices to show that i:I j(U i ) ∧ k(U i ) is an upper bound of {j(U i ) ∧ k(U j )} (i,j):I×I .Let m, n : I be two indices.As {U i } i:I is directed, there must exist some o such that U o is an upper bound of {U m , U n }.Using the monotonicity of j and k, we get 6 Joins in the frame of Scott continuous nuclei The nontrivial component of the patch frame construction is the join of a family {k i } i:I of perfect nuclei, as the pointwise join fails to be idempotent in general, and not inflationary when the family in consideration is empty.
A construction of the join, given in [8], is based on the idea that, if we start with a family {k i } i:I of nuclei, we can consider the family whose index type is the type of lists of indices in I, that will always be directed.We will use the following notation for lists over a type X: • ε denotes the empty list, • x :: s, with x : X and s : List(X), denotes the list with first element x followed by the elements of s, • s t denotes the concatentation of lists s and t.
To define the join operation, we will use the iterated composition function o that we define as follows: By an easy proof by induction, we have the following.Proposition 6.2For any family K := {k i } i:I of prenuclei on a locale and any s, t : List(I), we have that o(s t) = o(t) • o(s).Proposition 6.3 Given a family K := {k i } i:I of nuclei on a locale, every α ∈ K * is a prenucleus, that is, for every s : List(I), the function o(s) is a prenucleus.
Proof.If s = ε, we are done as it is immediate that the identity function id is a prenucleus.If s = i :: s ′ , we need to show that o(s ′ ) • k i is a prenucleus.For meet preservation, let U, V : O(X).We have that: For the inflation property, consider some U : O(X).We have that U ≤ k i (U ) ≤ o(s ′ )(k i (U )), by the inflation property of k i and the inductive hypothesis.✷ Proposition 6.4 Given a nucleus j and a family K := {k i } i:I of nuclei on a locale, if j is an upper bound of K then it is also an upper bound of K * .
Proof.Let j and K := {k i } i:I be, respectively, a nucleus and a family of nuclei on a locale.Let s : List(I).
We denote by {α s } s:List(S) the family K * .We proceed by induction on s.If s = ε, we have that id(U ) ≡ U ≤ j(U ).If s = i :: s ′ , we then have: [monotonicity of α s ′ (Prop.6.3 and monotonicity of prenuclei)] ≤ j(j(U )) [inductive hypothesis] ≤ j(U ) [idempotency of j].We are now ready to construct the join operation in the meet-semilattice of Scott continuous nuclei hence defining the patch frame O(Patch(X)) of the frame of a locale X. Theorem 6.8 (Join of Scott continuous nuclei) Let K := {k i } i:I be a family of Scott continuous nuclei.The join of K can be calculated as N K := U → α∈K * α(U ).

16-11
Proof.It must be checked that this is (1) indeed the join, ( 2) is a Scott continuous nucleus i.e. it is inflationary, binary-meet-preserving, idempotent, and Scott continuous.The inflation property is direct.For meet preservation, consider some U, V : O(X).We have: where the step ( †) uses antisymmetry.The Consider arbitrary β, γ ∈ K * .By the directedness of K * we know that there exists some δ ∈ K * that is an upper bound of {β, γ}.We then have: For idempotency, let U : O(X).We have that: where for the step ( †) it suffices to show that α∈K * α(U ) is an upper bound of the family {α(β(U )) | (α, β) ∈ K * × K * }.Consider arbitrary α, β ∈ K * .There must be lists s and t of indices of K such that α ≡ o(s) and β ≡ o(t).We pick δ := o(t s) ∈ K * which is then an upper bound of o(s) and o(t) (as in Proposition 6.6).By Proposition 6.2, we have that o(t)(o(s)(U )) ≡ o(t s)(U ) ≡ δ(U ) ≤ α∈K * α(U ).

16-12
Patch Locale of a Spectral Locale in Univalent Type Theory For Scott continuity, let {U j } j:J be a directed family over O(X).The result then follows as: as required.
The fact that N i k i is an upper bound of K is easy to verify: given some k i and U To see that it is the least upper bound, consider a Scott continuous nucleus j that is an upper bound of K. Let U : O(X).We need to show that ( N i k i )(U ) ≤ j(U ).We know by Proposition 6.4 that j is an upper bound of K * , since it is an upper bound of K, which is to say K * s (U ) ≤ j(U ) for every s : List(I) i.e. j(U ) is an upper bound of the family {α(U is the least upper bound of this family by definition, it follows that it is below j(U ).✷ We use Proposition 6.7 to prove the following.Proposition 6.9 (Distributivity) For any Scott continuous nucleus j and any family {k i } i:I of Scott continuous nuclei, we have that It follows that the Scott continuous nuclei form a frame.Definition 6.10 (Patch locale of a spectral locale) Let X be a large, locally small, and small complete spectral locale.The patch locale of X, written Patch(X), is given by the frame of Scott continuous nuclei on X.
Note that we do not assume the locale X in Definition 6.10 to be spectral.This is to highlight the fact that the construction of the patch frame does not rely on this assumption in a crucial way.Nevertheless, the patch locale is meaningful only on spectral locales as its universal property can be proved only under the assumption of spectrality.Definition 6.10 gives rise to a problem that we need to address: the patch of a locally small locale does not yield a locally small locale.Starting with a (U + , U , U )-locale X, Patch(X) is a (U + , U + , U )-locale since the pointwise ordering of nuclei (defined in Proposition 5.1) quantifies over arbitrary opens.In most of our development, we have restricted attention to only locally small frames meaning we run into problems if Patch(X) is not locally small (e.g.applying the Adjoint Functor Theorem).We circumvent this by using the following small version of the same relation: Definition 6.11 (Basic nuclei ordering on spectral locales) Let X be a spectral locale and denote its basis by {B i } i:I .Let j, k : O(X) → O(X) be two nuclei.We define the basic nuclei ordering Given two nuclei j and k on a (U , V, W)-locale, the relation j ≤ K k lives in universe V ∨ W meaning, in the case of a (U + , U , U )-locale, it lives in U as desired.
Tosun and Escardó 16-13 Proposition 6.12 The basic nuclei ordering given in Definition 6.11 is logically equivalent to the pointwise ordering of nuclei.
Proof.The usual pointwise ordering obviously implies the basic ordering so we address the other direction.Let j and k be two Scott continuous nuclei on a spectral locale X and assume that j ≤ K k.We need to show that j(U ) ≤ k(U ) for every open U so let U : O(X).It must be the case that U = l∈L B l where {B l } l∈L is the directed basic covering family of compact opens covering U .We then have j( l∈L B l ) = l∈L j(B l ) by Scott continuity and l∈L j(B l ) ≤ l∈L k(B l ) since j(B l ) ≤ k(B l ) for every l : L. ✷ Thanks to Proposition 6.12 our theorems that have the local smallness assumption apply to the patch frame as we know that Patch(X) always has an equivalent copy that is locally small.We also note that we will not always be precise in distinguishing between the basic order and the regular order on nuclei and will freely switch between the two, making implicit use of Proposition 6.12.

The coreflection property of Patch
We prove in this section that our construction of Patch has the desired universal property: it exhibits Stone as a coreflective subcategory of Spec.We also note that when we talk about Stone and spectral locales in this section, we implicitly assume them to be large, locally small, and small complete, and refrain from explicitly stating this assumption.
The notions of closed and open nuclei are crucial for proving the universal property.We first give the definitions of these.Let U be an open of a locale X; (i) The closed nucleus induced by U is the map V → U ∨ V ; (ii) The open nucleus induced by U is the map V → U ⇒ V .
We denote the closed nucleus induced by U by 'U ' and, because the open nucleus is the Boolean complement of the closed nucleus, we denote the open nucleus induced by U by ¬'U '.This follows the notation of [7,9].We now prove the Scott continuity of these nuclei.

Proof.
Closed nucleus.Let U be an open of a locale and let {V i } i:I be a directed family of opens.We need to show that 'U '( i:I V i ) = i:I 'U '(V i ).It is clear that U ∨ ( i:I V i ) is an upper bound of {U ∨ V i } i:I .Let W be an arbitrary upper bound of {U ∨ V i } i:I .It suffices to show that W is an upper bound of {U, ( i:I V i )}.For the case of i:I V i , we have that i:I V i ≤ i:I U ∨ V i ≤ W .For the case of U , we use the fact that {V i } i:I is directed.Since the family {V i } i:I is directed it must be inhabited by some V k .We then have In Lemma 7.5, we prove that the map whose inverse image sends an open U to the closed nucleus 'U ' is perfect.Before Lemma 7.5, we record two auxiliary lemmas that are needed in the proof.Lemma 7.3 Let X be a spectral locale with a small basis.The right adjoint ε * : O(Patch(X)) → O(X) of '−' is equal to the assignment j → j(⊥) i.e. ε * (j) = j(⊥) for every Scott continuous nucleus j on X.

Proposition 3 . 8 6 Patch
For any spectral locale X, every compact open of X falls in the basis.Proof.Let X be a spectral locale and denote by {B i } i:I its basis closed under finite joins.Let C : O(X) be a compact open and let {B j } j∈J be the covering family for C. Because the basis is closed under finite joins, this family is directed.As C ≤ i:I B i there must be some k : I by the compactness of C such that C ≤ B k .It is also clearly the case that B k ≤ C and so B k = C, meaning C falls in the basis.✷ 3.1 Zero-dimensional and regular locales Clopenness is central to the notion of a zero-dimensional locale, similar to the fundamental role played by the notion of a compact open in the definition of a spectral locale.To define the clopens, we first define the well inside relation.Definition 3.9 (Well inside relation) Given a locale X and opens U, V : O(X), U is said to be well 16-Locale of a Spectral Locale in Univalent Type Theory inside

Proposition 3 .
18 In any Stone locale, an open is compact iff it is clopen.Proof.By propositions 3.15 and 3.16 and the fact that every zero-dimensional locale is regular (Proposition 3.14).✷

Theorem 4 . 2 (
AFT) Let X and Y be two large, locally small, and small complete locales and let f * : O(Y ) → O(X) be a monotone map.Assume that Y has a small basis {B i } i:I .The map f * has a rightadjoint iff f * ( i U i ) = i f * (U i ) for any small family {U i } i:I in O(Y ).Proof.Let f * : O(Y ) → O(X)be a monotone map from frame O(Y ) to frame O(Y ) and assume that Y has a small basis {B i } i:I .The forward direction is easy: suppose f * : O(Y ) → O(X) has a right adjoint f * : O(X) → O(Y ).Let {U i } i:I be a family in O(Y ).By the uniqueness of joins, it is sufficient to show that f * ( i U i ) is the join of {f * (U i )} i:I .It is clearly an upper bound by the fact that f * is monotone.Given any other upper bound

Definition 6 . 1 ( 10 Patch
Iterated composition of nuclei) Given a small family K := {k i } i:I of nuclei on a 16-Locale of a Spectral Locale in Univalent Type Theory given locale X, we denote by K * the family (List(I), o) where o is defined as follows:

Lemma 7 . 1
For any spectral locale X and any monotone map h : O(X) → O(X), if for every U : O(X) and compact C : O(X) with C ≤ h(U ), there is some compact D ≤ U such that C ≤ h(D), then h is Scott continuous Lemma 7.2 Let X be a spectral locale.The closed nucleus 'U ' on X is Scott continuous for any open U , whereas the open nucleus is Scott continuous if the open U is compact.
as W is an upper bound of {U ∨ V i } i:I .Open nucleus.Let D be a compact open of a locale.By Lemma 7.1, it is sufficient to show that for any open V and any compact open C 1 with C 1 ≤ D ⇒ V , there exists some compact C 2 ≤ D such that C 1 ≤ D ⇒ C 2 .Let V and C 1 be two opens with C 1 compact and satisfying C 1 ≤ D ⇒ V .Pick C 2 := D ∧ C 1 .We know that this is compact by spectrality.It remains to check (1) C 2 ≤ V and (2) C 1 ≤ D ⇒ C 2 , both of which are direct.✷ giving the greatest lower bound U ∧ V of any two U, V : |L|, Fam W (|L|) → |L| giving the least upper bound i:I U i of any W-family {U i } i:I , such that binary meets distribute over arbitrary joins, i.e.
Proposition 6.5 Given a family {k i } i:I of Scott continuous nuclei on a locale, every prenucleus α ∈ K * is Scott continuous.Proof.Any composition of finitely manyScott continuous functions is Scott continuous.✷ Proposition 6.6 Given a family K :≡ {k i } i:I of nuclei on a locale, the family K * is directed.Proof.K * is indeed always inhabited by the identity nucleus.The upper bound of nuclei o(s) and o(t) is given by o(s t), which is o(t) • o(s) by Proposition 6.2.The fact that this is an upper bound of {o(s), o(t)} follows from monotonicity and inflationarity.✷ Proposition 6.7 Let j be a nucleus and K := {k i } i:I a family of nuclei on a locale.Denote by {α s } s:List(I) the family K * and by {β s } s:List(I) the family {j ∧ k | k ∈ K} * .We have that β s is a lower bound of {α s , j} for every s : List(I).