Unifying Boolean and Algebraic Descriptive Complexity
Abstract
We introduce ultrarings, which simultaneously generalize commutative rings and Boolean lextensive categories. As such, they allow to blend together standard algebraic notions (from commutative algebra) and logical notions (from categorical logic), providing a unifying descriptive framework in which complexity classes over arbitrary rings (as in the Blum, Schub, Smale model) and usual, Boolean complexity classes may be captured in a uniform way.
Keywords and phrases:
Descriptive complexity theory, Categorical logic, Blum-Shub-Smale complexityCopyright and License:
2012 ACM Subject Classification:
Theory of computation Complexity theory and logic ; Theory of computation Complexity classes ; Theory of computation Finite Model TheoryEditors:
Maribel FernándezSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
Descriptive complexity measures the difficulty of computational problems in terms of the expressiveness that a logical language needs to describe them, rather than in terms of the power that a machine needs to solve them. Initiated in the 1970s with Fagin’s theorem [14], which provides a characterization of the class , it has since been extended to capture virtually every other so-called “syntactic” complexity class [17].
Computational problems are usually defined as sets of finite objects (graphs, numbers, programs…) encoded as binary strings. Descriptive complexity regards such objects as totally ordered finite structures of a first-order language . A formula over an extension of plays the role of a machine, accepting a finite structure of if is a model of . The more expressive is, the more powerful the corresponding machine. Notice that is typically not a first-order extension: for example, corresponds to allowing second-order existential quantifiers [14], and corresponds to allowing fixpoint operators [16].
Computability and complexity may be meaningfully extended beyond finite objects. An interesting, well-known example is Blum, Shub and Smale’s (BSS) model of computation over the real numbers [5]. Rather than having a tape whose cells contain either or , BSS machines have a “tape” whose cells contain arbitrary real numbers. Usual Boolean operations are replaced by field operations, and testing the order relation plays the role of a conditional. Problems become sets of finite sequences of real numbers, and complexity may be developed in the usual way, including a definition of , and complete problems.
Grädel and Meer [15] showed how the descriptive approach may be applied to the BSS model. The idea is to introduce a kind of hybrid finite structure, part logical and part algebraic. The algebraic part takes care of the data manipulated by the machine (real numbers and field operations), the logical part describes the discrete steps of the BSS machine, allowing the transfer of Fagin’s [14] and Immerman’s [16] logical characterizations of and to the BSS setting.
We provide a framework in which descriptive complexity may be uniformly formulated over Booleans and over real numbers (or other commutative rings) using a single logico-algebraic language. This language arises from a combination of categorical logic and commutative algebra, taking the form of ultrarings, a new algebraic object whose introduction is the main contribution of this paper.
To understand ultrarings, one may start from categorical logic. This is a vast subject [21, 18, 19], so we concentrate on what is relevant for our purposes. Define a Boolean lextensive category to be a category with finite limits and finite pullback-stable disjoint coproducts in which every subobject has a complement. A primordial example is , the category of finite sets. Call a functor preserving finite limits and finite coproducts logical. Categorical logic gives us a correspondence between Boolean lextensive categories and classical finite-limit theories (or cartesian theories in Johnstone’s terminology [19]). These are theories of first-order classical logic whose axioms are closed formulas of the form with quantifier-free.111Actually, may contain provably unique existentials, but this is irrelevant at the present level of detail. The correspondence is as follows:
-
from a classical finite-limit theory one can construct a small Boolean lextensive category , the syntactic category of ;
-
each small Boolean lextensive category induces a classical finite-limit theory such that is equivalent to ;
-
one may define models of in any Boolean lextensive category , and models of in correspond to logical functors .
In the last point, taking yields finite models in the usual sense, which suggests a categorical approach to descriptive complexity. In fact, there is a classical finite-limit theory such that its finite models, modulo isomorphism, are exactly binary strings. Moreover, an extension of induces a logical functor (intuitively, an injection), so if we have a binary string seen as a functor , we may ask whether it factors through , which is to say whether may be extended to a model of . This means that extensions of express computational problems (i.e., subsets of ). The results of §4.2 capture the classes and as certain forms of extensions.
The above framework only expresses Boolean computation. However, the fact that classical finite-limit theories may be regarded as presentations for their Boolean lextensive syntactic categories is analogous to the presentation of a ring by a set equipped with a set of integer polynomials with variables in . The analogy is as follows:
-
each presentation induces a commutative ring ;
-
each commutative ring admits a presentation such that ;
-
given a commutative ring , a solution in of the system is the same thing as a ring homomorphism .
Notice how finding a model of a theory whose set of (closed) axioms is may be seen as “solving the system” , where is false, so the last point still fits the analogy.
Ultrarings turn the above analogy into two instances of a common construction. That is, ultrarings simultaneously generalize Boolean lextensive categories and commutative rings, and we have a notion of annular theory of which classical finite-limit theories and ring presentations are special cases. An annular theory is given by (possibly empty) sets of sorts, generators over the sorts, and equations. The latter are formulated using polynomials, which are a generalization of first-order formulas. Commutative rings are special “sortless” ultrarings: in case the are no sorts, a polynomial is exactly a polynomial in the usual algebraic sense. So ultrarings generalize commutative rings by adding sorts, and they generalize first-order logic by allowing ring operations on truth values.
Technically, an ultraring is a certain kind of small category (Definition 3), and the categories of commutative rings and of small Boolean lextensive categories are full subcategories of the category of ultrarings: to see a commutative ring as an ultraring, we take the category of free -modules of finite rank; to see a Boolean lextensive category as an ultraring, we take the Kleisli category of the partiality monad over (see §2.2).
In particular, there is an ultraring corresponding to the field of real numbers and an ultraring corresponding to the category of finite sets ( is in fact the initial ultraring). Let be either or . We will show that there is an annular theory and an associated ultraring such that, modulo isomorphism, a morphism is a finite sequence of real numbers if , or a binary string if . The former is a typical input of a BSS machine over , the latter of a Turing machine. This gives a first idea of how both algebraic and Boolean data may be treated uniformly.
Computability and complexity may be expressed in ultrarings by means of algebras: given an ultraring , an -algebra is (roughly) an ultraring together with a morphism . A -algebra expresses a computational problem as follows: a string is in iff it factors through . Our main result (Theorem 22) identifies classes of -algebras whose associated problems yield the standard classes (recursively-enumerable), and defined either in terms of BSS machines over or in terms of Turing machines, depending on how is instantiated.
In logical terms, a -algebra may be presented by an extension of the theory , and is equivalent to the fact that , seen as a model of in , may be extended to a model of . This highlights a shift with respect to descriptive complexity: rather than changing logical language for each complexity class, we fix one language (in the Boolean case, what categorical logicians would call “finite-limit logic”) and express complexity by means of logical extensions of in this same language.
2 Ultrarings
2.1 Main Definitions
In what follows, we often abbreviate composition of arrows by . If is a symmetric monoidal category, where is its symmetry, we denote by the canonical isomorphism. By “symmetric monoidal functor” we will always mean strong symmetric monoidal functor (i.e., tensor and unit are preserved up to iso).
A Frobenius sesquimonoid in a symmetric monoidal category is an object equipped with arrows , , such that is a commutative comonoid, is commutative (), associative (, left inverse to () and verifies the Frobenius law .
Initial objects will be denoted by . Recall that a (binary) coproduct diagram over an object is a pair of arrows , , called injections, such that, for every , there is a unique arrow such that . In that case, we write .
A distributive monoidal category is a symmetric monoidal category with finite coproducts such that, for all objects , is initial and the arrow is an isomorphism.
Recall that an initial object which is also terminal is called a zero object and that any category with a zero object has, for any pair of objects , a zero morphism obtained by composing the terminal and initial arrows . Also, for any pair of objects , the category has coinjections222We refer to these as coinjections rather than projections to avoid the reader assuming that the coproducts are also products. defined by:
It immediately follows that these verify
| (1) |
Definition 1.
A -category is a distributive monoidal category with a zero object such that each object is equipped with a Frobenius sesquimonoid structure satisfying, for every objects ,
and such that, for all , implies .
A morphism of -categories is a finite-coproduct-preserving symmetric monoidal functor with structural isomorphisms and such that, for each object of , , and .
In the sequel, subscripts such as those in will be dropped when unambiguously retrievable from the context.
Lemma 2.
In a -category, coinjections are jointly monic.
Proof.
See §A.1.
By the above lemma, for every arrows , of a -category, there is at most one arrow , which we call pairing, such that . Some pairings automatically exist. For instance, by (1), is the pairing and dually for . The pairing is simply . More subtly, the inverse of the distributivity isomorphism is the pairing , which can be deduced using the fact that injections into a coproduct are jointly epic.
Definition 3.
An ultraring is a small -category such that:
-
1.
disjoint pairings: for every and , if then their pairing exists;
-
2.
complements: for every such that , there exist a unique such that and , where is the codiagonal.
A morphism of ultrarings is just a morphism of -categories. We denote by the strict -category whose objects are ultrarings, whose arrows are morphisms between them and whose -cells are monoidal natural transformations.
2.2 Examples of Ultrarings
Let be a commutative ring. We denote by the category of free -modules of finite rank, and linear maps between them. This may be equivalently described as the category whose objects are natural numbers and whose arrows are matrices ( rows, columns) with coefficients in , and where composition is matrix multiplication.
This category is distributive monoidal: the (strict) monoidal structure is given by multiplication of natural numbers for objects and by the standard tensor product of matrices (also known as Kronecker product) for morphisms. Coproduct is addition and is easily seen to be a zero object. The Frobenius sesquimonoid structure is as follows: is the matrix whose -th column has the element at position and is zero everywhere else; is the row matrix ; and is the transpose of .
Under matrix addition, is actually an additive category, which means it has biproducts, so point (1) of Definition 3 is immediate. For what concerns point (2), any is a row matrix , and the condition amounts to for all . It is then a matter of elementary calculations to show that is the unique morphism verifying and . So is an ultraring.
A ring homomorphism induces a morphism of ultrarings by applying pointwise to matrices. It is well known (see for instance [7]) that every symmetric monoidal, finite-coproduct-preserving functor is monoidally isomorphic to a functor of the form for some . Therefore, if we consider the category of commutative rings to be a -category in which every hom-category is discrete, this defines a -functor , and we have:
Proposition 4.
is fully faithful.
Let be the category of finite sets and partial functions. Observe that the cartesian product induces a symmetric monoidal structure on (which is not a categorical product), whose unit is the singleton set , and that is obviously distributive (coproducts are disjoint unions) and has a zero object (the empty set). A Frobenius sesquimonoid structure may be defined by letting be the diagonal, be the unique total function and be the function which is defined on exactly when .
We invite the reader to check that, if and are partial functions, the condition amounts to the domains of and being disjoint. In that case, the pairing is the evident partial function whose domain is the union of the domains of and . Furthermore, observe that any partial function satisfies , and corresponds to a subset . The partial function corresponding to the complement of is easily seen to be the unique one verifying the desired properties of point (2) of Definition 3.
The above shows that has the structure of an ultraring, except that it is not small. This is easily fixed: let be the category whose objects are natural numbers and whose arrows are partial functions , or equivalently, matrices with coefficients in such that appears at most once in each column. As a skeleton of , is an ultraring. In fact, it is the initial ultraring: since is generated under finite coproducts by the monoidal unit and its identity arrow, any finite-coproduct-preserving functor with an ultraring is determined by the image of ; since morphisms of ultrarings are monoidal, and is equivalent to the terminal category.
Observe that is the Kleisli category of the partiality monad over the category of finite sets and total functions. This is a special case of a more general situation. A category is lextensive if it has finite limits and disjoint, pullback-stable finite coproducts. A lextensive category is called Boolean if every subobject has a complement; see [8]. A primordial example is . In fact, for what concerns finite limits and finite coproducts, the objects of Boolean lextensive categories may be thought of as sets and their arrows as total functions. In particular, if is a Boolean lextensive category whose terminal object is , the endofunctor is a monad and the Kleisli category may again be seen as a category of “sets and partial functions”. The Kleisli categories of the partiality monad on small Boolean lextensive categories may be characterized as certain ultrarings, which we introduce below.
Definition 5.
An ultraring is Boolean if every arrow satisfies and if for every there exists a unique coproduct diagram over such that , and, for every arrow , .
In the following, we denote by the full sub--category of on Boolean ultrarings, and by the -category of small Boolean lextensive categories, finitely continuous functors which preserve finite coproducts, and natural transformations.
Proposition 6.
The categories and are equivalent.
Proof.
We omit this proof due to space constraints.
3 Annular Theories and Models
3.1 Presentations of Ultrarings
Having introduced the motivating examples of ultrarings, we now wish to provide presentations of these objects, which will subsequently enable us to perform essential constructions on them, as well as providing the basis for a syntax having a natural semantics in ultrarings.
Definition 7.
A signature is a pair such that:
-
is a set of sorts. A tensor of arity is a sequence of sorts . The unique tensor of arity is denoted by .
-
is a set of generators, each with a type where are tensors.
We fix a countably infinite set of variables, ranged over by … and we use ,…to denote finite sequences of variables. Given a signature , the monomials over are defined as follows:
where ranges over , ranges over , and the length of and matches that of and , respectively. We write , and rather than , and , respectively. We abbreviate to . The notation is a binder: is bound in and is subject to the usual renaming conventions. If , we write for . When is empty, is just . We call a monomial positive if it contains no instances of the negation operator .
Monomials generalize logical formulas. Intuitively, in the Boolean case, the monomials , , and could be written , , , , and the monomial corresponds to a relation symbol satisfying that implies , i.e., a functional relation. The equality monomial is already a standard Boolean formula.
A pre-polynomial is a formal finite sum of monomials, with representing the empty sum. We can extend the operations of multiplication and integration in the definition of monomials (the last two operations) to pre-polynomials by assuming distributivity and linearity, respectively.
A context is a finite list of type assignments of the form where is a variable and a sort, such that no variable appears twice. If is repetition-free and , we also write the context as . In particular, in the sequence is empty. If and are contexts, denotes their concatenation (the variables appearing in each are assumed disjoint).
A monomial-in-context is an expression of the form , where is a monomial and and are contexts, which is derivable by means of the inductive rules of Fig. 1. If is derivable, we say that is well-typed, that is a domain for and that the context matches . Note that, thanks to the penultimate rule of Fig. 1, any context matching is also a domain for it. Pre-polynomials-in-context are defined similarly, adding a rule to derive whenever is derivable for all (in particular, is derivable for any ). From now on, we will only consider well-typed monomials and pre-polynomials.
A congruence is a context-indexed family of equivalence relations on pre-polynomials matching , closed under associativity and commutativity of multiplication , neutrality of , every equation of Fig. 2 and such that:
-
implies , for all matching and for every context including the assignments of , possibly in a different order;
-
implies ;
-
iff for any matching (we call this cancellativity).
Given a set of equations of the form where are pre-polynomials matching , the congruence generated by is the smallest congruence containing the equations of .
In the sequel, if is a congruence and we write , we mean for every matching both .
Lemma 8.
For any congruence and any pre-polynomial , iff . Moreover, either condition implies .
Proof.
See §A.1.
Given a congruence over a signature , we define -compatibility to be the context-indexed family of smallest symmetric relations on monomials of closed under the rules of Fig. 3 such that implies that is a domain for both and . We write to mean for every which is a domain for both and .
A -polynomial (or simply polynomial when this is unambiguous) is a pre-polynomial such that there exists such that for all monomials of and such that, whenever the expression appears in , we have .
Definition 9.
An annular theory (which we abbreviate to theory in the remainder) is a triple where is a signature and is a well-founded set of equations of the form where are pre-polynomials matching , such that, calling such an equation , we have that and are -polynomials with the congruence generated by the equations of strictly below in the order. We denote by the congruence generated by .
Definition 10.
A -matrix (or simply matrix) of type consists of a -indexed family of -polynomials-in-context which we abbreviate to , such that,
We always identify -matrices whose entries are equal modulo .
Lemma 11.
Let and be -matrices of type and , respectively. Then, the family of pre-polynomials-in-context indexed by defined by
is a -matrix of type .
Proof.
See §A.1.
Let be a theory. We define a category as follows:
-
the objects are formal finite coproducts of contexts of , modulo injective renaming of variables.
-
If and , is the set of -matrices of type .
-
Composition is given by Lemma 11, and is the diagonal matrix indexed by which, at position , is equal to , where we used the fact that, since objects are defined up to variable renaming, by renaming each to , we may write as .
As defined, is not small, because the finite sets indexing the objects are arbitrary. This may be circumvented by restricting to finite subsets of a fixed, countably infinite set of indices. We leave this implicit for notational convenience, but treat as a small category.
Proposition 12.
is an ultraring.
Proof.
We spell out the required structures and properties, without entering into the details. Here “polynomial”, “matrix”, etc. mean -polynomial, -matrix, etc.
Let and be generic objects of . The (strict) symmetric monoidal structure of is given by on objects, with as unit. On morphisms, tensor is matrix product, valid by a similar argument to the proof of Lemma 11, but without the integrals. The empty sum is a zero object, the all-zero matrix of suitable size is the zero morphism between any two objects. The coproduct of and (where we may suppose and to be disjoint) is given by , where and are equal to and (resp. and ) if (resp. ). This obviously satisfies strict distributivity. The injections are the block column matrices and , respectively, whereas the copairing of two matrices is the block row matrix .
For what concerns the Frobenius sesquimonoid structure, is the matrix indexed over whose column for has the element at position and is zero everywhere else, where we are renaming variables so that . is the row matrix which is equal to the monomial everywhere. is the transpose of .
Thanks to the above definition, elementary calculations show that, if and are matrices corresponding to morphisms and for some other object (indexed by , which we may supposed to be disjoint from even if ), then is equivalent to asking that, for all , and , we have , which implies , so we may form the block column matrix (with rows and columns). The reader may check that the coinjections are the block row matrices and , so is the (unique) pairing of , as desired.
Let now be a matrix of type . This means that is a row matrix, and elementary calculations show that is equivalent to asking that for all , so we are allowed to consider the polynomials and define . We need to show that . By similar calculations as above, this is equivalent to for all , which holds by Lemma 8. We are left with proving that . Notice that, in general, as matrices. This sum exists because, as shown above, is the block column matrix . So we need to show that for all , but this is one of the equations of Fig. 2.
3.2 Models and the Canonical Theory
The term “annular theory” in Definition 9 is not merely an analogy with logic: it is chosen so that ultraring morphisms out of become models of , in a sense that we now establish.
Definition 13.
Given a signature and an ultraring , an -structure in consists of:
-
An assignment . This extends to an assignment on tensors given by .
-
An assignment such that if then .
For -structures in , a homomorphism consists of a collection of morphisms in indexed by such that for each , .
Given a theory over a signature and a -structure , we can define an interpretation over of any -polynomial-in-context, as detailed in §A.2. The notion of model is then defined in the expected way:
Definition 14.
Let be a theory over signature and an ultraring. A model of in is a -structure in such that for each equation of , we have .
For models of in , a homomorphism is simply a homomorphism of -structures. We denote by the category of models of in and homomorphisms between them.
Proposition 15.
Let be a theory. There is an -natural equivalence of categories
Proof.
See §A.2.
Proposition 15 implies in particular the existence of a generic model of any annular theory , corresponding to the identity functor on , of which a model in any ultraring is an image by naturality.
If Proposition 12 shows us that we can generate ultrarings from theories, it may not be a surprise that every ultraring arises in this way up to equivalence.
Definition 16.
We define the canonical theory of an ultraring to be the theory where:
-
, where we denote the sort corresponding to by ;
-
has a generator for each morphism in ,333This is a mild abuse of notation, since the name can refer to multiple generators depending on how the domain and codomain are decomposed. When not specified, the type will be the one with the minimal decomposition.
-
consists of equations:
-
–
for ,
-
–
for composable in (with no coproduct decomposition of the codomains).
-
–
.
-
–
.
-
–
, for any typing of .
-
–
-
–
-
–
.
-
–
Theorem 17.
Let be an ultraring and its canonical theory, as defined in Definition 16. Then .
Proof.
See §A.2.
3.3 Examples of Annular Theories
In what follows, we let denote either or the ultraring corresponding to a commutative ring with no non-trivial idempotent, i.e., in which implies for all . Examples include any field or, more generally, any integral domain such as .
We define a predicate of a theory to be a -polynomial such that . Observe that, if is a model of in , then must be a row vector of zeros and ones: the equation becomes , and we already observed that this is equivalent to all entries of being idempotent. Furthermore, for some (all objects of are of this form). If we see as the set , may be identified with the subset of of all such , justifying the terminology.
Predicates are closed under Boolean logic: and are predicates; if and are predicates, then and are predicates (Lemma 8). Also, by the second row of Fig. 2, is always a predicate: . Moreover, models in are consistent with Boolean logic: if and are as above, , , , and is the diagonal of .
In the sequel, when we say that a generator is a predicate over , we mean that and that the equation is added to the theory. By the above, a monomial consisting entirely of generators which are predicates is like a Boolean formula and, if matches , we may impose that holds by adding the equation .
For example, we define the theory with one sort and one predicate over with equations making is a total order. We write rather than . A model of in is precisely a finite total order; modulo iso, we may assume it to be of the form . The theory is obtained from by adding a generator with no further equations. A model of in is a finite total order indexing a row vector of zeros and ones if , or of elements of otherwise. In other words, represents a binary string when , or a string of elements of otherwise. We denote the -th bit/element by .
4 Computation
4.1 Computability over Ultrarings
Let be as in §3.3. A -string is a binary string if , or a string over elements of otherwise. A -problem is a set of -strings.
We define -operations to be the following functions , where is if or the underlying ring of otherwise: -operations are conjunction, the constant function and the function negating the first bit and discarding the second; otherwise, -operations are constant functions, addition and multiplication of and, in case is a field, also division (the value of a division by zero is chosen arbitrarily). We also define to be the set of non-negative elements when is , or , or otherwise.
Definition 18.
A -RAM, where RAM stands for random access machine, is a (possibly empty) list of instructions, , chosen among: where is a -operation (a computation); , , or (an update); where ; and .
A configuration of the machine is a tuple where , is a -string, whose -th element is denoted by and said to be the content of register , and . The initial configuration is , where is the input of the machine. On configuration , the machine acts as follows. If , then the next configuration is determined according to (the string is considered to be padded with infinitely many ’s on the right, so is defined for all ):
-
: is , where , and for all ;
-
: is if or otherwise;
-
: is where and for all ;
-
, , or : is , , or , respectively.
Otherwise, the machine accepts if and rejects if .
It is immediate to see that a -RAM with one of , or is equivalent to a BSS machine [5] over those rings, modulo a polynomial slowdown (because computation steps of BSS machines are rational functions of arbitrary finite arity). On the other hand, an -RAM is obviously equivalent to a deterministic Turing machine on the alphabet .
The notion of acceptance/decision of a -problem by a -RAM is as usual. A polytime -RAM is a -RAM which always terminates in polynomially many steps in the size of the input. We denote by the class of -problems accepted by a -RAM, by the class of -problems decided by a polytime -RAM, and by the class of -problems which are projections over the first component of a -problem in whose -strings encode pairs such that the length of is polynomially bounded by the length of . By the above observations, , and are the usual classes , and , whereas , and are the usual classes defined using the BSS model [5].
By contrast, and do not coincide with the corresponding BSS classes. Indeed, BSS sort of “tweak” their definition of computability over in order to recover the usual, Boolean and : they consider an integer to have size equal to its representation as a binary string. We do not need to do this, as we use to capture Boolean computation.
4.2 Capturing Complexity Classes
Let be an ultraring. We define an -algebra to be an ultraring equipped with a structure map and an equivalence . Typical examples are given by extensions of theories: if is defined by adding sorts and/or generators and/or equations to a theory , then there is an obvious inclusion functor , mapping every object and morphism of to “itself”, making into an -algebra, with equality as equivalence. In general, if is presented by with a chosen equivalence , and if extends , to make it clear that we are viewing as an -algebra with inclusion as structure map and equivalence , we write rather than .
For example, if is as in §3.3, we may fix a presentation of and an equivalence (taking to be the empty theory), and add to the sort, generators, and equations of , obtaining a theory (so ) and a -algebra that we denote by , which is equal to with structure map the inclusion of .
Definition 19.
Let be an -algebra with structure map and equivalence . We say that accepts a -string if any morphism corresponding to as a model of in (via Proposition 15) factors through , modulo isomorphism. That is, given a morphism representing , there exists a morphism and a monoidal natural isomorphism between and . We denote by the set of -strings accepted by .
Notice that the above definition does not depend on the choice of representing : if exists for some , then it exists for all representing , because in that case and therefore as well.
Also observe that, by initiality of , every -algebra is an -algebra. Moreover, if has no non-identity endomorphism (for instance, if is , , or with prime or ), -strings still correspond to morphisms . In this case, the above definition may be equivalently formulated by speaking of -algebras. Concretely, if , a -string , seen as a model of in , is in iff we may extend it to a model in of augmented with the extra sorts, generators and equations of . This is how the definition is applied in the statement of Theorem 22 below. The above definition is more general because, if has non-trivial endomorphisms (for example ), a morphism may not correspond to a -string, but a morphism always does.
We say that an -algebra of the form is
-
of finite presentation if is finite (finitely many sorts, generators and equations are added);
-
plain if has no sorts (no sorts are added).
The latter terminology is justified by the fact that plain -algebras are algebras in the usual sense when is a commutative ring.
Let be a tensor of a theory . We say that is it a chain if there exist a predicate (as defined in §3.3) over and -polynomials and such that, with respect to , is a total order, and are functions identifying the minimum and maximum element w.r.t. , and is the successor function (every element has a unique successor and predecessor, except zero and max, which have no predecessor and successor, respectively). Notice that, if and are chains, the so is via the lexicographic order (it is not hard to see that this is definable in annular theories). Whenever is a polynomial matching a context , we will write , and to mean , and , respectively.
Definition 20.
Let be an ultraring and a plain -algebra, whose underlying equivalence is . We say that is inductive if there exists a tensor of which is a chain in such that every added generator is either making into a chain or has type for some and and belongs to one of the following classes:
-
inductive generators: generators with equations of the form
-
–
initialization: ,
-
–
induction: ,
and, possibly, equations stating that is a predicate and/or final value equations of the form , where are polynomials and are predicates such that, for all , , and ;
-
–
-
harmless predicates and ancillary generators: predicates over coming with their ancillary generators and their defining equations and for , where and are polynomials such that:
-
–
the degree of in the ancillary generators of is at most ;
-
–
no harmless predicate appears in or any ;
-
–
in any model of in , the equation has a solution in (with respect to the ancillary generators) iff the system has no solution in .
Moreover, the ancillary generators of do not appear in any equation of except the defining equations of .
-
–
Inductive algebras are inspired by fixed point operators in logic [16, 15]. Let be an integral domain or . The idea is that, given a model in of the base theory (i.e., a morphism ), finding whether may be extended to a model of plus the generators and equations of (i.e., whether factors via the inclusion ) may be done inductively on , which is like a time parameter. Indeed, to build one must find an interpretation in for the generators of . For an inductive generator, the initialization equation gives the value when and, once the value at is known, the induction equation gives the value for . For a harmless predicate with defining equations involving and , one may know whether holds at time by testing whether has a solution in . This may be done efficiently (at least for certain of interest, such as and ) because has degree at most two (it involves something like computing a discriminant, or solving a 2-CNF). The definition guarantees that, if has a solution, then one of the does not, therefore (because has no zero divisor) hence is true at time . Otherwise, if has no solution, then must be false at time .
The following results hold more generally than stated (for example, they also hold for , and with prime), but for succinctness we prove them only for and .
Lemma 21.
Let be or . For any polytime -RAM there exists a finite extension of such that:
-
is an inductive -algebra of finite presentation;
-
a model of in is an accepting run of , and its restriction to is the input of for that run.
Proof.
Let the running time of be bounded by , with the input length and a constant. The theory adds a chain structure on (the sort of ), so that is also a chain, which will play the role of the time parameter. Then, adds the inductive generators (the work tape, which is of length at most because it cannot be longer than the running time of ), (the values of and ), and the inductive predicates over (where holds iff instruction is executed at time ). If , also adds the harmless predicate over , with ancillary generators (for the relation), and the harmless predicate over , with ancillary generator (for division).
The equations added by are as follows (we will explain them momentarily):
| (2) | |||
| (3) | |||
| (4) | |||
| (5) | |||
| (6) | |||
| (7) | |||
| (8) | |||
| (9) | |||
| (10) | |||
| (11) | |||
| (12) | |||
| (13) | |||
| (14) |
Equations (2) state that the first (resp. last) instruction is the instruction of index (resp. ) and that only one instruction is executed at a time; (3) define the predicates (which is true iff , where is the content of register , as in Definition 18), (resp. and ) which is a witness of positivity (resp. negativity); (4) define the predicates which are witnesses of divisibility and the quotient; (5) and (6) state that and are initialized to and how they are updated, note that, due to the chain structure of , and thus so the sum is well defined; (7) states that when is not an update() the addresses is not modified; (8) defines the jump instructions, (9) and (10) the operations and (11) the copy instructions; (12) states that the first cell of the tape is only modified by computations and copies, where is the set of indices of computation and the one of copy instructions, also, note that the sets and are disjoints which is important for summability; (13) states that the other cells can only change if the instruction is a copy and the writing register is the right one; (14) states that the work tape initially contains the input and is filled with zeros after that, note that is the maximum of the sort (which equips with a chain structure), whereas is the strict order on the tensor (which is lexicographically ordered from the order on ).
By definition, adds no sorts and is finite. Towards proving the second point of the statement, we observe that a finite model of consists of a -string of length (the underlying model of in ), where is the interpretation of , plus seven additional functions and predicates.
Let us prove the second point of the statement by induction on : if this is (i.e., there is only one time step), then by equations 1 and 2 we have that , so the machine has only one state, which is accepting. Therefore, any model is an accepting run of the machine. If (note that, by definition, ), by induction all the functions and predicates are defined at time , then, for some we have that is defined. Also, cannot be by equation 2. This means that the current instruction is either a branch, an update, a copy or a computation.
First, if it is a branch(), then, since we supposed that is defined, by equation 9 we have that either or is defined, in any of those cases, is also defined by equation 3. By equations 13 and 14 we have that is also defined for any . Axioms 4 and 5 ensure that and are defined at time , and equation 8 gives us that and are both defined.
Then, if the instruction is an update, again, equations 13 and 14 ensure the definition of for any , equations 4 and 5 for the definitions of and , equation 7 for and 8 for , with and .
If the instruction is a copy, since and are defined we have that, for some , is defined by equation 12, if then is defined thanks to equation 13 and for all other is defined by equation 14. Again all other functions and predicates are defined by the same equations as before.
Finally, if the instruction is a computation, then either it is a division and is defined by equation 11 ( is divisible by , if not then the behavior of the machine is not defined) either it is not a division and is defined by equation 10. For all is defined by equation 14 and the other functions and predicates are still defined as before.
We have thus proved that, at any given , if is the unique element of such that holds, is the configuration obtained by running for steps from the initial configuration on input . Equation 2 guarantees that this is an accepting run, as the machine must have entered instruction at some point before time (after which it stays there).
We are left with checking that the resulting algebra is inductive. The inductive generators are clearly of the right form, so we just need to check that the other predicates are indeed harmless: for , in any model, at any time either is positive and there exists a real number such that either it is negative and there exists and such that and , in any case and have a solution. The same is true for , either is , either is not and there is a real number such that , in any case has a solution. Hence, the theory is inductive.
Theorem 22.
Let be or and let be a -problem. Then:
-
1.
iff with a -algebra of finite presentation;
-
2.
iff with a plain -algebra of finite presentation;
-
3.
iff with an inductive -algebra of finite presentation.
Proof.
For (1), consider an arbitrary -RAM . We slightly modify the proof of Lemma 21: rather than using as chain, we introduce a new sort , with the structure of a chain, and reproduce the proof with instead of . The theory thus obtained is no longer inductive but is still of finite presentation, and its models are accepting runs of , with the interpretation of giving its running time, which may now be arbitrary.
Conversely, if we are given an algebra with finitely extending and a -string , we have that a model of extending has finitely more data than , namely the data interpreting the additional sorts and generators of . Given such extra data, checking whether it verifies the additional equations of , of which there are finitely many, is certainly doable in a finite time (in fact, in polynomial time) on a -RAM.
For (2), let . This means that there exists a polytime -RAM and a constant such that, for every -string , iff there exists a string of length at most such that accepts the pair . We let be the maximum between and the exponent of the polynomial bound on the running time of , and construct a -algebra just like in the proof of Lemma 21, expect that we do not initialize the work tape beyond the input length. The algebra thus obtained is still plain (no sort is added) of finite presentation, but it is no longer inductive because the generator now is missing some initialization equations. The models of the resulting theory are still accepting runs of , on which the tape is now initialized non-deterministically beyond the input . In particular, it may be initialized with the witness , which is small enough to fit in .
The converse is much like point (1), except that this time we only need to account for the interpretation of the extra generators, which are of polynomial size (because these have types of the form with and constants) and may therefore be guessed and then checked with a polytime -RAM.
For (3), the implication from left to right is Lemma 21. For the converse, if we have an inductive algebra with finitely extending , and we have a -string , we check whether may be extended to a model of as outlined after Definition 20. The only thing left to verify is that computing harmless generators takes no more than polynomial time.
Let us start with the case . For each harmless predicate we have an equation of the form , so for each , to know whether is true in a given model in we just need to check whether the interpretation of has a root in . The idea here is to generalize the discriminant to multivariate polynomials of degree two. See the appendix for details (Lemma 24).
When , the truth of a harmless generator at time is controlled by a polynomial of degree two. In , this is interpreted as a -DNF. Therefore, testing the equation is testing whether a -DNF is falsifiable, which is well-known to be polytime [20].
Let us conclude with a few words about when . In this case, Lagrange’s four square theorem may be used to implement . Moreover, combined with the Davis-Putnam-Robinson-Matiyasevich theorem, Theorem 22 implies that .
5 Discussion and Perspectives
As implicitly shown in §2.2, ultrarings generalize commutative rings by generalizing their categories of modules (free of finite rank). This is not a new idea: it has already been mentioned or directly used in at least a few attempts to generalize algebraic geometry beyond commutative rings [13, 10, 6, 4]. What is new in ultrarings is the emphasis on presenting such generalized algebraic objects by means of a language which is directly derived from first-order logic and which still captures all ring presentations.
Speaking of algebraic geometry, it is very interesting to point out that the ultraring has some of the properties typically expected of the “field with one element”. In fact, the full subcategory of ultrarings which are plain -algebras (i.e., of the form with sortless) may be fully and faithfully embedded in the category of generalized commutative rings studied by Durov [12]. Under this embedding, is mapped to Durov’s version of the “field with one element”.
The reader may have observed that the field could also have been used capture Boolean computation: -strings are just binary strings and , and coincide with the usual Boolean classes. We contend that this is sort of an accident, and that Boolean computability is really over . Indeed, any -RAM may be restricted to operate only on , simulating a Boolean machine. This is routinely used in BSS or algebraic complexity to define the “Boolean part” of the language decided by a machine. Our approach nicely explains this by the existence of a unique morphism saying that “Booleans are everywhere”. By contrast, there is no morphism unless has characteristic .
In this paper, we have not developed the theory of ultrarings to the extent necessary to give a technical content to the above statement, but to the acquainted reader we may say that the above observation becomes a change of base along . In fact, the definition of ultraring in this paper has been intentionally restricted to give “logical-looking” presentations. We already know that ultrarings may be given a more liberal definition, still allowing presentations, but of a different flavor than the ones introduced here. Modules for these ultrarings may open interesting perspectives in terms of computational complexity: at least in the plain case (i.e., for the class and below), modules generalize algebras and could potentially be used to give finer characterizations of complexity classes.
In a different direction, if we restrict to Boolean lextensive categories (which, as §2.2 shows, are special cases of ultrarings) we know that more Boolean complexity classes may be captured by adapting ideas from descriptive complexity. These include deterministic and nondeterministic logarithmic space, the logtime hierarchy and the polynomial hierarchy, as well as non-uniform complexity classes, and will be the subject of another paper [9].
Finally, let us mention that descriptive complexity has well-known tools, taking the form of various pebble games [17], allowing one to establish lower bound results. These have been reformulated categorically [1, 3, 11, 2, 22]. Knowing if and how these reformulations interface with our work is an interesting question for the future.
References
- [1] Samson Abramsky, Anuj Dawar, and Pengming Wang. The pebbling comonad in finite model theory. In Proceedings of LICS, pages 1–12. IEEE Computer Society, 2017. doi:10.1109/LICS.2017.8005129.
- [2] Samson Abramsky and Luca Reggio. Arboreal categories: An axiomatic theory of resources. Log. Methods Comput. Sci., 19(3), 2023. doi:10.46298/LMCS-19(3:14)2023.
- [3] Samson Abramsky and Nihil Shah. Relating structure and power: Comonadic semantics for computational resources. J. Log. Comput., 31(6):1390–1428, 2021. doi:10.1093/LOGCOM/EXAB048.
- [4] John C. Baez, Joe Moeller, and Todd Trimble. 2-rig extensions and the splitting principle. arXiv:2410.05598 [math.CT], 2024.
- [5] Lenore Blum, Mike Shub, and Steve Smale. On a theory of computation and complexity over the real numbers. Bulletin of the American Mathematical Society, 21(1):1–46, 1989.
- [6] Martin Brandenburg. Tensor categorical foundations of algebraic geometry. Ph.d. thesis, University of Münster, 2014.
- [7] Martin Brandenburg and Alexandru Chirvasitu. Tensor functors between categories of quasi-coherent sheaves. Journal of Algebra, 399:675–692, 2014.
- [8] Aurelio Carboni, Stephen Lack, and R.F.C. Walters. Introduction to extensive and distributive categories. Journal of Pure and Applied Algebra, 84(2):145–198, 1993.
- [9] Baptiste Chanus and Damiano Mazza. A categorical approach to describing complexity classes. In preparation. Available on the authors’ web page, 2024.
- [10] Alexandru Chirvasitu and Theo Johnson-Freyd. The fundamental pro-groupoid of an affine 2-scheme. Appl. Categ. Structures, 21(5):469–522, 2013. doi:10.1007/S10485-011-9275-Y.
- [11] Anuj Dawar, Tomás Jakl, and Luca Reggio. Lovász-type theorems and game comonads. In Proceedings of LICS, pages 1–13. IEEE, 2021. doi:10.1109/LICS52264.2021.9470609.
- [12] Nikolai Durov. New Approach to Arakelov Geometry. arXiv 0704.2030 [math.AG], 2007.
- [13] Nikolai Durov. Classifying vectoids and operad kinds. Proc. Steklov Inst. Math., 273:48–63, 2011.
- [14] Ronald Fagin. Generalized first-order spectra and polynomial-time recognizable sets. In Complexity of Computation, SIAM-AMS Proccedings, volume 7, pages 43–73, 1974.
- [15] Erich Grädel and Klaus Meer. Descriptive complexity theory over the real numbers. In Proceedings of STOC, pages 315–324. ACM Press, 1995. doi:10.1145/225058.225151.
- [16] Neil Immerman. Relational queries computable in polynomial time. Information and Control, 68(1):86–104, 1986. doi:10.1016/S0019-9958(86)80029-8.
- [17] Neil Immerman. Descriptive complexity. Graduate texts in computer science. Springer, 1999. doi:10.1007/978-1-4612-0539-5.
- [18] Bart P. F. Jacobs. Categorical Logic and Type Theory, volume 141 of Studies in logic and the foundations of mathematics. North-Holland, 2001.
- [19] Peter T. Johnstone. Sketches of en Elephant. A Topos Theory Compendium. Volume 2. Oxford University Press, 2002.
- [20] Melven R. Krom. The decision problem for a class of first-order formulas in which all disjunctions are binary. Zeitschrift für Mathematische Logik und Grundlagen der Mathematik, 13(1–2):15–20, 1967.
- [21] Saunders Mac Lane and Ieke Moerdijk. Sheaves in Geometry and Logic. Springer, 1994.
- [22] Yoàv Montacute and Glynn Winskel. Concurrent games over relational structures: The origin of game comonads. In Proceedings of LICS, pages 58:1–58:14. ACM, 2024. doi:10.1145/3661814.3662075.
Appendix A Appendix
A.1 Proofs of Some Lemmas
Proof of Lemma 2.
We start by observing that, if are injections, then . We prove this for , the other case is essentially identical. We omit obvious subscripts for identity arrows. Let be the distributivity isomorphism. We have, using (1), , which proves the claim because is invertible. We will also need that, if are injections and another instance of distributivity, then , which holds by definition of .
Suppose now that we have with for . Using the above observations, we have , from which, applying the first two equalities in reverse order, we obtain for . Since injections are jointly epic and is invertible, we infer , from which we conclude by definition -category.
Proof of Lemma 8.
We start by observing that cancellativity implies , as well as . Next, we claim that, whenever matches the same contexts as and , we have . Indeed, , so we conclude by cancellativity.
Suppose that . Then, . For the converse, if , then using the above claim we have , so by the first two observations. Finally, we have .
Proof of Lemma 11.
For indices , let be monomials in , respectively. We need to check that each is a polynomial by verifying that, when we have . By hypothesis, , so we conclude by the last rule of Fig. 3. We must also check that the context is valid. By hypothesis, is matched by , with and being outputs, hence each monomial is well-typed and matched by , as required. Finally, we must check condition () of Definition 10. Given , we require , where is a monomial of . If , we conclude as above. If , by hypothesis we have , so we conclude by applying the last rule of Fig. 3 to these instead.
A.2 Interpreting Polynomials in a -structure
Let be a -structure. We start by inductively defining an interpretation over for positive monomials-in-context, following Fig. 1.
-
As a base case, we interpret monomials over with the maximal codomain context of all outputs and the minimal domain of all remaining free variables, for each of the basic constructions of monomials:
-
–
is ,
-
–
is ,
-
–
is ,
-
–
-
Next, we describe the effect of expanding and reorganizing contexts.
-
–
Given , let .
-
–
Relatedly, given , we define to be , (recalling that is the canonical isomorphism).
-
–
Given , permutations of and are interpreted by pre- or post-composing with the corresponding symmetry morphisms.
-
–
-
Finally, we specify how monomials combine.
-
–
Given and we can define to be ; to recover an interpretation of , we identify this with .
-
–
Given and a variable not appearing in , we define to be .
-
–
Dually, given and a variable not appearing in , we define to be .
-
–
Let us check that the above interpretations are well-defined. The first set of rules give unambiguous interpretations. For the second set, there is exactly one way to arrive a given context using these rules up to reordering, so it suffices to check that the order of operations does not affect the result; this is straightforward, relying on the fact that is symmetric.
The only place where ambiguity is introduced in the third set of rules, where the interpretation ostensibly depends on how the domain and codomain contexts are partitioned. We take these case by case.
-
Consider . By disjointness, and must respectively contain only outputs of and , so this is unambiguous; the remaining free variables of and must respectively go into and . Any remaining free variables, whether assigned to or , must be interpreted by , which eliminates any remaining ambiguity.
-
In , there is formally a choice to make about how to assign the instances of to or ; however, since the inductive construction will eventually disambiguate between any pair of repeated instances, commutativity and associativity of guarantee that any such choice will result in the same interpretation (considering also that the interpretation is invariant under -equivalence).
-
Similarly, distinguishing duplicates of variables in the codomain produces a well-defined result by commutativity and associativity of , so we are done.
Next, given , we have that is exactly . As such, when these interpretations are equal, we may take to be provided by Definition 3, thus extending the above to monomials featuring .
Finally, we define to be the zero morphism of the appropriate type.
Lemma 23.
Suppose we are given a theory over a signature and a -structure in . Suppose that whenever we have positive monomials-in-context and such that , it is the case that , so that in particular can interpret all monomials which are -polynomials. Suppose further that identifies and whenever when and are either monomials or . Then implies the pairing exists in .
Proof.
It suffices to check the axioms of Fig. 3 which determine the compatibility relation. Indeed, guarantees that if respectively interprets as in a given context then the first axiom of ultrarings Definition 3 ensures that the pairing exists.
The pairing of two components of (the interpretation of) a generator is the result of coinjecting onto the coproduct of their codomains.
If and exists, we can obtain the pairing of the interpretations of and by precomposing with and postcomposing with .
The existence of pairings in the last instance is immediate, so we are done.
As such, given and a model satisfying the conditions of Lemma 23, has a well-defined interpretation of any -polynomial-in-context as the joint pairing of the monomials appearing in (with the same context), followed by the codiagonal map.
Proposition 15. [Restated, see original statement.]
Let be a theory. There is an -natural equivalence of categories
Proof.
We have thus far shown that a -model in uniquely determines interpretations of -polynomials-in-context. To produce a functor , we need to extend this to -matrices. Each entry of a matrix determines a morphism . Condition () of Definition 10 ensures that for fixed , the interpretations of can be paired to give a morphism ; via the universal property of the coproduct, these produce a morphism . This extended construction ensures that the monoidal product and coproduct, as well as , and , are preserved.
Conversely, a morphism of ultrarings defines a model by its restriction to the sorts and generators. The equations of necessarily hold because they correspond to morphisms forced to be equal in , so are mapped by to the equal morphisms in .
It is straightforward to verify that a model morphism uniquely determines a monoidal natural transformation, and conversely, since the latter are determined by their components at objects which generate the category under monoidal products and coproducts.
Finally, naturality in follows from the fact that morphisms of ultrafunctors preserve the required structure: composing with an ultraring morphism turns a -model in into one in .
Theorem 17. [Restated, see original statement.]
Let be an ultraring and its canonical theory, as defined in Definition 16. Then .
Proof.
We have a functor sending each object to the sort and each morphism to the corresponding generator (with no decomposition of and as tensors or coproducts). We show that is an equivalence of ultrarings.
Consider the generators (which we distinguish by a subscript) and . By the second and first equations, these are mutual inverses in . Moreover, naturality of these morphisms follows from the fourth axiom (applied inductively), so preserves the monoidal product.
Consider the generator . By the third equation, we have that so this is equal to the row vector .
Dually, we have generators . By the third, first and fifth equations, we have which gives if and otherwise. Thus preserves the coproduct injections; in particular, these morphisms are compatible, so we can construct the column vector . We can use the second and third axioms to conclude that this column vector is the inverse to , so preserves coproducts. Formally, we must also check that the universal morphisms are respected by this isomorphism, in the sense that It suffices to check this componentwise by composing with , which works by the preceding observations and the second axiom.
For the -category structure, we observe that the sixth, seventh and eighth axioms directly ensure that these are preserved up to the isomorphisms constructed above. With this, we have shown that is a valid morphism of ultrarings.
Conversely, there is a canonical model of the canonical theory in , given by interpreting as and as (with the relevant typing). The claim that this -structure is indeed a model amounts to saying that the interpretations of the monomials appearing in the axioms of Definition 16 are equal in , which is straightforward to check.
Finally, to see that is an equivalence, we simply observe on the one hand that the induced model in is isomorphic to that corresponding to the identity functor and on the other that the induced endofunctor of is naturally isomorphic to the identity. The involved natural isomorphisms are the structural ones constructed above.
A.3 Harmless Predicates Over the Real Numbers
Lemma 24.
In the case , the truth value of a harmless predicate may be computed in constant time on a -RAM.
Proof.
For each harmless predicate we have an equation of the form , so for each , to know whether is true in a given model in we just need to check whether the interpretation of has a root in . The idea here is to reduce this problem as a series of positivity tests that can be done in constant time by generalizing the idea of the discriminant for variate polynomials of degree two. Let us give some details about this generalization.
If the polynomial is of degree zero the test is trivial because it has no roots. If it is of degree one, since every polynomial of of odd degree have a root in , we know that there is a root in . The only non trivial case is the degree two. Since we work in the polynomial has a root in iff it is reducible. First, let us do the special case of an homogeneous polynomial. A quadratic form can be written as a matrix multiplication , where is the Kronecker matrix of the quadratic form and is a symmetric matrix. We now show that has rank one iff is reducible. First if is reducible then we can write the as , by rewriting it with matrices multiplication so is of rank . Conversely if is of rank one, since we know that is a real symmetric matrix, it is diagonalizable. Hence, is similar to which is also similar to thus we can rewrite as a product of two degree one polynomials. Moreover is of rank one iff it has exactly one non-zero eigenvalue. Hence, we need to be root of its characteristic polynomial with multiplicity , being the number of variables, we can then rewrite the general form of the characteristic polynomial as . By identifying with the formula we are given a set of constraint on the coefficients of the quadratic form for it to be reducible. Let us now consider a general multivariate polynomial of degree two. We can write it as the being variables taken in a set . The following polynomial is a quadratic form. We need to show that is reducible iff is. This comes from the fact that if we note we have where is the Kronecker matrix of . To go from a factorisation of to one of is simply to replace by and the other way is only multiplying constant terms of each factor by .
To conclude, we need to show that these constraints we exhibited are fixed by the theory and can be hardcoded as a sequence into the code of the machine for each harmless predicate in . This means the machine doesn’t have to compute the characteristic polynomial each time but only compute the set of constraint we can deduce of it, this can be done in constant time. Since the polynomial might depend on non-harmless generators they should all be computed by the machine before the harmless predicate, which can be done because, by definition, non-harmless generators only depends on generators.
