Hostname: page-component-6565fbc58-bfzr4 Total loading time: 0 Render date: 2026-03-10T23:34:10.614Z Has data issue: false hasContentIssue false

Categories for collection monads

Published online by Cambridge University Press:  04 March 2026

Eugenio Moggi*
Affiliation:
DIBRIS, Universita degli Studi di Genova , Italy
*
Rights & Permissions [Opens in a new window]

Abstract

Manes (1998). Implementing Collection Classes with Monads. Mathematical Structures in Computer Science 8 (231–276) introduced the notion of a collection monad on the category of sets as a suitable semantics for collection types. The canonical example of collection monad is the finite powerset monad. In order to account for the algorithmic aspects, the category of sets should be replaced with categories whose arrows are maps computable by low-complexity algorithms. Inspired by realizability, we give a systematic way for constructing categories of small sets and low-complexity functions and define an analogue of collection monads on such categories.

Information

Type
Paper
Creative Commons
Creative Common License - CCCreative Common License - BY
This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (https://creativecommons.org/licenses/by/4.0/), which permits unrestricted re-use, distribution and reproduction, provided the original article is properly cited.
Copyright
© The Author(s), 2026. Published by Cambridge University Press

1. Introduction

In the context of database languages, collection types have been proposed as a common abstraction for a variety of datatypes (such as sets, multisets, arrays, lists, and trees) suitable for storing finite collections of elements of a certain type. Typed calculi for collection types (aka bulk types), like those in Buneman et al. (Reference Buneman, Naqvi, Tannen and Wong1995), provide a suitable framework for database query languages that go beyond traditional relational databases. These calculi have a lot in common with metalanguages for computational types (Moggi, Reference Moggi1991), but there are also important differences.

  • Equality of collections is decidable and can be added as an operation with a boolean result, while equality of programs is undecidable;

  • functional types and recursive definitions are available in most programming languages but are unacceptable in database languages, as they are incompatible with decidable equality.

Calculi for collection types are interpreted in categories with finite products, and collection types are interpreted by strong monads. Manes (Reference Manes1998) identifies certain finitary monads on the category ${\mathscr{S}}{\kern.8pt}$ of sets, called collection monads, as a more appropriate semantics for collection types. These monads have a well-behaved notion of membership and ensure that a collection has only finitely many members. We propose to replace the category ${\mathscr{S}}{\kern.8pt}$ of sets with (small) lextensive sub-categories ${\mathscr{C}}{\kern.8pt}$ of ${\mathscr{S}}$ , whose arrows are maps computable by low-complexity algorithms, for example, working in poly-time. These categories have the following desirable properties:

  • every object of ${\mathscr{C}}{\kern.8pt}$ has a decidable equality,Footnote 1

  • the category ${\mathscr{S}}_f$ of finite sets is (modulo equivalence) a full sub-category of ${\mathscr{C}}$ ,

  • ${\mathscr{C}}{\kern.8pt}$ has enough points, that is, the global section functor ${\mathscr{C}}{\kern.8pt}(1,-):{\mathscr{C}}{\kern.8pt}\xrightarrow {\,\,\,\hspace{6pt}}\mathscr{S}{\kern.8pt}$ is faithful.

Every monad on ${\mathscr{S}}{\kern.8pt}$ is strong (in a unique way); in a category ${\mathscr{C}}$ with enough points, a monad on ${\mathscr{C}}{\kern.8pt}$ can have at most one tensorial strength; thus, “being strong” becomes a property of a monad rather than additional structure. Therefore, one should add explicitly to the requirements for a collection monad that it is strong. The algebraic definition of collection monad given by Manes is not directly usable in the categories we propose as an alternative to ${\mathscr{S}}$ , because they are not locally finitely presentable.Footnote 2 However, when ${\mathscr{C}}{\kern.8pt}$ is a sub-category of ${\mathscr{S}}$ , we overcome this limitation by requiring that a monad on ${\mathscr{C}}{\kern.8pt}$ behaves like a (collection) monad on ${\mathscr{S}}$ .

Summary. The paper is organized as follows:

  • Section 2 recalls Manes’ definition of collection monad on ${\mathscr{S}}$ , and compares ${\mathscr{S}}{\kern.8pt}$ with the full sub-category ${\mathscr{S}}_\omega$ of countable sets.

  • Section 3 recalls the definition of a lextensive category and gives sufficient conditions on it for being a lextensive sub-category of ${\mathscr{S}}$ .

  • Section 4 recalls the definitions of the class of display maps ${\mathscr{D}}$ (CDM for short) and dominion ${\mathscr{M}}$ (i.e., a CDM of monos) and introduces the notion of ${\mathscr{D}}$ -monad, that is, a monad interacting nicely with the CDM ${\mathscr{D}}$ . For instance, collection monads are ${\mathscr{M}}$ -monads with ${\mathscr{M}}$ dominion of all monos in ${\mathscr{S}}$ .

  • Section 5 recalls the interpretation of Evaluation Logic in a lex category ${\mathscr{C}}{\kern.8pt}$ with a strong ${\mathscr{M}}$ -monad ${\mathbb{M}}$ . If ${\mathscr{C}}{\kern.8pt}$ is lextensive and ${\mathscr{M}}$ is the dominion of decidable monos, then the interpretation can be extended to a richer set of formulas, and it is possible to establish a connection with Algebraic Set Theory (Joyal and Moerdijk, Reference Joyal and Moerdijk1995; Simpson, Reference Simpson1999; Awodey et al., Reference Awodey, Butz, Simpson and Streicher2014).

  • Section 6 introduces the category $\mathsf{A}[C]$ of assemblies for a monoid $C$ of (partial) maps on a set $D$ , and the full sub-categories $\mathsf{M}[C]$ of modest sets and $\mathsf{P}[C]$ of predicates. These categories are instances of more general constructions for computability structures (see Longley (Reference Longley2014)). Example 6.3 gives some relevant $C$ .

  • Section 7 identifies sufficient properties on $C$ to ensure that the category $\mathsf{P}[C]$ is a lextensive sub-category of ${\mathscr{S}}$ , has enough points, and all its objects have decidable equality.

  • Section 8 investigates some lextensive categories of predicates $\mathsf{P}[C]$ to see if they have a strong $\mathscr{M}_2$ -monad ${\mathbb{P}}$ (with $\mathscr{M}_2$ dominion of decidable monos) behaving like the finite powerset monad $\mathbb{P}_f$ on ${\mathscr{S}}$ . Such a monad is determined by giving an injective encoding $P:\mathbb{P}_f(D)\to D$ .

Finally, in Section 9 we discuss further work and open issues.

2. Manes collection monads

We recall the two equivalent definitions of the collection monad on the category ${\mathscr{S}}{\kern.8pt}$ of sets and some properties of ${\mathscr{S}}{\kern.8pt}$ and finitary monads on ${\mathscr{S}}{\kern.8pt}$ (for proofs the reader should refer to Manes (Reference Manes1998)).

Definition 2.1. A monad ${\mathbb{M}}$ on ${\mathscr{S}}{\kern.8pt}$ is a collection monad if it satisfies one of the following equivalent properties:

  1. (1) ${\mathbb{M}}$ corresponds to a balanced algebraic theory, where an equation ${e}_0={e}_1$ is balanced when ${e}_0$ and ${e}_1$ have the same set of free variables.

  2. (2) ${\mathbb{M}}$ is equipped with a monad map $\tau$ to the finite powerset monad $\mathbb{P}_f$ (corresponding to the algebraic theory of commutative, idempotent monoids), s.t. when $m\;:\;X\xrightarrow {\,\,\,\hspace{6pt}} Y$ is monic.

Remark 2.2. If $(\Omega ,E)$ is a balanced algebraic theory, that is, $\Omega$ is a single-sorted algebraic signature and $E$ is a set of balanced equations between $\Omega$ -terms, then the monad ${\mathbb{M}}$ corresponding to such theory is s.t. ${\mathbb{M}} X$ is the set of $\Omega$ -terms with variables in $X$ modulo the equivalence $\sim$ induced by the equations $E$ and the monad map $\tau :{\mathbb{M}}\xrightarrow {\,\,\,\hspace{6pt}}\mathbb{P}_f$ is given by $\tau ([e])\stackrel {\Delta }{=}\textrm {FV}(e)$ , that is, the set of variables in the $\Omega$ -term $e$ . The definition of $\tau ([e])$ is well-defined, because $e_0\sim e_1$ implies $\textrm {FV}(e_0)=\textrm {FV}(e_1)$ , when $E$ is balanced.

We would like to replace the category ${\mathscr{S}}{\kern.8pt}$ of sets with other categories, which must be at least lextensive (i.e., they have finite limits and well-behaved finite sums; see Carboni et al. (Reference Carboni, Lack and Walters1993)). Therefore, one cannot rely on the peculiar properties of ${\mathscr{S}}$ . For instance, in a category ${\mathscr{C}}{\kern.8pt}$ with finite products, one can define the category ${\mathscr{A}}$ of algebras in ${\mathscr{C}}{\kern.8pt}$ for an equational theory $(\Omega ,E)$ , but the forgetful functor $U:\mathscr{A}\xrightarrow {\,\,\,\hspace{6pt}}{\mathscr{C}}{\kern.8pt}$ may not have a left adjoint (i.e., free algebras may not exist). However, the second characterization of collection monads generalizes to any lex category ${\mathscr{C}}$ , provided one has a substitute for the finite powerset monad $\mathbb{P}_f$ , which plays the role of the mother of all collection monads on ${\mathscr{C}}$ .

Proposition 2.3. The category ${\mathscr{S}}{\kern.8pt}$ has the following properties:

  1. (1) It is a Grothendieck topos; thus, the classes ${\mathscr{E}}$ of epis and ${\mathscr{M}}$ of monos form a stable factorization system.

  2. (2) Every epi is a split epi (i.e., the axiom of choice holds).

  3. (3) The subobject classifier is $1\xrightarrow {\,\,\,\hspace{6pt}} 2$ , where $2$ is the coproduct $1+1$ ; thus, every mono is decidable.

  4. (4) It has enough points, that is, $f,g:X\xrightarrow {\,\,\,\hspace{6pt}} Y$ are equal when $\forall x:1\to X.f\circ x=g\circ x$ .

  5. (5) Every monad is strong in a unique way.

  6. (6) Every monad preserves monos, that is, $P\subseteq X$ implies ${\mathbb{M}} P\subseteq {\mathbb{M}} X$ (with some abuse of notation),

  7. (7) A monad ${\mathbb{M}}$ is finitary (i.e., the underlying endofunctor preserves filtered colimits) $\Longleftrightarrow$ $\forall c\in {\mathbb{M}} X.\exists X_0\subseteq _{f} X.c\in {\mathbb{M}} X_0$ .

There are full sub-categories of ${\mathscr{S}}{\kern.8pt}$ that better resemble the categories we are looking for.

Example 2.4. We consider two full sub-categories of ${\mathscr{S}}{\kern.8pt}$ :

  • The category ${\mathscr{S}}_f$ of finite sets: it is a sub-topos of ${\mathscr{S}}{\kern.8pt}$ without Natural Number Object (NNO).

  • The category ${\mathscr{S}}_\omega$ of countable sets (i.e., with cardinality at most $\aleph _0$ ): it is a classic structure, in the sense of (Simpson, Reference Simpson1999, Definition 2.4), by taking as small maps the $f:Y\xrightarrow {\,\,\,\hspace{6pt}} X$ s.t. the set $\{y|f(y)=x\}$ is finite for every $x\in X$ , its small objects are the finite sets, and it has a NNO (which is not a small object).

Both ${\mathscr{S}}_f$ and ${\mathscr{S}}_\omega$ are lextensive, essentially small (i.e., equivalent to a small category), and the monad $\mathbb{P}_f$ restricts to them. More interestingly, a finitary monad ${\mathbb{M}}$ on ${\mathscr{S}}{\kern.8pt}$ restricts to ${\mathscr{S}}_\omega \Longleftrightarrow {\mathbb{M}} X\in \mathscr{S}_\omega$ for every finite set $X$ . In particular, every monad on ${\mathscr{S}}{\kern.8pt}$ corresponding to an algebraic theory with a countable signature restricts to ${\mathscr{S}}_\omega$ .

Remark 2.5. Any monad on ${\mathscr{S}}_f$ extends to a finitary monad on ${\mathscr{S}}$ ; thus, any monad on ${\mathscr{S}}_f$ is the restriction of a finitary monad on ${\mathscr{S}}$ . This is not true for ${\mathscr{S}}_\omega$ , namely, there is a monad ${\mathbb{M}}$ on ${\mathscr{S}}_\omega$ , which is not the restriction of a finitary monad on ${\mathscr{S}}{\kern.8pt}$ :

  • ${\mathbb{M}} X=X+1$ if $X$ is finite else $X+2$ ,

  • for a map $f:X\xrightarrow {\,\,\,\hspace{6pt}} Y$ in ${\mathscr{S}}_\omega$ the map ${\mathbb{M}} f=f+\textrm {id}_{1}$ if $X+Y$ is finite else $f+!$ if $Y$ is finite else $f+\iota$ if $X$ is finite else $f+\textrm {id}_{2}$ if $Y-f(X)$ is finite else $f+(\iota \circ !)$ , where $!:2\xrightarrow {\,\,\,\hspace{6pt}} 1$ and $\iota :1\xrightarrow {\,\,\,\hspace{6pt}} 2$ .

3. Lextensive categories

Lextensive categories are categories with finite limits and well-behaved finite sums (aka coproducts), as formalized by the notion of extensive category in Carboni et al. (Reference Carboni, Lack and Walters1993). By lextensive functor, we mean a functor between lextensive categories that preserves finite limits and finite sums. Similarly, we call a lex category a category with finite limits and a lex functor a functor between lex categories that preserves finite limits.

Any (locally small) category ${\mathscr{C}}{\kern.8pt}$ with a terminal object $1$ has a global section functor ${\mathscr{C}}{\kern.5pt}(1,-):{\mathscr{C}}\xrightarrow {\,\,\,\hspace{6pt}}\mathscr{S}$ , which preserves all small limits existing in ${\mathscr{C}}$ . We are mainly interested in (essentially small) lextensive categories with the property that the global section functor is faithful and lextensive. The following result gives sufficient conditions (in fact also necessary) on a lextensive category to have such a property.

Theorem 3.1. If ${\mathscr{C}}{\kern.8pt}$ is lextensive, not trivial (i.e., $0\not \cong 1$ ), and has enough points, then

  1. (1) the global section functor $|-|:{\mathscr{C}}\xrightarrow {\,\,\,\hspace{6pt}}\mathscr{S}$ is faithful and lextensive

  2. (2) the map $|-|:{\mathscr{C}}{\kern.5pt}(X,Y)\xrightarrow {\,\,\,\hspace{6pt}}\mathscr{S}{\kern.5pt}(|X|,|Y|)$ is an iso when $X$ is a finite sum of terminal objects.

Proof. Since ${\mathscr{C}}{\kern.8pt}$ has enough points, the global section functor is faithful and lex. To prove that it is extensive (i.e., it preserves finite sums), it suffices to prove that when $X_0\xrightarrow {\,\,\,\hspace{6pt}} 1\xleftarrow {\,\,\,\,\textrm {id}\,\,\,\,} X_1$ is a coproduct diagram, exactly one of the $X_i$ is initial.

  • The coproduct injections $X_i\xrightarrow {\,\,\,\hspace{6pt}} 1$ are monic (because ${\mathscr{C}}{\kern.8pt}$ is extensive); thus, for any $X\in {\mathscr{C}}$ , the hom-set ${\mathscr{C}}{\kern.5pt}(X,X_i)$ has at most one arrow (because $1$ is terminal).

  • If $|X_i|={\mathscr{C}}{\kern.5pt}(1,X_i)$ has one arrow, then $X_i$ is terminal (i.e., $X_i\xrightarrow {\,\,\,\hspace{6pt}} 1$ is an iso).

  • If $|X_i|={\mathscr{C}}{\kern.5pt}(1,X_i)$ is empty, then for any $Y\in {\mathscr{C}}$ the hom-set ${\mathscr{C}}{\kern.5pt}(X_i,Y)$ has at most one arrow (because $|-|$ is faithful); thus, $X_i\xrightarrow {\,\,\,\,\textrm {id}\,\,\,\,} X_i\xleftarrow {\,\,\,\,\textrm {id}\,\,\,\,} X_i$ is a coproduct, which implies $X_i$ initial (because in an extensive category coproduct injections are disjoint).

  • In conclusion, each $X_i$ is either initial or terminal.

  • It cannot be that both $X_0$ and $X_1$ are initial; otherwise, $1$ would be initial, contradicting the assumption $0\not \cong 1$ .

  • It cannot be that both $X_0$ and $X_1$ are terminal; otherwise, $1\xrightarrow {\,\,\,\hspace{6pt}}^{\textrm {id}_{}} 1\xleftarrow {\,\,\,\,\textrm {id}\,\,\,\,}^{} 1$ is a coproduct, contradicting the assumption $0\not \cong 1$ .

If $X\cong \sum _{i\in n}1$ (i.e., $X$ is the sum of $n$ copies of the terminal object), then we have the following sequence of isomorphisms natural in $Y$ (because $|-|$ is lextensive)

\begin{equation*}{\mathscr{C}}{\kern.5pt}(X,Y)\cong \prod _{i\in n}{\mathscr{C}}{\kern.5pt}(1,Y)=|Y|^n\cong \prod _{i\in n}\mathscr{S}{\kern.5pt}(1,|Y|)\cong \mathscr{S}{\kern.5pt}(\sum _{i\in n}1,|Y|)\cong \mathscr{S}{\kern.5pt}(|X|,|Y|)\end{equation*}

Lextensivity is preserved by several constructions, for example:

  • a slice category ${\mathscr{C}}/I$ of a lextensive category is lextensive (Carboni et al., Reference Carboni, Lack and Walters1993, Proposition 4.8),

  • a product $\prod _{i\in I}{\mathscr{C}}_i$ of lextensive categories is lextensive, since limits and colimits in $\prod _{i\in I}{\mathscr{C}}_i$ are computed pointwise,

  • a functor category ${\mathscr{C}}^{{\kern1.5pt}\mathscr{A}}$ is lextensive when ${\mathscr{C}}{\kern.8pt}$ is lextensive, since limits and colimits in ${\mathscr{C}}^{{\kern1.5pt}\mathscr{A}}$ are computed pointwise.

On the contrary, the property that the global section functor is lextensive may not be preserved, for example, $\mathscr{S}^{{\kern1.5pt}2}$ (or equivalently $\mathscr{S}/2$ ) does not have such property, since the sum $1+1$ in $\mathscr{S}^{{\kern1.5pt}2}$ has 4 global elements instead of 2.

4. Display maps and dominions

We recall the definitions of class of display maps from Taylor (Reference Taylor1987, Reference Taylor1999), dominion from Rosolini (Reference Rosolini1986) and Robinson and Rosolini (Reference Robinson and Rosolini1988), and properties of endo-functors and natural transformations w.r.t. a dominion (or a class of display maps) from Moggi (Reference Moggi1995). For simplicity we cast these definitions in the setting of a lex category.

Definition 4.1. A class of display maps (CDM) in a lex category ${\mathscr{C}}{\kern.8pt}$ is a class ${\mathscr{D}}$ of maps in ${\mathscr{C}}{\kern.8pt}$ closed under identities, composition, and pullbacks along arbitrary maps in ${\mathscr{C}}$ . A classifier for ${\mathscr{D}}$ is a map $p:E\xrightarrow {\,\,\,\hspace{6pt}} U$ in ${\mathscr{D}}$ , s.t. for every $d:X\to I$ in ${\mathscr{D}}$ there exists a unique $f:I\to U$ in ${\mathscr{C}}{\kern.8pt}$ with $d$ pullback of $p$ along $f$ .

When a CDM consists of monos is called a dominion , and a classifier for it is called a dominance .

The original definition of CDM in Taylor (Reference Taylor1987) does not require closure w.r.t. identities and composition, while the definition of dominion does. If a classifier $p:E\xrightarrow {\,\,\,\hspace{6pt}} U$ is a dominance, then $E$ is necessarily a terminal object; see (Moggi, Reference Moggi1995, Lemma 3.11).

Example 4.2. Examples of CDM and dominions in a lextensive category ${\mathscr{C}}{\kern.8pt}$ are:

  • the class ${\mathscr{C}}{\kern.8pt}$ of all maps (the biggest CDM in ${\mathscr{C}}{\kern.8pt}$ ),

  • the class $\mathscr{E}_s$ of all split epis,

  • the class ${\mathscr{M}}$ of all monos (the biggest dominion),

  • the class $\mathscr{M}_r$ of all regular monos,

  • the class $\mathscr{M}_2$ of all decidable monos, which has a dominance $1\xrightarrow {\,\,\,\hspace{6pt}} 2$ ,

  • the class ${\mathscr{I}}$ of all isos (the smallest dominion), which has a dominance $1\xrightarrow {\,\,\,\hspace{6pt}} 1$ .

In general, $\mathscr{M}_2\subseteq \mathscr{M}_r\subseteq \mathscr{M}$ . Moreover, $\mathscr{M}_r=\mathscr{M}$ when ${\mathscr{C}}{\kern.8pt}$ is a topos, and $\mathscr{M}_2=\mathscr{M}_r$ when all objects in ${\mathscr{C}}{\kern.8pt}$ have a decidable equality. Therefore, in ${\mathscr{S}}{\kern.8pt}$ one has $\mathscr{M}_2=\mathscr{M}_r=\mathscr{M}$ and $\mathscr{E}_s=\mathscr{E}$ (this follows from the axiom of choice).

Proposition 4.3. If $\mathscr{D}_i$ is a CDM (in a lex category ${\mathscr{C}}{\kern.8pt}$ ) for every $i\in I$ and $I\not =\emptyset$ , then

  1. (1) the intersection $\bigcap _{i\in I}\mathscr{D}_i$ is a CDM,

  2. (2) the closure under composition $(\bigcup _{i\in I}\mathscr{D}_i)^+$ of the union is a CDM.

The composition $\mathscr{D}\circ \mathscr{E}\stackrel {\Delta }{=}\{f|\exists d\in \mathscr{D}.\exists e\in \mathscr{E}.f=d\circ e\}$ of two CDM may not be a CDM, but $(\mathscr{D}\cup \mathscr{E})^+$ is the smallest CDM containing it, and $\mathscr{D}\circ \mathscr{E}=(\mathscr{D}\cup \mathscr{E})^+$ when $\mathscr{E}\circ \mathscr{D}\subseteq \mathscr{D}\circ \mathscr{E}$ .

Remark 4.4. In a lextensive category ${\mathscr{C}}$ , the composition $\mathscr{E}_s\circ \mathscr{M}_2$ is the biggest CDM ${\mathscr{C}}$ . In fact, any map $X\xrightarrow {\,\,\,{f}\hspace{6pt}} Y$ in ${\mathscr{C}}{\kern.8pt}$ is the composition , where $m$ is the injection of $X$ into $X+Y$ and $[f+\textrm {id}_{Y}]$ is a split epi (with the injection as a section).

The composition $\mathscr{M}_2\circ \mathscr{E}_s$ may fail to be a CDM, but if it does, then $(\mathscr{E}_s,\mathscr{M}_2)$ forms a stable factorization system for ${\mathscr{C}}$ . For instance, in the category of posets and monotone maps, $\mathscr{M}_2\circ \mathscr{E}_s$ is not a CDM. In fact, if $\mathscr{M}_2\circ \mathscr{E}_s$ were a CDM, then the epi-mono $2\xrightarrow {\,\,\,{e}\hspace{6pt}} \Sigma$ , where $\Sigma$ is the two-point lattice $0\lt 1$ , would be in it, since $e=e_s\circ m$ , where However, $e$ cannot be the composition $m'\circ e'_s$ of a decidable mono $m'$ and a split epi $e'_s$ , since the only decidable subobjects of $\Sigma$ are $\Sigma$ and $0$ , and all epis from $2$ to $\Sigma$ are not split.

Definition 4.5. Given a CDM ${\mathscr{D}}$ in a lex category ${\mathscr{C}}$ , we say that

  1. (1) an endo-functor $F$ (on ${\mathscr{C}}{\kern.8pt}$ ) is a ${\mathscr{D}}$ -functor $\stackrel {\Delta }{\Longleftrightarrow }$ implies,

  2. (2) a natural transformation $\sigma :F\stackrel {.}{\rightarrow } G$ is ${\mathscr{D}}$ -cartesian $\stackrel {\Delta }{\Longleftrightarrow }$ when $d\in \mathscr{D}$ ,

  3. (3) a monad $({\mathbb{M}},\eta ,\mu )$ is a ${\mathscr{D}}$ -monad $\stackrel {\Delta }{\Longleftrightarrow }$ ${\mathbb{M}}$ is a ${\mathscr{D}}$ -functor and $\eta$ and $\mu$ are ${\mathscr{D}}$ -cartesian.

A strong ${\mathscr{D}}$ -functor is a strong endo-functor s.t. the underlying endo-functor is a ${\mathscr{D}}$ -functor (similarly for a strong ${\mathscr{D}}$ -cartesian transformation and a strong ${\mathscr{D}}$ -monad).

Remark 4.6. Endo-functors coincide with ${\mathscr{I}}$ -functors (where ${\mathscr{I}}$ is the CDM of all isos), and natural transformations (between endo-functors) coincide with ${\mathscr{I}}$ -cartesian transformations. Usually, ${\mathscr{C}}{\kern.8pt}$ -functors are called cartesian endo-functors, and ${\mathscr{C}}{\kern.8pt}$ -cartesian transformations are called cartesian transformations. Manes (Reference Manes2002) introduces the notions of taut functor and taut natural transformation (between categories with pullbacks). Taut endo-functors coincide with ${\mathscr{M}}$ -functors, where ${\mathscr{M}}$ is the dominion of all monos, and taut natural transformations (between endo-functors) coincide with ${\mathscr{M}}$ -cartesian transformations. A collection monad ${\mathbb{M}}$ on ${\mathscr{S}}{\kern.8pt}$ is a taut monad, and the monad map $\tau :{\mathbb{M}}\xrightarrow {\,\,\,\hspace{6pt}}\mathbb{P}_f$ is a taut natural transformation. Every endo-functor (monad) on ${\mathscr{S}}{\kern.8pt}$ is strong in a unique way. The unique tensorial strength $\mathsf{t}$ of a taut endo-functor on ${\mathscr{S}}{\kern.8pt}$ is a natural transformation between taut functors from $\mathscr{S}^{{\kern1.5pt}2}$ to ${\mathscr{S}}$ , but in general $\mathsf{t}$ is not taut. Therefore, in the definition of strong ${\mathscr{D}}$ -functor, no additional property of $\mathsf{t}$ in relation to ${\mathscr{D}}$ is required.

Proposition 4.7. If ${\mathscr{D}}$ is a CDM in a lex category ${\mathscr{C}}$ , then

  1. (1) ${\mathscr{D}}$ -functors and ${\mathscr{D}}$ -cartesian transformations form a strict monoidal category ${\textbf{Endo}}_{\mathscr{D}}({\mathscr{C}})$ , where tensor is given by functor composition,

  2. (2) if $\sigma :F\stackrel {.}{\rightarrow } G$ is ${\mathscr{D}}$ -cartesian and $G$ is a ${\mathscr{D}}$ -functor, then $F$ is a ${\mathscr{D}}$ -functor,

  3. (3) if $\sigma :F\stackrel {.}{\rightarrow } G$ and $\tau :G\stackrel {.}{\rightarrow } H$ are natural transformations with $\tau$ and $\tau \circ \sigma$ ${\mathscr{D}}$ -cartesian, then $\sigma$ is ${\mathscr{D}}$ -cartesian,

  4. (4) if ${\mathbb{M}}$ is a ${\mathscr{D}}$ -monad and $\sigma :{\mathbb{M}}'\stackrel {.}{\rightarrow }{\mathbb{M}}$ is an ${\mathscr{D}}$ -cartesian monad map, then ${\mathbb{M}}'$ is a ${\mathscr{D}}$ -monad.

Similar properties hold for strong ${\mathscr{D}}$ -functors, strong ${\mathscr{D}}$ -cartesian transformations, and strong ${\mathscr{D}}$ -monads. In particular, we write ${\textbf{Endo}}_{s\mathscr{D}}{\kern.8pt}({\mathscr{C}})$ for the strict monoidal category of strong ${\mathscr{D}}$ -functors and strong ${\mathscr{D}}$ -cartesian transformations.

If Every endo-functor on a lex category ${\mathscr{C}}{\kern.8pt}$ with enough points has at most one tensorial strength. Therefore, one has the following inclusions ${\textbf{Endo}}_{s\mathscr{E}}{\kern1pt}({\mathscr{C}})\subseteq {\textbf{Endo}}_{\mathscr{E}}{\kern1pt}({\mathscr{C}})\subseteq {\textbf{Endo}}_{\mathscr{D}}{\kern.8pt}({\mathscr{C}})$ among strict monoidal categories, where $\mathscr{D}\subseteq \mathscr{E}$ are CDM in ${\mathscr{C}}$ .

Example 4.8. In the category ${\mathscr{S}}{\kern.8pt}$ of sets the CDM of small maps (see Example 2.4) is classified by $\sum n:\mathbb{N}.n\xrightarrow {\,\,\,{p}\hspace{6pt}} \mathbb{N}$ , where ${\mathbb{N}}$ is the set of natural numbers and a natural number $n\in \mathbb{N}$ is the set of its predecessors. If $E\xrightarrow {\,\,\,{p}\hspace{6pt}} U$ is a map in ${\mathscr{S}}{\kern.8pt}$ (more generally in a locally cartesian closed category), then one can define the polynomial endo-functor $PX\stackrel {\Delta }{=}\sum u:U.X^{E(u)}$ . If $p$ is a classifier for a CDM (closed w.r.t. identities and composition), then the endo-functor $P$ is actually a cartesian monad. In the case of small maps, $P$ is the list monad ${\mathbb{L}}$ , $\mathbb{N}\cong {\mathbb{L}}(1)$ and the maps $1\xrightarrow {\,\,\,{u}\hspace{6pt}}\mathbb{N}$ and $\sum n:\mathbb{N}.\mathbb{N}^n\xrightarrow {\,\,\,{a}\hspace{6pt}}\mathbb{N}$ , with $u(\!*\!)=1$ and $a(n,f)=\sum _{i:n}f(i)$ , correspond to $\eta _1$ and $\mu _1$ . Every map in ${\mathscr{S}}_f$ is small, while small maps in ${\mathscr{S}}_\omega$ are classified by $p$ , since $p$ is a map between countable sets.

A lextensive category ${\mathscr{C}}{\kern.8pt}$ may not have a NNO nor enough dependent types to mimic the definitions given in ${\mathscr{S}}{\kern.8pt}$ for the maps $p:\sum n:\mathbb{N}.n\xrightarrow {\,\,\,\hspace{6pt}}\mathbb{N}$ , $u:1\xrightarrow {\,\,\,\hspace{6pt}}\mathbb{N}$ , $a:\sum n:\mathbb{N}.\mathbb{N}^n\xrightarrow {\,\,\,\hspace{6pt}}\mathbb{N}$ , and the list monad ${\mathbb{L}} X\stackrel {\Delta }{=}\sum n:\mathbb{N}.X^{n}$ . However, when ${\mathscr{C}}{\kern.8pt}$ is small, one can replace ${\mathscr{C}}{\kern.8pt}$ with the Gaeta topos $G({\mathscr{C}})$ , that is, the topos of sheaves for the sub-canonical topology $J_G$ of the finite coproduct diagrams, since the Yoneda embedding from ${\mathscr{C}}{\kern.8pt}$ to the topos $G({\mathscr{C}})$ is lextensive. Therefore a map $p:E\to U$ in ${\mathscr{C}}{\kern.8pt}$ induces a polynomial functor $P$ on $G({\mathscr{C}})$ . The following result, which we state without proof, ensures that when $p$ is a classifier for a CDM ${\mathscr{D}}$ in ${\mathscr{C}}$ , then $Yp$ is a classifier for a CDM $\mathscr{D}^{{\kern1pt\prime}}$ in $G({\mathscr{C}})$ , which coincides with ${\mathscr{D}}{\kern1pt}$ when restricted to (the image of) ${\mathscr{C}}$ .

Proposition 4.9. If ${\mathscr{C}}^{{\kern1.5pt\prime}}$ is a lex category and ${\mathscr{C}}{\kern.8pt}$ is a full lex sub-category of ${\mathscr{C}}^{{\kern1.8pt\prime}}$ , then a CDM ${\mathscr{D}}$ in ${\mathscr{C}}{\kern.8pt}$ induces a CDM $\mathscr{D}^{{\kern1pt\prime}}$ in ${\mathscr{C}}^{{\kern1.5pt\prime}}$ given by $d':y'\to x'$ in $\mathscr{D}^{{\kern1pt\prime}}$ $\stackrel {\Delta }{\Longleftrightarrow }$ for every $f:x\to x'$ with $x\in {\mathscr{C}}$ the pullback $f^*(d'):y\to x$ of $d'$ along $f$ is in ${\mathscr{D}}$ .

If ${\mathscr{C}}{\kern.8pt}$ is a small lex category and ${\mathscr{C}}^{{\kern1.5pt\prime}}$ is a topos of sheaves for a sub-canonical topology on ${\mathscr{C}}$ , then the Yoneda embedding from ${\mathscr{C}}{\kern.8pt}$ to ${\mathscr{C}}^{{\kern1.5pt\prime}}$ is lex; thus, $\mathscr{D}^{{\kern1pt\prime}}$ is a CDM in ${\mathscr{C}}^{{\kern1.5pt\prime}}$ when ${\mathscr{D}}$ is a CDM in ${\mathscr{C}}$ , and moreover, $Yp$ is a classifier for $\mathscr{D}^{{\kern1pt\prime}}$ when $p$ is a classifier for ${\mathscr{D}}$ .

5. Evaluation logic in lextensive categories

In conformity with categorical semantics for fragments of predicate logic, Evaluation Logic (see Moggi (Reference Moggi1995) can be interpreted in any lex category ${\mathscr{C}}{\kern.8pt}$ after choosing a dominion ${\mathscr{M}}$ and a strong ${\mathscr{M}}$ -monad ${\mathbb{M}}$ , namely

  • A type $\tau \in T_{EL}::=1\ |\ \tau _0\times \tau _1\ |\ \ldots \ |\ {\mathbb{M}}\tau$ (and a context $\Gamma$ ) is interpreted by an object in ${\mathscr{C}}{\kern.8pt}$

  • a well-formed term $\Gamma \vdash _{} \tau :{e}$ is interpreted by an arrow in ${\mathscr{C}}{\kern.8pt}$ from (the interpretation of) $\Gamma$ to (that of) $\tau$ , where ${e}\in E_{EL}::=x\ |\ f({e}_i|i:n)\ |\ \ldots \ |\ [{e}]_{}\ |\ \textrm {let}_{}\,x{\Leftarrow }{e}_0\,\textrm {in}\,{e}_1$ and the formation rules for $[{e}]_{}$ and $\textrm {let}_{}\,x{\Leftarrow }{e}_0\,\textrm {in}\,{e}_1$ are

  • a well-formed formula $\Gamma \vdash _{} \phi :\mathsf{prop}$ is interpreted by an ${\mathscr{M}}$ -subobject of (the interpretation of) $\Gamma$ , where $\phi \in F_{EL}::= p({e}_i|i:n)\ |\ \top \ |\ \phi _1\land \phi _2\ |\ \ldots \ |\ [x{\Leftarrow }{e}]_{}\phi$ and the formation rule for necessity $[x{\Leftarrow }{e}]_{}\phi$ is

    If $1\xrightarrow {\,\,\,\hspace{6pt}}\Omega$ is a dominance for ${\mathscr{M}}$ , then $\Omega$ is like a type of truth values; thus, formulas can be viewed as terms of type $\Omega$ and interpreted as arrows from $\Gamma$ to $\Omega$ .

The valid inference rules for Evaluation Logic depend on the assumptions on the category ${\mathscr{C}}$ , the dominion ${\mathscr{M}}$ , and the strong ${\mathscr{M}}$ -monad ${\mathbb{M}}$ used for interpreting the logic. We consider four sets of inference rules (from weaker to stronger):

  1. (1) general rules, valid in any lex category ${\mathscr{C}}{\kern.8pt}$ with a dominion ${\mathscr{M}}$ and a strong ${\mathscr{M}}$ -monad ${\mathbb{M}}$

  2. (2) rules valid when ${\mathscr{M}}$ includes regular monos; thus, one can interpret equality as ${e}_0={e}_1$

  3. (3) rules valid when ${\mathscr{C}}{\kern.8pt}$ is lextensive and ${\mathscr{M}}$ is the dominion of decidable monos, and they coincide with regular monos

  4. (4) additional rules valid for the powerset monad on ${\mathscr{S}}{\kern.8pt}$ and its sub-monads.

The third set of rules is particularly relevant, because it is possible to define a decidable evaluation predicate that can be interpreted as membership $c\ni x$ , that is, “element $x$ belongs to collection $c$ ,” and a limited form of existential quantification $\langle x{\Leftarrow }{e} \rangle _{}\phi$ , defined as $\neg [x{\Leftarrow }{e}]_{}\neg \phi$ . Moreover, in combination with the fourth set of rules, it allows establishing a link with Algebraic Set Theory (Joyal and Moerdijk, Reference Joyal and Moerdijk1995; Simpson, Reference Simpson1999; Awodey et al., Reference Awodey, Butz, Simpson and Streicher2014).

5.1 General rules

The following logical equivalences ( $\Gamma \vdash _{} \phi _1 \Longleftrightarrow \phi _2$ ) and inference rules (for deriving sequents $\Gamma \vdash _{} \Phi \Longrightarrow \phi$ ) involving necessity are sound w.r.t. any interpretation of Evaluation Logic.

5.2 Rules for equality

If the dominion ${\mathscr{M}}$ includes all regular monos, then the equality predicate ${e}_0={e}_1$ can be added to the set $F_{EL}$ of formulas, and the following inference rule involving necessity and equality is sound.

5.3 Rules for lextensive categories

If ${\mathscr{C}}{\kern.8pt}$ is lextensive and every object in ${\mathscr{C}}{\kern.8pt}$ has a decidable equality, then we may take for ${\mathscr{M}}$ the dominion $\mathscr{M}_2$ of decidable monos, which is classified by the dominance $1\xrightarrow {\,\,\,\hspace{6pt}} 2$ ) and coincides with the dominion of regular monos. In this case, one can extend the set $T_{EL}$ of types with empty $0$ and sum $\tau _0+\tau _1$ types (extend the set $E_{EL}$ of terms accordingly) and add negation $\neg \phi$ to the set $F_{EL}$ of formulas, since $2$ supports classical boolean logic. Therefore, one can define

  • disjunction $\phi _1\vee \phi _2\stackrel {\Delta }{\Longleftrightarrow }\neg (\neg \phi _1\wedge \neg \phi _2)$ ,

  • implication $\phi _1\supset \phi _2\stackrel {\Delta }{\Longleftrightarrow }\neg \phi _1\vee \phi _2$ ,

  • possibility $\langle x{\Leftarrow }{e} \rangle _{}\phi \stackrel {\Delta }{\Longleftrightarrow }\neg [x{\Leftarrow }{e}]_{}\neg \phi$ , and

  • the evaluation predicate $c:{\mathbb{M}}\tau ,x:\tau \vdash _{} c\mbox{$\Downarrow _{}$}x\stackrel {\Delta }{\Longleftrightarrow }\langle x'{\Leftarrow }c \rangle _{}x'=x$ .

Moreover, the following inference rules (entailments $\phi _1\implies \phi _2$ ) and equivalences are derivableFootnote 3

  1. (2) if $x\notin \textrm {FV}(\phi )$ , then ${\langle x{\Leftarrow }{e} \rangle _{}\phi }\implies \phi$ and $\phi \implies {[x{\Leftarrow }{e}]_{}\phi }$

  2. (3) $\bot \Longleftrightarrow \langle x{\Leftarrow }{e} \rangle _{}\bot$ and ${\langle x{\Leftarrow }{e} \rangle _{}(\phi _1\vee \phi _2)}\Longleftrightarrow {(\langle x{\Leftarrow }{e} \rangle _{}\phi _1)\vee (\langle x{\Leftarrow }{e} \rangle _{}\phi _2)}$

  3. (4) if $x_1\notin \textrm {FV}(\phi )$ , then ${\langle x_1{\Leftarrow }{e}_1 \rangle _{}\langle x_2{\Leftarrow }{e}_2 \rangle _{}\phi }\Longleftrightarrow {\langle x_2{\Leftarrow }(\textrm {let}_{}\,x_1{\Leftarrow }{e}_1\,\textrm {in}\,{e}_2) \rangle _{}\phi }$

  4. (5) ${[x{\Leftarrow }{e}]_{}\phi }\Longleftrightarrow {(\textrm {let}_{}\,x{\Leftarrow }{e}\,\textrm {in}\,[\phi ]_{})=(\textrm {let}_{}\,x{\Leftarrow }{e}\,\textrm {in}\,[\top ]_{})}$ and ${\langle x{\Leftarrow }{e} \rangle _{}\phi }\Longleftrightarrow {(\textrm {let}_{}\,x{\Leftarrow }{e}\,\textrm {in}\,[\neg \phi ]_{})\neq (\textrm {let}_{}\,x{\Leftarrow }{e}\,\textrm {in}\,[\top ]_{})}$

  5. (6) if $x\notin \textrm {FV}(\phi _1)$ , then ${\phi _1\supset [x{\Leftarrow }{e}]_{}\phi _2}\Longleftrightarrow {[x{\Leftarrow }{e}]_{}(\phi _1\supset \phi _2)}$ and ${\phi _1\wedge \langle x{\Leftarrow }{e} \rangle _{}\phi _2}\Longleftrightarrow {\langle x{\Leftarrow }{e} \rangle _{}(\phi _1\wedge \phi _2)}$

  6. (7) if $x\notin \textrm {FV}({e}_0)$ , then ${(\textrm {let}_{}\,x{\Leftarrow }{e}_1\,\textrm {in}\,{e}_2)\mbox{$\Downarrow _{}$}{e}_0}\Longleftrightarrow {\langle x{\Leftarrow }{e}_1 \rangle _{}{e}_2\mbox{$\Downarrow _{}$}{e}_0}$ and ${[{e}_1]_{}\mbox{$\Downarrow _{}$}{e}_0}\Longleftrightarrow {e}_1={e}_0$ .

5.4 Rules for the powerset monad on ${\mathscr{S}}{\kern.8pt}$

The evaluation predicate $c\mbox{$\Downarrow _{}$}x$ is similar to set membership $c\ni x$ , necessity $[x{\Leftarrow }c]_{}\phi$ , and possibility $\langle x{\Leftarrow }c \rangle _{}\phi$ are similar to universal and existential quantification over elements belonging to the collection $c$ . In the case of the powerset monad ${\mathbb{P}}$ on ${\mathscr{S}}{\kern.8pt}$ (more generally, on an elementary topos with $2$ as subobject classifier) and its taut sub-monads, such as the finite powerset monad $\mathbb{P}_f$ , we have an exact correspondence, for example, for every $c\in \mathbb{P}_f X$ and $x\in X$ , one has $c\mbox{$\Downarrow _{}$}x\Longleftrightarrow c\ni x$ . These taut monads have additional properties; namely, the following inference bi-rules are sound

  1. (8)

  2. (9)

  3. (10) (extensionality)

There are other collection monads on ${\mathscr{S}}{\kern.8pt}$ satisfying ( $\Box$ - $\Downarrow$ ) and ( $\Diamond$ - $\Downarrow$ ) rules, but not (extensionality). If a strong $\mathscr{M}_2$ -monad ${\mathbb{M}}$ on a lextensive category ${\mathscr{C}}{\kern.8pt}$ satisfies also these additional rules, then one can derive weak variants of the axioms for categories of classes (e.g., see Simpson (Reference Simpson1999)). We show how to recover the notion of smallness and some expected properties (below we write $c\ni x$ instead of $c\mbox{$\Downarrow _{}$}x$ ).

  • A relation $r(x,y)$ on $X\times Y$ is small $\stackrel {\Delta }{\Longleftrightarrow }$ there exists a map $f:X\xrightarrow {\,\,\,\hspace{6pt}}{\mathbb{M}} Y$ s.t. $r(x,y)\Longleftrightarrow f(x)\ni y$ ; moreover, $f$ is unique because of (extensionality).

  • A small relation $r$ is always decidable because is the pullback of the decidable mono along $f\times \textrm {id}_{Y}$ .

  • The graph $r(x,y)\stackrel {\Delta }{\Longleftrightarrow } f(x)=y$ of a map $f:X\xrightarrow {\,\,\,\hspace{6pt}} Y$ is always a small relation, because $f(x)=y\Longleftrightarrow [f(x)]_{}\ni y$ .

  • A map $s:Y\xrightarrow {\,\,\,\hspace{6pt}} X$ is small $\stackrel {\Delta }{\Longleftrightarrow }$ the relation $x=s(y)$ on $X\times Y$ is small. Small monos are defined similarly.

If a lextensive category ${\mathscr{C}}{\kern.8pt}$ is not regular, then one cannot define the category $Rel({\mathscr{C}})$ of (binary) relations in ${\mathscr{C}}$ . However, composition of small relations is defined using the birule ( $\Diamond$ - $\Downarrow$ ), and the category $Rel_s({\mathscr{C}})$ of small relations in ${\mathscr{C}}{\kern.8pt}$ is isomorphic to the Kleisli category ${\mathscr{C}}_{\mathbb{M}}$ . Composability of small relations implies that small maps (and small monos) compose and that small monos are decidable. In fact, if it is a small mono, then the relation and its opposite are small, and their composition is given by the small relation . Since small relations are decidable and the pullback of $\langle m,m \rangle$ along is $m$ , then also $m$ is decidable.

Remark 5.1. Another desirable property of ${\mathbb{M}}$ is that each object ${\mathbb{M}}(X)$ is the carrier of a commutative and idempotent monoid. More precisely, the Kleisli category ${\mathscr{C}}_{\mathbb{M}}$ should embed (via a faithful functor) into the category of commutative and idempotent monoids in ${\mathscr{C}}$ . For this it suffices to have global elements $none:{\mathbb{M}}(0)$ and $two:{\mathbb{M}}(2)$ s.t. $two\ni 0$ and $two\ni 1$ . Because of extensionality, these elements are uniquely determined. In fact, ${\mathbb{M}}(0)$ has at most one global element, and $two$ is unique, since its properties imply $b:2 \vdash _{} two\ni b$ . Moreover, having $none:{\mathbb{M}}(0)$ implies that ${\mathbb{M}}(1)$ is isomorphic to $2$ (by extensionality); thus, the small monos are exactly the decidable monos.

6. Assemblies & co.

We introduce the category of assemblies $\mathsf{A}[C]$ for a sub-monoid $C$ of the monoid of partial maps on a set $D$ , and several full sub-categories of $\mathsf{A}[C]$ . The aim is to provide realizability-like models for low-complexity domain-specific languages (DSL), where $D$ is the set of data manipulated by programs in the DSL, and $C$ are the maps computed by such programs. The general idea, following Scott (Reference Scott1980), is to replace application with composition in order to achieve greater flexibility over realizability models based on partial Combinatory Algebras (pCA), such as the Effective topos in Hyland (Reference Hyland1982). Our definition of $\mathsf{A}[C]$ is an instance of a construction in Longley (Reference Longley2014) based on computability structures.

Definition 6.1 (Assemblies). The category $\mathsf{A}[C]$ of $C$ -assemblies is defined as follows:

  • an object $X$ is a pair $(|X|,\vdash _X)$ with $|X|$ set and $\vdash _X\subseteq D\times |X|$ surjective relation, that is, $\forall x\in |X|.\exists d\in D.d\vdash _Xx$ ; any $d\in D$ such that $d\vdash _Xx$ is called an encoding of $x$ .

  • an arrow $f:X\xrightarrow {\,\,\,\hspace{6pt}} Y$ is a map $f:|X|\xrightarrow {\,\,\,\hspace{6pt}}|Y|$ s.t. $\exists f'\in C.\forall d\in D.\forall x\in |X|.d\vdash _Xx\implies f'(d)\vdash _Yf(x)$ ; the map $f'\in C$ is called a realizer of $f$ , written $f'\vdash f$ for conciseness.

The faithful forgetful functor $\Gamma$ from $\mathsf{A}[C]$ to ${\mathscr{S}}{\kern.8pt}$ maps $X$ to $|X|$ .

Remark 6.2. If $C$ is a sub-monoid of , then one can define a computability structure $\textsf {C}$ with one datatype $D$ and the set of relations $\textsf {C}(D,D)$ consisting of the graphs of maps in $C$ . In this way the category of $C$ -assemblies coincides with the category of assemblies for the computability structure $\textsf {C}$ , see Longley (Reference Longley2014). If $(D,\cdot )$ is a partial Combinatory Algebra (pCA), let $C$ be the set of representable partial maps on $D$ (i.e., those $f$ such that $f(d)\simeq e\cdot d$ for some $e\in D$ ), then $C$ is a sub-monoid of , and the category of $C$ -assemblies coincides with the category of assemblies for the pCA $(D,\cdot )$ . More generally, if $(D,\cdot )$ is a partial applicative structure with combinators for identity and composition, then the set of representable partial maps forms a sub-monoid of .

If $D$ is trivial, that is, it has at most one element, then $C$ is irrelevant. More precisely:

  • if $D$ is the empty set, then $\mathsf{A}[C]$ is the discrete category with one object (the empty set);

  • if $D$ is a singleton, then $\mathsf{A}[C]$ is (isomorphic to) the category ${\mathscr{S}}{\kern.8pt}$ of sets.

We now give several examples of $D$ and $C$ that do not arise from a pCA.

Example 6.3. Examples of $C$ on the set ${\mathbb{N}}$ of natural numbers are:

  1. (1) the set $\mathsf{TR}$ of total recursive maps,

  2. (2) the set $\mathsf{PR}$ of primitive recursive maps,

  3. (3) the set $\mathsf{E}_{n}$ of primitive recursive maps in the $n$ -th level of the Grzegorczyk hierarchy.

The following inclusions hold $\mathsf{E}_{n}\subset \mathsf{E}_{n+1}\subset \bigcup _n\mathsf{E}_{n}={\mathsf{PR}}\subset \mathsf{TR}$ , and the set $\mathsf{E}_{3}$ coincides with the set of Kalmar elementary recursive maps, which has an alternative definition that does not involve bounded recursion.

Examples of $C$ on the set $B^*$ of bit-strings (i.e., strings over the binary alphabet $B$ ) are:

  1. (4) the set $\mathsf{PT}$ of total maps computable in poly-time by a multi-tape Turing machine (TM), Footnote 4

  2. (5) the set $\mathsf{LT}$ of total maps computable in linear time (i.e., $O(n)$ -time) by a TM,

  3. (6) the set $\mathsf{PS}$ of total maps computable in poly-space by a TM,

  4. (7) the set $\mathsf{LS}$ of total maps computable in linear space by a TM.

To ensure that $\mathsf{PS}$ and $\mathsf{LS}$ form a monoid, space complexity must account also for the use of cells on the output tape (in addition to those on the working tapes). In fact, the size of the output string can be exponential in the number of cells used on the working tapes. The following inclusions hold ${\mathsf{LT}}\subset \mathsf{PT}\subseteq {\mathsf{PS}}$ and ${\mathsf{LT}}\subseteq \mathsf{LS}\subset {\mathsf{PS}}$ .

  1. (8) If $D$ is an effectively given continuous lattice $D$ , then the set $[D\to D]_c$ of computable maps on $D$ is a sub-monoid of the set $[D\to D]$ of Scott continuous maps on $D$ .

  2. (9) If $S=L\to V$ is a set of states (with $L$ infinite and $V$ non-trivial), then the set $[S\to S]_f$ of state transformers doing finitely many reads and writes is a sub-monoid of the set $S\to S$ of all state transformers, where $t\in [S\to S]_f\stackrel {\Delta }{\Longleftrightarrow }\forall s\in S.\exists L_r,L_w\subseteq _{f} L$ s.t. $\forall s'\in S.s=s'$ on $L_r\implies t(s')=\lambda l.t(s)[l]$ if $l\in L_w$ else $s'[l]$ .

We define two full sub-categories of $\mathsf{A}[C]$ : the category $\mathsf{M}[C]$ of modest sets and the category $\mathsf{P}[C]$ of predicates.

Definition 6.4 (Special assemblies). Given an assembly $X\in \mathsf{A}[C]$ we say that

  1. (1) $X$ is a modest set ( $X\in \mathsf{M}[C]$ ) $\stackrel {\Delta }{\Longleftrightarrow }$ $\vdash _X$ is the graph of a surjective partial map from $D$ to $|X|$ .

  2. (2) $X$ is a predicate ( $X\in \mathsf{P}[C]$ ) $\stackrel {\Delta }{\Longleftrightarrow }$ $|X|\subseteq D$ and $\vdash _X$ is the identity relation $\Delta _{|X|}$ on $|X|$ .

We write $\hat {D}$ for the predicate $(D,\Delta _D)$ .

Remark 6.5. The full sub-category $\mathsf{M}[C]$ is replete (i.e., an assembly isomorphic in $\mathsf{A}[C]$ to a modest set is a modest set) and essentially small, because it is equivalent to the category of Partial Equivalence Relations (PER) on $D$ . The full sub-category $\mathsf{P}[C]$ is small, but not replete (unless $D$ is empty). However, one can modify the definition to make it replete, namely a modest set $X$ is isomorphic to a predicate $\Longleftrightarrow \exists e\in C.\forall d\in D.\forall x\in |X|.d\vdash _Xx\implies e^2(d)=e(d)\vdash _Xx$ , in other words $e$ maps every encoding $d$ of $x$ to its canonical encoding $e(d)$ .

Without further assumptions on $C$ , $\mathsf{A}[C]$ and its sub-categories have limited properties.

Theorem 6.6. If $D$ is not empty, then

  1. (1) The forgetful functor $\Gamma :\mathsf{A}[C]\xrightarrow {\,\,\,\hspace{6pt}}\mathscr{S}$ has a right adjoint $\nabla \vdash \Gamma$ , which maps a set $X$ to the assembly $(X,D\times X)$ .

  2. (2) The functor $\nabla$ is full and faithful; thus, ${\mathscr{S}}{\kern.8pt}$ is (isomorphic to) a full reflective sub-category of $\mathsf{A}[C]$ .

  3. (3) The inclusion functor has a left adjoint $r$ , thus $\mathsf{M}[C]$ is a full reflective sub-category of $\mathsf{A}[C]$ .

  4. (4) $\mathsf{A}[C]$ has initial and terminal objects, namely $\nabla 0\in \mathsf{P}[C]$ and $\nabla 1\in \mathsf{M}[C]$ , and $\Gamma$ preserves them.

  5. (5) A map $e$ is epi in $\mathsf{A}[C]$ $\Longleftrightarrow$ $\Gamma e$ is epi in ${\mathscr{S}}$ .

  6. (6) $\Gamma$ lifts equalizers and co-equalizers, that is, $\mathsf{A}[C]$ has equalizers and co-equalizers, and $\Gamma$ preserves them.

  7. (7) If in $\mathsf{A}[C]$ with $m$ equalizer of $(f,g)$ and $e$ co-equalizer of $(f,g)$ , then

    • $X\in \mathsf{M}[C]\implies M\in \mathsf{M}[C]$ and $Y\in \mathsf{M}[C]\implies E\in \mathsf{M}[C]$ ,

    • $X\in \mathsf{P}[C]\implies M\in \mathsf{P}[C]$ (up to iso).

  8. (8) $m:X\xrightarrow {\,\,\,\hspace{6pt}} Y$ is a regular mono in $\mathsf{A}[C]$ $\Longleftrightarrow$ $m$ is the pullback of along a (unique) map $f:Y\xrightarrow {\,\,\,\hspace{6pt}}\nabla 2$ .

  9. (9) In $\mathsf{A}[C]$ there are two proper factorization systems:

    • the system $(\mathscr{E},\mathscr{M}_r)$ of epis and regular monos (thus all strong monos are regular),

    • the system $(\mathscr{E}_r,\mathscr{M})$ of regular epis and monos (thus all strong epis are regular).

Proof. We give proof hints only for some of the claims.

  • The left adjoint $r$ to the inclusion maps an assembly $X$ to the modest set $(|X|/\sim ^+,\vdash )$ , where

    1. $\sim _X^+$ is the transitive closure of $x_1\sim _X x_2\stackrel {\Delta }{\Longleftrightarrow }\exists d.d\vdash _Xx_1\land d\vdash _Xx_2$ (the relation $\sim _X^+$ is an equivalence, since $\sim _X$ is reflexive and symmetric on $|X|$ ),

    2. $d\vdash [x]\stackrel {\Delta }{\Longleftrightarrow }\exists x'.x\sim _X^+x'\land d\vdash _X x'$ .

  • The characterization of epis in $\mathsf{A}[C]$ follows from $\Gamma$ faithful and $\mathsf{A}[C](Y,\nabla 2)=\mathscr{S}{\kern.5pt}(\Gamma Y,2)$ .

  • Given $f,g:X\xrightarrow {\,\,\,\hspace{6pt}} Y$ in $\mathsf{A}[C]$ , the equalizer and co-equalizer of $(f,g)$ are given by

    1. is the equalizer of $(\Gamma f,\Gamma g)$ in ${\mathscr{S}}{\kern.8pt}$ and $d\vdash _M z\stackrel {\Delta }{\Longleftrightarrow } d\vdash _X m(z)$ , thus $\textrm {id}_{D}\vdash m$ ,

    2. is the co-equalizer of $(\Gamma f,\Gamma g)$ in ${\mathscr{S}}{\kern.8pt}$ and $d\vdash _E z\stackrel {\Delta }{\Longleftrightarrow } \exists y.d\vdash _Y y\land $ $e(y)=z$ , thus $\textrm {id}_{D}\vdash e$ .

  • For $f:\mathsf{A}[C](X,Y)$ with $f'\vdash f$ , the epi-regular mono factorization $X\xrightarrow {\,\,\,{e}\hspace{6pt}}Z\xrightarrow {\,\,\,{m}\hspace{6pt}}Y$ of $f$ is given by the epi-mono factorization $|X|\xrightarrow {\,\,\,{e}\hspace{6pt}}|Z|\xrightarrow {\,\,\,{m}\hspace{6pt}}|Y|$ of $\Gamma f$ and $d\vdash _Z z\stackrel {\Delta }{\Longleftrightarrow } d\vdash _Y m(z)$ , thus $f'\vdash e$ and $\textrm {id}_{D}\vdash m$ . The regular epi-mono factorization $X\xrightarrow {\,\,\,{e}\hspace{6pt}}Z\xrightarrow {\,\,\,{m}\hspace{6pt}}Y$ of $f$ is given by the epi-mono factorization $|X|\xrightarrow {\,\,\,{e}\hspace{6pt}}|Z|\xrightarrow {\,\,\,{m}\hspace{6pt}}|Y|$ of $\Gamma f$ and $d\vdash _Z z\stackrel {\Delta }{\Longleftrightarrow }\exists x. d\vdash _X x\land e(x)=z$ , thus $\textrm {id}_{D}\vdash e$ and $f'\vdash m$ .

The other claims are easy to prove.

7. Special monoids

In this section we consider additional properties of a sub-monoid $C\subseteq D\to D$ , which imply that $\mathsf{P}[C]$ is lextensive, has enough points, and all its objects have decidable equality.

Definition 7.1. Given a sub-monoid $C\subseteq D\to D$ , we introduce the following properties:

  • (K) $D$ has at least two elements (say $b_0$ and $b_1$ ) and $\lambda x:D.d\in C$ for every $d\in D$ ,

  • (P) there is a map $p:D^2\to D$ and two maps $p_0,p_1\in C$ s.t.

    • $p_i(p(x_0,x_1))=x_i$ for every $x_0,x_1\in D$ ,

    • $\lambda x:D.p(f_0x,f_1x)\in C$ for every $f_0,f_1\in C$ .

  • (E) there is a map $t\in C$ s.t. $t(p(p(x_0,x_1),p(x_2,x_3)))= (x_2 \mbox{ if $x_0=x_1$ else } x_3)$ .

Remark 7.2. Property (P) is needed to express property (E). Property (K) rules out trivial cases (i.e., $D$ with at most one element) when properties (P) and (E) hold trivially. Property (K) and (P) implies that the set $D$ is infinite. All $C$ in Example 6.3 satisfy properties (K,P,E) except the last two. Property (P) allows to define for every $n\geq 1$

  • encodings $p^n:D^n\to D$ , where $p^1(x_0)\stackrel {\Delta }{=} x_0$ and $p^{n+1}(x_0,x_1,\ldots x_n)\stackrel {\Delta }{=} p^n(p(x_0,x_1),\ldots x_n)$ ,

  • projections $p^n_i\in C$ for $0\leq i\lt n$ , where $p^1_0(x)\stackrel {\Delta }{=} x$ , $p^{n+1}_n(x)=p_1(x)$ and $p^{n+1}_i(x)=p^n_i(p_0(x))$ ,

  • sets $C_n\stackrel {\Delta }{=}\{\,f\circ p^n|f\in C\}\subseteq D^n\to D$ .

The set $C_n$ do not depend on the choices in property (P); they are closed under composition, that is, if $f\in C_n$ and $g_i\in C_m$ for $i\in n$ , then $f\circ \langle g_i|i\in n \rangle \in C_m$ , and allow to recast property (E) as $(\lambda x_0,x_1,x_2,x_3.x_2 \mbox{ if $x_0=x_1$ else } x_3)\in C_4$ .

Theorem 7.3. Given a sub-monoid $C\subseteq D\to D$ satisfying (K,P,E) the following assertions hold:

  1. (1) $\nabla 1\in \mathsf{P}[C]$ (up to iso) and the global section functor $\mathsf{A}[C](\nabla 1,-)$ is isomorphic to $\Gamma$ ; thus, $\Gamma$ preserves limits.

  2. (2) $\Gamma$ lifts finite limits, that is, $\mathsf{A}[C]$ ( $\mathsf{M}[C]$ and $\mathsf{P}[C]$ ) has finite limits and $\Gamma$ preserves them.

  3. (3) Given a map $e$ in $\mathsf{M}[C]$ (or $\mathsf{P}[C]$ ), $e$ is epi in $\mathsf{M}[C]$ (or $\mathsf{P}[C]$ ) $\Longleftrightarrow$ $\Gamma e$ is epi in ${\mathscr{S}}$ .

  4. (4) In $\mathsf{A}[C]$ epis and regular epis are stable under pullbacks; thus, $\mathsf{A}[C]$ (and $\mathsf{M}[C]$ ) is regular and $\Gamma$ is exact.

  5. (5) $\mathsf{A}[C]$ ( $\mathsf{M}[C]$ and $\mathsf{P}[C]$ ) is lextensive, $\Gamma$ preserves finite sums, and every $X\in \mathsf{P}[C]$ has a decidable equality.

Proof.

  1. (1) (K) implies that $\{b_0\}\in \mathsf{P}[C]$ (indeed any $\{d\}$ with $d\in D$ ) is isomorphic to the terminal object $\nabla 1\in \mathsf{A}[C]$ . The isomorphism from $\Gamma X$ to $\mathsf{A}[C](\nabla 1,X)$ maps $x\in |X|=\Gamma X$ to the constant map $(\lambda \_.x):1\xrightarrow {\,\,\,\hspace{6pt}} |X|$ , which is in $\mathsf{A}[C](\nabla 1,X)$ because for any $d\vdash _X x$ by (K) we have that $\lambda \_.d\in C$ realizes $\lambda \_.x$ . For any category ${\mathscr{C}}{\kern.8pt}$ with a terminal object, the global section functor preserves all limits that exist in ${\mathscr{C}}$ .

  2. (2) By Theorem 6.6, $\mathsf{A}[C]$ , $\mathsf{M}[C]$ , and $\mathsf{P}[C]$ have equalizers, and $\Gamma$ preserves them. We prove such a property also for terminal objects and binary products, using only properties (K,P).

    Because of (K), if $\Gamma X$ is a singleton (i.e., a terminal object in ${\mathscr{S}}{\kern.8pt}$ ), then $X$ is a terminal object. Because of (P), a binary product $X_0\times X_1$ in $\mathsf{A}[C]$ is $X$ , where $|X|\stackrel {\Delta }{=}|X_0|\times |X_1|$ and $\vdash _X\stackrel {\Delta }{=}\{(p(d_0,d_1),(x_0,x_1))|\forall i\in 2.d_i\vdash _{X_i} x_i\}$ . The projection $X\xrightarrow {\,\,\,\hspace{6pt}} X_i$ is realized by $p_i\in C$ , and for any pair of maps $f_i:Y\xrightarrow {\,\,\,\hspace{6pt}} X_i$ realized by $f'_i\in C$ , the map $\langle f_0,f_1 \rangle :Y\xrightarrow {\,\,\,\hspace{6pt}} X$ is realized by $\lambda d. p(f'_0(d),f'_1(d))$ . Moreover, $X_0,X_1\in \mathsf{M}[C]\implies X_0\times X_1\in \mathsf{M}[C]$ , and the same holds for $\mathsf{P}[C]$ (up to iso), because $p:D^2\to D$ is injective.

  3. (3) $\Gamma e$ epi $\implies$ $e$ epi, whenever $\Gamma$ is a faithful functor. For the converse, given a map $e:X\xrightarrow {\,\,\,\hspace{6pt}} Y$ (in $\mathsf{M}[C]$ or $\mathsf{P}[C]$ ), if $\Gamma e$ is not epi in ${\mathscr{S}}$ , that is, $y_0\not \in e(|X|)$ for some $y_0\in |Y|$ , then $e$ is not epi, that is, there are two different maps $f,g:Y\xrightarrow {\,\,\,\hspace{6pt}} Z$ s.t. $f\circ e=g\circ e$ .

    When $Y\in \mathsf{P}[C]$ , using (K,P,E), one can take $Z=\{b_0,b_1\}$ , $f(y)=b_1$ , and $g(y)=b_0$ if $y=y_0$ else $b_1$ , which are realized by $\lambda d.b_1$ and $(\lambda d.b_0$ if $d=y_0$ else $b_1)$ , respectively. When $Y\in \mathsf{M}[C]$ , there are two cases: either $|Y|$ is a singleton (thus $Y$ is isomorphic to an object in $\mathsf{P}[C]$ ) or $|Y|$ has another element $y_1\neq y_0$ . In the second case, using (K), one can take $|Z|=\{b_0,b_1\}$ , $d\vdash _Z b_0\Longleftrightarrow d\vdash _Y y_0$ and $d\vdash _Z b_1\Longleftrightarrow d\not \vdash _Y y_0$ , $f(y)=b_1$ and $g(y)=b_0$ if $y=y_0$ else $b_1$ , which are realized by $\lambda d.d_1$ with $d_1\vdash _Y y_1$ and $\textrm {id}_{D}$ , respectively.

  4. (4) $\Gamma$ maps pullbacks in $\mathsf{A}[C]$ ( $\mathsf{M}[C]$ or $\mathsf{P}[C]$ ) to pullbacks in ${\mathscr{S}}$ , thus

    • $e$ epi in $\mathsf{A}[C]$ ( $\mathsf{M}[C]$ or $\mathsf{P}[C]$ ) $\implies$ by the characterization of epis in $\mathsf{A}[C]$ ( $\mathsf{M}[C]$ and $\mathsf{P}[C]$ ),

    • $\Gamma e$ epi in ${\mathscr{S}}{\kern.8pt}$ $\implies$ because epis in ${\mathscr{S}}{\kern.8pt}$ are stable under pullback,

    • $\Gamma h$ epi in ${\mathscr{S}}{\kern.8pt}$ $\implies$ by the characterization of epis in $\mathsf{A}[C]$ ( $\mathsf{M}[C]$ and $\mathsf{P}[C]$ ),

    • $h$ epi in $\mathsf{A}[C]$ ( $\mathsf{M}[C]$ or $\mathsf{P}[C]$ ).

    Theorem 6.6 characterizes co-equalizers in $\mathsf{A}[C]$ (and $\mathsf{M}[C]$ ). To prove that they are stable under pullbacks, we use (K,P). If $e:U\xrightarrow {\,\,\,\hspace{6pt}} X$ in the pullback above is a co-equalizer (i.e., $d\vdash _X x\stackrel {\Delta }{\Longleftrightarrow } \exists u.d\vdash _U u\land e(u)=x$ ), then $|V|=\{(u,y)|e(u)=f(y)\}$ , $d\vdash _V(u,y)\Longleftrightarrow \exists a,b.d=p(a,b)\land a\vdash _Uu\land b\vdash _Y y$ , and $h$ mapping $(u,y)$ to $y$ is realized by $p_1$ . To prove that $h$ is a co-equalizers, we prove that $Y$ is isomorphic to $Z$ , where $|Z|=|Y|$ and $d\vdash _Zy\Longleftrightarrow \exists u,a,b.p(a,b)\vdash _V(u,y)\land d=p(a,b)$ , and the isomorphism is $\textrm {id}_{|Y|}$ . More precisely, $\textrm {id}_{|Y|}:Z\xrightarrow {\,\,\,\hspace{6pt}} Y$ is realized by $p_1$ and $\textrm {id}_{|Y|}:Y\xrightarrow {\,\,\,\hspace{6pt}} Z$ is realized by $\lambda b.p(f'(b),b)$ , where $f'\vdash f$ .

  5. (5) The object $\nabla 0\in \mathsf{P}[C]$ is initial (for any $C$ ). To define binary sums we use (K,P,E). The sum $X_0+X_1$ in $\mathsf{A}[C]$ is the $X$ s.t. $|X|\stackrel {\Delta }{=}|X_0|+|X_1|$ and $\vdash _X\stackrel {\Delta }{=}\{(p(b_i,d),(i,x))| i\in 2\land d\vdash _{X_i} x\}$ . The injection $X_i\xrightarrow {\,\,\,\hspace{6pt}} X$ is realized by $\lambda d.p(b_i,d)$ , which is in $C$ by (K,P), and for any pair of arrows $f_i:X_i\xrightarrow {\,\,\,\hspace{6pt}} Y$ realized by $f'_i\in C$ , the map $[f_0,f_1]:X\xrightarrow {\,\,\,\hspace{6pt}} Y$ is realized by $\lambda d. t(b_0,p_0(d),f'_0(p_1(d)),f'_1(p_1(d)))$ . It is obvious that $\Gamma$ preserves finite sums. We skip the rest of the proof of extensivity for $\mathsf{A}[C]$ . Since $b_0\neq b_1$ and the map $p$ is injective, $X_0,X_1\in \mathsf{M}[C]\implies X_0+X_1\in \mathsf{M}[C]$ , and the same holds for $\mathsf{P}[C]$ (up to iso). Finally, if $X\in \mathsf{P}[C]$ , then $X\times X=\{p(d_0,d_1)|d_0.d_i\in X\}$ and $2=\{b_0,b_1\}$ , thus the equality map $X\times X\xrightarrow {\,\,\,\hspace{6pt}} 2$ is realized by $\lambda d.t(p_0(d),p_1(d),b_1,b_0)\in C$ .

Corollary 7.4. If $C$ satisfies properties (K,P,E), then the factorization systems

  • $(\mathscr{E},\mathscr{M}_r)$ of epis and regular monos in $\mathsf{A}[C]$ ,

  • $(\mathscr{E}_r,\mathscr{M})$ of regular epis and monos in $\mathsf{A}[C]$ ,

are stable, and they restrict to stable factorization systems in $\mathsf{M}[C]$ , namely

  • the system of epis and strong monos in $\mathsf{M}[C]$ ,

  • the system of regular epis and monos in $\mathsf{M}[C]$ .

Moreover, the first factorization system restricts to a stable factorization system in $\mathsf{P}[C]$ , namely

  • the system of epis and strong monos in $\mathsf{P}[C]$ .

Remark 7.5. In a lextensive category ${\mathscr{C}}{\kern.8pt}$ one can define the full replete sub-category ${\mathscr{C}}_d$ of objects with a decidable equality. Also ${\mathscr{C}}_d$ is lextensive, since it is closed w.r.t. finite limits and finite sums computed in ${\mathscr{C}}$ . If the sub-monoid $C\subseteq D\to D$ satisfies (K,P,E), then $\mathsf{A}[C]$ is lextensive and $\mathsf{P}[C]_d=\mathsf{P}[C]\subseteq \mathsf{M}[C]_d=\mathsf{A}[C]_d$ . Moreover, $\mathsf{P}[C]$ and $\mathsf{M}[C]$ are equivalent when $C=D\to D$ .

If $X$ is an object of a lextensive category ${\mathscr{C}}{\kern.8pt}$ with a decidable equality $eq:X\times X\xrightarrow {\,\,\,\hspace{6pt}} 2$ and the objects $1$ , $X\times X$ , and $X+X$ are retracts of $X$ , then one can define the category ${\mathscr{C}}[X]$ of decidable predicates on $X$ , whose objects are arrows $p:X\xrightarrow {\,\,\,\hspace{6pt}} 2$ in ${\mathscr{C}}{\kern.8pt}$ and an arrow from $p$ to $p'$ in ${\mathscr{C}}[X]$ is the equivalence class of an arrow $f:X\xrightarrow {\,\,\,\hspace{6pt}} X$ in ${\mathscr{C}}{\kern.8pt}$ s.t. $p\leq p'\circ f$ , where $f\sim g\stackrel {\Delta }{\Longleftrightarrow } p\leq eq\circ \langle f,g \rangle$ (cf (Maietti, Reference Maietti2010, Definition 4.6)). It is easy to see that ${\mathscr{C}}[X]$ is lextensive and every object has a decidable equality. Using the axiom of choice, one can define a lextensive embedding of ${\mathscr{C}}[X]$ into ${\mathscr{C}}$ .

If ${\mathscr{C}}{\kern.8pt}$ is $\mathsf{P}[C]$ ( $\mathsf{A}[C]$ or $\mathsf{M}[C]$ ) with $C$ satisfying property (K,P,E), then the object $D$ has the properties needed to define the category ${\mathscr{C}}[D]$ of decidable predicates on $D$ ; moreover, ${\mathscr{C}}[D]$ is isomorphic to the full sub-category $\mathsf{P}_d[C]$ of $\mathsf{P}[C]$ s.t. $X\in \mathsf{P}_d[C]\stackrel {\Delta }{\Longleftrightarrow }\forall d:D.d\in X\Longleftrightarrow p(d)$ for a predicate $p:D\xrightarrow {\,\,\,\hspace{6pt}} 2$ (necessarily unique).

8. Collection monads revised

Given a category ${\mathscr{C}}{\kern.8pt}$ with finite products, monadicity of the forgetful functor from the category of algebras in ${\mathscr{C}}{\kern.8pt}$ for a (balance) equational theory could be a property difficult to satisfy. The following definition replaces the equational theory with a monad ${\mathbb{M}}$ on ${\mathscr{S}}$ , and we look for (strong) monads ${\mathbb{M}}'$ on ${\mathscr{C}}{\kern.8pt}$ behaving like ${\mathbb{M}}$ .

Definition 8.1. Given a category ${\mathscr{C}}{\kern.8pt}$ with finite products and enough points, thus the global section functor $|-|:{\mathscr{C}}\xrightarrow {\,\,\,\hspace{6pt}}\mathscr{S}$ is faithful and limit preserving, we say that a (strong) monad ${\mathbb{M}}'$ on ${\mathscr{C}}{\kern.8pt}$ behaves like a monad ${\mathbb{M}}$ on ${\mathscr{S}}{\kern.8pt}$ when there is a natural isomorphism $\phi _X:|{\mathbb{M}}'(X)|\xrightarrow {\,\,\,\hspace{6pt}}{\mathbb{M}}(|X|)$ such that $(|-|,\phi )$ is a (strong) monad map.

We are mainly interested in the case of a lextensive category ${\mathscr{C}}{\kern.8pt}$ satisfying the properties of Theorem 3.1; thus, the global section functor is lextensive, and a (strong) $\mathscr{M}_2$ -monad ${\mathbb{P}}$ on ${\mathscr{C}}{\kern.8pt}$ (where $\mathscr{M}_2$ is the dominion of decidable monos) behaving like the finite powerset monad $\mathbb{P}_f$ on ${\mathscr{S}}$ . Since $|$ ${\mathbb{P}}$ $(n)|\cong \mathbb{P}_f(n)$ for every finite cardinal $n$ , the algebraic operations for ${\mathbb{P}}$ and $\mathbb{P}_f$ coincide.

Remark 8.2. There can be non-isomorphic strong monads ${\mathbb{P}}$ and ${\mathbb{P}}'$ on ${\mathscr{C}}{\kern.8pt}$ behaving like $\mathbb{P}_f$ on ${\mathscr{S}}$ , for example, when ${\mathscr{C}}{\kern.8pt}$ is the category of assemblies for a Combinatory Algebra $(D,\cdot )$ . In general, the monads on ${\mathscr{C}}{\kern.8pt}$ behaving like a monad ${\mathbb{M}}$ on ${\mathscr{S}}{\kern.8pt}$ form a preorder, where the arrows correspond to epi-mono monad maps.

If $C\subseteq D\to D$ is a sub-monoid satisfying properties (K,P,E) of Definition 7.1 and ${\mathscr{C}}{\kern.8pt}$ is the lextensive category $\mathsf{P}[C]$ of predicates (or the category $\mathsf{P}_d[C]$ of decidable predicates, see Remark 7.5), then $\mathscr{M}_2=\mathscr{M}_r$ and any (strong) monad ${\mathbb{P}}$ on ${\mathscr{C}}{\kern.8pt}$ behaving like $\mathbb{P}_f$ on ${\mathscr{S}}{\kern.8pt}$ restricts to the full sub-category ${\mathscr{C}}_f$ of finite cardinals in ${\mathscr{C}}{\kern.8pt}$ (i.e., finite sums of terminal objects), which is equivalent to ${\mathscr{S}}_f$ , since $X\in \mathsf{P}[C]_f\Longleftrightarrow |X|\in \mathscr{S}_f$ . The monad $\mathbb{P}_f$ has additional properties; thus, one expects that a monad ${\mathbb{P}}$ behaving like $\mathbb{P}_f$ should have them too.

  • $\mathbb{P}_f$ is taut. In $\mathsf{P}[C]$ not all mono are decidable; thus, we require ${\mathbb{P}}$ to be a (strong) $\mathscr{M}_2$ -monad.

  • In ${\mathscr{S}}{\kern.8pt}$ there is a small relation classifier , that is, every small relation (i.e., for every $x$ there are finitely many $y$ such that $R(x,y)$ ) is the pullback of $\ni _Y$ along $r\times \textrm {id}_{Y}$ for a unique $r:X\xrightarrow {\,\,\,\hspace{6pt}}\mathbb{P}_f Y$ . Moreover, it coincides with the interpretation of the predicate $c\mbox{$\Downarrow _{}$}v$ of Evaluation Logic; thus, we expect something similar for ${\mathbb{P}}$ by exploiting the interpretation of Evaluation Logic.

Another desirable property of a monad ${\mathbb{M}}$ on $\mathsf{P}[C]$ ( $\mathsf{M}[C]$ or $\mathsf{A}[C]$ ) is realizability.

Remark 8.3. A natural transformation $\sigma :F\stackrel {.}{\rightarrow } G$ between endo-functors on $\mathsf{P}[C]$ (more generally a family $\sigma$ of maps in $\mathsf{P}[C]$ ) is realizable $\stackrel {\Delta }{\Longleftrightarrow }$ there exists $f'\in C$ such that $f'\vdash \sigma _X$ for every $X\in \mathsf{P}[C]$ , that is, all $\sigma _X$ have the same realizer. To define when an endo-functor $F$ on $\mathsf{P}[C]$ (more generally a function $F$ on maps in $\mathsf{P}[C]$ ) is realizable, we need a notion of computability at type 2, or more generally at any level $n\geq 0$ . It is well-known that in type 2 there are different notions of computability; see Longley (Reference Longley2005). For our purposes the most appropriate ones are variants of Gödel’s system T and Kleene’s primitive recursive functionals. More precisely, given a set $D$ , consider the full type hierarchy $D_{\tau \in T}$ on $D$ , that is, $D_0\stackrel {\Delta }{=} D$ and $D_{\tau \to \tau '}\stackrel {\Delta }{=} D_{\tau }\to D_{\tau '}$ , where $\tau$ and $\tau '$ range over the set $\tau \in T::=0\ |\ \tau \to \tau '$ of simple types on a base type $0$ . A notion of computability amounts to give a family $C_\tau \subseteq D_\tau$ of subsets closed under $\lambda$ -definability. Having fixed the family $C_\tau$ , we say that an endo-functor $F$ on $\mathsf{P}[C_{0\to 0}]$ is realizable $\stackrel {\Delta }{\Longleftrightarrow }$ there exists $F'\in C_{(0\to 0)\to 0\to 0}$ such that $F'(f')\vdash F(f)$ when $f'\vdash f$ . In the rest of this section we do not specify the family $C_\tau$ , we only take $C=C_{0\to 0}$ . However, the existence of a $F'\in D_{(0\to 0)\to 0\to 0}$ is already a constrain on $F$ , since different maps in $\mathsf{P}[C]$ may have the same realizer.

In the rest of this section, we consider several examples of $C\subseteq D\to D$ satisfying properties (K,P,E) of Definition 7.1 and ask whether there exists a strong monad ${\mathbb{M}}'$ on $\mathsf{P}[C]$ behaving like a chosen monad ${\mathbb{M}}$ on ${\mathscr{S}}$ . For defining such a strong monad (and ensure realizability), it suffices to fix an injective encoding $M:{\mathbb{M}}(D)\succ \!\!\longrightarrow D$ s.t.

  • for each $X\in \mathsf{P}[C]$ (i.e., $X\subseteq D$ ) the object ${\mathbb{M}}'(X)$ is given by the subset $\{M(A)|A\in {\mathbb{M}}(X)\}$ ,

  • for every $f\in C$ for some $f'\in C$ ,

and have maps $\eta ',\mu ',\mathsf{t}'\in C$ s.t.

these maps are unique if the encodings $p:D^2\to D$ and $M:{\mathbb{M}}(D)\to D$ are bijective.

8.1 Examples of $C$ on ${\mathbb{N}}$

Given a subset $C\subseteq \mathbb{N}\to \mathbb{N}$ , the Skolem (elementary) expressions on $C$ are defined by the BNF

(1) \begin{eqnarray} {e}\in E_{S}[C]&::=& x\ |\ f({e})\ |\ 0\ |\ 1\ |\ {e}_0+{e}_1\ |\ {e}_0\doteq {e}_1\ |\ \Sigma x\lt {e}_0.{e}_1 \end{eqnarray}

where $x$ ranges over a countable set of variables and $f$ ranges over $C$ . There is a standard interpretation of Skolem expressions in ${\mathbb{N}}$ , in particular $n_0\doteq n_1\stackrel {\Delta }{=}\mbox{$1$ if $n_0=n_1$ else $0$}$ .

We recall two standard bijective encodings for pairs and finite subsets of natural numbers.

Definition 8.4. The encodings $p:\mathbb{N}^2\to \mathbb{N}$ (aka Cantor pairing) and $P:\mathbb{P}_f(\mathbb{N})\to \mathbb{N}$ are

\begin{equation*}p(n_0,n_1)\stackrel {\Delta }{=}\frac {(n_0+n_1)(n_0+n_1+1)}{2}+n_1\quad \textit{and}\quad P(A)\stackrel {\Delta }{=}\Sigma _{n\in A}2^n.\end{equation*}

The map $p$ is Skolem (i.e., it is definable by an expression in $E_S[\emptyset ]$ ), but $P$ is not. More precisely, $f(n)=2^n=P(\{n\})$ is not Skolem, because Skolem maps are always sub-polynomial, that is, $f\leq p_f$ for some polynomial function $p_f:\mathbb{N}\to \mathbb{N}$ .

Proposition 8.5. If $C$ is closed w.r.t. Skolem-definable maps, that is, the interpretation of every map $\lambda x.{e}$ with ${e}\in E_{S}[C]$ is in $C$ , then $C$ satisfies properties (K,P,E).

Proof. We introduce some derived Skolem expressions (i.e., shorthand for Skolem expressions), we write $\phi$ for Skolem expressions that can only denote $0$ or $1$ (e.g., ${e}_0\doteq {e}_1$ ):

  • ${e}_1*{e}_2\stackrel {\Delta }{=}\Sigma x\lt {e}_1.{e}_2$ product and ${e}_1\ominus {e}_2\stackrel {\Delta }{=}\mu x\leq {e}_1.{e}_1\dot {\leq }({e}_2+x)$ truncated subtraction;

  • ${e}_1\dot {\lt }{e}_2\stackrel {\Delta }{=}\Sigma x\lt {e}_2.({e}_1\doteq x)$ , $\neg \phi \stackrel {\Delta }{=}(\phi \doteq 0)$ , $\exists x\lt {e}.\phi \stackrel {\Delta }{=}0\dot {\lt }(\Sigma x\lt {e}.\phi )$ ;

  • $\mu x\leq {e}.\phi \stackrel {\Delta }{=}\Sigma x\leq {e}.(0\doteq \Sigma x\lt x.\phi )*(0\dot {\lt }\phi )*x$ bounded minimization (it is $0$ if $\neg \exists x\leq {e}.\phi$ );

  • $p({e}_0,{e}_1)\stackrel {\Delta }{=}(\Sigma x\leq {e}_0+{e}_1.x)+{e}_1$ pairing, and $\pi _i({e})\stackrel {\Delta }{=}\mu x_i\leq {e}.(\exists x_{1-i}\leq {e}.\langle x_0,x_1 \rangle \doteq {e})$ projections for $i=0,1$ ;

  • $if(\phi ,{e}_t,{e}_f)\stackrel {\Delta }{=}(0\doteq \phi )*{e}_f+(0\dot {\lt }\phi )*{e}_t$ conditional.

The map $t:\mathbb{N}^4\to \mathbb{N}$ in property (E) is given by $t(n_0,n_1,n_2,n_3)\stackrel {\Delta }{=} if(n_0\doteq n_1,n_2,n_3)$ . In property (P) we use Cantor pairing $p$ , but any other encoding $p'$ of pairs is $C$ -reducible to $p$ (i.e., $p'=f\circ p$ for some $f\in C$ ) and conversely.

To prove that the bijective encoding $P:\mathbb{P}_f(\mathbb{N})\to \mathbb{N}$ determines a strong monad on $\mathsf{P}[C]$ behaving like $\mathbb{P}_f$ , it is not sufficient to assume that $C$ is closed w.r.t. Skolem-definable maps, since $\eta '$ is not a Skolem map. We have to take Kalmar (elementary) expressions, whose BNF has an extra clause for bounded products, namely

(2) \begin{eqnarray} {e}\in E_{K}[C]&::=& x\ |\ f({e})\ |\ 0\ |\ 1\ |\ {e}_0+{e}_1\ |\ {e}_0\doteq {e}_1\ |\ \Sigma x\lt {e}_0.{e}_1\ |\ \Pi x\lt {e}_0.{e}_1 \end{eqnarray}

Proposition 8.6. If $C$ is closed w.r.t. Kalmar-definable maps, then $C$ satisfies properties (K,P,E) and the bijective encoding $P:\mathbb{P}_f(\mathbb{N})\to \mathbb{N}$ determines a strong monad ${\mathbb{P}}$ on $\mathsf{P}[C]$ behaving like $\mathbb{P}_f$ .

Proof. By Proposition 8.5 we already know that $C$ satisfies properties (K,P,E), and one can assume that the map $p$ in (P) is Cantor pairing. Therefore, we are left to prove that $P$ given in Definition 8.4 satisfies the properties for determining a strong monad on $\mathsf{P}[C]$ behaving like $\mathbb{P}_f$ . To do this we introduce some derived Kalmar (and Skolem) expressions needed to prove that the required maps are in $C$ (in the following $P_*$ denotes the inverse of $P$ ):

  • ${e}_2^{{e}_1}\stackrel {\Delta }{=}\Pi x\lt {e}_1.{e}_2$ exponentiation and $\eta '({e})\stackrel {\Delta }{=} 2^{{e}}$ , thus $\eta (n)=P_*(\eta '(n))$ for $n\in \mathbb{N}$ ;

  • ${e}_2//({e}_1+1)\stackrel {\Delta }{=}(\mu x\leq {e}_2.{e}_2\dot {\lt }({e}_1+1)*x)\ominus 1$ quotient and ${e}_2\%({e}_1+1)\stackrel {\Delta }{=}{e}_2\ominus ({e}_2//({e}_1+1))$ reminder;

  • ${e}_1\dot {\ni }{e}_2\stackrel {\Delta }{=}({e}_1//2^{{e}_2})\%2$ , thus $n_1\dot {\ni }n_2=\mbox{$1$ if $P_*(n_1)\ni n_2$ else $0$}$ ;

  • $\mu '({e})\stackrel {\Delta }{=}\Sigma x\lt {e}.if(\exists x'\lt {e}.{e}\dot {\ni }x'*x'\dot {\ni }x,2^x,0)$ , thus $\mu (B)=\cup B=P_*(\mu '(P(\mathbb{P}_f(P)(B))))$ for $B\in \mathbb{P}_f^2(\mathbb{N})$ ;

  • $\mathsf{t}'({e}_0,{e}_1)\stackrel {\Delta }{=}\Sigma x\lt {e}_1.if({e}_1\dot {\ni }x,2^{p({e}_0,x)},0)$ , thus $p(\mathsf{t}(n,A))=\{p(n,n')|n'\in A\}=P_*(\mathsf{t}'(n,P(A)))$ for $n\in \mathbb{N}$ and $A\in \mathbb{P}_f(\mathbb{N})$ .

Finally, if $f\in C$ , then $f'({e})\stackrel {\Delta }{=}\Sigma x\lt {e}.if({e}\dot {\ni }x,2^{f(x)},0)\in E_{K}[C]$ and $\mathbb{P}_f(f)(A)=P_*(f'(P(A)))$ for $A\in \mathbb{P}_f(\mathbb{N})$ .

Remark 8.7. Among the $C\subset \mathbb{N}\to \mathbb{N}$ in Example 6.3 only $\mathsf{TR}$ , $\mathsf{PR}$ and $\mathsf{E}_{n}$ for $n\geq 3$ are closed w.r.t. Kalmar-definable maps. Under the assumptions of Proposition 8.6 one can prove that there is a natural transformation $\cup _X:{\mathbb{P}}(X)^2\xrightarrow {\,\,\,\hspace{6pt}}{\mathbb{P}}(X)$ behaving like $\cup _X:\mathbb{P}_f(X)^2\xrightarrow {\,\,\,\hspace{6pt}}\mathbb{P}_f(X)$ realized by $\cup '({e}_1,{e}_2)\stackrel {\Delta }{=}\Sigma x\lt {e}_1+{e}_2. if(0\dot {\lt }({e}_1\dot {\ni }x+{e}_2\dot {\ni }x),2^{x},0)$ . Following Remark 5.1, another way to get this natural transformation is to observe that we have element $none$ and $two$ , namely $none$ is the only element $0\in {\mathbb{P}}(\emptyset )$ and $two$ is the element $\{0,1\}\in {\mathbb{P}}(\{0,1\})$ .

If the sub-monoid $C$ has the closure properties of primitive recursion maps, then ${\mathbb{N}}$ (with the obvious structure) is a pNNO (parameterized NNO) in $\mathsf{P}[C]$ , thus $\mathsf{P}[C]$ is a Skolem category in the sense of Maietti (Reference Maietti2010, Definition 2.2), and every commutative idempotent monoid $(X,e,m)$ in $\mathsf{P}[C]$ corresponds to an EM-algebra $(X,\alpha )$ for ${\mathbb{P}}$ .

However, if $C\subseteq O(T)\subset {\mathsf{PR}}$ for some $T\in {\mathsf{PR}}$ and $C$ satisfies properties (K,P,E), then $\mathsf{P}[C]$ cannot have a pNNO. In fact, if were a pNNO in $\mathsf{P}[C]$ , then there is a unique map $e:\mathbb{N}\xrightarrow {\,\,\,\hspace{6pt}} X$ in $\mathsf{PR}$ s.t. $e(n)=x_n\stackrel {\Delta }{=} f^n(a)$ , because is a pNNO in $\mathsf{P}[{\mathsf{PR}}]$ , and conversely there is a unique map $e':X\xrightarrow {\,\,\,\hspace{6pt}}\mathbb{N}$ (realized by a map) in $C$ s.t. $e'(x_n)=n$ , because $X$ is a pNNO in $\mathsf{P}[C]$ . In a Skolem category every (unary) primitive recursive map $g$ is representable by an arrow $g':\mathbb{N}\xrightarrow {\,\,\,\hspace{6pt}}\mathbb{N}$ on the pNNO. In $\mathsf{P}[C]$ this means that for every $g\in {\mathsf{PR}}$ the map $g':X\xrightarrow {\,\,\,\hspace{6pt}} X$ s.t. $g'(x_n)=x_{g(n)}$ is in $\mathsf{P}[C]$ . Therefore, the map $e'\circ g':X\xrightarrow {\,\,\,\hspace{6pt}}\mathbb{N}$ , that is, $x_n\mapsto g(n)$ , must be (realized by a map) in $C$ . Choose $T'\in {\mathsf{PR}}-O(T)$ and take $g=T'\circ e\in {\mathsf{PR}}$ , then $e'\circ g'=g\circ e'$ maps $x_n\mapsto T'(x_n)$ . We get a contradiction, because $e'\circ g'$ is (realized by a map) in $C\subseteq O(T)$ , while $T'\not \in O(T)$ .

8.2 Examples of $C$ on $B^*$

In the sequel $W$ denotes the set $B^*$ of bit-strings, $\epsilon$ denotes the empty string, $u\cdot v$ or $uv$ denotes the string $u$ followed by $v$ . We define three non-bijective encodings for pairs, finite sequences and finite subsets of strings.

Definition 8.8. The encodings $p:W^2\to W$ , $L:W^*\to W$ are

\begin{equation*}p(u,v)\stackrel {\Delta }{=} p_0(u)\cdot p_1(v)\qquad L([u_i|i:n])\stackrel {\Delta }{=} @([p_0(u_i)\cdot p_1(1)|i:n])\end{equation*}

where $p_b:W\to W$ puts $b\in B$ in front of every bit in $u$ , $@:W^*\to W$ is concatenation of a sequence of strings, i.e., $@([])=\epsilon$ and $@([u_i|i:n+1])=@([u_i|i:n])\cdot u_n$ . The maps $\pi _b:W\to W$ such that $\pi _b(p(u_0,u_1))=u_i$ are

\begin{equation*}\pi _b(\epsilon )=\pi _b(a)\stackrel {\Delta }{=}\epsilon \qquad \pi _b(acu)\stackrel {\Delta }{=}\mbox{($c$ if $a=b$ else $\epsilon $)}\cdot \pi _b(u)\mbox{ $where$ $a,b,c\in B$}\end{equation*}

The encoding $P:\mathbb{P}_f(W)\to W$ is

\begin{equation*}P(A)\stackrel {\Delta }{=} L([u_i|i:n])\mbox{ $where$ $[u_i|i:n]$ $is$ $the$ $sequence$ $of$ $the$ $strings$ $in$ $A$ $in$ $increasing$ $order$}\end{equation*}

w.r.t. the order $u\lt v\stackrel {\Delta }{\Longleftrightarrow }|u|\lt |v|\lor (|u|=|v|\land \exists w,u',v'.u=w0u'\land v=w1v')$ .

The encodings enjoy the following properties (that we state without proof).

Proposition 8.9. In the sequel $l\in W^*$ , $u,v,w\in W$ and $b\in B$ :

  1. (1) $L$ is a monoid homomorphism, that is, $L([])=\epsilon$ and $L(l_0\cdot l_1)=L(l_0)\cdot L(l_1)$ , moreover $\pi _0(L(l))=@(l)$ ,

  2. (2) $\lt$ is a linear order, that is, $u\lt v\lor u=v\lor v\lt u$ ,

  3. (3) $\epsilon \lt u\Longleftrightarrow \epsilon \neq u$ and $w\cdot u\lt w\cdot v\Longleftrightarrow u\lt v\Longleftrightarrow u\cdot w\lt v\cdot w$ ,

  4. (4) $u\lt v\Longleftrightarrow p_b(u)\lt p_b(v)$ and $p(w,u)\lt p(w,v)\Longleftrightarrow u\lt v\Longleftrightarrow p(u,w)\lt p(v,w)$ .

For maps on $W$ we introduce three types of complexity classes: output (size), time and space.

Definition 8.10. Given $f:W\to W$ and $g:\mathbb{N}\to \mathbb{N}$ (or more generally $g:\mathbb{N}\to {\mathbb{R}}$ ), we say that

  1. (1) $f\in OUT(g)\stackrel {\Delta }{\Longleftrightarrow }$ the map $n\mapsto \max _{|u|\leq n} |f(u)|$ is in $O(g)$ ,

  2. (2) $f\in TIME(g)\stackrel {\Delta }{\Longleftrightarrow }$ there is a TM computing $f$ and working in time $O(g)$ ,

  3. (3) $f\in SPACE(g)\stackrel {\Delta }{\Longleftrightarrow }$ there is a TM computing $f$ and working in space $O(g)$ .Footnote 5

We assume $g$ monotone and $\geq 1$ , otherwise replace it with the smallest $g'\geq g$ with such properties.

Inclusions among different types of complexity classes are, see Papadimitriou (Reference Papadimitriou1994, Theorem 9.4)

(3) \begin{eqnarray} TIME(g)\subseteq SPACE(g)\cap OUT(g)&\mbox{ and }& SPACE(g)\subseteq \bigcup _{C\gt 0}TIME(n*C^{g(n)}) \end{eqnarray}

The complexity classes $OUT(g)$ contain also non-computable maps, but they are useful in combination with the other complexity classes defined in terms of a computational model.

Lemma 8.11. The following implications hold, where all maps $g_i,t_i,s_i:\mathbb{N}\to \mathbb{N}$ are monotone.

  1. (1) If $f_i\in OUT(g_i)$ for $i\in 2$ , then $\exists C\gt 0.f_1\circ f_0\in OUT(g_1(C*g_0(n)))$ .

  2. (2) If $f_i\in TIME(t_i)\cap OUT(g_i)$ for $i\in 2$ , then $\exists C\gt 0.f_1\circ f_0\in TIME(t_0(n)+g_0(n)+t_1(C*g_0(n)))$ .

  3. (3) If $f_i\in SPACE(s_i)\cap OUT(g_i)$ for $i\in 2$ , then $\exists C\gt 0.f_1\circ f_0\in SPACE(s_0(n)+\log g_0(n)+s_1(C*g_0(n)))$ .

Proof. Implication (1) follows easily from the definition of $OUT(g)$ . Implications (2) and (3) follow from a complexity analysis of two different constructions, see the proof of Papadimitriou (Reference Papadimitriou1994, Proposition 8.2), of a TM $M$ computing $f_2\circ f_1$ given $M_1$ and $M_2$ computing $f_1$ and $f_2$ , respectively. One construction is time-efficient, while the other is space-efficient.

Figure 1. Sub-monoids of $W\to W$ defined in terms of complexity classes.

Remark 8.12. Lemma 8.11 implies that the subsets in Figure 1 are sub-monoids of $W\to W$ (see also Example 6.3). If $c:W\to \mathbb{N}$ is the bijective map $c(u)=2^n-1+\Sigma i\lt n.b_i*2^i$ , where $n=|u|$ and $b_i$ is the bit in $u$ in position $i$ (e.g., $b_0$ is the first bit), then the sub-monoid of maps on $W$ corresponding via $c$ to Kalmar elementary maps (on ${\mathbb{N}}$ ) is included in

\begin{equation*}\bigcup _{g\in \mathsf{KE}}TIME(g)=\bigcup _{g\in \mathsf{KE}}SPACE(g)\subset \bigcup _{g\in \mathsf{KE}}OUT(g)\end{equation*}

where $\mathsf{KE}$ is the set of Kalmar elementary maps on ${\mathbb{N}}$ , while the sub-monoid of maps on $W$ corresponding via $c$ to Skolem elementary maps is included in $\mathsf{LS}$ .

We establish some complexity results for certain maps on strings.Footnote 6 These results allow to prove that for some monoids $C$ defined using complexity classes the encodings $L:W^*\to W$ and $P:\mathbb{P}_f(W)\to W$ determine a strong monad on $\mathsf{P}[C]$ behaving like the list monad ${\mathbb{L}}$ and the finite powerset monad $\mathbb{P}_f$ on ${\mathscr{S}}$ , respectively.

Lemma 8.13. In the following claims $t$ denotes a map on ${\mathbb{N}}$ s.t. $t(m+n)\geq t(m)+t(n)\geq m+n$ , $a,b,c\in B$ denote bits and $u,v,w\in W$ bit-strings.

  1. (1) The maps $p_b,\pi _b:W\to W$ are in $SPACE(1)$ , the predicates $=,\lt :W^2\to B$ are in ${\mathsf{LT}}\cap \mathsf{\ell S}$ .

  2. (2) If $f_0,f_1,f:W\to W$ with $f(u)=p(f_0(u),f_1(u))$ , then

    1. a. $f_0,f_1\in TIME(t)\implies f\in TIME(t)$ ,

    2. b. $f_0,f_1\in SPACE(g)\implies f\in SPACE(g)$ ,

    3. c. $f_0,f_1\in OUT(g)\implies f\in OUT(g)$ .

  3. (3) The map $\eta '(u)\stackrel {\Delta }{=} L([u])=p_0(u)\cdot p_1(1)$ and $\mu '\stackrel {\Delta }{=} \pi _0$ are in $SPACE(1)$ .

  4. (4) Exists a $t'\in \mathsf{\ell S}\cap TIME(n^2)$ s.t. $t'(p(u,L([v_i|i:n])))=L([p(u,v_i)|i:n])$ .

  5. (5) If $f:W\to W$ there is a map $f'$ s.t. $f'(L([u_i|i:n]))=L([f(u_i)|i:n])$ and moreover

    1. a. $f\in TIME(t)\implies f'\in TIME(t)$ ,

    2. b. $f\in SPACE(g)\implies f'\in SPACE(g)$ ,

    3. c. $f\in OUT(g)\implies f'\in OUT(g)$ .

  6. (6) Exists a $s'\in \mathsf{\ell S}\cap TIME(n^2)\cap {\mathsf{LO}}$ s.t. $s'(L(l))=L(l')$ where $l'$ is the increasing sequence of strings in $l$ .

Proof. Only the proofs of items (2) and (5) are subtle (in a similar way); thus, we consider only item (2). The proof of item (2), like that of Lemma 8.11, requires different constructions for the cases $TIME(t)$ and $SPACE(g)$ . In both cases the TMs $M_i$ computing $f_i$ are used as black boxes by the TM $M$ computing $f$ . In the case $TIME(t)$ they are treated as oracles, that is, the input and output tapes of $M_i$ are working tapes in $M$ . In the case $SPACE(g)$ each TM $M_i$ is replaced by a demand-driven version, that is, $M$ asks the next bit in the output string, and $M_i$ asks $M$ the $k$ th bit of the input string (with $k\leq n$ ), thus the input tape of $M_i$ (of size $n$ ) is replaced by a working tape of size $O(\log n)$ .

Theorem 8.14. If $C$ is one of the sub-monoids in Figure 1 and $L$ and $P$ are the encodings in Definition 8.8 , then

  1. (1) $C$ satisfies properties (K,P,E)

  2. (2) $L$ determines a monad ${\mathbb{L}}'$ on $\mathsf{P}[C]$ behaving like ${\mathbb{L}}$ , moreover ${\mathbb{L}}'$ is strong $\Longleftrightarrow C\not \subseteq {\mathsf{LO}}$

  3. (3) $P$ determines a monad ${\mathbb{P}}$ on $\mathsf{P}[C]$ behaving like $\mathbb{P}_f$ when $C\not ={\mathsf{LT}}$ , moreover ${\mathbb{P}}$ is strong $\Longleftrightarrow C\not \subseteq {\mathsf{LO}}$ .

Proof. The positive results follow from Lemma 8.13. In particular, a realizer for ${\mathbb{P}}(f)$ is given by $s'\circ f'$ , where $f'$ and $s'$ are the maps in item (5) and (6) of Lemma 8.13, respectively. The case $C={\mathsf{LT}}$ is excluded, because $s'\not \in {\mathsf{LT}}$ .

The negative result in item (2), that is, ${\mathbb{L}}'$ does not have a tensorial strength when $C\subseteq {\mathsf{LO}}$ , follows from $t'\notin {\mathsf{LO}}$ when $t'$ is a map on $W$ s.t. $t'(p(u,L([v_i|i:n])))=L([p(u,v_i)|i:n])$ . Take $|u|=n$ , then $|p(u,L([\epsilon |i:n]))|=2(n+2n)\in O(n)$ and $|L([p(u,\epsilon )|i:n])|=2(n+1)n\in O(n^2)$ .

The negative result in item (3), that is, ${\mathbb{P}}$ does not have a tensorial strength when $C\subseteq {\mathsf{LO}}$ , follows from $t'\notin {\mathsf{LO}}$ , but we need a different counter-example, since $[v_i|i:n]$ must be increasing. Take $|u|=n=2^m$ and $[v_i|i:n]$ the increasing sequence of strings of length $m$ , then $|p(u,L([v_i|i:n]))|=2(n+2(m+1)n)\in O(n\log n)$ and $|L([p(u,v_i)|i:n])|=2(n+m+1)n\in O(n^2)$ .

Remark 8.15. We conjecture that $P$ does not determine a realizable monad ${\mathbb{P}}$ on $\mathsf{P}[{\mathsf{LT}}]$ behaving like $\mathbb{P}_f$ , that is, no oracle TM $M'[f:W\to W]$ computing ${\mathbb{P}}(f)$ can works in linear time for every $f\in {\mathsf{LO}}$ . The rational is:

  1. (1) Checking whether a string $w\in W$ is in ${\mathbb{P}}(W)=P(W^*)$ can be done in linear time; thus, $M'$ needs to call the oracle $f$ only when $w=P([u_i|i:n])$ , and in this case the output produced by $M'[f]$ must be $s'(L([f(u_i)|i:n])$ .

  2. (2) $M'[f]$ must call the oracle $f$ for every $u_i$ , because it has no other way to determine $f(u_i)$ , and must compare $f(u_i)$ and $f(u_j)$ to determine in which order they should appear in the output (or if they are equal).

Thus, $M'[f]$ must sort (and prune) the sequence $[f(u_i)|i:n]$ , and this cannot be done in linear time.

9. Discussion and further work

We conclude by discussing further work and some open issues.

$\mathsf{P}[C]$ versus ${\mathsf{P}}_d[C]$ . We have focused on the category $\mathsf{P}[C]$ of predicates, but also the full lextensive sub-category $\mathsf{P}_d[C]$ of decidable predicates (see Remark 7.5) is of interest. If a $\mathscr{M}_2$ -monad ${\mathbb{M}}'$ on $\mathsf{P}[C]$ behaves like ${\mathbb{M}}$ and is determined by an encoding $M:{\mathbb{M}}(D)\to D$ , then to prove that ${\mathbb{M}}'$ restricts to $\mathsf{P}_d[C]$ it suffices to check that the image of the encoding $M$ is in $\mathsf{P}_d[C]$ . In fact, if $X\in \mathsf{P}_d[C]$ and $p:D\xrightarrow {\,\,\,\hspace{6pt}} 2$ is the corresponding predicate, then the inclusions ${\mathbb{M}}'X\subseteq {\mathbb{M}}'D\subseteq D$ are decidable monos in $\mathsf{P}[C]$ , in particular the predicate ${\mathbb{M}}'D\xrightarrow {\,\,\,\hspace{6pt}} 2$ for the mono ${\mathbb{M}}'X\subseteq {\mathbb{M}}'D$ is given by (the interpretation of) the formula $c:{\mathbb{M}} D \vdash _{} [x{\Leftarrow }c]_{}p(x)$ . Probably, in $\mathsf{P}_d[C]$ it should be easier to prove negative results, such as the lack of free algebras.

Relation to algebraic set theory (AST). A strong $\mathscr{M}_2$ -monad ${\mathbb{P}}$ on $\mathsf{P}[C]$ behaving like $\mathbb{P}_f$ may not satisfy all the axioms in Simpson (Reference Simpson1999): $\mathsf{P}[C]$ may fail to be regular, and some monos in $\mathsf{P}[C]$ may fail to be small, because small monos are decidable (see the discussion at the end of Section 5). It would be desirable to identify weaker axioms for AST that cover these examples. For instance, Awodey et al. (Reference Awodey, Butz, Simpson and Streicher2014) requires small monos to include regular monos, rather than all monos.

Simulations. Longley introduced the notion of simulation $\gamma$ between computation structures (see Longley (Reference Longley2014, Definition 3.5)). When the notion is specialized to the case of monoids $C_i$ of partial maps (on a set $D_i$ ) a simulation $\gamma :C_1\xrightarrow {\,\,\,\hspace{6pt}} C_2$ is a total relation $\gamma :D_1\times D_2$ s.t.

\begin{equation*}\forall f_1\in C_1.\exists f_2\in C_2. \forall x_1\in D_1.\forall x_2\in D_2. f_1(x_1)\downarrow \wedge \gamma (x_1,x_2) \implies \gamma (f_1(x_1),f_2(x_2)).\end{equation*}

The simulation $\gamma$ induces a functor $\mathsf{A}[\gamma ]:\mathsf{A}[C_1]\xrightarrow {\,\,\,\hspace{6pt}} \mathsf{A}[C_2]$ , but if we want this functor to restrict to the categories of predicates, then $\gamma$ must be an injective map. Injectivity allows to simplify the definition of simulation as follows

\begin{equation*}\forall f_1\in C_1.\exists f_2\in C_2. \forall x_1\in D_1. f_1(x_1)\downarrow \implies \gamma (f_1(x_1))=f_2(\gamma (x_1)).\end{equation*}

It is unclear whether simulations may help to transfer results between different $\mathsf{P}[C]$ regarding the existence of monads on $\mathsf{P}[C]$ behaving like a certain collection monad.

Footnotes

1 An object $X$ in a lextensive category ${\mathscr{C}}{\kern.8pt}$ has a decidable equality when there is an arrow $eq:X\times X\xrightarrow {\,\,\,\hspace{6pt}} 2$ classifying the diagonal . If arrows in ${\mathscr{C}}{\kern.8pt}$ are computable, then $eq$ is decidable also in the sense of Computability Theory.

2 A weaker requirement on a category ${\mathscr{C}}{\kern.8pt}$ with finite products is that the forgetful functor from the category of algebras in ${\mathscr{C}}{\kern.8pt}$ (for certain algebraic theories) to ${\mathscr{C}}{\kern.8pt}$ is monadic.

3 The rules for possibility are the De Morgan dual of those for necessity.

4 In Computational Complexity (e.g., see Papadimitriou (Reference Papadimitriou1994)), one usually assumes that a TM $M$ for computing partial maps on bit strings has one read-only input tape (where the input string is written before the computation starts), one write-only output tape (where the output string will be written before the end of the computation), and several working tapes (on which $M$ may use symbols from a larger alphabet $A\supseteq B$ ).

5 For space complexity, one counts only the cells on working tapes used in the computation; those on the read-only input tape and the write-only output tape are ignored.

6 We assume that a TM computing a map of arity $n$ gets the $n$ inputs (separated by blanks) on the read-only input tape.

References

Awodey, S., Butz, C., Simpson, A. and Streicher, T. (2014). Relating first-order set theories, toposes and categories of classes. Annals of Pure and Applied Logic 165 (2) 428502.10.1016/j.apal.2013.06.004CrossRefGoogle Scholar
Buneman, P., Naqvi, S. A., Tannen, V. and Wong, L. (1995). Principles of programming with complex objects and collection types. Theoretical Computer Science 149 348.10.1016/0304-3975(95)00024-QCrossRefGoogle Scholar
Carboni, A., Lack, S. and Walters, R. F. C. (1993). Introduction to extensive and distributive categories. Journal of Pure and Applied Algebra 84 145158.10.1016/0022-4049(93)90035-RCrossRefGoogle Scholar
Hyland, J. M. E. (1982). The effective topos. In: Studies in Logic and the Foundations of Mathematics, vol. 110, Elsevier, 165216.Google Scholar
Joyal, A. and Moerdijk, I. (1995). Algebraic Set Theory, vol. 220, Cambridge University Press.10.1017/CBO9780511752483CrossRefGoogle Scholar
Longley, J. R. (2005). Notions of computability at higher types i. In: Logic Colloquium 2000 (hardcover). AK Peters/CRC Press, 32136.Google Scholar
Longley, J. R. (2014). Computability structures, simulations and realizability. Mathematical Structures in Computer Science 24 (2) e240201.10.1017/S0960129513000182CrossRefGoogle Scholar
Maietti, M. E. (2010). Joyal’s arithmetic universe as list-arithmetic pretopos. Theory and Applications of Categories 24 3983.10.70930/tac/qee78enbCrossRefGoogle Scholar
Manes, E. G. (1998). Implementing collection classes with monads. Mathematical Structures in Computer Science 8 231276.10.1017/S0960129598002515CrossRefGoogle Scholar
Manes, E. G. (2002). Taut monads and t0-spaces. Theoretical Computer Science 275 (1–2) 79109.10.1016/S0304-3975(00)00415-1CrossRefGoogle Scholar
Moggi, E. (1991). Notions of computation and monads. Information and Computation/Information and Control 93 5592.10.1016/0890-5401(91)90052-4CrossRefGoogle Scholar
Moggi, E. (1995). A semantics for evaluation logic. Fundamenta Informaticae. 22 (1/2) 117152.10.3233/FI-1995-22126CrossRefGoogle Scholar
Papadimitriou, C. H. (1994). Computational Complexity, Addison Wesley.Google Scholar
Robinson, E. and Rosolini, G. (1988). Categories of partial maps. Information and Computation 79 (2) 95130.10.1016/0890-5401(88)90034-XCrossRefGoogle Scholar
Rosolini, G. (1986). Continuity and Effectiveness in Topoi. Phd thesis, University of Oxford.Google Scholar
Scott, D. S. (1980). Relating theories of the lambda calculus. In: To HB Curry: Essays on Combinatory Logic, Lambda Calculus and Formalism, 403450.Google Scholar
Simpson, A. K. (1999). Elementary axioms for categories of classes. In: Logic in Computer Science, 7785.Google Scholar
Taylor, P. (1987). Recursive Domains, Indexed Category Theory and Polymorphism. Phd thesis, University of Cambridge.Google Scholar
Taylor, P. (1999). Practical Foundations of Mathematics, vol. 59, Cambridge University Press.Google Scholar
Figure 0

Figure 1. Sub-monoids of $W\to W$ defined in terms of complexity classes.