Stone Duality for Monads
Abstract
We introduce a contravariant idempotent adjunction between (1) the category of ranked monads on ; and (2) the category of internal categories and internal retrofunctors in the category of locales. The left adjoint takes a monad —viewed as a notion of computation, following Moggi—to its localic behaviour category . This behaviour category is understood as “the universal transition system” for interacting with : its “objects” are states and the “morphisms” are transitions. On the other hand, the right adjoint takes a localic category —similarly understood as a transition system—to the monad where is the set of -indexed families of local sections to the source map which jointly partition the locale of objects. The fixed points of this adjunction consist of (1) hyperaffine-unary monads, i.e., those monads where term admits a read-only operation predicting the output of ; and (2) ample localic categories, i.e., whose source maps are local homeomorphisms and whose locale of objects are strongly zero-dimensional. The hyperaffine-unary monads arise in earlier works by Johnstone and Garner as a syntactic characterization of those monads with Cartesian closed Eilenberg-Moore categories. This equivalence is the Stone duality for monads; so-called because it further restricts to the classical Stone duality by viewing a Boolean algebra as a monad of -partitions and the corresponding Stone space as a localic category with only identity morphisms.
keywords:
behaviour category, comodels, internal categories, internal retrofunctors, monads, stone duality1 Introduction
Notions of computation are described by monads, as is well-known from Moggi [22]. Later, Plotkin and Power [25, 26] refined this story: notions of computation are described by a set of basic computational operations , possibly of infinite arity, as well as equations saying when two program terms (constructed from the basic operations) compute the same way. The pair is known as an algebraic theory, and it is well-known that these correspond to ranked monads on [21].
But what does it mean for two terms to compute the same way, or even for a term to compute? One answer is that computation is interaction between program terms and a reality external to that program. Thus, to use Plato’s allegory, the equations in a Plotkin–Power notion of computation are merely impoverished shadows on a cave wall, cast by the flame of this interactive process. For example, computations with access to state arises as interaction between programs constructed from the basic operations of and , against an external reality consisting of memory cells. The equation is merely a syntactic manifestation of the inertia of memory cells.
Regardless, as prisoners in the cave privy only to the equations written on the wall, we still wish to understand the greater reality. One mathematical description of the possible realities inducing the equations are the comodels of Power and Shkaravska [27]. For a monad , a -comodel in a category consists of an object of states along with a cointerpretation for each computation , subject to compatibility with the monad structure of . We think of for as a transition on which along the way also produces a return value in the set . A good intuition is that if is the syntax tree of a term for an algebraic theory , then each specifies how to deterministically run down a sequence of operations (the trace of at ) to reach a return value—hence their alternative name of stateful runners [28]. As explained by Ahman and Bauer [2], we may also think of runners as virtual machines for .
Note that the definition of comodel makes use of the monad , and to know one must in effect know the equations of one’s notion of computation. To use our cave analogy, it is as if the shadows are dictating the structure of reality. But surely it is possible to find a description of the possible realities that does not depend on a particular shadow/monad ! In this paper, we present one such description.
The Topological Behaviour Category for Finitary Monads.
For now, let us just consider the finitary monads, which are those generated by operations of finite arity. Here, the possible realities can be described as topological categories, i.e., internal categories in the category of topological spaces. For each finitary monad , there is a distinguished reality best approximating , which we term the topological behaviour category .
Qua category, is best thought as a transition system, where objects are states and morphisms are transitions. In detail, objects are certain natural transformations saying how to run each computation term down to its return value ; while morphisms with domain are equivalence-classes of computations considered up to having the same trace at . In fact, this description of is not new: it is the behaviour category introduced by the first-named author in [10]. What is new is the topology imposed on the sets and of objects and morphisms.
To motivate the need for topology, we consider how we might attempt to recover from as a plain (non-topologised) category. A computation interacts with the transition system at some state by causing a transition and producing an output value . The assignments and constitute a pair of functions: (1) which is a section to the source map ; and (2) . It seems reasonable, then, to attempt to reconstruct by taking all such pairs as the computations returning values in . Indeed, we obtain in this way a monad .
Now, consider the case where encodes the theory of state with countably many memory cells. Here, is simply the set of possible memory configurations, while a transition in is an assignment of new values to finitely many memory cells. What of the computations ? Without further constraint, these may refer to the contents of infinitely many cells of the current memory configuration in determining an update and a return value. Yet, by the finitary nature of syntax, computations in may query only finitely many cells to reach such a determination. So admits many more computations than , most of which are computationally unreasonable. This gap is closed by introducing a topology of finite information on , and restricting to involve only continuous functions.
This brings us to our first main contribution. We show that, with the finite information topology, the construction on finitary monads contravariantly extends to a functor . Here, the category has topological categories as objects, but as morphisms, not the usual functors but rather retrofunctors [23]. Retrofunctors were originally introduced by Aguiar [1] and later used to classify morphisms of polynomial comonads by Ahman and Uustalu [3, 4]. On the other hand, taking (finitary) sections yields a contravariant functor , and this gives rise to the first adjunction in fig. 1.
The Localic Behaviour Category for Infinitary Monads.
Now, suppose we wish to consider a notion of state in which our memory cells contains arbitrary natural numbers: for this, we must adapt our story from finitary to infinitary monads. A simple-minded generalisation would make only this change, and otherwise proceed as before. However, we contend that the correct generalisation also replaces topological categories with localic categories, as in the second adjunction of fig. 1. This is a genuine generalisation: for indeed, when is a finitary monad, its localic behaviour category is the underlying localic category of its topological behaviour category , and the monads and found from these behaviour categories coincide.
The move to the localic world is perhaps best motivated with an example. Let be the monad encoding the theory of state with -many memory cells, each storing a natural number, augmented by a further equation expressing that no two memory cells can contain the same value. The admissible memory configurations for this correspond to injective functions —of which, of course, there are none; and yet, because the syntax of terms in is well-founded, it is impossible to discern this from the perspective of a program. This analysis shows that is non-trivial, while and hence also , are trivial: so again, fails badly to approximate our original . However, if we instead construct the behaviour category in a point-free way—prioritising the topology of finite information over the global state—we obtain what we term the localic behaviour category . For the example just described, the locale of objects of is the locale of injective functions , which is known to be a non-trivial locale without points (cf. [19, Example C1.2.9]); and in fact, when we apply the analogous construction to before to obtain , we now recover the original perfectly. See example 3.4 for a more in-depth explanation.
Can we always recover from ? In fact, no. The localic behaviour category is our best guess at reality, subject to assumptions of statefulness and determinism underlying the definition of comodels. But reality can be far stranger, in which case the recovered monad is merely an imperfect approximation of the original . Two key examples where the imperfection is particularly pronounced (due to Uustalu [28]) are the monads for non-termination—generated by a nullary operation satisfying no axioms—and any theory containing a commutative binary operation , for example the theory of non-deterministic choice. In both cases, , and hence , are trivial, though the original monads are not.
In general, for a ranked monad , the monad amounts to completing with prescience111in reverence to the rollback feature of the package management system nix, we may call this the nixification of .: To each term , there is a new operation which intuitively performs , keeps track of the result, and then rolls back the state of the system to just before performing . Such monads were characterised by the first-named author in [12, 13] as the cartesian closed monads, i.e., those whose categories of Eilenberg-Moore algebras are cartesian closed. In the other direction, the source map of the localic behaviour category is always a local homeomorphism, and the locale of objects is always strongly zero-dimensional in the sense of Johnstone [16] (also called ultraparacompact by Van Name [30]). Following a common terminology among -algebraists [24, Definition 2.2.4], we term localic categories satisfying these conditions ample. It turns out that the cartesian closed monads and the ample localic groupoids are precisely the fixpoints of the adjunction , which thus restricts to an equivalence between the two.
This equivalence is the Stone duality for monads of the title. The nomenclature is justified by the fact that this duality extends the classical duality of Boolean algebras and Stone (= totally disconnected compact Hausdorff) spaces. On the one hand, each Stone space is the space of objects of a topological (and hence localic) category with only identity transitions; and on the other, each Boolean algebra has an associated finitary monad of distributions over it [6]. Now restricting our Stone duality for monads to these two classes of objects re-finds the classical duality of Stone.
Outline & Contributions.
We now outline the structure and contributions of the paper. Section 2 collects the basic definitions and preliminary results about comodels, the behaviour category, locales and sheaves. Section 3 is the heart of this paper: we construct the terminal localic comodel (definition 3.1) and the locale of transitions (definition 3.11), before combining them into the localic behaviour category (definition 3.16). We also show that, when is finitary, is the underlying localic category of the topological behaviour category . In the short section 4, we functorialize the construction and prove that it has a right adjoint which takes global sections, so giving us the adjunctions of fig. 1. Finally, section 5 characterizes the fixed points of our adjunctions, obtaining the Stone duality of the title. We then conclude the paper in section 6 and provide directions for future research.
2 Preliminaries
2.1 Monads & Comodels
We start by recalling some basic definitions. A monad on comprises, for each set , a set of computations; for each value , a pure computation ; and for all sets a composition operation . These are required to satisfy the equations , and for all . A monad map comprises, for each set , a function satisfying and . An operation is finitary if there is some function from a finite set and such that ; if here we replace “finite” by “-small” for some regular cardinal , then we instead say that is -ary. Now itself is finitary if each of its operations is so, and is ranked if there is a regular cardinal for which all of its operations are -ary. We write (resp. ) for the category of finitary (resp. ranked) monads and monad maps. From now on, any mention of monads will refer to ranked monads only.
Recall that a category has copowers if for any and any set , the -fold coproduct exists. For example, both and have copowers given by the -fold disjoint sum . We will denote the inclusion maps by , and the codiagonal by .
Definition 2.1.
Let be a monad and a category with copowers. A comodel of in is a pair whose data comprises an object and co-interpretations for each computation . If we extend this to a cointerpretation of each via , then the comodel axioms require that and . A comodel map is a map which preserves each co-interpretation, i.e., for each , we have . We write for the category of -comodels in .
Clearly, any -comodel is a -comodel, yielding a forgetful functor . On the other hand, there is also a coarsest topology on any -comodel making it a -comodel [11]:
Definition 2.2.
(Operational Topology) Let be a -comodel in . The operational topology on is generated by sub-basic open sets for and .
Proposition 2.3.
The assignment which endows a comodel with its operational topology yields a right adjoint to .
Proof 2.4.
Let be a -comodel and a -comodel. Then any -comodel morphism is a continuous function since .
2.2 The Behaviour Category
Fixing a monad on , we now recall the classification of via the behaviour category [10]. Objects of are elements of the terminal -comodel, which are the observable behaviours of comodel states. Such behaviours describe how the state runs a given computation term down to a value.
Definition 2.5.
(Admissible behaviours) An admissible -behaviour is a natural transformation such that for any , and , we have . The set of behaviours admits a comodel structure with where the next behaviour is defined by . This in fact makes the terminal -comodel, where for any other comodel , the unique comodel map sends to the behaviour .
For a monad generated by operations but no equations, a -behaviour produces from each term a sequence of operations, called the trace, which it had to evaluate to run down to its return value;these traces are the morphisms of the behaviour category. In fact, the return value itself does not matter for computing the trace, so it is enough to consider the trace of -terms only. For a general monad , the notion of trace as a sequence of operations no longer makes literal sense, but we can still define trace-equivalence and recover the traces as the trace-equivalence classes.
Definition 2.6.
(-equivalence, behaviour category) Let be a -behaviour. The relation on is the least equivalence relation such that for any and . Write for the -equivalence class of . The behaviour category has as objects -behaviours, and as morphisms pairs of the form but which we will simply write as . The morphism has source and target . The identity is , while the composite is .
Theorem 2.7.
.
Example 2.8.
Consider the monad generated by a single binary operation . For any term and behaviour , we find by successive applications of admissibility that . In other words, ’s behaviour is determined by the values for each , where , or more succinctly, by a map . Since the theory is free, any such map will do, so that is in bijection with the set of infinite binary streams . The trace of at is just the number of s traversed by when running down , so a morphism in has the form for some .
Example 2.9.
For the state monad , behaviours are in bijection with the set of states , and so is : two unary terms are -equivalent iff . So is the indiscrete (or chaotic) category with object-set . As we can see, since the theory of state has many equations, trace equivalence looks more semantic in nature here. We refer to [10] for more examples.
2.3 Frames & Locales
A frame is a poset with infinite joins and finite limits satisfying the infinite distributive law . We write for the category of frames and frame homomorphisms, i.e., monotone maps which preserve infinite joins and finite meets. A locale is simply a frame, but the category of locales is . We have a functor which sends to its frame of open sets , and a continuous map to . We imagine a general locale to be the lattice of opens of some space, and the data of a continuous map to be given by the inverse image map. To sustain this fantasy, we overload notation by writing for the identity functor, writing its action on morphisms as , and calling elements opens of . Any locale induces a topological space with set of points the locale morphisms from the terminal locale and open sets given by for . This yields a functor , right adjoint to . A locale at which the adjunction counit is invertible is called spatial, while a space at which the unit is invertible is called sober: thus, spatial locales and sober spaces form equivalent categories.
We make use of the fact—see [17, II 2.11]—that frames may be constructed by generators and relations. For example, the (frame of opens of the) copower locale can be presented by generating opens of the form for and , subject to the equations (1) ; (2) ; and (3) for . These equations imply that every open is uniquely of the form —which is consistent with the fact that -fold copowers in correspond to -fold products in . In particular, since has copowers, we may consider as well as , and we now have:
Proposition 2.10.
The adjunction lifts to .
Proof 2.11.
In sketch, since comodels are defined in terms of copowers, it suffices to verify that and preserve copowers. This is obvious for the left adjoint . As for , this is one of its standard properties, which follows from fact that the terminal locale is connected, so that homming out of it preserves copowers.
For a finitary monad, the terminal topological comodel—which by proposition 2.3 is the terminal comodel equipped with the operational topology—is always a Stone space. When we go to construct the locale of objects for the localic behaviour category, we will similarly take the terminal localic comodel. This is also always going to be an “infinitary Stone space”, in the sense that it is generated by “clopen sets” but no longer compact. These are the strongly zero-dimensional locales as defined by Johnstone [16], also called ultraparacompact by Van Name [30]. We adopt the latter name since it is more compact (pun intended).
Definition 2.12.
[30] Let be a locale. An open is complemented if it so in the usual lattice-theoretic sense: thus, there is some with and . The set of complemented opens of inherits finite meets and joins from , and so is a Boolean algebra. We say that is zero-dimensional if is the join of the complemented opens below it.
A cover of is a subset such that . A cover refines if for every there is such that . An extended partition is a pairwise disjoint cover, i.e., for any . A partition is an extended partition which does not contain , and any extended partition induces a partition . A zero-dimensional locale is strongly zero-dimensional or ultraparacompact if every open cover is refined by a partition.
Stone spaces correspond to Boolean algebras: this is known as Stone duality. Generalizing this, ultraparacompact locales correspond to Grothendieck Boolean algebras. The notion is due to [30] but our nomenclature follows [12, Definition 3.6].
Definition 2.13.
A Grothendieck Boolean algebra is a Boolean algebra equipped with a strongly zero-dimensional topology, i.e., a collection of partitions for such that
-
(i)
contains every finite partition;
-
(ii)
if and for each , then also;
-
(iii)
if and is a surjective function, then each exists in and .
Theorem 2.14.
[30, Theorem 24] The category of ultraparacompact locales is dually equivalent to the category of Grothendieck Boolean algebras.
Proof 2.15.
We sketch just the constructions. An ultraparacompact locale induces a Boolean algebra with strongly zero-dimensional topology given by the partitions of (the opens in a partition are necessarily complemented). On the other hand, a Grothendieck Boolean algebra generates a locale of -closed ideals in the usual way (as explained by Vickers [31] or Johnstone [17, II 2.11]).
Every Boolean algebra can be regarded as a Grothendieck Boolean algebra under the topology of all finite partitions, and in this way, the above equivalence restricts to the usual Stone duality.
2.4 Sheaves, Local Homeomorphisms & -Sets
An important aspect of our results is that the source map of the localic behaviour category is a local homeomorphism. Here, a map of locales is a local homeomorphism if there is a cover of its domain such that, on each part of this cover, the map restricts to an open injection. It is well-known that local homeomorphisms into a locale correspond to sheaves on a locale; and since is ultraparacompact, this leads to a particularly appealing description of the source map. For indeed, sheaves on an ultraparacompact locale—or at least, those possessing a global section—can be described purely algebraically as sets with a suitable action of the corresponding Grothendieck Boolean algebra. This was first shown by Bergman [6] for Boolean algebras, and later extended to the Grothendieck case [12]. One advantage of this presentation is that it makes clear what homomorphisms and congruences of -sets are.
Definition 2.16.
(-sets) Let be a non-degenerate Boolean algebra (i.e., in ). A -set consists of a set equipped with one binary operation for each satisfying the equations
| (1) | ||||||||
for all . If is a strongly zero-dimensional topology on , then a -set consists of a -set further equipped with a -ary operation for each partition . These operations are required to satisfy, for any and families , the axioms
| (2) |
These axioms are rather intuitive if one reads each operation as an if-then-else operation, and the infinitary operations as infinitary switch statements. To see the correspondence with sheaves, view the elements of a -set as a global section. Then the operations perform amalgamation: for example is the unique amalgam of and . We don’t have to explicitly track local sections because if we have any global section at all, then a local section over manifests as a global section by taking the amalgamation of and . Hence, the category of non-empty -sets is equivalent to the category of sheaves over the locale presented by that have a global section.
Because every local section of a -set comes from some global section, the set of local sections over some is a quotient of , by the relation defined as follows.
Proposition 2.17.
[13, Proposition 2.6] Let be a non-degenerate Grothendieck Boolean algebra. Any -set structure on a set induces equivalence relations for given by . These equivalence relations satisfy: (1) if and then ; (2) iff , and always; (3) for any and , there is a unique such that for all . In fact, any -indexed family of equivalence relations on satisfying (i)–(iii) determine a -set, wherein is the aforementioned unique . With this alternative definition, a -set homomorphism is a function that preserves the relations.
The sheaf corresponding to the source map will be constructed as a quotient of a free -set, so it is instructive to construct the free -set explicitly.
Definition 2.18.
(Free -sets) Let be a set and a non-degenerate Grothendieck Boolean algebra. Then the Grothendieck Boolean power is the set of functions for which .
Proposition 2.19.
[12, Remark 3.17] Let be a set. Then has a -set structure given by , and this is the free -set with -many generators. The unit map identifies with the map for which and for .
Given a sheaf on a locale , the corresponding local homeomorphism is found by taking as the frame of subsheaves of . We can re-express this in terms of the category of sheaves on : this is a topos, and in particular admits a subobject classifier , so subsheaves of correspond to sheaf maps . Now if is the ultraparacompact locale presented by , then itself is a -set, and so the frame is given by the set of -set homomorphisms under pointwise ordering. as a -set turns out to be itself with the action , or equivalently with .
Definition 2.20.
Let be an ultraparacompact locale presented by , and be a -set. The étale space corresponding to is given by , and its associated projection map is defined by (the constant function at ).
Lemma 2.21.
Let be an ultraparacompact locale presented by , and be a -set. Each element injectively induces an open defined by . Moreover, these generate because every can be expressed as .
Proposition 2.22.
Let be an ultraparacompact locale presented by . Then the corresponding local homeomorphism of a -set is the map .
For a sheaf , the points of the corresponding local homeomorphism are known as germs. Here is the corresponding notion for -sets.
Proposition 2.23.
Let be an ultraparacompact locale presented by and a -set. Then , where . An element of this space is called a germ. The topology on this space is generated by subbasic open sets .
3 The Localic Behaviour Category
In this section, we construct the localic behaviour category . Following the construction of the behaviour category, the locale of objects can be characterized as the terminal localic comodel. On the other hand, we will construct the locale of morphisms in a rather roundabout way as a sheaf over , but we hope that this clarifies the nature of the construction.
3.1 The Terminal Localic Comodel
By proposition 2.10, we see that the terminal topological comodel has to be the spatialization of the terminal localic comodel. But by proposition 2.3, the terminal topological comodel is the set of behaviours, equipped with the operational topology. This gives us an idea of what the terminal localic comodel looks like.
Definition 3.1.
Let be a monad on . The behaviour locale is generated by opens for each , subject to the following equations for all and .
| (-) |
| (-) |
| (-) |
Here we write as shorthand for with when and otherwise.
Proposition 3.2.
Let be a monad on . Then the following equations hold in :
where , , and .
In fact, axiom (-) can equivalently be replaced by a combination of the first and third equations of proposition 3.2. We chose axioms (-) and (-) because of their resemblance to the admissibility condition of -behaviours. In any case, the axioms can be “discovered” as the necessary conditions for proving the universal property of as the terminal localic comodel, as in the following proposition.
Proposition 3.3.
is the terminal localic comodel with cointerpretation given by: .
Now by proposition 2.10 we can conclude that the points of the behaviour locale are simply the admissible behaviours of . The following example demonstrates that in general the projection from localic comodels to topological comodels is lossy: it is a monad whose behaviour locale is non-trivial, but which admit no admissible behaviours.
Example 3.4.
Consider the monad induced by the theory with generating operations for each . The theory has, in addition to the usual axioms of read-only state with memory locations as can be found in e.g. [27], the family of equations where and is any function such that for . This says two distinct memory cells cannot contain the same value, so is empty since the admissible behaviours in this case corresponds to injective memory configurations , of which there are (famously) none.
However, a term in this signature is well-founded, which is to say any particular execution of this computation term can only query finitely many memory locations. So, from the program’s perspective, it can never be sure that it is not in a non-injective state configuration, since it needs to query uncountably-many memory locations to make a pigeonhole principle argument (i.e., non-injectivity is semi-decidable). We can think of this as having a virtual address space of reals over countably many physical memory cells—the moment you try to query more locations than there are actual cells, the program is forced to halt.
Mathematically, this manifests in the non-triviality of the behaviour locale . By repeated applications of axiom (-) we can see that the behaviour locale for this monad can instead be generated by opens of the form . The axioms of the behaviour locale in this instance are equivalent to the axioms of the locale of injective functions from [19, Example C1.2.9], which generates a non-trivial locale. For these axioms and the proof of correspondence, see section A.5.
The terminal topological comodel can be shown to be a Stone space. Correspondingly, we also have that the terminal localic comodel is ultraparacompact, and this is because can be presented by generators and partitions, instead of just coverages. See section A.6 for details.
Proposition 3.5.
Let be a monad. Then is ultraparacompact.
3.2 The Locale of Morphisms
For a monad , any operation induces a section of the behaviour category. This suggests we should recover a monad from the behaviour category by taking such sections. But doing so allows “computations” which are computationally unreasonable, as the following example shows.
Example 3.6.
Consider induced by the free theory on one binary operation . The behaviours are infinite binary streams and morphisms are natural numbers, as explained in example 2.8. But we can have a section which maps and any other stream to . Using only the operation which reveals only one digit each time, it is impossible to determine in finite time that the input stream is precisely , so this does not represent a reasonable computation at all. This example also shows how the behaviour category fails to represent even if is deterministic and stateful, and hence why we really need to consider the topological structure on .
Hence, we want the source map of the localic behaviour category such that only the feasible computations (and as little else) be allowed as sections. Therefore, instead of directly constructing the locale of morphisms , we will first construct a sheaf—or more precisely a -set—over whose generating sections are the -computations, and then take the corresponding local homeomorphism as the source map. For the remainder of this section, is the Grothendieck Boolean algebra of complemented opens in . Of course, the sheaf should not be generated freely: we can see in that if a term factors as , then at each we have , so the global sections and are equal when restricted to the region .
Definition 3.7.
Let be a monad. The sheaf of transitions associated to is a quotient of the free -set with generators , by the smallest -congruence identifying where , and is the partition canonically associated to .
This definition is rather intuitive, but it is not at all obvious what its relationship is with the morphisms of the behaviour category introduced in definition 2.6. To see the connection, we prove that two elements are related by just when they are pointwise trace-equivalent, as expressed by the following definition and accompanying lemma.
Definition 3.8.
Let be a monad of rank . Define the -valued relation of trace equivalence on :
| (3) | ||||
| (4) |
If is a complemented open, we define to be true whenever (if , we simply write . This definition seems complicated, but it is just the point-free transliteration of the definition for -equivalence.
Lemma 3.9.
is an equivalence relation, in the sense that for all ,
Consequentially, all the are equivalence relations in the usual sense.
Lemma 3.10.
Let . Then iff for each , we have . Moreover, .
Be warned that we abuse notation by confusing elements of with the induced element of , even though the unit map from proposition 2.19 is in general not injective.
Recall from proposition 2.22 that the corresponding local homeomorphism is the locale of homomorphisms . By the universal property of free algebras, such homomorphisms correspond to functions respecting the generating equation . We can restate this in terms of trace equivalence between generators, as follows (proof of correspondence can be found in section A.8).
Definition 3.11.
The locale of transitions is the pointwise-ordered poset of functions for which implies for any and .
We are now in the position to introduce the localic behaviour category, but before we do so we specialize lemma 2.21 and proposition 2.23 to our locale of transitions, which relates the localic behaviour category back to the usual behaviour category.
Lemma 3.12.
Every open can be expressed as , so the frame is generated by opens of the form for and .
Proposition 3.13.
The set of points is bijective with .
Proof 3.14.
By proposition 2.23, we know that . But we know , so the really are just admissible behaviours. Next, observe that every can be expressed in the form , and hence for the with . Hence, we have over each . Therefore .
Finally, the following lemma is useful for we will often have to consider various pullbacks with the source map, such as when we define the composition map of the localic behaviour category in definition 2.6 below.
Lemma 3.15.
The pullback of a locale map along the source map has frame of opens given by the pointwise-ordered poset of functions for which implies for any and .
In terms of points, such a function contains all the points for which and .
Definition 3.16.
Let be a monad. Then the localic behaviour category has:
-
•
locale of objects given by the terminal localic -comodel;
-
•
source map given by ;
-
•
target map given by ;
-
•
identity map given by ;
-
•
composition map given by , where, by lemma 3.15 we identify with the poset of functions for which implies and implies .
A function as above corresponds to the open set containing pairs of germs with . For the verification that this is a localic category, see section A.10.
3.3 Topological Behaviour Category & Finitary Monads
We have already seen that and (proposition 3.13). Being a right adjoint, the functor preserves limits and hence lifts to internal categories. Hence we get a topological behaviour category , which is just an appropriately topologized version of the behaviour category.
Definition 3.17.
(Topological behaviour category) Let be a monad. The operational topology on is generated by subbasic opens of the form . Taking and with their operational topologies makes the structure maps of the behaviour category continuous, yielding the topological behaviour category .
While example 3.4 shows that we need the full force of the localic behaviour category for infinitary monads, for finitary monads it suffices to consider the topological behaviour category because the involved locales and are spatial, which we shall now prove. The spatiality of is easily seen from the definition. The finitariness of means that axiom (-) of definition 3.1 can be expressed by a finite join, and so the axioms generate a distributive lattice—in fact a Boolean algebra —from which the frame is freely generated. Locales freely generated from a distributive lattice in this way are well-known to be spatial [17, II 3.4], and in this case the space corresponds to the Stone dual of .
As for , it is spatial because is determined by a sheaf over a spatial locale , and sheaves only depend on the lattice of opens of its base space. More precisely, we observe that the source map of the topological behaviour category is also a local homeomorphism, and it has the same sections as the (source map of the) localic behaviour category, and is thus the same sheaf.
Lemma 3.18.
Let be a finitary monad. Then for any global section of , there is a finite family of pairs such that is a finite partition and maps . Moreover, this family is unique up to trace equivalence: if we have two such families and then for all we have .
Proof 3.19.
Each admits an open neighborhood where is some representative of the equivalence class . This induces an open cover on which is refined by a finite partition since is a Stone space. It suffices to pick to be the of an open refined by . The uniqueness under trace equivalence is easy to see because for any , we have . The spatiality of then ensures this corresponds to .
It is not hard to see that a family as in the lemma above defines an element of the free -set, and that the uniqueness translates to the same condition as in lemma 3.10. That is, the global sections of correspond to the sheaf of transitions over , and hence . Hence we have:
Proposition 3.20.
For finitary , and are spatial, i.e., has enough states and transitions.
4 The Stone Adjunction for Monads
In this section, we functorialize the construction of the localic behaviour category and prove that it has a right adjoint by taking sections of the source map. Here, the correct morphisms between localic categories are retrofunctors, not functors like usual. Just as we view topological/localic categories as transition systems, we can view a retrofunctor as a simulation of transition systems.
Definition 4.1.
Let and be small categories. A retrofunctor consists of two functions and , where is the pullback of along . In other words, given and we get a lift such that . These are further required to respect identity and composition:
| (5) |
If and are internal categories, then there is an appropriate notion of internal retrofunctor which make the appropriate diagrams commute, as described by Clarke [7, definition 2.10]. Write and for the categories of internal categories and retrofunctors in and respectively.
Proposition 4.2.
The assignment extends contravariantly to a functor , and similarly a functor .
Proof 4.3.
A monad morphism induces a retrofunctor whose action on objects is given on generating opens by . For the action on morphisms , by lemma 3.15 we can identify with an appropriate poset of functions . The action is then simply given by . We refer to section A.11 for more details and the verification of functoriality.
On the other hand, if we view a localic category as a transition system, what is a computation on ? Well, a computation (of output type ) should specify, for each state , a transition out of (the “side-effect” of the computation) along with an output in . In other words, the computations are global sections of the source map, or more precisely a disjoint, -indexed, jointly global family of partial sections. Indeed, we get a monad of such sections—notice that this looks very much like a state monad except we also keep track which transitions are taken, not just the end state.
Proposition 4.4.
Let be a localic category. Then the endofunctor
on (with the action on given by post-composing ) admits a monad structure given, for arbitrary , by and
In terms of points, we have and where and , while in terms of opens we have
Moreover, the assignment defines a contravariant functor .
Proof 4.5.
A straightforward diagram chase reveals that unitality and associativity of the monad structure is inherited from the unitality and associativity of . Functoriality is automatically obtained when we prove the adjunction of theorem 4.6, so we leave it as an exercise to define the action of retrofunctors.
Any computation defines a global section of the behaviour category, defined by on generating opens. This defines the unit map of an adjunction between and , which brings us to the main adjunction of this paper.
Theorem 4.6.
.
Proof 4.7.
The counit map is given by , and . See section A.12 for the verification of the adjunction.
We also have a functor , and this similarly admits a right adjoint , but it is not well behaved because loses too much information about the infinitary monad , as exemplified by example 3.4. However, by proposition 3.20, if we restrict to then is spatial and corresponds to the topological category . The right adjoint of the functor is given by taking the monad of finitary sections for a topological category .
Theorem 4.8.
Proof 4.9.
The inclusion has a right adjoint given by where is the usual full inclusion of the category of finite sets (as follows from relative monad theory [5]). Then we have the desired adjunction by composing with , noting that .
5 The Stone Duality for Hyperaffine-Unary Monads
This final section is devoted to proving that the adjunction 4.6 is idempotent, and to characterize its fixed points. On the monad side, the fixed points correspond to those monads whose category of Eilenberg-Moore algebras are cartesian-closed. These were first syntactically characterized by Johnstone [18], but [12] provided an improved syntactic characterization as those monads which admit a hyperaffine-unary decomposition. On the side of localic categories, the fixed points are the ample localic categories, i.e., whose source maps are local homeomorphisms and whose locales of objects are ultraparacompact.
In fact, this equivalence between hyperaffine-unary monads and ample localic categories is originally due to the first-named author [13]. In addition to filling in details about the equivalence, our contribution is to envelope the equivalence in an adjunction, which yields a process of hyperaffine-unary completion for monads on one hand, and a process of amplification for localic categories on the other.
5.1 Hyperaffine-Unary Monads
What exactly is the difference between and ? Because of the unit map, all computations in live inside . The answer is that adds additional operations which predicts the output of without performing the side effect of . Computationally, this can be thought of as performing and then rolling the state back, or more mystically as scrying222A particularly potent analogy is to think of the environment as an (infinite) deck of playing cards, and of the program as the player, in which case a scry allows the player to look at the top cards of their deck before putting it back in the same order. This happens for example in the trading card game Magic: The Gathering. the future.
Example 5.1.
(Binary Input with Scrying) Let be induced by as in example 3.6. The topology of is the cantor space, and hence generated by open sets of infinite streams which extend a given finite string . By continuity and compactness of , any global section is therefore described (non-uniquely) by a pair where is a finite set of finite strings that jointly cover all infinite streams, and assigns to each element of a pair consisting of the number of digits to consume from the stream, and the output . Notice that this rules out the section we introduced in example 3.6. As an example, the binary tree , induces a section which is described by the assignments .
In general, an assignment for a section of the form must satisfy . That is, to use information about the first digits of the stream you must consume at least digits. However, in general sections do not need to respect this: the assignments describe a perfectly acceptable section . We can think of as looking ahead or scrying the first two digits of the stream, before deciding what to do. Indeed, for any section , we have a corresponding which outputs the same values as , but only makes identity transitions. Then factors as .
It is easy to see in general that monads of the form always has this factorization property, since a section always admits a cousin which sends objects to the same output, but replaces the morphism by identity morphisms—the scry corresponding to . Monads satisfying this factorization property, called hyperaffine-unary monads in [12], suffices to characterize the fixed points of adjunction 4.6.
Definition 5.2.
(Hyperaffine-unary) Let be a monad. A computation is hyperaffine if
| (6) |
The monad is hyperaffine-unary if for every computation , there is a unique hyperaffine such that . Any hyperaffine-unary monad admits a submonad of hyperaffine operations ([12, Proposition 6.1]).
Proposition 5.3.
Let be a localic category. Then is hyperaffine-unary.
Proof 5.4.
A computation reveals that , while . So these two are equal iff . Notice that we do not use the second condition of being hyperaffine, because it is automatically true for any satisfying the first condition (also known as affine). Now, suppose that such a hyperaffine for a section . Then a straightforward computation (using the characterization of hyperaffines) reveals that the condition implies which determines as a well-defined frame homomorphism. See section A.13 for the computations.
Hyperaffine-unary monads admit a particularly nice presentation of the localic behaviour category, which greatly aids us in proving the characterization of the fixed points.
Lemma 5.5.
Let be a hyperaffine-unary monad with hyperaffine submonad . Then is generated by where admits a Boolean algebra structure and is a strongly zero-dimensional topology defined by with . Here, we abuse notation by writing for . Moreover, the map is an isomorphism, with admitting a -set structure given by .
Proof 5.6.
The Grothendieck Boolean algebra structure is established in [12]. The Boolean algebra structure on is given by , and , and from this it is easy to see that satisfies (-), (-), , and for finite sets . Then the only missing axioms are for infinite , but these are precisely the partitions in . Hence generates .
The inverse to is witnessed by , where is a hyperaffine realizing the partition induced by . On one hand we have . On the other hand, .
Proposition 5.7.
A monad is hyperaffine-unary iff the unit map is an isomorphism.
Proof 5.8.
() Suppose now the unit map is an isomorphism. Then the hyperaffine-unary factorization of (proposition 5.3) must transfer along the unit map onto .
() For the converse direction, we make use of lemma 5.5, which basically says any global section identifies a hyperaffine and a family of unary computations, and the composite induces the section . See Section A.14 for the details.
5.2 Ample Localic Categories and Stone Duality
On the other side of the adjunction, what is the relationship between a localic category and the behaviour category ? Well, only considers the partitioning sections of , so is only sensitive to the ultraparacompact quotient of , i.e., whose frame of opens is the ultraparacompact frame generated by taking the zero-dimensional topology of partitions on the Boolean algebra . Moreover, then reconstructs the locale of morphisms from only the sections over this ultraparacompact quotient. So this reconstruction is perfect if in the first place is ultraparacompact and the source map is a local homeomorphism. These are called ample localic categories [13].
Definition 5.9.
A localic category is ample if is a local homeomorphism and is ultraparacompact. A topological category is ample if is a local homeomorphism and is a Stone space. Write (resp. ) for the full subcategory of (resp. ) containing the ample localic (resp. topological) categories.
Proposition 5.10.
A localic category is ample iff the counit map is an isomorphism.
The combination of propositions 5.7 and 5.10 allow us to derive the titular Stone duality for monads.
Theorem 5.11.
The adjunction of theorem 4.6 is idempotent and its fixed points are the equivalent categories . Furthermore, this equivalence restricts to .
Proof 5.12.
It follows from proposition 5.10 that is an isomorphism, since is ample for any monad . Hence adjunction 4.6 is idempotent, and propositions 5.7 and 5.10 characterize the fixpoints. For the finitary monad case, we know that preserves pullbacks along local homeomorphisms. So induces a functor . The equivalence when restricted to finitary monads factors through this functor. This factorization is essentially surjective on objects, because now taking the global sections monad on an ample topological category , the compactness of the base space ensures this monad is the monad of finitary sections. Hence, we get an equivalence .
Example 5.13.
Every Grothendieck Boolean algebra presenting a locale is associated to a distributions monad whose computations are all hyperaffine, and hence hyperaffine-unary. Under the equivalence of theorem 5.11, corresponds to the localic category with and source map . Of course, if consists of only finite partitions, then is the Stone dual of , and so our equivalence subsumes the classical Stone duality.
6 Conclusion & Prospectus
Summary. We constructed the localic behaviour category (definition 3.16) associated to a ranked monad, and showed that the functor admits a right adjoint by taking global sections (theorem 4.6). We further showed that this adjunction is idempotent, and restricts to a known equivalence between the full subcategory of hyperaffine-unary monads, and the full subcategory of ample localic categories (theorem 5.11).
On Classifying Comodels. Recall from theorem 2.7 that the behaviour category classifies comodels. It is easy to prove a similar classification theorem for localic -comodels, this time as -spaces, i.e., locales equipped with an action by , which we omit for brevity. In fact, we have a more abstract perspective on this classification, which we shall now quickly sketch. -comodels are particular instances of right -modules, and the construction of the localic behaviour category can be generalized to arbitrary right -modules (recovering the original by considering as a right module of itself). The resulting construction is no longer a category, but rather a fibred -space , i.e., a family of localic -comodels varying continuously over . Following [9], we can explain this as the free comodel associated to , with the fibration being necessary because the free comodel lives not in , but rather in the topos of sheaves . However, if is itself a comodel, then is the singleton space, and , which is now just a -space, corresponds exactly to the comodel .
Prospectus. Stone dualities underlie completeness theorems for logics. In future work, we hope to use our Stone duality to constructing a logic for reasoning about monadic programs, such as can be expressed in Moggi’s monadic metalanguage [22]. We expect this logic to take the shape of propositional dynamic logic (PDL) [15], since the localic behaviour category can be seen as a Kripke model whose propositions are interpreted as clopens of and whose programs are (generated by) . The modality is interpreted as . The advantage of this approach is that, in light of theorem 5.11, we may think of as universally completing with propositions (the “scrying” hyperaffines), i.e., we are really interpreting our logic in . This lifts a constraint in previous works on monadic program logics such as Goncharov & Schröder [14] which require the original monad to contain sufficient innocent computations to interpret the propositions in the first place.
Having brought up Goncharov & Schröder [14], we also ought to discuss their use of unary computations as propositions, contrasting with our use of binary computations (in ). This contrast seems to stem from their assumption that computations may fail to terminate, leading to an information ordering on computations ala domain theory, whereas in this paper, the choice to use comodels (which always return a value) is tantamount to assuming that computations always terminate. Therefore, we hope in the future to explore the Stone-type duality that arises when we consider comodels residual [2, 20, 29] over the lifting monad . Just as the global sections monad is a very fancy state monad, we expect the right adjoint of this duality to take monads of partial sections, i.e., fancy partial state monads.
It is also natural to consider generalizations beyond monads on . In this paper, many constructions explicitly talk about elements of monads, so an appropriate generalization will replace elements with morphisms in the Kleisli category. We can shed a preliminary light on this too, based on the very general adjunction introduced in [8] between restriction categories realized in and partite categories internal in . Here, our localic behaviour category is the partite internal category corresponding under this adjunction to a restriction category generated by the functor . This provides a description of the localic behaviour category which avoids talking about elements of , so generalization efforts ought to begin by better understanding the construction of this restriction category.
Finally, the existence of a spectral duality for monads raise the interesting possibility of developing a scheme theory of monads. Recall the notion of a scheme of rings from algebraic geometry: these are locally ringed sheaves which are locally isomorphic to the spectrum of a commutative ring. The analogy here is between rings and (hyperaffine-unary) monads, with the spectrum of a ring (which is a sheaf) analogous to the source map of . At first approximation, a scheme of monads should then be a localic category , which “locally resembles” for some . The idea is that in a scheme , the monad (and hence the syntax) in play varies continuously over the base space . This should allow for the modelling of effects whose syntax is not fixed, such as local state—it would be nice if “local state” = “locally a state monad”.
References
- [1] Aguiar, M., Internal Categories and Quantum Groups, Cornell University (1997).
-
[2]
Ahman, D. and A. Bauer, Runners in Action, pages 29–55, Lecture notes in computer science, Springer International Publishing (2020).
https://doi.org/10.1007/978-3-030-44914-8_2 -
[3]
Ahman, D. and T. Uustalu, Directed containers as categories, Electronic Proceedings in Theoretical Computer Science 207, pages 89–98 (2016).
https://doi.org/10.4204/eptcs.207.5 - [4] Ahman, D. and T. Uustalu, Taking updates seriously, in: R. Eramo and M. Johnson, editors, Proceedings of the Sixth International Workshop on Bidirectional Transformations, pages 59–73, CEUR Workshop Proceedings (2017).
-
[5]
Altenkirch, T., J. Chapman and T. Uustalu, Monads need not be endofunctors, in: C. L. Ong, editor, Foundations of Software Science and Computational Structures, 13th International Conference, FOSSACS 2010, Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2010, Paphos, Cyprus, March 20-28, 2010. Proceedings, volume 6014 of Lecture Notes in Computer Science, pages 297–311, Springer (2010).
https://doi.org/10.1007/978-3-642-12032-9_21 -
[6]
Bergman, G. M., Actions of boolean rings on sets, Algebra universalis 28, pages 153–187 (1991).
https://doi.org/10.1007/bf01190851 - [7] Clarke, B., Internal split opfibrations and cofunctors, Theory and Applications of Categories 35, pages 1608–1633 (2020).
-
[8]
Cockett, R. and R. Garner, Generalising the étale groupoid–complete pseudogroup correspondence, Advances in mathematics 392, page 108030 (2021).
https://doi.org/10.1016/j.aim.2021.108030 - [9] Cole, J. C., The bicategory of topoi and spectra, Reprints in Theory and Applications of Categories 25, pages 1–16 (2016).
-
[10]
Garner, R., The costructure–cosemantics adjunction for comodels for computational effects, Mathematical structures in computer science 32, pages 374–419 (2022).
https://doi.org/10.1017/s0960129521000219 -
[11]
Garner, R., Stream processors and comodels, Logical Methods in Computer Science 19, Issue 1 (2023).
https://doi.org/10.46298/lmcs-19(1:2)2023 -
[12]
Garner, R., Cartesian closed varieties I: the classification theorem, Algebra universalis 85 (2024).
https://doi.org/10.1007/s00012-024-00869-1 -
[13]
Garner, R., Cartesian closed varieties II: links to algebra and self-similarity, Proceedings of the Royal Society of Edinburgh: Section A Mathematics pages 1–45 (2025).
https://doi.org/10.1017/prm.2024.80 -
[14]
Goncharov, S. and L. Schröder, A relatively complete generic hoare logic for order-enriched effects, in: 2013 28th Annual ACM/IEEE Symposium on Logic in Computer Science, IEEE (2013).
https://doi.org/10.1109/lics.2013.33 -
[15]
Harel, D., D. Kozen and J. Tiuryn, Dynamic logic, pages 99–217, Springer Netherlands (2001).
https://doi.org/10.1007/978-94-017-0456-4_2 -
[16]
Johnstone, P., Cartesian monads on toposes, Journal of pure and applied algebra 116, pages 199–220 (1997).
https://doi.org/10.1016/s0022-4049(96)00165-x - [17] Johnstone, P. T., Stone Spaces, Cambridge University Press (1982).
-
[18]
Johnstone, P. T., Collapsed toposes and cartesian closed varieties, Journal of algebra 129, pages 446–480 (1990).
https://doi.org/10.1016/0021-8693(90)90230-l - [19] Johnstone, P. T., Sketches of an Elephant: Volume 2, Oxford University Press (2002).
-
[20]
Katsumata, S.-Y., E. Rivas and T. Uustalu, Interaction laws of monads and comonads, in: Proceedings of the 35th Annual ACM/IEEE Symposium on Logic in Computer Science, ACM (2020).
https://doi.org/10.1145/3373718.3394808 -
[21]
Kelly, G. M. and A. J. Power, Adjunctions whose counits are coequalizers, and presentations of finitary enriched monads, Journal of Pure and Applied Algebra 89, pages 163–179 (1993).
https://doi.org/10.1016/0022-4049(93)90092-8 -
[22]
Moggi, E., Notions of computation and monads, Information and Computation 93, pages 55–92 (1991).
https://doi.org/10.1016/0890-5401(91)90052-4 - [23] Niu, N. and D. I. Spivak, Polynomial Functors: A Mathematical Theory of Interaction, London Mathematical Society Lecture Note Series, Cambridge University Press (2025).
- [24] Paterson, A. L. T., Groupoids, inverse semigroups, and their operator algebras, volume 170 of Progress in Mathematics, Birkhäuser (1999).
-
[25]
Plotkin, G. and J. Power, Notions of Computation Determine Monads, pages 342–356, Lecture notes in computer science, Springer Berlin Heidelberg (2002).
https://doi.org/10.1007/3-540-45931-6_24 -
[26]
Plotkin, G. and J. Power, Computational effects and operations: An overview, Electronic Notes in Theoretical Computer Science 73, pages 149–163 (2004).
https://doi.org/10.1016/j.entcs.2004.08.008 -
[27]
Power, J. and O. Shkaravska, From comodels to coalgebras: State and arrays, Electronic notes in theoretical computer science 106, pages 297–314 (2004).
https://doi.org/10.1016/j.entcs.2004.02.041 -
[28]
Uustalu, T., Stateful runners of effectful computations, Electronic notes in theoretical computer science 319, pages 403–421 (2015).
https://doi.org/10.1016/j.entcs.2015.12.024 -
[29]
Uustalu, T. and N. Voorneveld, Algebraic and Coalgebraic Perspectives on Interaction Laws, pages 186–205, Lecture notes in computer science, Springer International Publishing (2020).
https://doi.org/10.1007/978-3-030-64437-6_10 - [30] Van Name, J., Ultraparacompactness and ultranormality, arXiv:1306.6086v1 [math.GN] (2013).
- [31] Vickers, S., Topology via Logic, Cambridge University Press (1996).
Appendix A Omitted Proofs
A.1 Proof of lemma 2.21
Each open is a -set homomorphism since if then
where holds from right-to-left because we can take the on the LHS to be the on the RHS. The assignment is injective, as we now show. Let and assume that . Then we have , which implies there is a (cover , WLOG refinable into a) partition such that for each we have . But then .
Finally, let us show that . Take an arbitrary . Then . On the other hand, for the right-to-left inequality, it suffices to show for any with that . But this is clearly true since implies .
A.2 Proof of proposition 2.22
The map is a local homeomorphism by taking the family , which is covering by 2.21. Each such open is homeomorphic onto the whole base space .
The set of global sections to forms a -set, . Every element corresponds to a global section given by . This defines a -set homomorphism since implies, for all that , i.e., that . Moreover, this assignment is injective by the injectivity of (lemma 2.21).
On the other hand, to see that this assignment is surjective, notice that a global section given by a frame homomorphism induces a map . The image of this map covers because when we take all the opens together, they cover . Since is ultraparacompact, we can refine to an (extended) partition (not uniquely, but we don’t care which one we choose). This yields an element by taking the amalgamation . The element induces the section , so to see that :
whereby the last equality follows from lemma 2.21.
A.3 Proof of proposition 2.23
Given a germ , we can define a point by letting iff . This is coherent with respect to the choice of , because if then for some , so which entails by definition. But then .
On the other hand, suppose we have a point . This defines a subset , which has to be non-empty because otherwise for all , and hence contradicting being a frame homomorphism. also induces a point , and the germ induced by is for any . This is coherent: for any we have , but by lemma 2.21 there is some such that and . Then
From here it is a routine unfolding of definitions to see that a germ induces itself by going back-and-forth. On the other hand, given a point , going forth-and-back produces point with iff for some iff , and hence .
The subbasic opens on the set of germs is induced by the opens , which generate all other opens by lemma 2.21.
A.4 Proof of proposition 3.3
We first check that respects and , making a comodel. For we have
| apply (-) twice, and simplify | ||||
whereas for , we compute
but this is just . Next, we show that this comodel is terminal, so let be an arbitrary localic comodel. If a map exists, then being a comodel map implies , and hence this uniquely determines . We leave the verification that this map is well-defined as an exercise to the reader.
A.5 Proof of correspondence for example 3.4
Definition A.1.
The locale of injective functions is presented by generators for and , required to satisfy, for and , the equations
We must prove that this presentation is bi-interpretable with the behaviour locale of injective state. In one direction, the generator is interpreted as , in which case the first two axioms straightforwardly follow. The third axiom can be proven as follows:
| (by injectivity eqn) | ||||
In the other direction, by recursion we define a map interpreting the generators of the behaviour locale:
We leave the reader to verify that this respects the usual equations satisfied by terms in the theory of state. As an example, we will verify just the injectivity equation from example 3.4:
| by def. A.1 | ||||
A.6 Proof of proposition 3.5
We follow a similar line of argument to [16, Section 2]. First, notice that we can construct in two steps. Begin by constructing the meet semi-lattice generated by opens subject to equations and . Then we can generate the frame from subject to the equations and . Following [17, II 2.11], this can be presented as a covering system instead. The covering system is generated by the following rules:
Notice that the three base cases are pairwise-disjoint covers, and the inductive cases preserve the pairwise-disjoint property. Hence all the covers in this system are pairwise-disjoint. The frame presented by this system consists of all the -ideals, i.e., downwards closed subsets such that for any , implies . For any subset , the smallest -ideal containing is , and the join of a family of -ideals is the . Also, every induces an ideal .
We now prove that every open cover is refined by a partition, so consider an open cover . It is covering iff iff there is such that . But if we now consider the family , then this is precisely a partition (pairwise-disjoint because is) refining .
A.7 Proof of lemma 3.10
First, for self-containedness we lay out precisely the definition of -congruence.
Definition A.2.
Let be a -set. An equivalence relation is a -set congruence if for every partition , and two families such that for each , , we have
Given a set of pairs , The congruence generated by is given by the following inference rules
| gen refl trans symm cong- |
We also define as the relation derivable by exactly one use of gen, any use of cong- for any finite partition , and any use of refl.
If only contains finite partitions, then the algebraic theory of -sets only has finite operations and we can easily show that is the symmetric transitive closure of . However, if has infinite partitions, then this is no longer the case, but we can still prove that is always derivable by one congruence applied to , i.e., the transitive symmetric closure of the relation .
Lemma A.3.
If , then this can be derived with exactly one application of the cong rule.
Proof A.4.
By induction on derivation of . In the base case, we clearly have zero applications, but we can add an application of the cong rule over the one-element partition . In the inductive case, we have a derivation which looks like
By the inductive hypothesis, each subderivation of can be rewritten to use exactly one cong rule, so each subderivation is associated with a partition , defining a map . The derivation now looks like the derivation on the left-hand side below, which is derivable as on the right-hand side.
| cong cong |
The right-hand derivation uses only one cong, concluding the proof.
Lemma A.5.
If then this is derivable by a derivation of the form
| cong |
Proof A.6.
By induction on the derivation of . The base cases and the inductive cases for symm and cong- are easy, so we only work out the case for trans. By induction hypothesis we know that our derivation will look like
| trans |
We can re-arrange this into the following derivation,
| cong |
where is allowed to be any element of the -set (if is empty the theorem is vacuously true anyway). Here, the equality follows from , since and similarly .
Now, we see on the lefthand-side that , and similarly for on the righthand-side. Each of the derivations of only uses finite congruences, so can be re-arranged into derivations of , which concludes this inductive case and hence the proof.
Now let be the generating equation of definition 3.7, and for which we will omit the subscript from this point on. The proof of the actual lemma proceeds in two steps. We first prove lemma A.7, which is the version of lemma 3.10 for (which actually suffices to prove lemma 3.10 in the case where is finitary), and then prove the statement for .
Lemma A.7.
For any , if then for each , we have .
Proof A.8.
A derivation of is a (composable) chain of either or derivations, e.g. (arrow directions non-indicative). Each such derivation , by lemma A.3, can be rewritten with exactly one cong rule over an associated partition . This means that the derivation looks like
where for a unique , we have and and for , we have . Associate to the partition , and to the partition
For a derivation , perform the opposite assignment. So each is then associated with two partitions and , except for and . For these, define and . Since there are finitely many of these partitions, we can take a common refinement—call this .
Consider . It refines a unique , which identifies the term . Now look at the first derivation, and suppose it is . Then refines a unique . There are two possible cases:
-
(1)
Either , in which case we define ;
-
(2)
or for some , in which case we know that must be of the form . So define .
We note that in either case, we have .
The other possibility is that . Then refines a unique . There are two possible cases:
-
(1)
Either , in which case we define ;
-
(2)
or for some , in which case we know that must be of the form . So define .
Now we may repeat this process, obtaining . Here, since refines some , we have that . So we may conclude . To finish the proof, we see that any is a join of its refinements in , and since we show for all of its refinements , we can conclude that .
Finally, we prove lemma 3.10.
suppose . Then by lemma A.5, we know that for some partition and families such that for each , . So by lemma A.7, we have for every . Now, recall from 2.18 that , so . Hence iff for all , , which we have.
Suppose for each . Let be the common refinement of and . Abusing notation, we will write families indexed by elements of as indexed by pairs , for example . Then and , and so by cong- it suffices to prove for each and with .
Consider first the special case where . Then
is an open cover, so there is a refining partition . We can further refine this partition to . Now each is either , or and associated with some , and families such that , , and . Then we can derive
| by similar reasoning | ||||
Now, consider the general case: by ultraparacompactness, it suffices to consider when for each . Then is refinable by a partition such that each is either or and for some . Then we can prove by similar reasoning as the previous paragraph, so by transitivity of we have . Then we finally finish the proof with the following equational reasoning:
A.8 Proof that definition 3.11 corresponds to definition 3.7
Suppose is a function respecting trace equivalence as in 3.11. Then we need to show , which we have by
| (2) | ||||
| (2) | ||||
| (*) |
where (*) follows because respects trace equivalence:
On the other hand, if is a -set homomorphism, then we need to show restricts to a function which respects trace equivalence. Consider then two trace equivalent terms . Then we have since
where the last equality follows because by lemma 3.10.
A.9 Proof of lemma 3.15
The following decomposition lemma, analogous to lemma 3.12, will come in handy.
Lemma A.9.
Every with the conditions of this lemma is of the form where .
Proof A.10.
We have to show . As in the proof of lemma 3.12, the left-to-right inequality is easy, so we focus on the right-to-left inequality for which we have to show . By ultraparacompactness, so it suffices to prove for each complemented that , but this immediately follows from the condition on .
It is easy to see that satisfies the condition since it is just a constant map. Meanwhile, for whenever we have that
Hence satisfies the condition of this lemma.
The two projections and are given by and . Given a pullback cone and , if a universal arrow exists then it must satisfy
But then by lemma A.9, the frame of opens for the pullback is generated by these opens, so these two equations uniquely determine . It is then straightforward to check that this is well-defined.
A.10 Proof that definition 3.16 is a localic category
It is very straightforward to check that the domain and codomain of identity and compositions correspond to what they should be, so we focus on the unitality and associativity. It is easy to see from lemma 3.15 that , for which the unitality diagram becomes
and this commutes by unitality of . Finally, by lemma 3.15 the pullback of composable triples can be constructed as the frame of appropriate maps , for which the associativity diagram below obviously commutes due to the associativity of .
A.11 Details to the proof of proposition 4.2
First we have to verify that is an internal retrofunctor. For this we need to consider the pullbacks
Noting that is the pullback of the second square composed with the first square, and following similar ideas to lemma 3.15, the second pullback can be expressed by the frame of maps such that implies , and implies .
The requirements on the domain and codomain of the lift is encoded by requiring the following diagram to commute:
but this follows by a straightforward chase along the diagram. Next, to see that identity and composition is respected, we require the following diagrams to commute:
For the commutativity involving , this amounts to checking, for , that
The proof of this is similar to the proof of lemma A.9. For the commutativity involving , the map is defined on inverse image by . Then the commutativity of this square amounts to checking, for , that but this easily follows from being a monad map.
We now also must verify that is functorial. If then we see that the definition of is indeed the identity retrofunctor. For composition, given and , it is obvious that . For the action on morphisms, the composite is given by
Let us compute the inverse image of an open set along this map. The inverse along gives which by lemma A.9 can be expressed as . Now the inverse of along the pair of maps can be computed as the inverse of just the left component, which again gives , but this time as an open in . The inverse of along the pair can be computed as the inverse of along the right component, which gives . So combining the two, in the end we get an open of defined by
and we have to show this is equal to . But this is again the same type of reasoning as in the proof of lemma A.9.
A.12 Details to the proof of theorem 4.6
Let us write as shorthand for . It suffices to prove, for any retrofunctor , there is a unique monad morphism such that . For this, we show that this condition uniquely determines . So consider and observe that . We then show that (1) ; and (2) . This fully determines as .
Now, (i) is a straightforward unfolding of definitions on the equation , so we leave this as an exercise to the reader (if the reader is still reading). For (ii), we have
Let us compute the inverse image of along this map. First, by lemma A.9 we can decompose . Then the the inverse image of along the pair is given simply as while the inverse image of is . Therefore, we arrive at the result
Hence, if we let , then we have . Now, it is easy to see that by taking . On the other hand, for we have to reason in terms of witnesses of . For simplicity, we simply consider a -step witness for such that and , with . Then one can see that
This proves (ii) and hence we conclude that is uniquely determined.
A.13 Details to the proof of proposition 5.3
(affine characterization) Applying the definition of , we find that where . But notice that is the inverse image of along
but this inverse image is equally well computed as , and hence .
(determination of ) Since , we can compute as
A.15 Proof of proposition 5.10
The following lemma come in handy.
Lemma A.11.
Two internal categories are retrofunctorially isomorphic iff they are functorially isomorphic.
Proof A.12.
Let and be internal categories. Given a functorial isomorphism with inverse , define the retrofunctor by and , and vice versa for . On the other hand, given retrofunctors and , define the functor by and where . Define the inverse similarly. We leave it to the reader to verify the necessary equations.
For brevity, we omit the subscript from , and let us also write for .
By lemma A.11, we get an isomorphism so is also ultraparacompact, and also we get an isomorphism commuting with the source maps, so the source map of is also a local homeomorphism.
By lemma A.11 it suffices to prove that the counit partakes in a functorial isomorphism. The action on objects has inverse given on generating clopens by where given by and . This map is well-defined because it realizes all partitions of : any partition manifests as a section defined analogously to , and hence we have . It is straightforward to see that . On the other hand, to see that , consider a generating open where . By proposition 5.3 we have its corresponding hyperaffine , and it is easy to see that . Then, it is a matter of checking that .
This gives us an internal functor with and which more explicitly can be computed as . By proposition 5.3 and lemma 5.5, the local homeomorphism is induced by the -set , but this just corresponds to the sheaf induced by the local homeomorphism , so we must have . The map is the canonical map witnessing this isomorphism, up to a change of base along the isomorphism . We leave it to the reader to verify functoriality.