\newtheoremrep

thm[theorem]Theorem \newtheoremreplemma[theorem]Lemma \newtheoremrepobservation[theorem]Observation \newtheoremrepcorollary[theorem]Corollary \hideLIPIcs Computer Science, University of California–Davis, CA, USA and https://web.cs.ucdavis.edu/~doty/[email protected]://orcid.org/0000-0002-3922-172XNSF awards 2211793, 1900931, 1844976, and DoE EXPRESS award SC0024467 CIT, Technical University of Munich, Germany and Computer Science, University of California–Davis, CA, [email protected] award 1844976 \CopyrightDavid Doty and Ben Heckmann \ccsdescTheory of computation Models of computation

The computational power of discrete chemical reaction networks with bounded executions

David Doty    Ben Heckmann
Abstract

Chemical reaction networks (CRNs) model systems where molecules interact according to a finite set of reactions such as A+BC𝐴𝐵𝐶A+B\to Citalic_A + italic_B → italic_C, representing that if a molecule of A𝐴Aitalic_A and B𝐵Bitalic_B collide, they disappear and a molecule of C𝐶Citalic_C is produced. CRNs can compute Boolean-valued predicates ϕ:d{0,1}:italic-ϕsuperscript𝑑01\phi:\mathbb{N}^{d}\to\{0,1\}italic_ϕ : blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT → { 0 , 1 } and integer-valued functions f:d:𝑓superscript𝑑f:\mathbb{N}^{d}\to\mathbb{N}italic_f : blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT → blackboard_N; for instance X1+X2Ysubscript𝑋1subscript𝑋2𝑌X_{1}+X_{2}\to Yitalic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT + italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT → italic_Y computes the function min(x1,x2).subscript𝑥1subscript𝑥2\min(x_{1},x_{2}).roman_min ( italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ) .

We study the computational power of execution bounded CRNs, in which only a finite number of reactions can occur from the initial configuration (e.g., ruling out reversible reactions such as AB𝐴𝐵A\mathop{\rightleftharpoons}\limits Bitalic_A ⇌ italic_B). The power and composability of such CRNs depends crucially on some other modeling choices that do not affect the computational power of CRNs with unbounded executions, namely whether an initial leader is present, and whether (for predicates) all species are required to “vote” for the Boolean output. If the CRN starts with an initial leader, and can allow only the leader to vote, then all semilinear predicates and functions can be stably computed in O(nlogn)𝑂𝑛𝑛O(n\log n)italic_O ( italic_n roman_log italic_n ) parallel time by execution bounded CRNs.

However, if no initial leader is allowed, all species vote, and the CRN is “noncollapsing” (does not shrink from initially large to final O(1)𝑂1O(1)italic_O ( 1 ) size configurations), then execution bounded CRNs are severely limited, able to compute only eventually constant predicates. A key tool is to characterize execution bounded CRNs as precisely those with a nonnegative linear potential function that is strictly decreased by every reaction, a result that may be of independent interest.

keywords:
chemical reaction networks, population protocols, stable computation

1 Introduction

Chemical reaction networks (CRNs) are a fundamental tool for understanding and designing molecular systems. By abstracting chemical reactions into a set of finite, rule-based transformations, CRNs allow us to model the behavior of complex systems. For instance, the CRN with a single reaction 2XY2𝑋𝑌2X\rightarrow Y2 italic_X → italic_Y, produces one Y𝑌Yitalic_Y every time two X𝑋Xitalic_X molecules randomly react together, effectively calculating the function f(x)=x/2𝑓𝑥𝑥2f(x)=\lfloor x/2\rflooritalic_f ( italic_x ) = ⌊ italic_x / 2 ⌋ if the initial count of X𝑋Xitalic_X molecules is interpreted as the input and Y𝑌Yitalic_Y as the output. A commonly studied special case of CRNs is the population protocol model of distributed computing [Angluin2006ComputationalPower], in which each reaction has exactly two reactants and two products, e.g., A+BC+D𝐴𝐵𝐶𝐷A+B\to C+Ditalic_A + italic_B → italic_C + italic_D. This model assumes idealized conditions where reactions can proceed indefinitely, constrained only by the availability of reactants in the well-mixed solution.

Precisely the semilinear predicates ϕ:d{0,1}:italic-ϕsuperscript𝑑01\phi:\mathbb{N}^{d}\to\{0,1\}italic_ϕ : blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT → { 0 , 1 } and functions f:d:𝑓superscript𝑑f:\mathbb{N}^{d}\to\mathbb{N}italic_f : blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT → blackboard_N can be computed stably, roughly meaning that the output is correct no matter the order in which reactions happen. In population protocols or other CRNs with a finite reachable configuration space, this means that the output is correct with probability 1 under a stochastic scheduler that picks the next molecules to react at random. However, existing constructions to compute semilinear predicates and functions use CRNs with unbounded executions, meaning that it is possible to execute infinitely many reactions from the initial configuration. CRNs with bounded executions have several advantages. With an absolute guarantee on how many reactions will happen before the CRN terminates, wet-lab implementations need only supply a bounded amount of fuel to power the reactions. Such CRNs are simpler to reason about: each reaction brings it “closer” to the answer. They also lead to a simpler definition of stable computation than is typically employed: an execution bounded CRN stably computes a predicate/function if it gets the correct answer after sufficiently many reactions.

To study this topic, we limit the classical, discrete CRN model to networks that must eventually reach a configuration where no further reactions can occur, regardless of the sequence of reactions executed. By guaranteeing a finite endpoint for CRN computations and later integrating the concept of decreasing potential, we aim to align our models more closely with their implementations in the physical world.

This restriction is nontrivial because the techniques in [Chen2012DeterministicFunction] and [Doty2013Leaderless] rely on reversible reactions catalyzed by species we expect to be depleted once a computational step has terminated. This trick seems to add computational power to our system by undoing certain reactions as long as a specific species is present. Consider the following CRN computing f(x1,x2,x3)=min(x1x2,x3)𝑓subscript𝑥1subscript𝑥2subscript𝑥3subscript𝑥1subscript𝑥2subscript𝑥3f(x_{1},x_{2},x_{3})=\min\left(x_{1}-x_{2},x_{3}\right)italic_f ( italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , italic_x start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT ) = roman_min ( italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT - italic_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , italic_x start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT ). The input values xisubscript𝑥𝑖x_{i}italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT are given as counts of copies of Xisubscript𝑋𝑖X_{i}italic_X start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, and the count of Z𝑍Zitalic_Z molecules in the stable output:

X1subscript𝑋1\displaystyle X_{1}italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT Yabsent𝑌\displaystyle\rightarrow Y→ italic_Y (1)
X2+Ysubscript𝑋2𝑌\displaystyle X_{2}+Yitalic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT + italic_Y absent\displaystyle\rightarrow\varnothing→ ∅ (2)
Y+X3𝑌subscript𝑋3\displaystyle Y+X_{3}italic_Y + italic_X start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT Zabsent𝑍\displaystyle\rightarrow Z→ italic_Z (3)
Z+X2𝑍subscript𝑋2\displaystyle Z+X_{2}italic_Z + italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT X2+X3+Yabsentsubscript𝑋2subscript𝑋3𝑌\displaystyle\rightarrow X_{2}+X_{3}+Y→ italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT + italic_X start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT + italic_Y (4)

Reactions (1) and (2) compute x1x2subscript𝑥1subscript𝑥2x_{1}-x_{2}italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT - italic_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT, storing the result in the count of Y𝑌Yitalic_Y. Next, reaction (3) can be applied exactly min(y,x3)𝑦subscript𝑥3\min(y,x_{3})roman_min ( italic_y , italic_x start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT ) times. But since the order of reactions is a stochastic process, we might consume copies of Y𝑌Yitalic_Y in (3), before all of x2subscript𝑥2x_{2}italic_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT is subtracted from it. Therefore, we add reaction (4), using X2subscript𝑋2X_{2}italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT as a catalyst to undo reaction (3) as long as copies of X2subscript𝑋2X_{2}italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT are present, indicating that the first step of computation has not terminated. A similar technique is used in [Chen2012DeterministicFunction], where semilinear sets are understood as a finite union of linear sets, shown to be computable in parallel by CRNs. A reversible, catalyzed reaction finally converts the output of one of the CRNs to the global output. Among other questions, we explore how the constructions of [Chen2012DeterministicFunction] and [Doty2013Leaderless] can be modified to provide equal computational power while guaranteeing bounded execution.

Section 3 defines execution boundedness (Definition 3.1). Furthermore, we introduce alternative characterizations of the class for use in later proofs, such as the lack of self-covering execution paths. Section 4 and 5 contain the main positive results of the paper and provide the concrete constructions used to decide semilinear sets and functions using execution bounded CRNs whose initial configurations contain a single leader. Section 6 discusses the limitations of execution bounded CRNs, introducing the concept of a “linear potential function” as a core characterization of these systems. We demonstrate that entirely execution bounded CRNs that are leaderless and non-collapsing (such as all population protocols), can only stably decide trivial semilinear predicates: the eventually constant predicates (Definition 6.11).

2 Preliminaries

We use established notation from [Chen2012DeterministicFunction, Doty2013Leaderless] and stable computation definitions from [Angluin2006ComputationalPower] for (discrete) chemical reaction networks.

2.1 Notation

Let \mathbb{N}blackboard_N denote the nonnegative integers. For any finite set ΛΛ\Lambdaroman_Λ, we write ΛsuperscriptΛ\mathbb{N}^{\Lambda}blackboard_N start_POSTSUPERSCRIPT roman_Λ end_POSTSUPERSCRIPT to mean the set of functions f:Λ:𝑓Λf:\Lambda\rightarrow\mathbb{N}italic_f : roman_Λ → blackboard_N. Equivalently, ΛsuperscriptΛ\mathbb{N}^{\Lambda}blackboard_N start_POSTSUPERSCRIPT roman_Λ end_POSTSUPERSCRIPT can be interpreted as the set of vectors indexed by the elements of ΛΛ\Lambdaroman_Λ, and so 𝐜Λ𝐜superscriptΛ\mathbf{c}\in\mathbb{N}^{\Lambda}bold_c ∈ blackboard_N start_POSTSUPERSCRIPT roman_Λ end_POSTSUPERSCRIPT specifies nonnegative integer counts for all elements of ΛΛ\Lambdaroman_Λ. 𝐜(i)𝐜𝑖\mathbf{c}(i)bold_c ( italic_i ) denotes the i𝑖iitalic_i-th coordinate of 𝐜𝐜\mathbf{c}bold_c, and if 𝐜𝐜\mathbf{c}bold_c is indexed by elements of ΛΛ\Lambdaroman_Λ, then 𝐜(Y)𝐜𝑌\mathbf{c}(Y)bold_c ( italic_Y ) denotes the count of species YΛ𝑌ΛY\in\Lambdaitalic_Y ∈ roman_Λ.

For two vectors 𝐱,𝐲k𝐱𝐲superscript𝑘\mathbf{x},\mathbf{y}\in\mathbb{R}^{k}bold_x , bold_y ∈ blackboard_R start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT, we write 𝐱𝐲𝐱𝐲\mathbf{x}\geqq\mathbf{y}bold_x ≧ bold_y to denote that 𝐱(i)𝐲(i)𝐱𝑖𝐲𝑖\mathbf{x}(i)\geq\mathbf{y}(i)bold_x ( italic_i ) ≥ bold_y ( italic_i ) for all 1ik1𝑖𝑘1\leq i\leq k1 ≤ italic_i ≤ italic_k, 𝐱𝐲𝐱𝐲\mathbf{x}\geq\mathbf{y}bold_x ≥ bold_y to denote that 𝐱𝐲𝐱𝐲\mathbf{x}\geqq\mathbf{y}bold_x ≧ bold_y but 𝐱𝐲𝐱𝐲\mathbf{x}\neq\mathbf{y}bold_x ≠ bold_y, and 𝐱>𝐲𝐱𝐲\mathbf{x}>\mathbf{y}bold_x > bold_y to denote that 𝐱(i)>𝐲(i)𝐱𝑖𝐲𝑖\mathbf{x}(i)>\mathbf{y}(i)bold_x ( italic_i ) > bold_y ( italic_i ) for all 1ik1𝑖𝑘1\leq i\leq k1 ≤ italic_i ≤ italic_k. In the case that 𝐲=𝟎𝐲0\mathbf{y}=\mathbf{0}bold_y = bold_0, we say that 𝐱𝐱\mathbf{x}bold_x is nonnegative, semipositive, and positive, respectively. Similarly define ,,<\leqq,\leq,<≦ , ≤ , <.

For a matrix or vector 𝐱𝐱\mathbf{x}bold_x, define 𝐱=𝐱1=i|𝐱(i)|norm𝐱subscriptnorm𝐱1subscript𝑖𝐱𝑖\|\mathbf{x}\|=\|\mathbf{x}\|_{1}=\sum_{i}|\mathbf{x}(i)|∥ bold_x ∥ = ∥ bold_x ∥ start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = ∑ start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT | bold_x ( italic_i ) |, i𝑖iitalic_i ranges over all the entries of 𝐱𝐱\mathbf{x}bold_x.

2.2 Chemical Reaction Networks

A chemical reaction network (CRN) is a pair 𝒞=(Λ,R)𝒞Λ𝑅\mathcal{C}=(\Lambda,R)caligraphic_C = ( roman_Λ , italic_R ), where ΛΛ\Lambdaroman_Λ is a finite set of chemical species, and R𝑅Ritalic_R is a finite set of reactions over ΛΛ\Lambdaroman_Λ, where each reaction is a pair (𝐫,𝐩)Λ×Λ𝐫𝐩superscriptΛsuperscriptΛ(\mathbf{r},\mathbf{p})\in\mathbb{N}^{\Lambda}\times\mathbb{N}^{\Lambda}( bold_r , bold_p ) ∈ blackboard_N start_POSTSUPERSCRIPT roman_Λ end_POSTSUPERSCRIPT × blackboard_N start_POSTSUPERSCRIPT roman_Λ end_POSTSUPERSCRIPT indicating the reactants 𝐫𝐫\mathbf{r}bold_r and products 𝐩𝐩\mathbf{p}bold_p. A population protocol [angluin2004computation] is a CRN in which all reactions (𝐫,𝐩)𝐫𝐩(\mathbf{r},\mathbf{p})( bold_r , bold_p ) obey 𝐫=𝐩=2norm𝐫norm𝐩2\|\mathbf{r}\|=\|\mathbf{p}\|=2∥ bold_r ∥ = ∥ bold_p ∥ = 2. We write reactions such as A+2BA+3C𝐴2𝐵𝐴3𝐶A+2B\mathop{\rightarrow}\limits A+3Citalic_A + 2 italic_B → italic_A + 3 italic_C to represent the reaction ({A,2B},{A,3C})𝐴2𝐵𝐴3𝐶(\{A,2B\},\{A,3C\})( { italic_A , 2 italic_B } , { italic_A , 3 italic_C } ). A configuration 𝐜Λ𝐜superscriptΛ\mathbf{c}\in\mathbb{N}^{\Lambda}bold_c ∈ blackboard_N start_POSTSUPERSCRIPT roman_Λ end_POSTSUPERSCRIPT of a CRN assigns integer counts to every species SΛ𝑆ΛS\in\Lambdaitalic_S ∈ roman_Λ. When convenient, we use the notation {n1S1,n2S2,,nkSk}subscript𝑛1subscript𝑆1subscript𝑛2subscript𝑆2subscript𝑛𝑘subscript𝑆𝑘\left\{n_{1}S_{1},n_{2}S_{2},\ldots,n_{k}S_{k}\right\}{ italic_n start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT italic_S start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_n start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT italic_S start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , … , italic_n start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT italic_S start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT } to describe a configuration 𝐜𝐜\mathbf{c}bold_c with nisubscript𝑛𝑖n_{i}\in\mathbb{N}italic_n start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∈ blackboard_N copies of species Sisubscript𝑆𝑖S_{i}italic_S start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, i.e., 𝐜(Si)=ni𝐜subscript𝑆𝑖subscript𝑛𝑖\mathbf{c}(S_{i})=n_{i}bold_c ( italic_S start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) = italic_n start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, and any species that is not listed is assumed to have a zero count. If some configuration 𝐜𝐜\mathbf{c}bold_c is understood from context, for a species S𝑆Sitalic_S, we write #S#𝑆\#S# italic_S to denote 𝐜(S).𝐜𝑆\mathbf{c}(S).bold_c ( italic_S ) . A reaction (𝐫,𝐩)𝐫𝐩(\mathbf{r},\mathbf{p})( bold_r , bold_p ) is said to be applicable in configuration 𝐜𝐜\mathbf{c}bold_c if 𝐫𝐜𝐫𝐜\mathbf{r}\leqq\mathbf{c}bold_r ≦ bold_c. If the reaction (𝐫,𝐩)𝐫𝐩(\mathbf{r},\mathbf{p})( bold_r , bold_p ) is applicable, applying it results in configuration 𝐜=𝐜𝐫+𝐩superscript𝐜𝐜𝐫𝐩\mathbf{c}^{\prime}=\mathbf{c}-\mathbf{r}+\mathbf{p}bold_c start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT = bold_c - bold_r + bold_p, and we write 𝐜𝐜𝐜superscript𝐜\mathbf{c}\rightarrow\mathbf{c}^{\prime}bold_c → bold_c start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT.

An execution \mathcal{E}caligraphic_E is a finite or infinite sequence of one or more configurations =(𝐜0,𝐜1,𝐜2,)subscript𝐜0subscript𝐜1subscript𝐜2\mathcal{E}=(\mathbf{c}_{0},\mathbf{c}_{1},\mathbf{c}_{2},\ldots)caligraphic_E = ( bold_c start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_c start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , bold_c start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , … ) such that, for all i{1,,||1},𝐜i1𝐜iformulae-sequence𝑖11subscript𝐜𝑖1subscript𝐜𝑖i\in\{1,\ldots,|\mathcal{E}|-1\},\mathbf{c}_{i-1}\rightarrow\mathbf{c}_{i}italic_i ∈ { 1 , … , | caligraphic_E | - 1 } , bold_c start_POSTSUBSCRIPT italic_i - 1 end_POSTSUBSCRIPT → bold_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and 𝐜i1𝐜isubscript𝐜𝑖1subscript𝐜𝑖\mathbf{c}_{i-1}\neq\mathbf{c}_{i}bold_c start_POSTSUBSCRIPT italic_i - 1 end_POSTSUBSCRIPT ≠ bold_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT. 𝐱P𝐲subscript𝑃𝐱𝐲\mathbf{x}\Rightarrow_{P}\mathbf{y}bold_x ⇒ start_POSTSUBSCRIPT italic_P end_POSTSUBSCRIPT bold_y denotes that P𝑃Pitalic_P is finite, starts at 𝐱𝐱\mathbf{x}bold_x, and ends at 𝐲𝐲\mathbf{y}bold_y. In this case we say 𝐲𝐲\mathbf{y}bold_y is reachable from 𝐱𝐱\mathbf{x}bold_x. Let 𝗋𝖾𝖺𝖼𝗁(𝐱)={𝐲𝐱𝐲}𝗋𝖾𝖺𝖼𝗁𝐱conditional-set𝐲𝐱𝐲\mathsf{reach}(\mathbf{x})=\{\mathbf{y}\mid\mathbf{x}\Rightarrow\mathbf{y}\}sansserif_reach ( bold_x ) = { bold_y ∣ bold_x ⇒ bold_y }. Note that the reachability relation is additive: if 𝐱𝐲𝐱𝐲\mathbf{x}\Rightarrow\mathbf{y}bold_x ⇒ bold_y, then for all 𝐜Λ𝐜superscriptΛ\mathbf{c}\in\mathbb{N}^{\Lambda}bold_c ∈ blackboard_N start_POSTSUPERSCRIPT roman_Λ end_POSTSUPERSCRIPT, 𝐱+𝐜𝐲+𝐜𝐱𝐜𝐲𝐜\mathbf{x}+\mathbf{c}\Rightarrow\mathbf{y}+\mathbf{c}bold_x + bold_c ⇒ bold_y + bold_c.

For a CRN 𝒞=(Λ,R)𝒞Λ𝑅\mathcal{C}=(\Lambda,R)caligraphic_C = ( roman_Λ , italic_R ) where |Λ|=nΛ𝑛|\Lambda|=n| roman_Λ | = italic_n and |R|=m𝑅𝑚|R|=m| italic_R | = italic_m, define the n×m𝑛𝑚n\times mitalic_n × italic_m stoichiometric matrix 𝐌𝐌\mathbf{M}bold_M of 𝒞𝒞\mathcal{C}caligraphic_C as follows. The species are ordered S1,,Snsubscript𝑆1subscript𝑆𝑛S_{1},\dots,S_{n}italic_S start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_S start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT, and the reactions are ordered (𝐫1,𝐩1),,(𝐫m,𝐩m)subscript𝐫1subscript𝐩1subscript𝐫𝑚subscript𝐩𝑚(\mathbf{r}_{1},\mathbf{p}_{1}),\dots,(\mathbf{r}_{m},\mathbf{p}_{m})( bold_r start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , bold_p start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ) , … , ( bold_r start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT , bold_p start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT ), and 𝐌ij=𝐩j(Si)𝐫j(Si)subscript𝐌𝑖𝑗subscript𝐩𝑗subscript𝑆𝑖subscript𝐫𝑗subscript𝑆𝑖\mathbf{M}_{ij}=\mathbf{p}_{j}(S_{i})-\mathbf{r}_{j}(S_{i})bold_M start_POSTSUBSCRIPT italic_i italic_j end_POSTSUBSCRIPT = bold_p start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ( italic_S start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) - bold_r start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ( italic_S start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ). In other words, 𝐌ijsubscript𝐌𝑖𝑗\mathbf{M}_{ij}bold_M start_POSTSUBSCRIPT italic_i italic_j end_POSTSUBSCRIPT is the net amount of Sisubscript𝑆𝑖S_{i}italic_S start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT produced when executing the j𝑗jitalic_j’th reaction. For instance, if the CRN has two reactions S1S2+2S3subscript𝑆1subscript𝑆22subscript𝑆3S_{1}\mathop{\rightarrow}\limits S_{2}+2S_{3}italic_S start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT → italic_S start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT + 2 italic_S start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT and 3S2+S3S1+S2+S33subscript𝑆2subscript𝑆3subscript𝑆1subscript𝑆2subscript𝑆33S_{2}+S_{3}\mathop{\rightarrow}\limits S_{1}+S_{2}+S_{3}3 italic_S start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT + italic_S start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT → italic_S start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT + italic_S start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT + italic_S start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT, then \optfull

𝐌=(111220).𝐌matrix111220\mathbf{M}=\begin{pmatrix}-1&1\\ 1&-2\\ 2&0\end{pmatrix}.bold_M = ( start_ARG start_ROW start_CELL - 1 end_CELL start_CELL 1 end_CELL end_ROW start_ROW start_CELL 1 end_CELL start_CELL - 2 end_CELL end_ROW start_ROW start_CELL 2 end_CELL start_CELL 0 end_CELL end_ROW end_ARG ) .
\opt

submission,final 𝐌=(111220).𝐌matrix111220\mathbf{M}=\begin{pmatrix}-1&1\\ 1&-2\\ 2&0\end{pmatrix}.bold_M = ( start_ARG start_ROW start_CELL - 1 end_CELL start_CELL 1 end_CELL end_ROW start_ROW start_CELL 1 end_CELL start_CELL - 2 end_CELL end_ROW start_ROW start_CELL 2 end_CELL start_CELL 0 end_CELL end_ROW end_ARG ) .

Remark 2.1.

Let 𝐮R𝐮superscript𝑅\mathbf{u}\in\mathbb{N}^{R}bold_u ∈ blackboard_N start_POSTSUPERSCRIPT italic_R end_POSTSUPERSCRIPT. Then the vector 𝐌𝐮Λ𝐌𝐮superscriptΛ\mathbf{M}\mathbf{u}\in\mathbb{Z}^{\Lambda}bold_Mu ∈ blackboard_Z start_POSTSUPERSCRIPT roman_Λ end_POSTSUPERSCRIPT represents the change in species counts that results from applying reactions by amounts described in 𝐮𝐮\mathbf{u}bold_u. In the above example, if 𝐮=(2,1)𝐮21\mathbf{u}=(2,1)bold_u = ( 2 , 1 ), then 𝐌𝐮=(1,0,4)𝐌𝐮104\mathbf{M}\mathbf{u}=(-1,0,4)bold_Mu = ( - 1 , 0 , 4 ), meaning that executing the first reaction twice (𝐮1=2subscript𝐮12\mathbf{u}_{1}=2bold_u start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = 2) and the second reaction once (𝐮2=1subscript𝐮21\mathbf{u}_{2}=1bold_u start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT = 1) causes S1subscript𝑆1S_{1}italic_S start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT to decrease by 1, S2subscript𝑆2S_{2}italic_S start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT to stay the same, and S3subscript𝑆3S_{3}italic_S start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT to increase by 4.

2.3 Stable computation with CRNs

To capture the result of computations done by a CRN, we generalize the definitions to include information about how to interpret the final configuration after letting the CRN run until the result cannot change anymore (characterized below as stable computation). Computation primarily involves two classes of functions: 1. evaluating predicates to determine properties of the input (akin to deciding a set defined by these properties), and 2. executing general functions that map an input configuration to an output, denoted as f:k:𝑓superscript𝑘f:\mathbb{N}^{k}\rightarrow\mathbb{N}italic_f : blackboard_N start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT → blackboard_N.

A chemical reaction decider (CRD) is a tuple 𝒟=(Λ,R,Σ,ΥY,ΥN,𝐬)𝒟Λ𝑅ΣsubscriptΥYsubscriptΥN𝐬\mathcal{D}=(\Lambda,R,\Sigma,\Upsilon_{\mathrm{Y}},\Upsilon_{\mathrm{N}},% \mathbf{s})caligraphic_D = ( roman_Λ , italic_R , roman_Σ , roman_Υ start_POSTSUBSCRIPT roman_Y end_POSTSUBSCRIPT , roman_Υ start_POSTSUBSCRIPT roman_N end_POSTSUBSCRIPT , bold_s ), where (Λ,R)Λ𝑅(\Lambda,R)( roman_Λ , italic_R ) is a CRN, ΣΛΣΛ\Sigma\subseteq\Lambdaroman_Σ ⊆ roman_Λ is the set of input species, ΥYΛsubscriptΥYΛ\Upsilon_{\mathrm{Y}}\subseteq\Lambdaroman_Υ start_POSTSUBSCRIPT roman_Y end_POSTSUBSCRIPT ⊆ roman_Λ is the set of yes voters, and ΥNΛsubscriptΥNΛ\Upsilon_{\mathrm{N}}\subseteq\Lambdaroman_Υ start_POSTSUBSCRIPT roman_N end_POSTSUBSCRIPT ⊆ roman_Λ is the set of no voters. If ΥYΥN=ΛsubscriptΥYsubscriptΥNΛ\Upsilon_{\mathrm{Y}}\cup\Upsilon_{\mathrm{N}}=\Lambdaroman_Υ start_POSTSUBSCRIPT roman_Y end_POSTSUBSCRIPT ∪ roman_Υ start_POSTSUBSCRIPT roman_N end_POSTSUBSCRIPT = roman_Λ, we say the CRD is all-voting. We define a global output partial function Φ:Λ{0,1}:ΦsuperscriptΛ01\Phi:\mathbb{N}^{\Lambda}\longrightarrow\{0,1\}roman_Φ : blackboard_N start_POSTSUPERSCRIPT roman_Λ end_POSTSUPERSCRIPT ⟶ { 0 , 1 } as follows. Φ(𝐜)Φ𝐜\Phi(\mathbf{c})roman_Φ ( bold_c ) is undefined if either 𝐜=𝟎𝐜0\mathbf{c}=\mathbf{0}bold_c = bold_0, or if there exist SNΥNsubscript𝑆NsubscriptΥNS_{\mathrm{N}}\in\Upsilon_{\mathrm{N}}italic_S start_POSTSUBSCRIPT roman_N end_POSTSUBSCRIPT ∈ roman_Υ start_POSTSUBSCRIPT roman_N end_POSTSUBSCRIPT and SYΥYsubscript𝑆YsubscriptΥYS_{\mathrm{Y}}\in\Upsilon_{\mathrm{Y}}italic_S start_POSTSUBSCRIPT roman_Y end_POSTSUBSCRIPT ∈ roman_Υ start_POSTSUBSCRIPT roman_Y end_POSTSUBSCRIPT such that 𝐜(SN)>0𝐜subscript𝑆N0\mathbf{c}\left(S_{\mathrm{N}}\right)>0bold_c ( italic_S start_POSTSUBSCRIPT roman_N end_POSTSUBSCRIPT ) > 0 and 𝐜(SY)>0𝐜subscript𝑆Y0\mathbf{c}\left(S_{\mathrm{Y}}\right)>0bold_c ( italic_S start_POSTSUBSCRIPT roman_Y end_POSTSUBSCRIPT ) > 0. In other words, we require a unanimous vote as our output. We say 𝐜𝐜\mathbf{c}bold_c is stable if, for all 𝐜superscript𝐜\mathbf{c}^{\prime}bold_c start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT such that 𝐜𝐜𝐜superscript𝐜\mathbf{c}\Rightarrow\mathbf{c}^{\prime}bold_c ⇒ bold_c start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT, Φ(𝐜)=Φ(𝐜).Φ𝐜Φsuperscript𝐜\Phi(\mathbf{c})=\Phi(\mathbf{c}^{\prime}).roman_Φ ( bold_c ) = roman_Φ ( bold_c start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ) . We say a CRD 𝒟𝒟\mathcal{D}caligraphic_D stably decides the predicate ψ:Σ{0,1}:𝜓superscriptΣ01\psi:\mathbb{N}^{\Sigma}\rightarrow\{0,1\}italic_ψ : blackboard_N start_POSTSUPERSCRIPT roman_Σ end_POSTSUPERSCRIPT → { 0 , 1 } if, for any valid initial configuration 𝐢Λ𝐢superscriptΛ\mathbf{i}\in\mathbb{N}^{\Lambda}bold_i ∈ blackboard_N start_POSTSUPERSCRIPT roman_Λ end_POSTSUPERSCRIPT with 𝐢Σ=𝐢0𝐢Σsubscript𝐢0\mathbf{i}\upharpoonright\Sigma=\mathbf{i}_{0}bold_i ↾ roman_Σ = bold_i start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT, for all configurations 𝐜Λ,𝐢𝐜formulae-sequence𝐜superscriptΛ𝐢𝐜\mathbf{c}\in\mathbb{N}^{\Lambda},\mathbf{i}\Rightarrow\mathbf{c}bold_c ∈ blackboard_N start_POSTSUPERSCRIPT roman_Λ end_POSTSUPERSCRIPT , bold_i ⇒ bold_c implies 𝐜𝐜𝐜superscript𝐜\mathbf{c}\Rightarrow\mathbf{c}^{\prime}bold_c ⇒ bold_c start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT such that 𝐜superscript𝐜\mathbf{c}^{\prime}bold_c start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT is stable and Φ(𝐜)=ψ(𝐢0)Φsuperscript𝐜𝜓subscript𝐢0\Phi\left(\mathbf{c}^{\prime}\right)=\psi\left(\mathbf{i}_{0}\right)roman_Φ ( bold_c start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ) = italic_ψ ( bold_i start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ). We associate to a predicate ψ𝜓\psiitalic_ψ the set A=ψ1(1)𝐴superscript𝜓11A=\psi^{-1}(1)italic_A = italic_ψ start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT ( 1 ) of inputs on which ψ𝜓\psiitalic_ψ outputs 1, so we can equivalently say the CRD stably decides the set A.𝐴A.italic_A .

A chemical reaction computer (CRC)𝐶𝑅𝐶(CRC)( italic_C italic_R italic_C ) is a tuple 𝒞=(Λ,R,Σ,Y,𝐬)𝒞Λ𝑅Σ𝑌𝐬\mathcal{C}=(\Lambda,R,\Sigma,Y,\mathbf{s})caligraphic_C = ( roman_Λ , italic_R , roman_Σ , italic_Y , bold_s ), where (Λ,R)Λ𝑅(\Lambda,R)( roman_Λ , italic_R ) is a CRN, ΣΛΣΛ\Sigma\subset\Lambdaroman_Σ ⊂ roman_Λ is the set of input species, YΛ\Σ𝑌\ΛΣY\in\Lambda\backslash\Sigmaitalic_Y ∈ roman_Λ \ roman_Σ is the output species, and 𝐬Λ\Σ𝐬superscript\ΛΣ\mathbf{s}\in\mathbb{N}^{\Lambda\backslash\Sigma}bold_s ∈ blackboard_N start_POSTSUPERSCRIPT roman_Λ \ roman_Σ end_POSTSUPERSCRIPT is the initial context. A configuration 𝐨Λ𝐨superscriptΛ\mathbf{o}\in\mathbb{N}^{\Lambda}bold_o ∈ blackboard_N start_POSTSUPERSCRIPT roman_Λ end_POSTSUPERSCRIPT is stable if, for every 𝐜𝐜\mathbf{c}bold_c such that 𝐨𝐜,𝐨(Y)=𝐜(Y)formulae-sequence𝐨𝐜𝐨𝑌𝐜𝑌\mathbf{o}\Rightarrow\mathbf{c},\mathbf{o}(Y)=\mathbf{c}(Y)bold_o ⇒ bold_c , bold_o ( italic_Y ) = bold_c ( italic_Y ), i.e. the output can never change again. We say that 𝒞𝒞\mathcal{C}caligraphic_C stably computes a function f:k:𝑓superscript𝑘f:\mathbb{N}^{k}\rightarrow\mathbb{N}italic_f : blackboard_N start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT → blackboard_N if for any valid initial configuration 𝐢Σ𝐢superscriptΣ\mathbf{i}\in\mathbb{N}^{\Sigma}bold_i ∈ blackboard_N start_POSTSUPERSCRIPT roman_Σ end_POSTSUPERSCRIPT and any 𝐜Λ,𝐢𝐜formulae-sequence𝐜superscriptΛ𝐢𝐜\mathbf{c}\in\mathbb{N}^{\Lambda},\mathbf{i}\Rightarrow\mathbf{c}bold_c ∈ blackboard_N start_POSTSUPERSCRIPT roman_Λ end_POSTSUPERSCRIPT , bold_i ⇒ bold_c implies 𝐜𝐨𝐜𝐨\mathbf{c}\Rightarrow\mathbf{o}bold_c ⇒ bold_o such that 𝐨𝐨\mathbf{o}bold_o is stable and f(𝐢Σ)=𝐨(Y)𝑓𝐢Σ𝐨𝑌f(\mathbf{i}\upharpoonright\Sigma)=\mathbf{o}(Y)italic_f ( bold_i ↾ roman_Σ ) = bold_o ( italic_Y ) where 𝐢Σ𝐢Σ\mathbf{i}\upharpoonright\Sigmabold_i ↾ roman_Σ denotes restriction of 𝐢𝐢\mathbf{i}bold_i to ΣΣ\Sigmaroman_Σ.

For a CRD or CRC with initial context 𝐬𝐬\mathbf{s}bold_s and input species ΣΣ\Sigmaroman_Σ, we say a 𝐢𝐢\mathbf{i}bold_i is a valid initial configuration if 𝐢=𝐬+𝐱𝐢𝐬𝐱\mathbf{i}=\mathbf{s}+\mathbf{x}bold_i = bold_s + bold_x, where 𝐱(S)=0𝐱𝑆0\mathbf{x}(S)=0bold_x ( italic_S ) = 0 for all SΛΣ𝑆ΛΣS\in\Lambda\setminus\Sigmaitalic_S ∈ roman_Λ ∖ roman_Σ; i.e., 𝐢𝐢\mathbf{i}bold_i is the initial context plus only input species.table configuration.

2.4 Time model

The following model of stochastic chemical kinetics is widely used in quantitative biology and other fields dealing with chemical reactions between species present in small counts [Gillespie77]. It ascribes probabilities to execution sequences, and also defines the time of reactions, allowing us to study the computational complexity of the CRN computation in Sections 4 and 5. If the volume is defined to be n𝑛nitalic_n, the total number of molecules, then the time model is essentially equivalent to the notion of parallel time studied in population protocols [AngluinAE2008Fast]. In this paper, the rate constants of all reactions are 1111, and we define the kinetic model with this assumption. A reaction is unimolecular if it has one reactant and bimolecular if it has two reactants. We use no higher-order reactions in this paper.

The kinetics of a CRN is described by a continuous-time Markov process as follows. Given a fixed volume v>0𝑣0v>0italic_v > 0, the propensity of a unimolecular reaction α:X:𝛼𝑋\alpha:X\to\ldotsitalic_α : italic_X → … in configuration 𝐜𝐜\mathbf{c}bold_c is ρ(𝐜,α)=𝐜(X)𝜌𝐜𝛼𝐜𝑋\rho(\mathbf{c},\alpha)=\mathbf{c}(X)italic_ρ ( bold_c , italic_α ) = bold_c ( italic_X ). The propensity of a bimolecular reaction α:X+Y:𝛼𝑋𝑌\alpha:X+Y\to\ldotsitalic_α : italic_X + italic_Y → …, where XY𝑋𝑌X\neq Yitalic_X ≠ italic_Y, is ρ(𝐜,α)=𝐜(X)𝐜(Y)v𝜌𝐜𝛼𝐜𝑋𝐜𝑌𝑣\rho(\mathbf{c},\alpha)=\frac{\mathbf{c}(X)\mathbf{c}(Y)}{v}italic_ρ ( bold_c , italic_α ) = divide start_ARG bold_c ( italic_X ) bold_c ( italic_Y ) end_ARG start_ARG italic_v end_ARG. The propensity of a bimolecular reaction α:X+X:𝛼𝑋𝑋\alpha:X+X\to\ldotsitalic_α : italic_X + italic_X → … is ρ(𝐜,α)=12𝐜(X)(𝐜(X)1)v𝜌𝐜𝛼12𝐜𝑋𝐜𝑋1𝑣\rho(\mathbf{c},\alpha)=\frac{1}{2}\frac{\mathbf{c}(X)(\mathbf{c}(X)-1)}{v}italic_ρ ( bold_c , italic_α ) = divide start_ARG 1 end_ARG start_ARG 2 end_ARG divide start_ARG bold_c ( italic_X ) ( bold_c ( italic_X ) - 1 ) end_ARG start_ARG italic_v end_ARG. The propensity function determines the evolution of the system as follows. The time until the next reaction occurs is an exponential random variable with rate ρ(𝐜)=αRρ(𝐜,α)𝜌𝐜subscript𝛼𝑅𝜌𝐜𝛼\rho(\mathbf{c})=\sum_{\alpha\in R}\rho(\mathbf{c},\alpha)italic_ρ ( bold_c ) = ∑ start_POSTSUBSCRIPT italic_α ∈ italic_R end_POSTSUBSCRIPT italic_ρ ( bold_c , italic_α ) (note that ρ(𝐜)=0𝜌𝐜0\rho(\mathbf{c})=0italic_ρ ( bold_c ) = 0 if no reactions are applicable to 𝐜𝐜\mathbf{c}bold_c). The probability that next reaction will be a particular αnextsubscript𝛼next\alpha_{\text{next}}italic_α start_POSTSUBSCRIPT next end_POSTSUBSCRIPT is ρ(𝐜,αnext)ρ(𝐜)𝜌𝐜subscript𝛼next𝜌𝐜\frac{\rho(\mathbf{c},\alpha_{\text{next}})}{\rho(\mathbf{c})}divide start_ARG italic_ρ ( bold_c , italic_α start_POSTSUBSCRIPT next end_POSTSUBSCRIPT ) end_ARG start_ARG italic_ρ ( bold_c ) end_ARG.

The kinetic model is based on the physical assumption of well-mixedness that is valid in a dilute solution. Thus, we assume the finite density constraint, which stipulates that a volume required to execute a CRN must be proportional to the maximum molecular count obtained during execution [SolCooWinBru08]. In other words, the total concentration (molecular count per volume) is bounded. This realistically constrains the speed of the computation achievable by CRNs.

For a CRD or CRC stably computing a predicate/function, the stabilization time is the function t::𝑡t:\mathbb{N}\to\mathbb{N}italic_t : blackboard_N → blackboard_N defined for all n𝑛n\in\mathbb{N}italic_n ∈ blackboard_N as t(n)=𝑡𝑛absentt(n)=italic_t ( italic_n ) = the worst-case expected time to reach from any valid initial configuration of size n𝑛nitalic_n to a stable configuration.

2.5 Semilinear sets, predicates, functions

Definition 2.2.

A set Ld𝐿superscript𝑑L\subseteq\mathbb{N}^{d}italic_L ⊆ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT is linear if there are vectors 𝐛,𝐩1,,𝐩k𝐛subscript𝐩1subscript𝐩𝑘\mathbf{b},\mathbf{p}_{1},\dots,\mathbf{p}_{k}bold_b , bold_p start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , bold_p start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT such that L={𝐛+n1𝐩1++nk𝐩kn1,,nk}𝐿conditional-set𝐛subscript𝑛1subscript𝐩1subscript𝑛𝑘subscript𝐩𝑘subscript𝑛1subscript𝑛𝑘L=\{\mathbf{b}+n_{1}\mathbf{p}_{1}+\dots+n_{k}\mathbf{p}_{k}\mid n_{1},\dots,n% _{k}\in\mathbb{N}\}italic_L = { bold_b + italic_n start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT bold_p start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT + ⋯ + italic_n start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT bold_p start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ∣ italic_n start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_n start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ∈ blackboard_N }. A set is semilinear if it is a finite union of linear sets. A predicate ϕ:d{0,1}:italic-ϕsuperscript𝑑01\phi:\mathbb{N}^{d}\to\{0,1\}italic_ϕ : blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT → { 0 , 1 } is semilinear if the set ϕ1(1)superscriptitalic-ϕ11\phi^{-1}(1)italic_ϕ start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT ( 1 ) is semilinear. A function f:d:𝑓superscript𝑑f:\mathbb{N}^{d}\to\mathbb{N}italic_f : blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT → blackboard_N is semilinear if its graph {(𝐱,y)d+1f(𝐱)=y}conditional-set𝐱𝑦superscript𝑑1𝑓𝐱𝑦\{(\mathbf{x},y)\in\mathbb{N}^{d+1}\mid f(\mathbf{x})=y\}{ ( bold_x , italic_y ) ∈ blackboard_N start_POSTSUPERSCRIPT italic_d + 1 end_POSTSUPERSCRIPT ∣ italic_f ( bold_x ) = italic_y } is semilinear.

The following is a famous characterization of the computational power of CRNs [Angluin2006ComputationalPower, chen2023rate].

Theorem 2.3 ([Angluin2006ComputationalPower, chen2023rate]).

A predicate/function is stably computable by a CRD/CRC if and only if it is semilinear.

Definition 2.4.

Td𝑇superscript𝑑T\subseteq\mathbb{N}^{d}italic_T ⊆ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT is a threshold set is if there are constants c,w1,,wd𝑐subscript𝑤1subscript𝑤𝑑c,w_{1},\dots,w_{d}\in\mathbb{Z}italic_c , italic_w start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_w start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT ∈ blackboard_Z such that T={𝐱dw1𝐱(1)++wd𝐱(d)c}.𝑇conditional-set𝐱superscript𝑑subscript𝑤1𝐱1subscript𝑤𝑑𝐱𝑑𝑐T=\{\mathbf{x}\in\mathbb{N}^{d}\mid w_{1}\mathbf{x}(1)+\dots+w_{d}\mathbf{x}(d% )\leq c\}.italic_T = { bold_x ∈ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT ∣ italic_w start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT bold_x ( 1 ) + ⋯ + italic_w start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT bold_x ( italic_d ) ≤ italic_c } . Md𝑀superscript𝑑M\subseteq\mathbb{N}^{d}italic_M ⊆ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT is a mod set if there are constants c,m,w1,,wd𝑐𝑚subscript𝑤1subscript𝑤𝑑c,m,w_{1},\dots,w_{d}\in\mathbb{N}italic_c , italic_m , italic_w start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_w start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT ∈ blackboard_N such that M={𝐱dw1𝐱(1)++wd𝐱(d)cmodm}.𝑀conditional-set𝐱superscript𝑑subscript𝑤1𝐱1subscript𝑤𝑑𝐱𝑑modulo𝑐𝑚M=\{\mathbf{x}\in\mathbb{N}^{d}\mid w_{1}\mathbf{x}(1)+\dots+w_{d}\mathbf{x}(d% )\equiv c\mod m\}.italic_M = { bold_x ∈ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT ∣ italic_w start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT bold_x ( 1 ) + ⋯ + italic_w start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT bold_x ( italic_d ) ≡ italic_c roman_mod italic_m } .

The following well-known characterization of semilinear sets is useful.

Theorem 2.5 ([Ginsburg1966Semigroups]).

A set is semilinear if and only if it is a Boolean combination (union, intersection, complement) of threshold and mod sets.

3 Execution bounded chemical reaction networks

In this section, we define execution bounded CRNs and state a few alternate characterizations of the definition. \optsubmissionProofs are in the appendix. \optfinalconfProofs are in the full version of this paper.

Definition 3.1.

A CRN 𝒞𝒞\mathcal{C}caligraphic_C is execution bounded from configuration 𝐱𝐱\mathbf{x}bold_x if all executions =(𝐱,)𝐱\mathcal{E}=(\mathbf{x},\ldots)caligraphic_E = ( bold_x , … ) starting at 𝐱𝐱\mathbf{x}bold_x are finite. A CRD or CRC 𝒞𝒞\mathcal{C}caligraphic_C is execution bounded if it is execution bounded from every valid initial configuration. 𝒞𝒞\mathcal{C}caligraphic_C is entirely execution bounded if it is execution bounded from every configuration.

This is a distinct concept from the notion of “bounded” CRNs studied by Rackoff [Rackoff1978CoveringBoundedness] (studied under the equivlaent formalism of vector addition systems). That paper defines a CRN to be bounded from a configuration 𝐱𝐱\mathbf{x}bold_x if |𝗋𝖾𝖺𝖼𝗁(𝐱)|𝗋𝖾𝖺𝖼𝗁𝐱|\mathsf{reach}(\mathbf{x})|| sansserif_reach ( bold_x ) | is finite (and shows that the decision problem of determining whether this is true is 𝖤𝖷𝖯𝖲𝖯𝖠𝖢𝖤𝖤𝖷𝖯𝖲𝖯𝖠𝖢𝖤\mathsf{EXPSPACE}sansserif_EXPSPACE-complete.) We use the term execution bounded to avoid confusion with this concept.

{toappendix}

We first observe that being execution bounded from 𝐱𝐱\mathbf{x}bold_x implies a slightly stronger condition: there is a uniform upper bound on the length of all executions from 𝐱𝐱\mathbf{x}bold_x.111 In other words, this rules out the possibility that, although all executions from 𝐱𝐱\mathbf{x}bold_x are finite, there are infinitely many of them 1,2,subscript1subscript2\mathcal{E}_{1},\mathcal{E}_{2},\dotscaligraphic_E start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , caligraphic_E start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , …, each longer than the previous.

{observation}

A CRN is execution bounded from 𝐱𝐱\mathbf{x}bold_x if and only if there is a constant N𝑁N\in\mathbb{N}italic_N ∈ blackboard_N such that all executions from 𝐱𝐱\mathbf{x}bold_x have length at most N𝑁Nitalic_N. Equivalently, there are finitely many executions from 𝐱𝐱\mathbf{x}bold_x.

Proof 3.2.

We use Kőnig’s lemma to show that in the absence of an infinite path, the number of all possible paths must be finite, which directly implies a global bound on the length of all executions. We represent the set of all executions for 𝒞𝒞\mathcal{C}caligraphic_C as a tree where each edge represents a single reaction applied and each node stores the complete execution sequence starting from configuration 𝐱𝐱\mathbf{x}bold_x. Note that this construction is slightly different from a more straightforward graph with the reachable states as nodes, which would not give us a tree, since the same state can be reached by different executions. Formally, we generate the tree as follows: T𝒞(𝐱)=(V,E)subscript𝑇𝒞𝐱𝑉𝐸T_{\mathcal{C}}(\mathbf{x})=(V,E)italic_T start_POSTSUBSCRIPT caligraphic_C end_POSTSUBSCRIPT ( bold_x ) = ( italic_V , italic_E ) where V{{Λ} is a valid execution sequence starting from 𝐱}𝑉conditional-setsuperscriptsuperscriptΛ is a valid execution sequence starting from 𝐱V\triangleq\{\mathcal{E}\in\{\mathbb{N}^{\Lambda}\}^{*}\mid\mathcal{E}\text{ % is a valid execution sequence starting from }\mathbf{x}\}italic_V ≜ { caligraphic_E ∈ { blackboard_N start_POSTSUPERSCRIPT roman_Λ end_POSTSUPERSCRIPT } start_POSTSUPERSCRIPT ∗ end_POSTSUPERSCRIPT ∣ caligraphic_E is a valid execution sequence starting from bold_x }, E{(1,2)12|2|=|1|+1E\triangleq\{(\mathcal{E}_{1},\mathcal{E}_{2})\mid\mathcal{E}_{1}\preceq% \mathcal{E}_{2}\land|\mathcal{E}_{2}|=|\mathcal{E}_{1}|+1italic_E ≜ { ( caligraphic_E start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , caligraphic_E start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ) ∣ caligraphic_E start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ⪯ caligraphic_E start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ∧ | caligraphic_E start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT | = | caligraphic_E start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT | + 1}. In other words, all the executions from 𝐱𝐱\mathbf{x}bold_x of length d𝑑ditalic_d are the nodes at depth d𝑑ditalic_d of this tree. One can think of the nodes as being labeled by configurations rather than executions (specifically the final configuration of the execution, with the tree rooted at 𝐱𝐱\mathbf{x}bold_x), but the same configuration can label multiple nodes if it can be reached from 𝐱𝐱\mathbf{x}bold_x via different executions. In this case the children of a configuration are those that are reachable from it by applying a single reaction.

This tree is finitely branching, as we can only choose from a finite number of reactions at any node. By definition of execution bounded, there is no execution sequence with an infinite length. Due to the bijection between paths in T𝒞(𝐱)subscript𝑇𝒞𝐱T_{\mathcal{C}}(\mathbf{x})italic_T start_POSTSUBSCRIPT caligraphic_C end_POSTSUBSCRIPT ( bold_x ) and executions possible in 𝒞𝒞\mathcal{C}caligraphic_C, there is no infinite path in the tree. By Kőnig’s Lemma, the tree has a finite number of nodes, guaranteeing a single bound N𝑁Nitalic_N (the depth of the tree) on the length of every execution.

The next lemma characterizes execution boundedness as equivalent to having a finite reachable state space with no cycles.

Lemma 3.3.

A CRN is execution bounded from 𝐱𝐱\mathbf{x}bold_x if and only if 𝗋𝖾𝖺𝖼𝗁(x)={𝐲𝐱𝐲}𝗋𝖾𝖺𝖼𝗁𝑥conditional-set𝐲𝐱𝐲\mathsf{reach}(x)=\{\mathbf{y}\mid\mathbf{x}\Rightarrow\mathbf{y}\}sansserif_reach ( italic_x ) = { bold_y ∣ bold_x ⇒ bold_y } is finite and, for all 𝐲𝗋𝖾𝖺𝖼𝗁(x)𝐲𝗋𝖾𝖺𝖼𝗁𝑥\mathbf{y}\in\mathsf{reach}(x)bold_y ∈ sansserif_reach ( italic_x ), 𝐲⇏𝐲⇏𝐲𝐲\mathbf{y}\not\Rightarrow\mathbf{y}bold_y ⇏ bold_y except by the zero-length execution.

Proof 3.4.

Every configuration reachable from 𝐱𝐱\mathbf{x}bold_x is reached through some execution contained in T𝒞(𝐱)subscript𝑇𝒞𝐱T_{\mathcal{C}}(\mathbf{x})italic_T start_POSTSUBSCRIPT caligraphic_C end_POSTSUBSCRIPT ( bold_x ) as a node and there exists only a finite number of them (Section 3). Multiple unique executions can produce the same configuration but one execution cannot produce multiple configurations. Thus, there exists a surjection from the nodes of T𝒞(𝐱)subscript𝑇𝒞𝐱T_{\mathcal{C}}(\mathbf{x})italic_T start_POSTSUBSCRIPT caligraphic_C end_POSTSUBSCRIPT ( bold_x ) into 𝗋𝖾𝖺𝖼𝗁(x)𝗋𝖾𝖺𝖼𝗁𝑥\mathsf{reach}(x)sansserif_reach ( italic_x ) and 𝗋𝖾𝖺𝖼𝗁(x)𝗋𝖾𝖺𝖼𝗁𝑥\mathsf{reach}(x)sansserif_reach ( italic_x ) must also be finite. For the second part of the condition, we prove its contrapositive and assume there exists 𝐲𝗋𝖾𝖺𝖼𝗁(x)𝐲𝗋𝖾𝖺𝖼𝗁𝑥\mathbf{y}\in\mathsf{reach}(x)bold_y ∈ sansserif_reach ( italic_x ), 𝐲P𝐲|P|>0subscript𝑃𝐲𝐲𝑃0\mathbf{y}\Rightarrow_{P}\mathbf{y}\land|P|>0bold_y ⇒ start_POSTSUBSCRIPT italic_P end_POSTSUBSCRIPT bold_y ∧ | italic_P | > 0. Let P=(𝐩1,𝐩2,,𝐩n)𝑃subscript𝐩1subscript𝐩2subscript𝐩𝑛P=(\mathbf{p}_{1},\mathbf{p}_{2},\dots,\mathbf{p}_{n})italic_P = ( bold_p start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , bold_p start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , … , bold_p start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT ). It holds that 𝐩1=𝐩nsubscript𝐩1subscript𝐩𝑛\mathbf{p}_{1}=\mathbf{p}_{n}bold_p start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = bold_p start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT and 𝐩n1𝐩1subscript𝐩𝑛1subscript𝐩1\mathbf{p}_{n-1}\Rightarrow\mathbf{p}_{1}bold_p start_POSTSUBSCRIPT italic_n - 1 end_POSTSUBSCRIPT ⇒ bold_p start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT. We can construct an infinite-length execution P=(𝐱,,𝐩1,,𝐩n1,𝐩1,)superscript𝑃𝐱subscript𝐩1subscript𝐩𝑛1subscript𝐩1P^{\prime}=(\mathbf{x},\dots,\mathbf{p}_{1},\dots,\mathbf{p}_{n-1},\mathbf{p}_% {1},\dots)italic_P start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT = ( bold_x , … , bold_p start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , bold_p start_POSTSUBSCRIPT italic_n - 1 end_POSTSUBSCRIPT , bold_p start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … ), which must also be a valid under the reactions of 𝒞𝒞\mathcal{C}caligraphic_C, making 𝒞𝒞\mathcal{C}caligraphic_C execution unbounded from 𝐱𝐱\mathbf{x}bold_x.

If 𝗋𝖾𝖺𝖼𝗁(x)𝗋𝖾𝖺𝖼𝗁𝑥\mathsf{reach}(x)sansserif_reach ( italic_x ) is finite and contains no such 𝐲𝐲\mathbf{y}bold_y, then we can construct a finite, directed, acyclic graph G𝒞(𝐱)=(V,E)subscript𝐺𝒞𝐱𝑉𝐸G_{\mathcal{C}}(\mathbf{x})=(V,E)italic_G start_POSTSUBSCRIPT caligraphic_C end_POSTSUBSCRIPT ( bold_x ) = ( italic_V , italic_E ) where V=𝗋𝖾𝖺𝖼𝗁(x)𝑉𝗋𝖾𝖺𝖼𝗁𝑥V=\mathsf{reach}(x)italic_V = sansserif_reach ( italic_x ), E={(𝐱,𝐲)𝐱P𝐲|P|>0}𝐸conditional-set𝐱𝐲subscript𝑃𝐱𝐲𝑃0E=\{(\mathbf{x},\mathbf{y})\mid\mathbf{x}\Rightarrow_{P}\mathbf{y}\land|P|>0\}italic_E = { ( bold_x , bold_y ) ∣ bold_x ⇒ start_POSTSUBSCRIPT italic_P end_POSTSUBSCRIPT bold_y ∧ | italic_P | > 0 }. The longest path in the graph has length of at most |𝗋𝖾𝖺𝖼𝗁(x)|1𝗋𝖾𝖺𝖼𝗁𝑥1|\mathsf{reach}(x)|-1| sansserif_reach ( italic_x ) | - 1. A bijection exists between paths in G𝒞(𝐱)subscript𝐺𝒞𝐱G_{\mathcal{C}}(\mathbf{x})italic_G start_POSTSUBSCRIPT caligraphic_C end_POSTSUBSCRIPT ( bold_x ) and executions possible in 𝒞𝒞\mathcal{C}caligraphic_C starting from 𝐱𝐱\mathbf{x}bold_x. We set n=|𝗋𝖾𝖺𝖼𝗁(x)|𝑛𝗋𝖾𝖺𝖼𝗁𝑥n=|\mathsf{reach}(x)|italic_n = | sansserif_reach ( italic_x ) | satisfying that each execution has length of at most n𝑛nitalic_n, making 𝒞𝒞\mathcal{C}caligraphic_C execution bounded.

The following result is used frequently in impossibility proofs for CRNs and population protocols, and it will help us prove another characterization of execution bounded CRNs in Section 3.

Lemma 3.5.

(Dickson’s Lemma) For every infinite sequence of nonnegative integer vectors 𝐱1,𝐱2,ksubscript𝐱1subscript𝐱2superscript𝑘\mathbf{x}_{1},\mathbf{x}_{2},\dots\in\mathbb{N}^{k}bold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , bold_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , ⋯ ∈ blackboard_N start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT, there are i<j𝑖𝑗i<jitalic_i < italic_j such that 𝐱i𝐱jsubscript𝐱𝑖subscript𝐱𝑗\mathbf{x}_{i}\leqq\mathbf{x}_{j}bold_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ≦ bold_x start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT.

We first observe an equivalent characterization of execution bounded that will be useful in the negative results of Section 6. \optsubmissionA proof is in the appendix.

Definition 3.6.

A execution =(𝐱1,𝐱2,)subscript𝐱1subscript𝐱2\mathcal{E}=(\mathbf{x}_{1},\mathbf{x}_{2},\dots)caligraphic_E = ( bold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , bold_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , … ) is self-covering if for some i<j𝑖𝑗i<jitalic_i < italic_j, 𝐱i𝐱jsubscript𝐱𝑖subscript𝐱𝑗\mathbf{x}_{i}\leqq\mathbf{x}_{j}bold_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ≦ bold_x start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT. It is strictly self-covering if 𝐱i𝐱jsubscript𝐱𝑖subscript𝐱𝑗\mathbf{x}_{i}\leq\mathbf{x}_{j}bold_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ≤ bold_x start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT. We also refer to these as (strict) self-covering paths.222 Rackoff [Rackoff1978CoveringBoundedness] uses the term “self-covering” to mean what we call strictly self-covering here, and points out that Karp and Miller [karp1969parallel] showed that |𝗋𝖾𝖺𝖼𝗁(𝐱)|𝗋𝖾𝖺𝖼𝗁𝐱|\mathsf{reach}(\mathbf{x})|| sansserif_reach ( bold_x ) | is infinite if and only if there is a strictly self-covering path from 𝐱𝐱\mathbf{x}bold_x. The distinction between these concepts is illustrated by the CRN AB𝐴𝐵A\mathop{\rightleftharpoons}\limits Bitalic_A ⇌ italic_B. From any configuration 𝐱𝐱\mathbf{x}bold_x, 𝗋𝖾𝖺𝖼𝗁(𝐱)𝗋𝖾𝖺𝖼𝗁𝐱\mathsf{reach}(\mathbf{x})sansserif_reach ( bold_x ) is finite (|𝗋𝖾𝖺𝖼𝗁(𝐱)|=𝐱(A)+𝐱(B)+1𝗋𝖾𝖺𝖼𝗁𝐱𝐱𝐴𝐱𝐵1|\mathsf{reach}(\mathbf{x})|=\mathbf{x}(A)+\mathbf{x}(B)+1| sansserif_reach ( bold_x ) | = bold_x ( italic_A ) + bold_x ( italic_B ) + 1), and there is no strict self-covering path. However, from (say) {A}𝐴\{A\}{ italic_A }, there is a (nonstrict) self-covering path {A}{B}{A}𝐴𝐵𝐴\{A\}\Rightarrow\{B\}\Rightarrow\{A\}{ italic_A } ⇒ { italic_B } ⇒ { italic_A }, and by repeating, this CRN has an infinite cycling execution within its finite configuration space 𝗋𝖾𝖺𝖼𝗁({A})={{A},{B}}𝗋𝖾𝖺𝖼𝗁𝐴𝐴𝐵\mathsf{reach}(\{A\})=\{\{A\},\{B\}\}sansserif_reach ( { italic_A } ) = { { italic_A } , { italic_B } }.

{lemmarep}

A CRN is execution bounded from 𝐱𝐱\mathbf{x}bold_x if and only if there is no self-covering path from 𝐱𝐱\mathbf{x}bold_x.

Proof 3.7.

For the forward direction, assume there is a self-covering path from 𝐱𝐱\mathbf{x}bold_x, which reaches to 𝐱isubscript𝐱𝑖\mathbf{x}_{i}bold_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and later to 𝐱j𝐱isubscript𝐱𝑗subscript𝐱𝑖\mathbf{x}_{j}\geqq\mathbf{x}_{i}bold_x start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ≧ bold_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT. Then the reactions going from 𝐱isubscript𝐱𝑖\mathbf{x}_{i}bold_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT to 𝐱jsubscript𝐱𝑗\mathbf{x}_{j}bold_x start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT can be repeated indefinitely (in a cycle if 𝐱i=𝐱jsubscript𝐱𝑖subscript𝐱𝑗\mathbf{x}_{i}=\mathbf{x}_{j}bold_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = bold_x start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT, and increasing some molecular counts unboundedly if 𝐱i𝐱jsubscript𝐱𝑖subscript𝐱𝑗\mathbf{x}_{i}\leq\mathbf{x}_{j}bold_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ≤ bold_x start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT), so 𝒞𝒞\mathcal{C}caligraphic_C is not execution bounded from 𝐱𝐱\mathbf{x}bold_x.

For the reverse direction, assume 𝒞𝒞\mathcal{C}caligraphic_C is not execution bounded from 𝐱𝐱\mathbf{x}bold_x. Then there is an infinite execution =(𝐱=𝐱1,𝐱2,𝐱3,).𝐱subscript𝐱1subscript𝐱2subscript𝐱3\mathcal{E}=(\mathbf{x}=\mathbf{x}_{1},\mathbf{x}_{2},\mathbf{x}_{3},\dots).caligraphic_E = ( bold_x = bold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , bold_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , bold_x start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT , … ) . By Dickson’s Lemma there are i<j𝑖𝑗i<jitalic_i < italic_j such that 𝐱i𝐱jsubscript𝐱𝑖subscript𝐱𝑗\mathbf{x}_{i}\leqq\mathbf{x}_{j}bold_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ≦ bold_x start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT, i.e., \mathcal{E}caligraphic_E is self-covering.

4 Execution bounded CRDs stably decide all semilinear sets

In this section, we will show the computational equivalence between execution bounded and execution unbounded CRNs by a construction. The following is the main result of this section.

Theorem 4.1.

Exactly the semilinear sets are stably decidable by execution bounded CRDs. Furthermore, each can be stably decided with expected stabilization time Θ(nlogn)Θ𝑛𝑛\Theta(n\log n)roman_Θ ( italic_n roman_log italic_n ).

Since semilinear sets are Boolean combinations of mod and threshold predicates, we prove this theorem by showing that execution bounded CRDs can decide mod and threshold sets individually as well as any Boolean combination in the following lemmas. To ensure execution boundedness in the last step, we require the following property.

Definition 4.2.

Let 𝒟𝒟\mathcal{D}caligraphic_D be a CRD with voting species ΥΥ\Upsilonroman_Υ. We say 𝒟𝒟\mathcal{D}caligraphic_D is single-voting if for any valid initial configuration 𝐢Σ𝐢superscriptΣ\mathbf{i}\in\mathbb{N}^{\Sigma}bold_i ∈ blackboard_N start_POSTSUPERSCRIPT roman_Σ end_POSTSUPERSCRIPT and any 𝐜Λ𝐜superscriptΛ\mathbf{c}\in\mathbb{N}^{\Lambda}bold_c ∈ blackboard_N start_POSTSUPERSCRIPT roman_Λ end_POSTSUPERSCRIPT s.t. 𝐢𝐜𝐢𝐜\mathbf{i}\Rightarrow\mathbf{c}bold_i ⇒ bold_c, VΥ𝐜(V)=1subscript𝑉Υ𝐜𝑉1\sum_{V\in\Upsilon}\mathbf{c}(V)=1∑ start_POSTSUBSCRIPT italic_V ∈ roman_Υ end_POSTSUBSCRIPT bold_c ( italic_V ) = 1, i.e., exactly one voter is present in every reachable configuration.

{lemmarep}

Every mod set M={(x1,,xd)i=1dwixicmodm}𝑀conditional-setsubscript𝑥1subscript𝑥𝑑superscriptsubscript𝑖1𝑑subscript𝑤𝑖subscript𝑥𝑖modulo𝑐𝑚M=\big{\{}\left(x_{1},\ldots,x_{d}\right)\mid\sum_{i=1}^{d}w_{i}x_{i}\equiv c% \bmod m\big{\}}italic_M = { ( italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_x start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT ) ∣ ∑ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT italic_w start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ≡ italic_c roman_mod italic_m } is stably decidable by an execution bounded, single-voting CRD with stabilization time Θ(nlogn)Θ𝑛𝑛\Theta(n\log n)roman_Θ ( italic_n roman_log italic_n ).

We design a CRD 𝒟𝒟\mathcal{D}caligraphic_D with exactly one leader present at all times, cycling through m𝑚mitalic_m “states” while consuming the input and accepting on state c𝑐citalic_c. Let Σ={X1,,Xd}Σsubscript𝑋1subscript𝑋𝑑\Sigma=\{X_{1},\dots,X_{d}\}roman_Σ = { italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_X start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT } be the set of input species and start with only one L0subscript𝐿0L_{0}italic_L start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT leader, i.e. set the initial context 𝐬(L0)=1𝐬subscript𝐿01\mathbf{s}(L_{0})=1bold_s ( italic_L start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ) = 1 and 𝐬(S)=0𝐬𝑆0\mathbf{s}(S)=0bold_s ( italic_S ) = 0 for all other species. For each i{1,,d},j{0,,m1}formulae-sequence𝑖1𝑑𝑗0𝑚1i\in\{1,\dots,d\},j\in\{0,\dots,m-1\}italic_i ∈ { 1 , … , italic_d } , italic_j ∈ { 0 , … , italic_m - 1 } add the following reaction: Xi+LjLj+wimodm.subscript𝑋𝑖subscript𝐿𝑗subscript𝐿modulo𝑗subscript𝑤𝑖𝑚X_{i}+L_{j}\rightarrow L_{j+w_{i}\bmod m}.italic_X start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT + italic_L start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT → italic_L start_POSTSUBSCRIPT italic_j + italic_w start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT roman_mod italic_m end_POSTSUBSCRIPT . Let only Lcsubscript𝐿𝑐L_{c}italic_L start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT vote yes and all other species no, i.e. Υ={Lc}Υsubscript𝐿𝑐\Upsilon=\{L_{c}\}roman_Υ = { italic_L start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT }. For any valid initial configuration, 𝒟𝒟\mathcal{D}caligraphic_D reaches a stable configuration which votes yes if and only if the input is in the mod set, and no otherwise. \optsubmissionThe time and execution boundedness are proven in the appendix.

Proof 4.3.

𝒟𝒟\mathcal{D}caligraphic_D terminates with the correct output value: At any point in time, there is a single leader Ljsubscript𝐿𝑗L_{j}italic_L start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT present (the initial configuration contains a single leader and each reaction produces and consumes one). Every reaction satisfies the following invariant (for the leader’s subscript j𝑗jitalic_j): ji=1dwiximodm𝑗modulosuperscriptsubscript𝑖1𝑑subscript𝑤𝑖superscriptsubscript𝑥𝑖𝑚j\equiv\sum_{i=1}^{d}w_{i}x_{i}^{\prime}\bmod mitalic_j ≡ ∑ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT italic_w start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT roman_mod italic_m where xisuperscriptsubscript𝑥𝑖x_{i}^{\prime}italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT is the updated count of species Xisubscript𝑋𝑖X_{i}italic_X start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT in the current configuration. By design of 𝒟𝒟\mathcal{D}caligraphic_D, there will be a reaction applicable as long as there are copies of Xisubscript𝑋𝑖X_{i}italic_X start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT (a leader with any subscript can react with any Xisubscript𝑋𝑖X_{i}italic_X start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT). After applying this reaction as often as possible, we have reached a stable configuration with Li=1dwiximodmsubscript𝐿modulosuperscriptsubscript𝑖1𝑑subscript𝑤𝑖subscript𝑥𝑖𝑚L_{\sum_{i=1}^{d}w_{i}x_{i}\bmod m}italic_L start_POSTSUBSCRIPT ∑ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT italic_w start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT roman_mod italic_m end_POSTSUBSCRIPT as the only species present.

𝒟𝒟\mathcal{D}caligraphic_D is execution bounded: Every reaction reduces the count of chemicals by one. Every possible execution contains exactly 𝐢norm𝐢\|\mathbf{i}\|∥ bold_i ∥ configurations, where 𝐢norm𝐢\|\mathbf{i}\|∥ bold_i ∥ is the number of all molecules in the starting configuration.

𝒟𝒟\mathcal{D}caligraphic_D is single-voting: Initially, L0subscript𝐿0L_{0}italic_L start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT is present and the only voter. Every valid input contains no voter and every reaction results in no change to the count of copies of Lisubscript𝐿𝑖L_{i}italic_L start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT.

𝒟𝒟\mathcal{D}caligraphic_D stabilizes in Θ(nlogn)Θ𝑛𝑛\Theta(n\log n)roman_Θ ( italic_n roman_log italic_n ) time: We start with #L=1,#X=nformulae-sequence#𝐿1#𝑋𝑛\#L=1,\#X=n# italic_L = 1 , # italic_X = italic_n in volume n𝑛nitalic_n. n𝑛nitalic_n reactions must occur before 𝒟𝒟\mathcal{D}caligraphic_D terminates. For the first reaction, we have a rate of λ=n1n𝜆𝑛1𝑛\lambda=\frac{n\cdot 1}{n}italic_λ = divide start_ARG italic_n ⋅ 1 end_ARG start_ARG italic_n end_ARG, for the last (with only the leader and one X𝑋Xitalic_X present), our rate will be λ=11n𝜆11𝑛\lambda=\frac{1\cdot 1}{n}italic_λ = divide start_ARG 1 ⋅ 1 end_ARG start_ARG italic_n end_ARG. Thus, the expected time for all n𝑛nitalic_n reactions to complete is

i=1nni=ni=1n1i=Θ(nlogn).superscriptsubscript𝑖1𝑛𝑛𝑖𝑛superscriptsubscript𝑖1𝑛1𝑖Θ𝑛𝑛\sum_{i=1}^{n}\frac{n}{i}=n\sum_{i=1}^{n}\frac{1}{i}=\Theta(n\log n).∑ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT divide start_ARG italic_n end_ARG start_ARG italic_i end_ARG = italic_n ∑ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT divide start_ARG 1 end_ARG start_ARG italic_i end_ARG = roman_Θ ( italic_n roman_log italic_n ) .
{lemmarep}

Every threshold set T={(x1,,xd)i=1dwixit}𝑇conditional-setsubscript𝑥1subscript𝑥𝑑superscriptsubscript𝑖1𝑑subscript𝑤𝑖subscript𝑥𝑖𝑡T=\big{\{}(x_{1},\ldots,x_{d})\mid\sum_{i=1}^{d}w_{i}x_{i}\geq t\big{\}}italic_T = { ( italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_x start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT ) ∣ ∑ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT italic_w start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ≥ italic_t } is stably decidable by an execution bounded, single-voting CRD with stabilization time Θ(nlogn)Θ𝑛𝑛\Theta(n\log n)roman_Θ ( italic_n roman_log italic_n ).

We design a CRD 𝒟𝒟\mathcal{D}caligraphic_D which multiplies the input molecules according to their weight and consumes positive and negative units alternatingly using a single leader. Once no more reaction is applicable, the leader’s state will indicate whether or not there are positive units left and the threshold is met. Let Σ={X1,,Xd}Σsubscript𝑋1subscript𝑋𝑑\Sigma=\{X_{1},\dots,X_{d}\}roman_Σ = { italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_X start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT } be the set of input species and Υ={LY}Υsubscript𝐿𝑌\Upsilon=\{L_{Y}\}roman_Υ = { italic_L start_POSTSUBSCRIPT italic_Y end_POSTSUBSCRIPT } the yes voter. We first add reactions to multiply the input species by their respective weights. For all i{1,,d}𝑖1𝑑i\in\{1,\dots,d\}italic_i ∈ { 1 , … , italic_d }, add the reaction:

Xi{wiPif wi>0wiNif wi<0otherwisesubscript𝑋𝑖casessubscript𝑤𝑖𝑃if subscript𝑤𝑖0subscript𝑤𝑖𝑁if subscript𝑤𝑖0otherwise\displaystyle X_{i}\rightarrow\begin{cases}w_{i}P&\text{if }w_{i}>0\\ -w_{i}N&\text{if }w_{i}<0\\ \emptyset&\text{otherwise}\end{cases}italic_X start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT → { start_ROW start_CELL italic_w start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT italic_P end_CELL start_CELL if italic_w start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT > 0 end_CELL end_ROW start_ROW start_CELL - italic_w start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT italic_N end_CELL start_CELL if italic_w start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT < 0 end_CELL end_ROW start_ROW start_CELL ∅ end_CELL start_CELL otherwise end_CELL end_ROW (5)

P𝑃Pitalic_P and N𝑁Nitalic_N represent “positive” and “negative” units respectively. Now add reactions to consume P𝑃Pitalic_P and N𝑁Nitalic_N alternatingly using a leader until we run out of one species:

LY+Nsubscript𝐿𝑌𝑁\displaystyle L_{Y}+Nitalic_L start_POSTSUBSCRIPT italic_Y end_POSTSUBSCRIPT + italic_N LNabsentsubscript𝐿𝑁\displaystyle\rightarrow L_{N}→ italic_L start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT (6)
LN+Psubscript𝐿𝑁𝑃\displaystyle L_{N}+Pitalic_L start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT + italic_P LYabsentsubscript𝐿𝑌\displaystyle\rightarrow L_{Y}→ italic_L start_POSTSUBSCRIPT italic_Y end_POSTSUBSCRIPT (7)

Finally, initialize the CRD with one LYsubscript𝐿𝑌L_{Y}italic_L start_POSTSUBSCRIPT italic_Y end_POSTSUBSCRIPT and the threshold number t𝑡titalic_t copies of P𝑃Pitalic_P (or tN𝑡𝑁-tN- italic_t italic_N if t𝑡titalic_t is negative), i.e. 𝐬(LY)=1𝐬subscript𝐿𝑌1\mathbf{s}(L_{Y})=1bold_s ( italic_L start_POSTSUBSCRIPT italic_Y end_POSTSUBSCRIPT ) = 1, 𝐬(P)=t𝐬𝑃𝑡\mathbf{s}(P)=tbold_s ( italic_P ) = italic_t if t>0𝑡0t>0italic_t > 0, or 𝐬(N)=t𝐬𝑁𝑡\mathbf{s}(N)=-tbold_s ( italic_N ) = - italic_t if t<0𝑡0t<0italic_t < 0, and 𝐬(S)=0𝐬𝑆0\mathbf{s}(S)=0bold_s ( italic_S ) = 0 for all other species. For any valid initial configuration, 𝒟𝒟\mathcal{D}caligraphic_D reaches a stable configuration which votes yes if and only if the weighted sum of inputs is above the threshold, and no otherwise. \optsubmissionThe execution time is proven in the appendix.

Proof 4.4.

𝒟𝒟\mathcal{D}caligraphic_D is single-voting since it starts with a single leader and no reaction changes the count of LBsubscript𝐿𝐵L_{B}italic_L start_POSTSUBSCRIPT italic_B end_POSTSUBSCRIPT molecules.

𝒟𝒟\mathcal{D}caligraphic_D stabilizes in Θ(nlogn)Θ𝑛𝑛\Theta(n\log n)roman_Θ ( italic_n roman_log italic_n ) time: First, all input species will be converted to wisubscript𝑤𝑖w_{i}italic_w start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT instances of P𝑃Pitalic_P or N𝑁Nitalic_N. We run these reactions until no Xisubscript𝑋𝑖X_{i}italic_X start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT. As they are independent of molecules other than the reactant, these reactions have a rate of λ=i𝜆𝑖\lambda=iitalic_λ = italic_i, so the expected time until the next reaction is 1i1𝑖\frac{1}{i}divide start_ARG 1 end_ARG start_ARG italic_i end_ARG. The total time for reactions (5) to complete is therefore i=1n1i=Θ(logn)superscriptsubscript𝑖1𝑛1𝑖𝛩𝑛\sum_{i=1}^{n}\frac{1}{i}=\mathit{\Theta}(\log n)∑ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT divide start_ARG 1 end_ARG start_ARG italic_i end_ARG = italic_Θ ( roman_log italic_n ). The time for reactions (6) and (7) on the other hand is asymptotically dominated by the last reaction, where #L=1#𝐿1\#L=1# italic_L = 1 and #B=1#𝐵1\#B=1# italic_B = 1, where B{P,N}𝐵𝑃𝑁B\in\{P,N\}italic_B ∈ { italic_P , italic_N }, so λ=11n𝜆11𝑛\lambda=\frac{1\cdot 1}{n}italic_λ = divide start_ARG 1 ⋅ 1 end_ARG start_ARG italic_n end_ARG. Let nP,nNsubscript𝑛𝑃subscript𝑛𝑁n_{P},n_{N}italic_n start_POSTSUBSCRIPT italic_P end_POSTSUBSCRIPT , italic_n start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT be the counts of P,N𝑃𝑁P,Nitalic_P , italic_N and assume without loss of generality nPnNsubscript𝑛𝑃subscript𝑛𝑁n_{P}\geq n_{N}italic_n start_POSTSUBSCRIPT italic_P end_POSTSUBSCRIPT ≥ italic_n start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT. We get:

i=0nN1n(nPi)+n(nNi)i=0nN12n(nNi)=2ni=1nN1i=Θ(nlogn).superscriptsubscript𝑖0subscript𝑛𝑁1𝑛subscript𝑛𝑃𝑖𝑛subscript𝑛𝑁𝑖superscriptsubscript𝑖0subscript𝑛𝑁12𝑛subscript𝑛𝑁𝑖2𝑛superscriptsubscript𝑖1subscript𝑛𝑁1𝑖Θ𝑛𝑛\sum_{i=0}^{n_{N}-1}\frac{n}{(n_{P}-i)}+\frac{n}{(n_{N}-i)}\leq\sum_{i=0}^{n_{% N}-1}\frac{2n}{(n_{N}-i)}=2n\sum_{i=1}^{n_{N}}\frac{1}{i}=\Theta(n\log n).∑ start_POSTSUBSCRIPT italic_i = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT - 1 end_POSTSUPERSCRIPT divide start_ARG italic_n end_ARG start_ARG ( italic_n start_POSTSUBSCRIPT italic_P end_POSTSUBSCRIPT - italic_i ) end_ARG + divide start_ARG italic_n end_ARG start_ARG ( italic_n start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT - italic_i ) end_ARG ≤ ∑ start_POSTSUBSCRIPT italic_i = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT - 1 end_POSTSUPERSCRIPT divide start_ARG 2 italic_n end_ARG start_ARG ( italic_n start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT - italic_i ) end_ARG = 2 italic_n ∑ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT end_POSTSUPERSCRIPT divide start_ARG 1 end_ARG start_ARG italic_i end_ARG = roman_Θ ( italic_n roman_log italic_n ) .
Lemma 4.5.

If sets X1,X2dsubscript𝑋1subscript𝑋2superscript𝑑X_{1},X_{2}\subseteq\mathbb{N}^{d}italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ⊆ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT are stably decided by some execution bounded, single-voting CRD, then so are X1X2,X1X2subscript𝑋1subscript𝑋2subscript𝑋1subscript𝑋2X_{1}\cup X_{2},X_{1}\cap X_{2}italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ∪ italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ∩ italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT, and X1¯¯subscript𝑋1\overline{X_{1}}over¯ start_ARG italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT end_ARG with stabilization time O(nlogn)𝑂𝑛𝑛O(n\log n)italic_O ( italic_n roman_log italic_n ).

Proof 4.6.

To stably decide X1¯¯subscript𝑋1\overline{X_{1}}over¯ start_ARG italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT end_ARG, swap the yes and no voters.

For \cup and \cap, consider a construction where we decide both sets separately and record both of their votes in a new voter species. For this, we allow the set of all voters to be a strict subset of all species. We first add reactions to duplicate our input with reactions of the form

XiXi,1+Xi,2subscript𝑋𝑖subscript𝑋𝑖1subscript𝑋𝑖2X_{i}\rightarrow X_{i,1}+X_{i,2}italic_X start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT → italic_X start_POSTSUBSCRIPT italic_i , 1 end_POSTSUBSCRIPT + italic_X start_POSTSUBSCRIPT italic_i , 2 end_POSTSUBSCRIPT (8)

by two separate CRDs. Subsequently, we add reactions to record the separate votes in one of four new voter species: VNN,VNY,VYN,VYYsubscript𝑉𝑁𝑁subscript𝑉𝑁𝑌subscript𝑉𝑌𝑁subscript𝑉𝑌𝑌V_{NN},V_{NY},V_{YN},V_{YY}italic_V start_POSTSUBSCRIPT italic_N italic_N end_POSTSUBSCRIPT , italic_V start_POSTSUBSCRIPT italic_N italic_Y end_POSTSUBSCRIPT , italic_V start_POSTSUBSCRIPT italic_Y italic_N end_POSTSUBSCRIPT , italic_V start_POSTSUBSCRIPT italic_Y italic_Y end_POSTSUBSCRIPT. The first and second CRN determine the first and second subscript respectively. For b{Y,N}𝑏𝑌𝑁b\in\{Y,N\}italic_b ∈ { italic_Y , italic_N } and if Sb,Tbsubscript𝑆𝑏subscript𝑇𝑏S_{b},T_{b}italic_S start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT , italic_T start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT are leaders of 𝒞1subscript𝒞1\mathcal{C}_{1}caligraphic_C start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT and 𝒞2subscript𝒞2\mathcal{C}_{2}caligraphic_C start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT respectively, add the reactions:

Sb+Vb¯?Sb+Vb?subscript𝑆𝑏subscript𝑉¯𝑏?subscript𝑆𝑏subscript𝑉𝑏?\displaystyle S_{b}+V_{\overline{b}?}\rightarrow S_{b}+V_{b?}italic_S start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT + italic_V start_POSTSUBSCRIPT over¯ start_ARG italic_b end_ARG ? end_POSTSUBSCRIPT → italic_S start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT + italic_V start_POSTSUBSCRIPT italic_b ? end_POSTSUBSCRIPT (9)
Tb+V?b¯Tb+V?bsubscript𝑇𝑏subscript𝑉?¯𝑏subscript𝑇𝑏subscript𝑉?𝑏\displaystyle T_{b}+V_{?\overline{b}}\rightarrow T_{b}+V_{?b}italic_T start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT + italic_V start_POSTSUBSCRIPT ? over¯ start_ARG italic_b end_ARG end_POSTSUBSCRIPT → italic_T start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT + italic_V start_POSTSUBSCRIPT ? italic_b end_POSTSUBSCRIPT (10)

E.g. if N1subscript𝑁1N_{1}italic_N start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT is the no voter of the first CRD, we would add N1+LYNN1+LNNsubscript𝑁1subscript𝐿𝑌𝑁subscript𝑁1subscript𝐿𝑁𝑁N_{1}+L_{YN}\rightarrow N_{1}+L_{NN}italic_N start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT + italic_L start_POSTSUBSCRIPT italic_Y italic_N end_POSTSUBSCRIPT → italic_N start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT + italic_L start_POSTSUBSCRIPT italic_N italic_N end_POSTSUBSCRIPT and N1+LYYN1+LNYsubscript𝑁1subscript𝐿𝑌𝑌subscript𝑁1subscript𝐿𝑁𝑌N_{1}+L_{YY}\rightarrow N_{1}+L_{NY}italic_N start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT + italic_L start_POSTSUBSCRIPT italic_Y italic_Y end_POSTSUBSCRIPT → italic_N start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT + italic_L start_POSTSUBSCRIPT italic_N italic_Y end_POSTSUBSCRIPT. We let the yes voters be: Υ={VNY,VYN,VYY}Υsubscript𝑉𝑁𝑌subscript𝑉𝑌𝑁subscript𝑉𝑌𝑌\Upsilon=\{V_{NY},V_{YN},V_{YY}\}roman_Υ = { italic_V start_POSTSUBSCRIPT italic_N italic_Y end_POSTSUBSCRIPT , italic_V start_POSTSUBSCRIPT italic_Y italic_N end_POSTSUBSCRIPT , italic_V start_POSTSUBSCRIPT italic_Y italic_Y end_POSTSUBSCRIPT } to stably decide X1X2subscript𝑋1subscript𝑋2X_{1}\cup X_{2}italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ∪ italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT or Υ={VYY}Υsubscript𝑉𝑌𝑌\Upsilon=\{V_{YY}\}roman_Υ = { italic_V start_POSTSUBSCRIPT italic_Y italic_Y end_POSTSUBSCRIPT } to stably decide X1X2subscript𝑋1subscript𝑋2X_{1}\cap X_{2}italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ∩ italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT.

Reaction (8) will complete in O(logn)𝑂𝑛O(\log n)italic_O ( roman_log italic_n ) time and is clearly execution bounded since the input Xisubscript𝑋𝑖X_{i}italic_X start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT is finite and not produced in any reaction. Consequently, two separate CRNs run in Θ(nlogn)𝛩𝑛𝑛\mathit{\Theta}(n\log n)italic_Θ ( italic_n roman_log italic_n ) time as shown in Section 4 and Section 4. After stabilization of the parallel CRNs, we expect reaction (9) and (10) to happen exactly once. Each molecule involved is a leader and has count 1111 in volume n𝑛nitalic_n. This leads to a rate of λ=11n𝜆11𝑛\lambda=\frac{1\cdot 1}{n}italic_λ = divide start_ARG 1 ⋅ 1 end_ARG start_ARG italic_n end_ARG, so the expected time for one reaction to happen is O(n)𝑂𝑛O(n)italic_O ( italic_n ). It is important to note that reactions (9) and (10) do not result in unbounded executions due to the unanimous vote in parallel CRDs. In both mod sets and threshold sets, the leader changes its vote a maximum of |𝐢|𝐢|\mathbf{i}|| bold_i | times, with only ever one leader present at any time. Again, we start with only one Vbbsubscript𝑉𝑏𝑏V_{bb}italic_V start_POSTSUBSCRIPT italic_b italic_b end_POSTSUBSCRIPT voter present initially and no reaction changes the count of voters, making our construction single-voting.

Since semilinear predicates are exactly Boolean combinations of threshold and mod predicates, Sections 4, 4 and 4.5 imply the following.

Theorem 4.7.

Every semilinear set is stably decidable by an execution bounded, single-voting CRD, with stabilization time O(nlogn).𝑂𝑛𝑛O(n\log n).italic_O ( italic_n roman_log italic_n ) .

We can also prove the same result for all-voting CRDs. Note, however, that such CRDs cannot be “composed” using the constructions of LABEL:{lem:boolean-closure-crd} and 5.5, which crucially relied on the assumption that the CRDs being used as “subroutines” are single-voting. \optsubmissionA proof is in the appendix.

{thmrep}

Every semilinear set is stably decidable by an execution bounded, all-voting CRD, with stabilization time O(nlogn).𝑂𝑛𝑛O(n\log n).italic_O ( italic_n roman_log italic_n ) .

Proof 4.8.

By Theorem 4.7, every semilinear set is stably decided by a single-voting CRD. We convert this to an all-voting CRD, where every species is required to vote yes or no, by “propagating” the final vote (recorded in the single voter V0superscript𝑉0V^{0}italic_V start_POSTSUPERSCRIPT 0 end_POSTSUPERSCRIPT voting no or V1superscript𝑉1V^{1}italic_V start_POSTSUPERSCRIPT 1 end_POSTSUPERSCRIPT voting yes) back to all other molecules. A superscript indicates the “global” decision. The execution boundedness proven in Lemma 4.5 ensures that the leader propagates the final vote only a finite amount of times. For each vote b{0,1}𝑏01b\in\{0,1\}italic_b ∈ { 0 , 1 } and each voter Vbsuperscript𝑉𝑏V^{b}italic_V start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT voting b𝑏bitalic_b, and all other species SΛ\{V}𝑆\Λ𝑉S\in\Lambda\backslash\{V\}italic_S ∈ roman_Λ \ { italic_V }, replace species S𝑆Sitalic_S with two versions S0superscript𝑆0S^{0}italic_S start_POSTSUPERSCRIPT 0 end_POSTSUPERSCRIPT and S1superscript𝑆1S^{1}italic_S start_POSTSUPERSCRIPT 1 end_POSTSUPERSCRIPT, and add reactions:

Vb+Sb¯Vb+Sbsuperscript𝑉𝑏superscript𝑆¯𝑏superscript𝑉𝑏superscript𝑆𝑏\displaystyle V^{b}+S^{\overline{b}}\mathop{\rightarrow}\limits V^{b}+S^{b}italic_V start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT + italic_S start_POSTSUPERSCRIPT over¯ start_ARG italic_b end_ARG end_POSTSUPERSCRIPT → italic_V start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT + italic_S start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT (11)

The original reactions of the CRD must also be replaced with “functionally identical” reactions for the new versions of species. For example, the reaction A+BC+D𝐴𝐵𝐶𝐷A+B\mathop{\rightarrow}\limits C+Ditalic_A + italic_B → italic_C + italic_D becomes

A0+B0superscript𝐴0superscript𝐵0\displaystyle A^{0}+B^{0}italic_A start_POSTSUPERSCRIPT 0 end_POSTSUPERSCRIPT + italic_B start_POSTSUPERSCRIPT 0 end_POSTSUPERSCRIPT C0+D0superscript𝐶0superscript𝐷0\displaystyle\mathop{\rightarrow}\limits C^{0}+D^{0}→ italic_C start_POSTSUPERSCRIPT 0 end_POSTSUPERSCRIPT + italic_D start_POSTSUPERSCRIPT 0 end_POSTSUPERSCRIPT
A0+B1superscript𝐴0superscript𝐵1\displaystyle A^{0}+B^{1}italic_A start_POSTSUPERSCRIPT 0 end_POSTSUPERSCRIPT + italic_B start_POSTSUPERSCRIPT 1 end_POSTSUPERSCRIPT C0+D0superscript𝐶0superscript𝐷0\displaystyle\mathop{\rightarrow}\limits C^{0}+D^{0}→ italic_C start_POSTSUPERSCRIPT 0 end_POSTSUPERSCRIPT + italic_D start_POSTSUPERSCRIPT 0 end_POSTSUPERSCRIPT
A1+B0superscript𝐴1superscript𝐵0\displaystyle A^{1}+B^{0}italic_A start_POSTSUPERSCRIPT 1 end_POSTSUPERSCRIPT + italic_B start_POSTSUPERSCRIPT 0 end_POSTSUPERSCRIPT C0+D0superscript𝐶0superscript𝐷0\displaystyle\mathop{\rightarrow}\limits C^{0}+D^{0}→ italic_C start_POSTSUPERSCRIPT 0 end_POSTSUPERSCRIPT + italic_D start_POSTSUPERSCRIPT 0 end_POSTSUPERSCRIPT
A1+B1superscript𝐴1superscript𝐵1\displaystyle A^{1}+B^{1}italic_A start_POSTSUPERSCRIPT 1 end_POSTSUPERSCRIPT + italic_B start_POSTSUPERSCRIPT 1 end_POSTSUPERSCRIPT C1+D1superscript𝐶1superscript𝐷1\displaystyle\mathop{\rightarrow}\limits C^{1}+D^{1}→ italic_C start_POSTSUPERSCRIPT 1 end_POSTSUPERSCRIPT + italic_D start_POSTSUPERSCRIPT 1 end_POSTSUPERSCRIPT

In the middle two cases we can pick the superscripts of the products arbitrarily, whereas in the first and last case, we must choose the product votes to match those of the reactants to ensure stable states remain stable.

A vote change of the Vbsuperscript𝑉𝑏V^{b}italic_V start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT leader leads to the propagation of the vote to at most n𝑛nitalic_n molecules once using reaction (11). This reaction dominates the runtime, as a single molecule is required to interact with each other molecule. We cannot speed this process up using an epidemic style process as conflicting votes would make the CRN execution unbounded. The original CRD takes time O(nlogn)𝑂𝑛𝑛O(n\log n)italic_O ( italic_n roman_log italic_n ) to converge on a correct output for the single voter Vbsuperscript𝑉𝑏V^{b}italic_V start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT. At that point, a standard coupon collector argument shows that the voter Vbsuperscript𝑉𝑏V^{b}italic_V start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT takes expected time O(nlogn)𝑂𝑛𝑛O(n\log n)italic_O ( italic_n roman_log italic_n ) to correct the votes of all other species via reaction (11).

5 Execution bounded CRCs stably compute all semilinear functions

In this section we shift focus from computing Boolean-valued predicates ϕ:d{0,1}:italic-ϕsuperscript𝑑01\phi:\mathbb{N}^{d}\to\{0,1\}italic_ϕ : blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT → { 0 , 1 } to integer-valued functions f:d:𝑓superscript𝑑f:\mathbb{N}^{d}\to\mathbb{N}italic_f : blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT → blackboard_N, showing that execution bounded CRCs can stably compute the same class of functions (semilinear) as unrestricted CRCs.

Similar to [Chen2012DeterministicFunction, Doty2013Leaderless], we compute semilinear functions by decomposing them into “affine pieces”, which we will show can be computed by execution bounded CRNs and combined by using semilinear predicates to decide which linear function to apply for a given input.333 While this proof generalizes to multivariate output functions as in [Chen2012DeterministicFunction, Doty2013Leaderless], to simplify notation we focus on single output functions. Multi-valued functions f:dl:𝑓superscript𝑑superscript𝑙f:\mathbb{N}^{d}\to\mathbb{N}^{l}italic_f : blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT → blackboard_N start_POSTSUPERSCRIPT italic_l end_POSTSUPERSCRIPT can be equivalently thought of as l𝑙litalic_l separate single output functions fi:d:subscript𝑓𝑖superscript𝑑f_{i}:\mathbb{N}^{d}\to\mathbb{N}italic_f start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT : blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT → blackboard_N, which can be computed in parallel by independent CRCs.

We say a partial function f:k:𝑓superscript𝑘f:\mathbb{N}^{k}\dashrightarrow\mathbb{N}italic_f : blackboard_N start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT ⇢ blackboard_N is affine if there exist a vectors 𝐚k𝐚superscript𝑘\mathbf{a}\in\mathbb{Q}^{k}bold_a ∈ blackboard_Q start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT, 𝐜k𝐜superscript𝑘\mathbf{c}\in\mathbb{N}^{k}bold_c ∈ blackboard_N start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT with 𝐱𝐜𝟎𝐱𝐜0\mathbf{x}-\mathbf{c}\geq\mathbf{0}bold_x - bold_c ≥ bold_0 and nonnegative integer b𝑏b\in\mathbb{N}italic_b ∈ blackboard_N such that f(𝐱)=𝐚(𝐱𝐜)+b.𝑓𝐱superscript𝐚top𝐱𝐜𝑏f(\mathbf{x})=\mathbf{a}^{\top}(\mathbf{x}-\mathbf{c})+b.italic_f ( bold_x ) = bold_a start_POSTSUPERSCRIPT ⊤ end_POSTSUPERSCRIPT ( bold_x - bold_c ) + italic_b . This definition of affine function may appear contrived, but the main utility of the definition is that it satisfies Section 5. For convenience, we can ensure to only work with integer valued molecule counts by multiplying by 1d1𝑑\frac{1}{d}divide start_ARG 1 end_ARG start_ARG italic_d end_ARG after the dot product, where d𝑑ditalic_d may be taken to be the least common multiple of the denominators of the rational coefficients in the original definition such that ni=d𝐚(i)subscript𝑛𝑖𝑑𝐚𝑖n_{i}=d\cdot\mathbf{a}(i)italic_n start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = italic_d ⋅ bold_a ( italic_i ): \optfull

f(𝐱)=b+i=1kai(xici)f(𝐱)=b+1di=1kni(xici).iff𝑓𝐱𝑏superscriptsubscript𝑖1𝑘subscript𝑎𝑖subscript𝑥𝑖subscript𝑐𝑖𝑓𝐱𝑏1𝑑superscriptsubscript𝑖1𝑘subscript𝑛𝑖subscript𝑥𝑖subscript𝑐𝑖f(\mathbf{x})=b+\sum_{i=1}^{k}a_{i}(x_{i}-c_{i})\iff f(\mathbf{x})=b+\frac{1}{% d}\sum_{i=1}^{k}n_{i}(x_{i}-c_{i}).italic_f ( bold_x ) = italic_b + ∑ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT italic_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ( italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT - italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) ⇔ italic_f ( bold_x ) = italic_b + divide start_ARG 1 end_ARG start_ARG italic_d end_ARG ∑ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ( italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT - italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) .
\opt

submission,final f(𝐱)=b+i=1k𝐚(i)(𝐱(i)𝐜(i))f(𝐱)=b+1di=1kni(𝐱(i)𝐜(i)).iff𝑓𝐱𝑏superscriptsubscript𝑖1𝑘𝐚𝑖𝐱𝑖𝐜𝑖𝑓𝐱𝑏1𝑑superscriptsubscript𝑖1𝑘subscript𝑛𝑖𝐱𝑖𝐜𝑖f(\mathbf{x})=b+\sum_{i=1}^{k}\mathbf{a}(i)(\mathbf{x}(i)-\mathbf{c}(i))\iff f% (\mathbf{x})=b+\frac{1}{d}\sum_{i=1}^{k}n_{i}(\mathbf{x}(i)-\mathbf{c}(i)).italic_f ( bold_x ) = italic_b + ∑ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT bold_a ( italic_i ) ( bold_x ( italic_i ) - bold_c ( italic_i ) ) ⇔ italic_f ( bold_x ) = italic_b + divide start_ARG 1 end_ARG start_ARG italic_d end_ARG ∑ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ( bold_x ( italic_i ) - bold_c ( italic_i ) ) .

We say that a partial function f:k2:𝑓superscript𝑘superscript2f:\mathbb{N}^{k}\rightarrow\mathbb{N}^{2}italic_f : blackboard_N start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT → blackboard_N start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT is a diff-representation of f𝑓fitalic_f if domf=domf^dom𝑓dom^𝑓\operatorname{dom}f=\operatorname{dom}\hat{f}roman_dom italic_f = roman_dom over^ start_ARG italic_f end_ARG and, for all 𝐱domf𝐱dom𝑓\mathbf{x}\in\operatorname{dom}fbold_x ∈ roman_dom italic_f, if (yP,yC)=f^(𝐱)subscript𝑦𝑃subscript𝑦𝐶^𝑓𝐱\left(y_{P},y_{C}\right)=\hat{f}(\mathbf{x})( italic_y start_POSTSUBSCRIPT italic_P end_POSTSUBSCRIPT , italic_y start_POSTSUBSCRIPT italic_C end_POSTSUBSCRIPT ) = over^ start_ARG italic_f end_ARG ( bold_x ), then f(𝐱)=yPyC𝑓𝐱subscript𝑦𝑃subscript𝑦𝐶f(\mathbf{x})=y_{P}-y_{C}italic_f ( bold_x ) = italic_y start_POSTSUBSCRIPT italic_P end_POSTSUBSCRIPT - italic_y start_POSTSUBSCRIPT italic_C end_POSTSUBSCRIPT, and yP=O(f(𝐱))subscript𝑦𝑃𝑂𝑓𝐱y_{P}=O(f(\mathbf{x}))italic_y start_POSTSUBSCRIPT italic_P end_POSTSUBSCRIPT = italic_O ( italic_f ( bold_x ) ). In other words, f^^𝑓\hat{f}over^ start_ARG italic_f end_ARG represents f𝑓fitalic_f as the difference of its two outputs yPsubscript𝑦𝑃y_{P}italic_y start_POSTSUBSCRIPT italic_P end_POSTSUBSCRIPT and yCsubscript𝑦𝐶y_{C}italic_y start_POSTSUBSCRIPT italic_C end_POSTSUBSCRIPT, with the larger output yPsubscript𝑦𝑃y_{P}italic_y start_POSTSUBSCRIPT italic_P end_POSTSUBSCRIPT possibly being larger than the original function’s output, but at most a multiplicative constant larger [Doty2013Leaderless].

Lemma 5.1.

Let f:k:𝑓superscript𝑘f:\mathbb{N}^{k}\rightarrow\mathbb{N}italic_f : blackboard_N start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT → blackboard_N be an affine partial function. Then there is a diff-representation f^:k2:^𝑓superscript𝑘superscript2\hat{f}:\mathbb{N}^{k}\longrightarrow\mathbb{N}^{2}over^ start_ARG italic_f end_ARG : blackboard_N start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT ⟶ blackboard_N start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT of f𝑓fitalic_f and an execution bounded CRC that monotonically stably computes f^^𝑓\hat{f}over^ start_ARG italic_f end_ARG in expected time O(n)𝑂𝑛O(n)italic_O ( italic_n ).

Proof 5.2.

Define a CRC C𝐶Citalic_C with input species Σ={X1,,Xk}Σsubscript𝑋1subscript𝑋𝑘\Sigma=\{X_{1},\ldots,X_{k}\}roman_Σ = { italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_X start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT } and output species Γ={YP,YC}Γsuperscript𝑌𝑃superscript𝑌𝐶\Gamma=\{Y^{P},Y^{C}\}roman_Γ = { italic_Y start_POSTSUPERSCRIPT italic_P end_POSTSUPERSCRIPT , italic_Y start_POSTSUPERSCRIPT italic_C end_POSTSUPERSCRIPT }. We need to ensure that after stabilizing, y=#YP#YC𝑦#superscript𝑌𝑃#superscript𝑌𝐶y=\#Y^{P}-\#Y^{C}italic_y = # italic_Y start_POSTSUPERSCRIPT italic_P end_POSTSUPERSCRIPT - # italic_Y start_POSTSUPERSCRIPT italic_C end_POSTSUPERSCRIPT

To account for the b𝑏bitalic_b offset, start with b𝑏bitalic_b copies of YPsuperscript𝑌𝑃Y^{P}italic_Y start_POSTSUPERSCRIPT italic_P end_POSTSUPERSCRIPT.

For the cisubscript𝑐𝑖c_{i}italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT offset, we must reduce the number of Xisubscript𝑋𝑖X_{i}italic_X start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT by cisubscript𝑐𝑖c_{i}italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT. Since the result will be used in the next reaction, we want to produce a new species Xisuperscriptsubscript𝑋𝑖X_{i}^{\prime}italic_X start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT and require Xisuperscriptsubscript𝑋𝑖X_{i}^{\prime}italic_X start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT to not be consumed during the computation. We achieve this by adding reactions that let Xisubscript𝑋𝑖X_{i}italic_X start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT consume itself cisubscript𝑐𝑖c_{i}italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT times (kee** track with a subscript) and converting Xisubscript𝑋𝑖X_{i}italic_X start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT to Xisuperscriptsubscript𝑋𝑖X_{i}^{\prime}italic_X start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT once cisubscript𝑐𝑖c_{i}italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT has been reached. For each i{1,,k}𝑖1𝑘i\in\{1,\ldots,k\}italic_i ∈ { 1 , … , italic_k } and m,p{1,,ci}𝑚𝑝1subscript𝑐𝑖m,p\in\left\{1,\ldots,c_{i}\right\}italic_m , italic_p ∈ { 1 , … , italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT }, if m+pci𝑚𝑝subscript𝑐𝑖m+p\leq c_{i}italic_m + italic_p ≤ italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, add the reaction

Xi,m+Xi,pXi,m+psubscript𝑋𝑖𝑚subscript𝑋𝑖𝑝subscript𝑋𝑖𝑚𝑝X_{i,m}+X_{i,p}\rightarrow X_{i,m+p}italic_X start_POSTSUBSCRIPT italic_i , italic_m end_POSTSUBSCRIPT + italic_X start_POSTSUBSCRIPT italic_i , italic_p end_POSTSUBSCRIPT → italic_X start_POSTSUBSCRIPT italic_i , italic_m + italic_p end_POSTSUBSCRIPT (12)

If m+p>ci𝑚𝑝subscript𝑐𝑖m+p>c_{i}italic_m + italic_p > italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, add the reaction

Xi,m+Xi,pXi,ci+(m+pci)Xisubscript𝑋𝑖𝑚subscript𝑋𝑖𝑝subscript𝑋𝑖subscript𝑐𝑖𝑚𝑝subscript𝑐𝑖superscriptsubscript𝑋𝑖\displaystyle X_{i,m}+X_{i,p}\rightarrow X_{i,c_{i}}+\left(m+p-c_{i}\right)X_{% i}^{\prime}italic_X start_POSTSUBSCRIPT italic_i , italic_m end_POSTSUBSCRIPT + italic_X start_POSTSUBSCRIPT italic_i , italic_p end_POSTSUBSCRIPT → italic_X start_POSTSUBSCRIPT italic_i , italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_POSTSUBSCRIPT + ( italic_m + italic_p - italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) italic_X start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT (13)

Runtime: In volume n𝑛nitalic_n, the rate of reactions (12) and (13) would be λ(xi)2n𝜆superscriptsubscript𝑥𝑖2𝑛\lambda\approx\frac{(x_{i})^{2}}{n}italic_λ ≈ divide start_ARG ( italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG start_ARG italic_n end_ARG (xisubscript𝑥𝑖x_{i}italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT molecules have the chance to react with any of the xi1subscript𝑥𝑖1x_{i}-1italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT - 1 others), so the expected time for the next reaction is n(xi)2𝑛superscriptsubscript𝑥𝑖2\frac{n}{(x_{i})^{2}}divide start_ARG italic_n end_ARG start_ARG ( italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG. The expected time for the whole process is i=1xini2=ni=1xi1i2=O(n)superscriptsubscript𝑖1subscript𝑥𝑖𝑛superscript𝑖2𝑛superscriptsubscript𝑖1subscript𝑥𝑖1superscript𝑖2𝑂𝑛\sum_{i=1}^{x_{i}}\frac{n}{i^{2}}=n\sum_{i=1}^{x_{i}}\frac{1}{i^{2}}=O(n)∑ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_POSTSUPERSCRIPT divide start_ARG italic_n end_ARG start_ARG italic_i start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG = italic_n ∑ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT end_POSTSUPERSCRIPT divide start_ARG 1 end_ARG start_ARG italic_i start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT end_ARG = italic_O ( italic_n ). Further, the reactions are execution bounded since both strictly decrease the number of their reactants and exactly xi1subscript𝑥𝑖1x_{i}-1italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT - 1 reactions will happen.

To account for the ni/dsubscript𝑛𝑖𝑑n_{i}/ditalic_n start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT / italic_d coefficient, we multiply by nisubscript𝑛𝑖n_{i}italic_n start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, then divide by d𝑑ditalic_d using similar reactions as for the subtraction. To multiply by nisubscript𝑛𝑖n_{i}italic_n start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, add the following reaction for each i{1,,k}𝑖1𝑘i\in\{1,\ldots,k\}italic_i ∈ { 1 , … , italic_k }:

Xi{niD1P, if ni>0(ni)D1C, if ni<0superscriptsubscript𝑋𝑖casessubscript𝑛𝑖superscriptsubscript𝐷1𝑃 if subscript𝑛𝑖0subscript𝑛𝑖superscriptsubscript𝐷1𝐶 if subscript𝑛𝑖0\displaystyle X_{i}^{\prime}\rightarrow\begin{cases}n_{i}D_{1}^{P},&\text{ if % }n_{i}>0\\ \left(-n_{i}\right)D_{1}^{C},&\text{ if }n_{i}<0\end{cases}italic_X start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT → { start_ROW start_CELL italic_n start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT italic_D start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_P end_POSTSUPERSCRIPT , end_CELL start_CELL if italic_n start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT > 0 end_CELL end_ROW start_ROW start_CELL ( - italic_n start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) italic_D start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_C end_POSTSUPERSCRIPT , end_CELL start_CELL if italic_n start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT < 0 end_CELL end_ROW (14)

For each m,p{1,,d1}𝑚𝑝1𝑑1m,p\in\left\{1,\ldots,d-1\right\}italic_m , italic_p ∈ { 1 , … , italic_d - 1 }, if m+pd1𝑚𝑝𝑑1m+p\leq d-1italic_m + italic_p ≤ italic_d - 1, add the reactions

DmP+DpPDm+pPsuperscriptsubscript𝐷𝑚𝑃superscriptsubscript𝐷𝑝𝑃superscriptsubscript𝐷𝑚𝑝𝑃\displaystyle D_{m}^{P}+D_{p}^{P}\rightarrow D_{m+p}^{P}italic_D start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_P end_POSTSUPERSCRIPT + italic_D start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_P end_POSTSUPERSCRIPT → italic_D start_POSTSUBSCRIPT italic_m + italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_P end_POSTSUPERSCRIPT (15)
DmC+DpCDm+pCsuperscriptsubscript𝐷𝑚𝐶superscriptsubscript𝐷𝑝𝐶superscriptsubscript𝐷𝑚𝑝𝐶\displaystyle D_{m}^{C}+D_{p}^{C}\rightarrow D_{m+p}^{C}italic_D start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_C end_POSTSUPERSCRIPT + italic_D start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_C end_POSTSUPERSCRIPT → italic_D start_POSTSUBSCRIPT italic_m + italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_C end_POSTSUPERSCRIPT (16)

If m+p>ci𝑚𝑝subscript𝑐𝑖m+p>c_{i}italic_m + italic_p > italic_c start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, add the reactions

DmP+DpPDm+pdB+YPsuperscriptsubscript𝐷𝑚𝑃superscriptsubscript𝐷𝑝𝑃superscriptsubscript𝐷𝑚𝑝𝑑𝐵superscript𝑌𝑃\displaystyle D_{m}^{P}+D_{p}^{P}\rightarrow D_{m+p-d}^{B}+Y^{P}italic_D start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_P end_POSTSUPERSCRIPT + italic_D start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_P end_POSTSUPERSCRIPT → italic_D start_POSTSUBSCRIPT italic_m + italic_p - italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_B end_POSTSUPERSCRIPT + italic_Y start_POSTSUPERSCRIPT italic_P end_POSTSUPERSCRIPT (17)
DmC+DpCDm+pdB+YCsuperscriptsubscript𝐷𝑚𝐶superscriptsubscript𝐷𝑝𝐶superscriptsubscript𝐷𝑚𝑝𝑑𝐵superscript𝑌𝐶\displaystyle D_{m}^{C}+D_{p}^{C}\rightarrow D_{m+p-d}^{B}+Y^{C}italic_D start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_C end_POSTSUPERSCRIPT + italic_D start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_C end_POSTSUPERSCRIPT → italic_D start_POSTSUBSCRIPT italic_m + italic_p - italic_d end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_B end_POSTSUPERSCRIPT + italic_Y start_POSTSUPERSCRIPT italic_C end_POSTSUPERSCRIPT (18)

Reactions (14) complete in expected time O(logn)𝑂𝑛O(\log n)italic_O ( roman_log italic_n ), while (17) and (18) complete in O(n)𝑂𝑛O(n)italic_O ( italic_n ) by a similar analysis as for the first two reactions. As for execution boundedness, (14) is only applicable once for every Xisuperscriptsubscript𝑋𝑖X_{i}^{\prime}italic_X start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT; all other reactions start with a number of reactants which are a constant factor of Xisuperscriptsubscript𝑋𝑖X_{i}^{\prime}italic_X start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT and decrease the count of their reactants by one in each reaction.

We require the following result due to Chen, Doty, Soloveichik [Chen2012DeterministicFunction], guaranteeing that any semilinear function can be built from affine partial functions.

Lemma 5.3 ([Chen2012DeterministicFunction]).

Let f:d:𝑓superscript𝑑f:\mathbb{N}^{d}\rightarrow\mathbb{N}italic_f : blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT → blackboard_N be a semilinear function. Then there is a finite set {f1:d,,fm:d}conditional-setsubscript𝑓1:superscript𝑑subscript𝑓𝑚superscript𝑑\big{\{}f_{1}:\mathbb{N}^{d}\rightarrow\mathbb{N},\ldots,f_{m}:\mathbb{N}^{d}% \rightarrow\mathbb{N}\big{\}}{ italic_f start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT : blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT → blackboard_N , … , italic_f start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT : blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT → blackboard_N } of affine partial functions, where each domfidomsubscript𝑓𝑖\operatorname{dom}f_{i}roman_dom italic_f start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT is a linear set, such that, for each 𝐱d𝐱superscript𝑑\mathbf{x}\in\mathbb{N}^{d}bold_x ∈ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT, if fi(𝐱)subscript𝑓𝑖𝐱f_{i}(\mathbf{x})italic_f start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ( bold_x ) is defined, then f(𝐱)=fi(𝐱)𝑓𝐱subscript𝑓𝑖𝐱f(\mathbf{x})=f_{i}(\mathbf{x})italic_f ( bold_x ) = italic_f start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ( bold_x ), and i=1mdomfi=dsuperscriptsubscript𝑖1𝑚domsubscript𝑓𝑖superscript𝑑\bigcup_{i=1}^{m}\operatorname{dom}f_{i}=\mathbb{N}^{d}⋃ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT roman_dom italic_f start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT.

We strengthen Lemma 5.3 to show we may assume each domfidomsubscript𝑓𝑖\mathrm{dom}\ f_{i}roman_dom italic_f start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT is disjoint from the others. This is needed not only to prove Theorem 5.5, but to correct the proof of Lemma 4.4 in [Chen2012DeterministicFunction], which implicitly assumed the domains are disjoint. \optsubmissionSection 5 is proven in the appendix.

{lemmarep}

Let f:d:𝑓superscript𝑑f:\mathbb{N}^{d}\rightarrow\mathbb{N}italic_f : blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT → blackboard_N be a semilinear function. Then there is a finite set {f1:d,,fm:d}conditional-setsubscript𝑓1:superscript𝑑subscript𝑓𝑚superscript𝑑\big{\{}f_{1}:\mathbb{N}^{d}\rightarrow\mathbb{N},\ldots,f_{m}:\mathbb{N}^{d}% \rightarrow\mathbb{N}\big{\}}{ italic_f start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT : blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT → blackboard_N , … , italic_f start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT : blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT → blackboard_N } of affine partial functions, where each domfidomsubscript𝑓𝑖\operatorname{dom}f_{i}roman_dom italic_f start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT is a linear set, and domfidomfj=domsubscript𝑓𝑖domsubscript𝑓𝑗\operatorname{dom}f_{i}\cap\operatorname{dom}f_{j}=\emptysetroman_dom italic_f start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∩ roman_dom italic_f start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT = ∅ for all ij𝑖𝑗i\neq jitalic_i ≠ italic_j, such that, for each 𝐱d𝐱superscript𝑑\mathbf{x}\in\mathbb{N}^{d}bold_x ∈ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT, if fi(𝐱)subscript𝑓𝑖𝐱f_{i}(\mathbf{x})italic_f start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ( bold_x ) is defined, then f(𝐱)=fi(𝐱)𝑓𝐱subscript𝑓𝑖𝐱f(\mathbf{x})=f_{i}(\mathbf{x})italic_f ( bold_x ) = italic_f start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ( bold_x ), and i=1mdomfi=dsuperscriptsubscript𝑖1𝑚domsubscript𝑓𝑖superscript𝑑\bigcup_{i=1}^{m}\operatorname{dom}f_{i}=\mathbb{N}^{d}⋃ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT roman_dom italic_f start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT.

Proof 5.4.

By [Ito1969SemilinearSetsFiniteUnionDisjointLinearSets, Theorem 2], every semilinear set is a finite union of disjoint fundamental linear sets. The author defines a linear set L={𝐛+n1𝐮1++np𝐮pn1,,np}𝐿conditional-set𝐛subscript𝑛1subscript𝐮1subscript𝑛𝑝subscript𝐮𝑝subscript𝑛1subscript𝑛𝑝L=\big{\{}\mathbf{b}+n_{1}\mathbf{u}_{1}+\ldots+n_{p}\mathbf{u}_{p}\mid n_{1},% \ldots,n_{p}\in\mathbb{N}\big{\}}italic_L = { bold_b + italic_n start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT bold_u start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT + … + italic_n start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT bold_u start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT ∣ italic_n start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_n start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT ∈ blackboard_N } as fundamental, if 𝐮1,𝐮pksubscript𝐮1subscript𝐮𝑝superscript𝑘\mathbf{u}_{1},\dots\mathbf{u}_{p}\in\mathbb{N}^{k}bold_u start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … bold_u start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT ∈ blackboard_N start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT span a p𝑝pitalic_p-dimensional vector space in ksuperscript𝑘\mathbb{R}^{k}blackboard_R start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT, i.e. all vectors are linearly independent in ksuperscript𝑘\mathbb{R}^{k}blackboard_R start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT.444 This distinction is significant because not all integer-valued linear sets can be represented using solely linearly independent vectors. An illustrative example is 𝐛=𝟎,𝐮1=(1,1,1),𝐮2=(2,0,1),𝐮3=(0,2,1)formulae-sequence𝐛0formulae-sequencesubscript𝐮1111formulae-sequencesubscript𝐮2201subscript𝐮3021\mathbf{b}=\mathbf{0},\mathbf{u}_{1}=(1,1,1),\mathbf{u}_{2}=(2,0,1),\mathbf{u}% _{3}=(0,2,1)bold_b = bold_0 , bold_u start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = ( 1 , 1 , 1 ) , bold_u start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT = ( 2 , 0 , 1 ) , bold_u start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT = ( 0 , 2 , 1 ), as discussed in [Chen2012DeterministicFunction]. The vectors 𝐮1,𝐮2,𝐮3subscript𝐮1subscript𝐮2subscript𝐮3\mathbf{u}_{1},\mathbf{u}_{2},\mathbf{u}_{3}bold_u start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , bold_u start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , bold_u start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT are not linearly independent in 3superscript3\mathbb{R}^{3}blackboard_R start_POSTSUPERSCRIPT 3 end_POSTSUPERSCRIPT, yet this set cannot be expressed with less than three basis vectors. The proof of Lemma 5.3 in [Chen2012DeterministicFunction] shows that each linear set Lisubscript𝐿𝑖L_{i}italic_L start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT comprising the semilinear graph of f𝑓fitalic_f corresponds to one partial affine function fisubscript𝑓𝑖f_{i}italic_f start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT. The fact that [Ito1969SemilinearSetsFiniteUnionDisjointLinearSets, Theorem 2] lets us assume each Lisubscript𝐿𝑖L_{i}italic_L start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT is disjoint from the others immediately implies that each domfidomsubscript𝑓𝑖\mathrm{dom}\ f_{i}roman_dom italic_f start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT is disjoint from the others.

The next theorem shows that semilinear functions can be computed by execution bounded CRCs in expected time Θ(nlogn)Θ𝑛𝑛\Theta(n\log n)roman_Θ ( italic_n roman_log italic_n ).

Theorem 5.5.

Let f:d:𝑓superscript𝑑f:\mathbb{N}^{d}\rightarrow\mathbb{N}italic_f : blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT → blackboard_N be a semilinear function. Then there is an execution bounded CRC that stably computes f𝑓fitalic_f with stabilization time O(nlogn)𝑂𝑛𝑛O(n\log n)italic_O ( italic_n roman_log italic_n ), in expectation and with probability at least 1nc1superscript𝑛𝑐1-n^{-c}1 - italic_n start_POSTSUPERSCRIPT - italic_c end_POSTSUPERSCRIPT.

Proof 5.6.

We employ the same construction of [Chen2012DeterministicFunction] with minor alterations. A CRC with input species Σ={X1,,Xd}Σsubscript𝑋1subscript𝑋𝑑\Sigma=\{X_{1},\ldots,X_{d}\}roman_Σ = { italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_X start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT } and output species Γ={Y}Γ𝑌\Gamma=\{Y\}roman_Γ = { italic_Y }. By Section 5, we decompose our semilinear function into partial affine functions (with linear, disjoint domains), which can be computed in parallel by Lemma 5.1. Further, we decide which function to use by computing the predicate ϕi=subscriptitalic-ϕ𝑖absent\phi_{i}=italic_ϕ start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT =xdomfixdomsubscript𝑓𝑖\mathrm{x}\in\operatorname{dom}f_{i}roman_x ∈ roman_dom italic_f start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT” (Theorem 4.7). We interpret each Y^iPsuperscriptsubscript^𝑌𝑖𝑃\widehat{Y}_{i}^{P}over^ start_ARG italic_Y end_ARG start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_P end_POSTSUPERSCRIPT and Y^iCsuperscriptsubscript^𝑌𝑖𝐶\widehat{Y}_{i}^{C}over^ start_ARG italic_Y end_ARG start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_C end_POSTSUPERSCRIPT as an “inactive” version of “active” output species YiPsuperscriptsubscript𝑌𝑖𝑃Y_{i}^{P}italic_Y start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_P end_POSTSUPERSCRIPT and YiCsuperscriptsubscript𝑌𝑖𝐶Y_{i}^{C}italic_Y start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_C end_POSTSUPERSCRIPT. Let LiY,LiNsuperscriptsubscript𝐿𝑖𝑌superscriptsubscript𝐿𝑖𝑁L_{i}^{Y},L_{i}^{N}italic_L start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_Y end_POSTSUPERSCRIPT , italic_L start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_N end_POSTSUPERSCRIPT be the yes and no voters respectively voting whether 𝐱𝐱\mathbf{x}bold_x lies in the domain of i𝑖iitalic_i-th partial function. Now, we convert the function result of the applicable partial affine function to the global output by adding the following reactions for each i{1,,m}𝑖1𝑚i\in\{1,\ldots,m\}italic_i ∈ { 1 , … , italic_m }.

LiY+Y^iPsuperscriptsubscript𝐿𝑖𝑌superscriptsubscript^𝑌𝑖𝑃\displaystyle L_{i}^{Y}+\widehat{Y}_{i}^{P}italic_L start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_Y end_POSTSUPERSCRIPT + over^ start_ARG italic_Y end_ARG start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_P end_POSTSUPERSCRIPT LiY+YiP+Yabsentsuperscriptsubscript𝐿𝑖𝑌superscriptsubscript𝑌𝑖𝑃𝑌\displaystyle\rightarrow L_{i}^{Y}+Y_{i}^{P}+Y→ italic_L start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_Y end_POSTSUPERSCRIPT + italic_Y start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_P end_POSTSUPERSCRIPT + italic_Y (19)
LiN+YiPsuperscriptsubscript𝐿𝑖𝑁superscriptsubscript𝑌𝑖𝑃\displaystyle L_{i}^{N}+Y_{i}^{P}italic_L start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_N end_POSTSUPERSCRIPT + italic_Y start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_P end_POSTSUPERSCRIPT LiN+Miabsentsuperscriptsubscript𝐿𝑖𝑁subscript𝑀𝑖\displaystyle\rightarrow L_{i}^{N}+M_{i}→ italic_L start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_N end_POSTSUPERSCRIPT + italic_M start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT (20)
Mi+Ysubscript𝑀𝑖𝑌\displaystyle M_{i}+Yitalic_M start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT + italic_Y Y^iPabsentsuperscriptsubscript^𝑌𝑖𝑃\displaystyle\rightarrow\widehat{Y}_{i}^{P}→ over^ start_ARG italic_Y end_ARG start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_P end_POSTSUPERSCRIPT (21)

Reaction (19) produces an output copy of species Y𝑌Yitalic_Y and (20) and (21) reverse the first reaction using only bimolecular reactions. Both are catalyzed by the vote of the i𝑖iitalic_i-th predicate result. Also add reactions

LiY+Y^iCLiY+YiCsuperscriptsubscript𝐿𝑖𝑌superscriptsubscript^𝑌𝑖𝐶superscriptsubscript𝐿𝑖𝑌superscriptsubscript𝑌𝑖𝐶\displaystyle L_{i}^{Y}+\widehat{Y}_{i}^{C}\rightarrow L_{i}^{Y}+Y_{i}^{C}italic_L start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_Y end_POSTSUPERSCRIPT + over^ start_ARG italic_Y end_ARG start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_C end_POSTSUPERSCRIPT → italic_L start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_Y end_POSTSUPERSCRIPT + italic_Y start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_C end_POSTSUPERSCRIPT (22)
LiN+YiCLiN+Y^iCsuperscriptsubscript𝐿𝑖𝑁superscriptsubscript𝑌𝑖𝐶superscriptsubscript𝐿𝑖𝑁superscriptsubscript^𝑌𝑖𝐶\displaystyle L_{i}^{N}+Y_{i}^{C}\rightarrow L_{i}^{N}+\widehat{Y}_{i}^{C}italic_L start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_N end_POSTSUPERSCRIPT + italic_Y start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_C end_POSTSUPERSCRIPT → italic_L start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_N end_POSTSUPERSCRIPT + over^ start_ARG italic_Y end_ARG start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_C end_POSTSUPERSCRIPT (23)

and

YiP+YiCsuperscriptsubscript𝑌𝑖𝑃superscriptsubscript𝑌𝑖𝐶\displaystyle Y_{i}^{P}+Y_{i}^{C}italic_Y start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_P end_POSTSUPERSCRIPT + italic_Y start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_C end_POSTSUPERSCRIPT Kabsent𝐾\displaystyle\rightarrow K→ italic_K (24)
K+Y𝐾𝑌\displaystyle K+Yitalic_K + italic_Y absent\displaystyle\rightarrow\varnothing→ ∅ (25)

Reactions (22) and (23) activate and deactivate the “negative” output values and reactions (24) and (25) allow two active partial outputs to cancel out and consume the excess Y𝑌Yitalic_Y in the process. When the input is in the domain of function i𝑖iitalic_i, exactly one copy of LiYsuperscriptsubscript𝐿𝑖𝑌L_{i}^{Y}italic_L start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_Y end_POSTSUPERSCRIPT will be present, otherwise one copy of LiNsuperscriptsubscript𝐿𝑖𝑁L_{i}^{N}italic_L start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_N end_POSTSUPERSCRIPT. Since we know that the predicate computation is execution bounded and produces at most one voter, the catalytic reaction will also happen at most as often as the leader changes its vote. Therefore, it is also execution bounded.

6 Limitations of execution bounded CRNs

The main positive results of the paper (LABEL:{thm:execution_bdd_CRDs_decide_all_semilinear_sets} and 5.5) rely on the assumption that valid initial configurations have a single leader (in particular, they are execution bounded only from configurations with a single leader, but not from arbitrary configurations). Section 4 shows that we may assume the CRD deciding a semilinear set is all-voting. However, for the “constructive” results LABEL:{lem:boolean-closure-crd} and 5.5, which compose the output of a CRD 𝒟𝒟\mathcal{D}caligraphic_D with downstream computation, using 𝒟𝒟\mathcal{D}caligraphic_D as a “subroutine” to stably compute a more complex set/function, the constructions crucially use the assumption that 𝒟𝒟\mathcal{D}caligraphic_D is single-voting (i.e., only the leader of 𝒟𝒟\mathcal{D}caligraphic_D votes) to argue the resulting composed CRN is execution bounded. In this section we show these assumptions are necessary, proving that execution bounded CRNs without those constraints are severely limited in their computational abilities.

We show that entirely execution bounded CRNs (from every configuration) can be characterized by a simpler property of having a “linear potential function” that essentially measures how close the CRN is to reaching a terminal configuration. We then use this characterization to prove that entirely execution bounded CRNs can stably decide only limited semilinear predicates (eventually constant, Definition 6.11), assuming all species vote, and that molecular counts cannot decrease to O(1)𝑂1O(1)italic_O ( 1 ) in stable configurations (see Definition 6.8).

6.1 Linear potential functions

We define a linear potential function of a CRN to be a nonnegative linear function of states that each reaction strictly decreases.

Definition 6.1.

A linear potential function Φ:Λ0:ΦsuperscriptΛsubscriptabsent0\Phi:\mathbb{R}^{\Lambda}\to\mathbb{R}_{\geq 0}roman_Φ : blackboard_R start_POSTSUPERSCRIPT roman_Λ end_POSTSUPERSCRIPT → blackboard_R start_POSTSUBSCRIPT ≥ 0 end_POSTSUBSCRIPT for a CRN is a nonnegative, linear function of configurations, such that for each reaction (𝐫,𝐩)𝐫𝐩(\mathbf{r},\mathbf{p})( bold_r , bold_p ), Φ(𝐩𝐫)<0.Φ𝐩𝐫0\Phi(\mathbf{p}-\mathbf{r})<0.roman_Φ ( bold_p - bold_r ) < 0 .

Note that since Φ(𝐱)=SΛcS𝐱(S)Φ𝐱subscript𝑆Λsubscript𝑐𝑆𝐱𝑆\Phi(\mathbf{x})=\sum_{S\in\Lambda}c_{S}\mathbf{x}(S)roman_Φ ( bold_x ) = ∑ start_POSTSUBSCRIPT italic_S ∈ roman_Λ end_POSTSUBSCRIPT italic_c start_POSTSUBSCRIPT italic_S end_POSTSUBSCRIPT bold_x ( italic_S ) is required to be nonnegative on all configurations 𝐱𝐱\mathbf{x}bold_x, it must be nondecreasing in each species, i.e., all coefficients cSsubscript𝑐𝑆c_{S}italic_c start_POSTSUBSCRIPT italic_S end_POSTSUBSCRIPT must be nonnegative (though some are permitted to be 0). Intuitively, we can think of ΦΦ\Phiroman_Φ as assigning a nonnegative “mass” to each species (the mass of S𝑆Sitalic_S is cSsubscript𝑐𝑆c_{S}italic_c start_POSTSUBSCRIPT italic_S end_POSTSUBSCRIPT), such that each reaction removes a positive amount of mass from the system.

Remark 6.2.

A system of linear inequalities with rational coefficients has a real solution if and only if it has a rational solution. For any homogeneous system (where all inequalities are comparing to 0), any positive scalar multiple of a solution is also a solution. By clearing denominators, a system has a rational solution if and only if it has an integer solution. Thus, one can equivalently define a linear potential function to be a function Φ(𝐱)=SΛcS𝐱(S)Φ𝐱subscript𝑆Λsubscript𝑐𝑆𝐱𝑆\Phi(\mathbf{x})=\sum_{S\in\Lambda}c_{S}\mathbf{x}(S)roman_Φ ( bold_x ) = ∑ start_POSTSUBSCRIPT italic_S ∈ roman_Λ end_POSTSUBSCRIPT italic_c start_POSTSUBSCRIPT italic_S end_POSTSUBSCRIPT bold_x ( italic_S ) such that each cSsubscript𝑐𝑆c_{S}\in\mathbb{N}italic_c start_POSTSUBSCRIPT italic_S end_POSTSUBSCRIPT ∈ blackboard_N, i.e., we may assume Φ:Λ:ΦsuperscriptΛ\Phi:\mathbb{N}^{\Lambda}\to\mathbb{N}roman_Φ : blackboard_N start_POSTSUPERSCRIPT roman_Λ end_POSTSUPERSCRIPT → blackboard_N. In particular, since ΦΦ\Phiroman_Φ is decreased by each reaction, it is decreased by at least 1.

A CRN may or may not have a linear potential function. Although it is not straightforward to “syntactically check” a CRN to see if has a linear potential function, it is efficiently decidable: a CRN has a linear potential function if and only if the following system of linear inequalities has a solution (which can be solved in polynomial time using linear programming techniques; the variables to solve for are the cSsubscript𝑐𝑆c_{S}italic_c start_POSTSUBSCRIPT italic_S end_POSTSUBSCRIPT for each SΛ𝑆ΛS\in\Lambdaitalic_S ∈ roman_Λ), where the i𝑖iitalic_i’th reaction has reactants 𝐫isubscript𝐫𝑖\mathbf{r}_{i}bold_r start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and products 𝐩isubscript𝐩𝑖\mathbf{p}_{i}bold_p start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, and species SΛ𝑆ΛS\in\Lambdaitalic_S ∈ roman_Λ has mass cS0subscript𝑐𝑆0c_{S}\geq 0italic_c start_POSTSUBSCRIPT italic_S end_POSTSUBSCRIPT ≥ 0: \optfull

(i)SΛ[𝐩i(S)𝐫i(S)]cS<0for-all𝑖subscript𝑆Λdelimited-[]subscript𝐩𝑖𝑆subscript𝐫𝑖𝑆subscript𝑐𝑆0(\forall i)\sum_{S\in\Lambda}[\mathbf{p}_{i}(S)-\mathbf{r}_{i}(S)]c_{S}<0( ∀ italic_i ) ∑ start_POSTSUBSCRIPT italic_S ∈ roman_Λ end_POSTSUBSCRIPT [ bold_p start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ( italic_S ) - bold_r start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ( italic_S ) ] italic_c start_POSTSUBSCRIPT italic_S end_POSTSUBSCRIPT < 0
\opt

submission,final (i)SΛ[𝐩i(S)𝐫i(S)]cS<0.for-all𝑖subscript𝑆Λdelimited-[]subscript𝐩𝑖𝑆subscript𝐫𝑖𝑆subscript𝑐𝑆0(\forall i)\sum_{S\in\Lambda}[\mathbf{p}_{i}(S)-\mathbf{r}_{i}(S)]c_{S}<0.( ∀ italic_i ) ∑ start_POSTSUBSCRIPT italic_S ∈ roman_Λ end_POSTSUBSCRIPT [ bold_p start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ( italic_S ) - bold_r start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ( italic_S ) ] italic_c start_POSTSUBSCRIPT italic_S end_POSTSUBSCRIPT < 0 . For example, for the reactions A+AB+C𝐴𝐴𝐵𝐶A+A\mathop{\rightarrow}\limits B+Citalic_A + italic_A → italic_B + italic_C and B+BA𝐵𝐵𝐴B+B\mathop{\rightarrow}\limits Aitalic_B + italic_B → italic_A, for each reaction to strictly decrease the potential function Φ(𝐱)=cA𝐱(A)+cB𝐱(B)+cC𝐱(C)Φ𝐱subscript𝑐𝐴𝐱𝐴subscript𝑐𝐵𝐱𝐵subscript𝑐𝐶𝐱𝐶\Phi(\mathbf{x})=c_{A}\mathbf{x}(A)+c_{B}\mathbf{x}(B)+c_{C}\mathbf{x}(C)roman_Φ ( bold_x ) = italic_c start_POSTSUBSCRIPT italic_A end_POSTSUBSCRIPT bold_x ( italic_A ) + italic_c start_POSTSUBSCRIPT italic_B end_POSTSUBSCRIPT bold_x ( italic_B ) + italic_c start_POSTSUBSCRIPT italic_C end_POSTSUBSCRIPT bold_x ( italic_C ), ΦΦ\Phiroman_Φ must satisfy 2cA>cB+cC2subscript𝑐𝐴subscript𝑐𝐵subscript𝑐𝐶2c_{A}>c_{B}+c_{C}2 italic_c start_POSTSUBSCRIPT italic_A end_POSTSUBSCRIPT > italic_c start_POSTSUBSCRIPT italic_B end_POSTSUBSCRIPT + italic_c start_POSTSUBSCRIPT italic_C end_POSTSUBSCRIPT and 2cB>cA2subscript𝑐𝐵subscript𝑐𝐴2c_{B}>c_{A}2 italic_c start_POSTSUBSCRIPT italic_B end_POSTSUBSCRIPT > italic_c start_POSTSUBSCRIPT italic_A end_POSTSUBSCRIPT. In this case, cA=1,cB=1,cC=0formulae-sequencesubscript𝑐𝐴1formulae-sequencesubscript𝑐𝐵1subscript𝑐𝐶0c_{A}=1,c_{B}=1,c_{C}=0italic_c start_POSTSUBSCRIPT italic_A end_POSTSUBSCRIPT = 1 , italic_c start_POSTSUBSCRIPT italic_B end_POSTSUBSCRIPT = 1 , italic_c start_POSTSUBSCRIPT italic_C end_POSTSUBSCRIPT = 0 works.

The following is a variant of Farkas’ Lemma [farkas1902theorie], one of several similar “Theorems of the Alternative” stating that exactly one of two different linear systems has a solution. (See [mangasarian1994nonlinear, Chapter 4] for a list of such theorems.) A proof can be found in [gale1960theory, Theorem 2.10].

Theorem 6.3.

Let 𝐌𝐌\mathbf{M}bold_M be a real matrix. Exactly one of the following statements is true.

  1. 1.

    There is a vector 𝐮𝟎𝐮0\mathbf{u}\geqq\mathbf{0}bold_u ≧ bold_0 such that 𝐌𝐮<𝟎𝐌𝐮0\mathbf{M}\mathbf{u}<\mathbf{0}bold_Mu < bold_0.

  2. 2.

    There is a vector 𝐯𝟎𝐯0\mathbf{v}\geq\mathbf{0}bold_v ≥ bold_0 such that 𝐯𝐌𝟎𝐯𝐌0\mathbf{v}\mathbf{M}\geqq\mathbf{0}bold_vM ≧ bold_0.

We require the following discrete variant of Theorem 6.3. The geometric intuition of this version is illustrated in Figure 1. \optsubmissionIt is proven in the appendix.

{corollaryrep}

Let 𝐌𝐌\mathbf{M}bold_M be a rational matrix. Exactly one of the following statements is true.

  1. 1.

    There is an integer vector 𝐮𝟎𝐮0\mathbf{u}\geq\mathbf{0}bold_u ≥ bold_0 such that 𝐌𝐮𝟎𝐌𝐮0\mathbf{M}\mathbf{u}\geqq\mathbf{0}bold_Mu ≧ bold_0.

  2. 2.

    There is an integer vector 𝐯𝟎𝐯0\mathbf{v}\geqq\mathbf{0}bold_v ≧ bold_0 such that 𝐯𝐌<𝟎𝐯𝐌0\mathbf{v}\mathbf{M}<\mathbf{0}bold_vM < bold_0.

Proof 6.4.

For convenience when we use Section 6.1 in proving Theorem 6.5, we swapped the roles of 𝐮𝐮\mathbf{u}bold_u and 𝐯𝐯\mathbf{v}bold_v in left- vs. right-multiplication with 𝐌𝐌\mathbf{M}bold_M; the real-valued version of the statement of Section 6.1 is equivalent to Theorem 6.3 by taking the transpose of 𝐌𝐌\mathbf{M}bold_M.

To see that we may assume the vectors are integer-valued if 𝐌𝐌\mathbf{M}bold_M is rational-valued, recall that a system of linear equalities/inequalities with rational coefficients has a solution if and only if it has a rational solution. Since the system is homogeneous (the matrix-vector product is compared to the zero vector 𝟎0\mathbf{0}bold_0), any multiple of a solution is also a solution. By clearing denominators, it has a rational solution if and only if it has an integer solution.

Refer to caption
Figure 1: Geometric intuition of Section 6.1. A matrix 𝐌𝐌\mathbf{M}bold_M has column vectors 𝐱1,𝐱2,𝐱3subscript𝐱1subscript𝐱2subscript𝐱3\mathbf{x}_{1},\mathbf{x}_{2},\mathbf{x}_{3}bold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , bold_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , bold_x start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT. The cone of 𝐌𝐌\mathbf{M}bold_M is the nonnegative span of these vectors, shown as a faded gray region. Exactly one of two scenarios occurs: a) The cone of 𝐌𝐌\mathbf{M}bold_M intersects the first quadrant (nonnegative orthant in higher dimensions) away from the origin, i.e., some semipositive point (𝐌𝐮𝟎𝐌𝐮0\mathbf{M}\mathbf{u}\geq\mathbf{0}bold_Mu ≥ bold_0 above) is a nonnegative linear combination of vectors 𝐱1,𝐱2,𝐱3subscript𝐱1subscript𝐱2subscript𝐱3\mathbf{x}_{1},\mathbf{x}_{2},\mathbf{x}_{3}bold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , bold_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , bold_x start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT. b) The cone of 𝐌𝐌\mathbf{M}bold_M does not intersect the first quadrant except at the origin. In this case we can draw a dashed line (hyperplane in higher dimensions) separating the cone of 𝐌𝐌\mathbf{M}bold_M from the first quadrant. The orthogonal vector 𝐯𝟎𝐯0\mathbf{v}\geq\mathbf{0}bold_v ≥ bold_0 to this line lies in the first quadrant, but 𝐯𝐌<0𝐯𝐌0\mathbf{v}\mathbf{M}<0bold_vM < 0 means each vector 𝐱isubscript𝐱𝑖\mathbf{x}_{i}bold_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT has negative dot product 𝐯𝐱i<0𝐯subscript𝐱𝑖0\mathbf{v}\cdot\mathbf{x}_{i}<0bold_v ⋅ bold_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT < 0, i.e., all 𝐱isubscript𝐱𝑖\mathbf{x}_{i}bold_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT vectors lie on the other side of the line.
{toappendix}

Although we do not need the following fact, it is worthwhile to observe that, if 𝐌𝐌\mathbf{M}bold_M is integer-valued (as in our application), then the solution 𝐮𝐮\mathbf{u}bold_u or 𝐯𝐯\mathbf{v}bold_v (whichever exists) in Section 6.1 has entries that are at most exponential in 𝐌norm𝐌\|\mathbf{M}\|∥ bold_M ∥ i.e., at most exponential in the sum of absolute values of entries of 𝐌𝐌\mathbf{M}bold_M (see e.g., [papadimitriou1981complexity]). So in particular when we consider 𝐌𝐌\mathbf{M}bold_M having small O(1)𝑂1O(1)italic_O ( 1 ) size entries, this means the solution 𝐮𝐮\mathbf{u}bold_u or 𝐯𝐯\mathbf{v}bold_v has entries that are at most exponential in the number of rows and columns of 𝐌𝐌\mathbf{M}bold_M. When 𝐌𝐌\mathbf{M}bold_M is a stoichiometric matrix, this corresponds to the number of species and reactions, respectively, of the CRN.

Section 6.1 will help us prove the following theorem characterizing CRNs with bounded executions from all configurations. Theorem 6.5 is used in this paper only to prove Theorems 6.9 and 6.3, but it may also be of independent interest, since it equates a “global, infinitary, difficult-to-check” condition (bounded executions from all configurations) with a “local, easy-to-check” condition (having a linear potential function).

Theorem 6.5.

A CRN has a linear potential function if and only if it is entirely execution bounded.

Proof 6.6.

Let 𝒞=(Λ,R)𝒞Λ𝑅\mathcal{C}=(\Lambda,R)caligraphic_C = ( roman_Λ , italic_R ) be a CRN. The forward direction is easy: assuming 𝒞𝒞\mathcal{C}caligraphic_C has potential function ΦΦ\Phiroman_Φ, since each reaction decreases ΦΦ\Phiroman_Φ by at least 1 (see Remark 6.2), starting from configuration 𝐱𝐱\mathbf{x}bold_x, we can execute at most Φ(𝐱)Φ𝐱\Phi(\mathbf{x})roman_Φ ( bold_x ) reactions while kee** ΦΦ\Phiroman_Φ nonnegative. Thus 𝒞𝒞\mathcal{C}caligraphic_C is entirely execution bounded.

To see the reverse direction, assume that 𝒞𝒞\mathcal{C}caligraphic_C is execution bounded from every configuration, and let 𝐌𝐌\mathbf{M}bold_M be the stoichiometric matrix of 𝒞𝒞\mathcal{C}caligraphic_C. We claim there is no integer vector 𝐮𝟎𝐮0\mathbf{u}\geq\mathbf{0}bold_u ≥ bold_0 satisfying 𝐌𝐮𝟎𝐌𝐮0\mathbf{M}\mathbf{u}\geqq\mathbf{0}bold_Mu ≧ bold_0; for the sake of contradiction suppose otherwise. Interpreting 𝐮𝐮\mathbf{u}bold_u as counts of reactions to execute, for any sufficiently large configuration 𝐱𝐱\mathbf{x}bold_x, all reactions in 𝐮𝐮\mathbf{u}bold_u can be applied (in arbitrary order), and the vector 𝐌𝐮𝐌𝐮\mathbf{M}\mathbf{u}bold_Mu describes the resulting change in species counts, reaching to configuration 𝐲=𝐱+𝐌𝐮𝐲𝐱𝐌𝐮\mathbf{y}=\mathbf{x}+\mathbf{M}\mathbf{u}bold_y = bold_x + bold_Mu. Since 𝐌𝐮𝟎𝐌𝐮0\mathbf{M}\mathbf{u}\geqq\mathbf{0}bold_Mu ≧ bold_0, this path is self-covering, i.e., 𝐲𝐱𝐲𝐱\mathbf{y}\geqq\mathbf{x}bold_y ≧ bold_x. But since 𝒞𝒞\mathcal{C}caligraphic_C is execution bounded from every configuration, by Section 3, 𝒞𝒞\mathcal{C}caligraphic_C has no self-covering path from any configuration, a contradiction. This establishes the claim that 𝐌𝐮𝟎𝐌𝐮0\mathbf{M}\mathbf{u}\geqq\mathbf{0}bold_Mu ≧ bold_0 has no integer solution 𝐮𝟎𝐮0\mathbf{u}\geq\mathbf{0}bold_u ≥ bold_0.

By Section 6.1, there is an integer vector 𝐯𝟎𝐯0\mathbf{v}\geqq\mathbf{0}bold_v ≧ bold_0 such that 𝐯𝐌<𝟎𝐯𝐌0\mathbf{v}\mathbf{M}<\mathbf{0}bold_vM < bold_0. Let 𝐯Λ𝐯superscriptΛ\mathbf{v}\in\mathbb{N}^{\Lambda}bold_v ∈ blackboard_N start_POSTSUPERSCRIPT roman_Λ end_POSTSUPERSCRIPT be the coefficients of a linear function Φ:Λ:ΦsuperscriptΛ\Phi:\mathbb{N}^{\Lambda}\to\mathbb{N}roman_Φ : blackboard_N start_POSTSUPERSCRIPT roman_Λ end_POSTSUPERSCRIPT → blackboard_N, i.e., Φ(𝐱)=𝐯𝐱Φ𝐱𝐯𝐱\Phi(\mathbf{x})=\mathbf{v}\cdot\mathbf{x}roman_Φ ( bold_x ) = bold_v ⋅ bold_x. Then the vector 𝐯𝐌R𝐯𝐌superscript𝑅\mathbf{v}\mathbf{M}\in\mathbb{Z}^{R}bold_vM ∈ blackboard_Z start_POSTSUPERSCRIPT italic_R end_POSTSUPERSCRIPT represents the amount ΦΦ\Phiroman_Φ changes by one unit of each reaction, i.e., 𝐯𝐌(α)𝐯𝐌𝛼\mathbf{v}\mathbf{M}(\alpha)bold_vM ( italic_α ) is the amount ΦΦ\Phiroman_Φ increases when executing reaction α𝛼\alphaitalic_α once. Since 𝐯𝐌<𝟎𝐯𝐌0\mathbf{v}\mathbf{M}<\mathbf{0}bold_vM < bold_0, this means that every reaction strictly decreases ΦΦ\Phiroman_Φ, i.e., ΦΦ\Phiroman_Φ is a linear potential function for 𝒟𝒟\mathcal{D}caligraphic_D.

{toappendix}
Remark 6.7.

By employing the real-valued version of Section 6.1, the above proof also shows that Theorem 6.5 holds for the continuous model of CRNs [chen2023rate], in which species amounts are modeled as continuous nonnegative real concentrations. In this case, a continuous CRN would be defined to be execution bounded from configuration 𝐱𝐱\mathbf{x}bold_x if each reaction can be executed by at most a finite (real-valued) amount from 𝐱𝐱\mathbf{x}bold_x.

6.2 Impossibility of stably deciding majority and parity

In this section, we prove Theorem 6.9, which is a special case of our main negative result, Section 6.3. We give a self-contained proof of Theorem 6.9 because it is simpler and serves as an intuitive warmup to some of the key ideas used in proving Section 6.3, without the complexities of dealing with arbitrary semilinear sets.

Theorem 6.9 shows a limitation on the computational power of entirely execution bounded, all-voting CRNs, but it requires an additional constraint on the CRN for the result to hold (and we later give counterexamples showing that this extra hypothesis is provably necessary), described in the following definition.

Definition 6.8.

Let 𝒟𝒟\mathcal{D}caligraphic_D be a CRD. The output size of 𝒟𝒟\mathcal{D}caligraphic_D is the function s::𝑠s:\mathbb{N}\to\mathbb{N}italic_s : blackboard_N → blackboard_N defined s(n)=min𝐱,𝐲{𝐲𝐱𝐲,𝐱=n,𝐱 is a valid initial configuration,𝐲 is stable}𝑠𝑛subscript𝐱𝐲conditionalnorm𝐲𝐱𝐲norm𝐱𝑛𝐱 is a valid initial configuration𝐲 is stables(n)=\min_{\mathbf{x},\mathbf{y}}\{\|\mathbf{y}\|\mid\mathbf{x}\Rightarrow% \mathbf{y},\|\mathbf{x}\|=n,\mathbf{x}\text{ is a valid initial configuration}% ,\mathbf{y}\text{ is stable}\}italic_s ( italic_n ) = roman_min start_POSTSUBSCRIPT bold_x , bold_y end_POSTSUBSCRIPT { ∥ bold_y ∥ ∣ bold_x ⇒ bold_y , ∥ bold_x ∥ = italic_n , bold_x is a valid initial configuration , bold_y is stable }, the size of the smallest stable configuration reachable from any valid initial configuration of size n𝑛nitalic_n. A CRD is non-collapsing if limns(n)=subscript𝑛𝑠𝑛\lim_{n\to\infty}s(n)=\inftyroman_lim start_POSTSUBSCRIPT italic_n → ∞ end_POSTSUBSCRIPT italic_s ( italic_n ) = ∞.

Put another way, 𝒟𝒟\mathcal{D}caligraphic_D is collapsing if there is a constant c𝑐citalic_c such that, from infinitely many initial configurations 𝐱𝐱\mathbf{x}bold_x, 𝒟𝒟\mathcal{D}caligraphic_D can reach a stable configuration of size at most c𝑐citalic_c. All population protocols are non-collapsing, since every reaction preserves the configuration size.

Theorem 6.9.

No noncollapsing, all-voting, entirely execution bounded CRD can stably decide the majority predicate [X1X2?]delimited-[]subscript𝑋1subscript𝑋2?[X_{1}\geq X_{2}?][ italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ≥ italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ? ] or the parity predicate [X1mod2?]delimited-[]𝑋modulo12?[X\equiv 1\mod 2?][ italic_X ≡ 1 roman_mod 2 ? ].

Proof 6.10.

Let 𝒟=(Λ,R,Σ,ΥY,ΥN,𝐬)𝒟Λ𝑅ΣsubscriptΥYsubscriptΥN𝐬\mathcal{D}=(\Lambda,R,\Sigma,\Upsilon_{\mathrm{Y}},\Upsilon_{\mathrm{N}},% \mathbf{s})caligraphic_D = ( roman_Λ , italic_R , roman_Σ , roman_Υ start_POSTSUBSCRIPT roman_Y end_POSTSUBSCRIPT , roman_Υ start_POSTSUBSCRIPT roman_N end_POSTSUBSCRIPT , bold_s ) be a CRD obeying the stated conditions, and suppose for the sake of contradiction that 𝒟𝒟\mathcal{D}caligraphic_D stably decides the majority predicate (so Σ={X1,X2}Σsubscript𝑋1subscript𝑋2\Sigma=\{X_{1},X_{2}\}roman_Σ = { italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT }).

We consider the sequence of stable configurations 𝐚1,𝐛1,𝐚2,𝐛2,subscript𝐚1subscript𝐛1subscript𝐚2subscript𝐛2italic-…\mathbf{a}_{1},\mathbf{b}_{1},\mathbf{a}_{2},\mathbf{b}_{2},\dotsbold_a start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , bold_b start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , bold_a start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , bold_b start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , italic_… defined as follows. Let 𝐚1subscript𝐚1\mathbf{a}_{1}bold_a start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT be a stable configuration reachable from initial configuration 𝐬+{X1,X2}𝐬subscript𝑋1subscript𝑋2\mathbf{s}+\{X_{1},X_{2}\}bold_s + { italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT }; since the correct answer is yes, all species present in 𝐚1subscript𝐚1\mathbf{a}_{1}bold_a start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT vote yes. Now add a single copy of X2subscript𝑋2X_{2}italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT. By additivity, the configuration 𝐚1+{X2}subscript𝐚1subscript𝑋2\mathbf{a}_{1}+\{X_{2}\}bold_a start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT + { italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT } is reachable from 𝐬+{X1,2X2}𝐬subscript𝑋12subscript𝑋2\mathbf{s}+\{X_{1},2X_{2}\}bold_s + { italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , 2 italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT }, for which the correct answer in this case is no. Thus, since 𝒟𝒟\mathcal{D}caligraphic_D stably decides majority, from 𝐚1+{X2}subscript𝐚1subscript𝑋2\mathbf{a}_{1}+\{X_{2}\}bold_a start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT + { italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT }, a stable “no” configuration is reachable; call this 𝐛1subscript𝐛1\mathbf{b}_{1}bold_b start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT. Now add a single X1subscript𝑋1X_{1}italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT. Since the correct answer is yes, from 𝐛1+{X1}subscript𝐛1subscript𝑋1\mathbf{b}_{1}+\{X_{1}\}bold_b start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT + { italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT } a stable “yes” configuration is reachable, call it 𝐚2subscript𝐚2\mathbf{a}_{2}bold_a start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT.

Continuing in this way, we have a sequence of stable configurations 𝐚1,𝐛1,𝐚2,𝐛2,subscript𝐚1subscript𝐛1subscript𝐚2subscript𝐛2italic-…\mathbf{a}_{1},\mathbf{b}_{1},\mathbf{a}_{2},\mathbf{b}_{2},\dotsbold_a start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , bold_b start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , bold_a start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , bold_b start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , italic_… where all species in 𝐚isubscript𝐚𝑖\mathbf{a}_{i}bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT vote yes and all species in 𝐛isubscript𝐛𝑖\mathbf{b}_{i}bold_b start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT vote no. Since 𝒟𝒟\mathcal{D}caligraphic_D is noncollapsing, the size of the configurations 𝐚isubscript𝐚𝑖\mathbf{a}_{i}bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and 𝐛isubscript𝐛𝑖\mathbf{b}_{i}bold_b start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT increases without bound as i𝑖i\to\inftyitalic_i → ∞. (Possibly 𝐚i+1<𝐚inormsubscript𝐚𝑖1normsubscript𝐚𝑖\|\mathbf{a}_{i+1}\|<\|\mathbf{a}_{i}\|∥ bold_a start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT ∥ < ∥ bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥, i.e., the size is not necessarily monotonically increasing, but for all sufficiently large j>i𝑗𝑖j>iitalic_j > italic_i, we have 𝐚j>𝐚inormsubscript𝐚𝑗normsubscript𝐚𝑖\|\mathbf{a}_{j}\|>\|\mathbf{a}_{i}\|∥ bold_a start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ∥ > ∥ bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥.) Since all species vote, for some constant δ>0𝛿0\delta>0italic_δ > 0, to get from 𝐚i+{X2}subscript𝐚𝑖subscript𝑋2\mathbf{a}_{i}+\{X_{2}\}bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT + { italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT } to 𝐛isubscript𝐛𝑖\mathbf{b}_{i}bold_b start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, at least δ𝐚i𝛿normsubscript𝐚𝑖\delta\|\mathbf{a}_{i}\|italic_δ ∥ bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥ reactions must occur. This is because all species in 𝐚isubscript𝐚𝑖\mathbf{a}_{i}bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT must be removed since they vote yes, and each reaction removes at most O(1)𝑂1O(1)italic_O ( 1 ) molecules. (Concretely, let δ=1/max(𝐫,𝐩)R𝐫𝐩𝛿1subscript𝐫𝐩𝑅norm𝐫norm𝐩\delta=1/\max_{(\mathbf{r},\mathbf{p})\in R}\|\mathbf{r}\|-\|\mathbf{p}\|italic_δ = 1 / roman_max start_POSTSUBSCRIPT ( bold_r , bold_p ) ∈ italic_R end_POSTSUBSCRIPT ∥ bold_r ∥ - ∥ bold_p ∥, i.e., 1 over the most net molecules consumed in any reaction.) Similarly, to get from 𝐛i+{X1}subscript𝐛𝑖subscript𝑋1\mathbf{b}_{i}+\{X_{1}\}bold_b start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT + { italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT } to 𝐚i+1subscript𝐚𝑖1\mathbf{a}_{i+1}bold_a start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT, at least δ𝐛i𝛿normsubscript𝐛𝑖\delta\|\mathbf{b}_{i}\|italic_δ ∥ bold_b start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥ reactions must occur.

Since 𝒟𝒟\mathcal{D}caligraphic_D is entirely execution bounded, by Theorem 6.5, 𝒟𝒟\mathcal{D}caligraphic_D has a linear potential function Φ(𝐱)=𝐯𝐱Φ𝐱𝐯𝐱\Phi(\mathbf{x})=\mathbf{v}\cdot\mathbf{x}roman_Φ ( bold_x ) = bold_v ⋅ bold_x, where 𝐯𝟎𝐯0\mathbf{v}\geq\mathbf{0}bold_v ≥ bold_0. Adding a single X2subscript𝑋2X_{2}italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT to 𝐚isubscript𝐚𝑖\mathbf{a}_{i}bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT increases ΦΦ\Phiroman_Φ by the constant 𝐯(X2)𝐯subscript𝑋2\mathbf{v}(X_{2})bold_v ( italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ). Since 𝐚inormsubscript𝐚𝑖\|\mathbf{a}_{i}\|∥ bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥ grows without bound, the number of reactions to get from 𝐚i+{X2}subscript𝐚𝑖subscript𝑋2\mathbf{a}_{i}+\{X_{2}\}bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT + { italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT } to 𝐛isubscript𝐛𝑖\mathbf{b}_{i}bold_b start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT increases without bound as i𝑖i\to\inftyitalic_i → ∞, and since each reaction strictly decreases ΦΦ\Phiroman_Φ by at least 1, the total change in ΦΦ\Phiroman_Φ that results from adding X2subscript𝑋2X_{2}italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT and then going from 𝐚i+{X2}subscript𝐚𝑖subscript𝑋2\mathbf{a}_{i}+\{X_{2}\}bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT + { italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT } to 𝐛isubscript𝐛𝑖\mathbf{b}_{i}bold_b start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT is unbounded in i𝑖iitalic_i, so unboundedly negative for sufficiently large i𝑖iitalic_i (negative once i𝑖iitalic_i is large enough that δ𝐚i𝐯(X2)+2𝛿normsubscript𝐚𝑖𝐯subscript𝑋22\delta\|\mathbf{a}_{i}\|\geq\mathbf{v}(X_{2})+2italic_δ ∥ bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥ ≥ bold_v ( italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ) + 2). Similarly, adding a single X1subscript𝑋1X_{1}italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT to 𝐛isubscript𝐛𝑖\mathbf{b}_{i}bold_b start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and going from 𝐛i+{X1}subscript𝐛𝑖subscript𝑋1\mathbf{b}_{i}+\{X_{1}\}bold_b start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT + { italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT } to 𝐚i+1subscript𝐚𝑖1\mathbf{a}_{i+1}bold_a start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT, the resulting total change in ΦΦ\Phiroman_Φ is unbounded and (eventually) negative.

ΦΦ\Phiroman_Φ starts this process at the constant Φ(𝐬+{X1,X2})Φ𝐬subscript𝑋1subscript𝑋2\Phi(\mathbf{s}+\{X_{1},X_{2}\})roman_Φ ( bold_s + { italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT } ). Before 𝐚inormsubscript𝐚𝑖\|\mathbf{a}_{i}\|∥ bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥ and 𝐛inormsubscript𝐛𝑖\|\mathbf{b}_{i}\|∥ bold_b start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥ are large enough that δ𝐚i𝐯(X2)+2𝛿normsubscript𝐚𝑖𝐯subscript𝑋22\delta\|\mathbf{a}_{i}\|\geq\mathbf{v}(X_{2})+2italic_δ ∥ bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥ ≥ bold_v ( italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ) + 2 and δ𝐛i𝐯(X1)+2𝛿normsubscript𝐛𝑖𝐯subscript𝑋12\delta\|\mathbf{b}_{i}\|\geq\mathbf{v}(X_{1})+2italic_δ ∥ bold_b start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥ ≥ bold_v ( italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ) + 2 (i.e., large enough that the net change in ΦΦ\Phiroman_Φ is negative resulting from adding a single input and going to the next stable configuration), ΦΦ\Phiroman_Φ could increase, if Φ({X1})Φsubscript𝑋1\Phi(\{X_{1}\})roman_Φ ( { italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT } ) (resp. Φ({X2})Φsubscript𝑋2\Phi(\{X_{2}\})roman_Φ ( { italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT } )) is larger than the net decrease in ΦΦ\Phiroman_Φ due to following reactions to get from 𝐚i+{X2}subscript𝐚𝑖subscript𝑋2\mathbf{a}_{i}+\{X_{2}\}bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT + { italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT } to 𝐛isubscript𝐛𝑖\mathbf{b}_{i}bold_b start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT (resp. from 𝐛i+{X1}subscript𝐛𝑖subscript𝑋1\mathbf{b}_{i}+\{X_{1}\}bold_b start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT + { italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT } to 𝐚isubscript𝐚𝑖\mathbf{a}_{i}bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT).

However, since 𝒟𝒟\mathcal{D}caligraphic_D is noncollapsing, this can only happen for a constant number of i𝑖iitalic_i (so ΦΦ\Phiroman_Φ never reaches more than a constant above its initial value Φ(𝐬+{X1,X2})Φ𝐬subscript𝑋1subscript𝑋2\Phi(\mathbf{s}+\{X_{1},X_{2}\})roman_Φ ( bold_s + { italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT } )), after which ΦΦ\Phiroman_Φ strictly decreases after each round of this process. At some point in this process, 𝒟𝒟\mathcal{D}caligraphic_D will not be able to reach all the way to the next 𝐚isubscript𝐚𝑖\mathbf{a}_{i}bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT or 𝐛isubscript𝐛𝑖\mathbf{b}_{i}bold_b start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT without ΦΦ\Phiroman_Φ becoming negative, a contradiction.

The argument for parity is similar, but instead of alternating adding X1subscript𝑋1X_{1}italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT then X2subscript𝑋2X_{2}italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT, in each round we always add one more X𝑋Xitalic_X to flip the correct answer.

Theorem 6.9 is false without the noncollapsing hypothesis. The following collapsing, leaderless (but all-voting and entirely execution bounded) CRD stably decides majority: Species X1,x1subscript𝑋1subscript𝑥1X_{1},x_{1}italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT vote yes, while X2,x2subscript𝑋2subscript𝑥2X_{2},x_{2}italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , italic_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT vote no:

X1+X2subscript𝑋1subscript𝑋2\displaystyle X_{1}+X_{2}italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT + italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT x1+x2subscript𝑥1subscript𝑥2\displaystyle\mathop{\rightarrow}\limits x_{1}+x_{2}→ italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT + italic_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT
X1+x2subscript𝑋1subscript𝑥2\displaystyle X_{1}+x_{2}italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT + italic_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT X1subscript𝑋1\displaystyle\mathop{\rightarrow}\limits X_{1}→ italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT
X2+x1subscript𝑋2subscript𝑥1\displaystyle X_{2}+x_{1}italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT + italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT X2subscript𝑋2\displaystyle\mathop{\rightarrow}\limits X_{2}→ italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT
x1+x2subscript𝑥1subscript𝑥2\displaystyle x_{1}+x_{2}italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT + italic_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT x1subscript𝑥1\displaystyle\mathop{\rightarrow}\limits x_{1}→ italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT

It has bounded executions from any configuration: min(#X1,#X2)#subscript𝑋1#subscript𝑋2\min(\#X_{1},\#X_{2})roman_min ( # italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , # italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ) of the first reaction can occur, and the other reactions decrease molecular count, so are limited by the total configuration size. However, it is collapsing since a stable configuration of size 1 is always reachable. Theorem 6.9 is similarly false without the all-voting hypothesis; for each of the reactions with one product above, add another non-voting product W𝑊Witalic_W. This converts the CRD to be noncollapsing but not all-voting. Of course, the execution bounded hypothesis is also necessary: the original population protocols paper [angluin2004computation] showed that all-voting, noncollapsing, leaderless population protocols can stably decide all semilinear predicates.

The following collapsing, all-voting, leaderless (but entirely execution bounded) CRD stably decides parity. Let the input species be named X1subscript𝑋1X_{1}italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT. Species X1subscript𝑋1X_{1}italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT votes yes, X0subscript𝑋0X_{0}italic_X start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT votes no:

X1+X1subscript𝑋1subscript𝑋1\displaystyle X_{1}+X_{1}italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT + italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT X0subscript𝑋0\displaystyle\mathop{\rightarrow}\limits X_{0}→ italic_X start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT
X1+X0subscript𝑋1subscript𝑋0\displaystyle X_{1}+X_{0}italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT + italic_X start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT X1subscript𝑋1\displaystyle\mathop{\rightarrow}\limits X_{1}→ italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT
X0+X0subscript𝑋0subscript𝑋0\displaystyle X_{0}+X_{0}italic_X start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT + italic_X start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT X0subscript𝑋0\displaystyle\mathop{\rightarrow}\limits X_{0}→ italic_X start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT
\opt

full It has bounded executions from any configuration: exactly #X1+#X01#subscript𝑋1#subscript𝑋01\#X_{1}+\#X_{0}-1# italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT + # italic_X start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT - 1 reactions can occur since each reduces #X1+#X0#subscript𝑋1#subscript𝑋0\#X_{1}+\#X_{0}# italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT + # italic_X start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT by 1. Similar to above, by adding the non-voting product W𝑊Witalic_W to each reaction above, this CRD becomes noncollapsing but not all-voting, showing that the all-voting hypothesis is also necessary for stably deciding parity.

6.3 Impossibility of stably deciding not eventually constant predicates

We now present our main negative result, Section 6.3, which generalizes Theorem 6.9 to show that such CRNs can stably decide only trivial (eventually constant) predicates. \optsubmissionThe proof is in the appendix.

Definition 6.11.

Let ϕ:d{0,1}:italic-ϕsuperscript𝑑01\phi:\mathbb{N}^{d}\rightarrow\{0,1\}italic_ϕ : blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT → { 0 , 1 } be a predicate. We say ϕitalic-ϕ\phiitalic_ϕ is eventually constant if there is n0subscript𝑛0n_{0}\in\mathbb{N}italic_n start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ∈ blackboard_N such that ϕitalic-ϕ\phiitalic_ϕ is constant on n0d={𝐱d(i{1,,d})𝐱(i)n0}superscriptsubscriptabsentsubscript𝑛0𝑑conditional-set𝐱superscript𝑑for-all𝑖1𝑑𝐱𝑖subscript𝑛0\mathbb{N}_{\geq n_{0}}^{d}=\left\{\mathbf{x}\in\mathbb{N}^{d}\mid(\forall i% \in\{1,\ldots,d\})\ \mathbf{x}(i)\geq n_{0}\right\}blackboard_N start_POSTSUBSCRIPT ≥ italic_n start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT = { bold_x ∈ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT ∣ ( ∀ italic_i ∈ { 1 , … , italic_d } ) bold_x ( italic_i ) ≥ italic_n start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT }, i.e., either ϕ1(0)n0d=superscriptitalic-ϕ10superscriptsubscriptabsentsubscript𝑛0𝑑\phi^{-1}(0)\cap\mathbb{N}_{\geq n_{0}}^{d}=\emptysetitalic_ϕ start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT ( 0 ) ∩ blackboard_N start_POSTSUBSCRIPT ≥ italic_n start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT = ∅ or ϕ1(1)n0d=superscriptitalic-ϕ11superscriptsubscriptabsentsubscript𝑛0𝑑\phi^{-1}(1)\cap\mathbb{N}_{\geq n_{0}}^{d}=\emptysetitalic_ϕ start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT ( 1 ) ∩ blackboard_N start_POSTSUBSCRIPT ≥ italic_n start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT = ∅.

In other words, although ϕitalic-ϕ\phiitalic_ϕ may have an infinite number of each output, “sufficiently far from the boundary of the positive orthant” (where all coordinates exceed n0subscript𝑛0n_{0}italic_n start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT), only one output appears. \optsubmission,fullSee Figure 2 for a 2D example.

{toappendix}
Refer to caption
Figure 2: Boolean combinations of threshold predicates in 2D. In all cases, inputs of region R2subscript𝑅2R_{2}italic_R start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT output yes, while R1,R3,R4subscript𝑅1subscript𝑅3subscript𝑅4R_{1},R_{3},R_{4}italic_R start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_R start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT , italic_R start_POSTSUBSCRIPT 4 end_POSTSUBSCRIPT output no. In part (a), the no regions are finite, making the predicate trivially eventually constant. Part (b) features both infinite no and yes regions; setting m03subscript𝑚03m_{0}\geq 3italic_m start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ≥ 3, the output within m0ksubscriptsuperscript𝑘absentsubscript𝑚0\mathbb{N}^{k}_{\geq m_{0}}blackboard_N start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT start_POSTSUBSCRIPT ≥ italic_m start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT end_POSTSUBSCRIPT is constant, rendering the predicate eventually constant. In contrast, part (c) has two totally unbounded regions R2subscript𝑅2R_{2}italic_R start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT and R3subscript𝑅3R_{3}italic_R start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT, both of which contain points that are arbitrarily large on all components. We further observe that this implies a separating line with a positive, non-infinite slope between the two regions (in 2D). Generalized to more dimensions: a hyperplane with a normal vector with at least one positive and at least one negative component (Lemma 6.17).

For any set Bd𝐵superscript𝑑B\subseteq\mathbb{N}^{d}italic_B ⊆ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT and 𝐯d𝐯superscript𝑑\mathbf{v}\in\mathbb{N}^{d}bold_v ∈ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT, write B+𝐯𝐵𝐯B+\mathbf{v}italic_B + bold_v to denote the set {𝐱+𝐯𝐱B},conditional-set𝐱𝐯𝐱𝐵\{\mathbf{x}+\mathbf{v}\mid\mathbf{x}\in B\},{ bold_x + bold_v ∣ bold_x ∈ italic_B } , which is B𝐵Bitalic_B translated by vector 𝐯𝐯\mathbf{v}bold_v. Let 𝐮idsubscript𝐮𝑖superscript𝑑\mathbf{u}_{i}\in\mathbb{N}^{d}bold_u start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∈ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT denote the unit vector in direction i𝑖iitalic_i, i.e., 𝐮i(i)=1subscript𝐮𝑖𝑖1\mathbf{u}_{i}(i)=1bold_u start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ( italic_i ) = 1 and 𝐮i(j)=0subscript𝐮𝑖𝑗0\mathbf{u}_{i}(j)=0bold_u start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ( italic_j ) = 0 for ji𝑗𝑖j\neq iitalic_j ≠ italic_i.

Definition 6.12.

We say Ad𝐴superscript𝑑A\subseteq\mathbb{N}^{d}italic_A ⊆ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT is periodic if, for some k+𝑘superscriptk\in\mathbb{N}^{+}italic_k ∈ blackboard_N start_POSTSUPERSCRIPT + end_POSTSUPERSCRIPT, for some finite set F{0,1,,k1}d𝐹superscript01𝑘1𝑑F\subseteq\{0,1,\dots,k-1\}^{d}italic_F ⊆ { 0 , 1 , … , italic_k - 1 } start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT, A=n1,,ndF+i=1dkni𝐮i𝐴subscriptsubscript𝑛1subscript𝑛𝑑𝐹superscriptsubscript𝑖1𝑑𝑘subscript𝑛𝑖subscript𝐮𝑖A=\bigcup_{n_{1},\dots,n_{d}\in\mathbb{N}}F+\sum_{i=1}^{d}k\cdot n_{i}\cdot% \mathbf{u}_{i}italic_A = ⋃ start_POSTSUBSCRIPT italic_n start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_n start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT ∈ blackboard_N end_POSTSUBSCRIPT italic_F + ∑ start_POSTSUBSCRIPT italic_i = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT italic_k ⋅ italic_n start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ⋅ bold_u start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT. We say k𝑘kitalic_k is the period of A𝐴Aitalic_A and say that A𝐴Aitalic_A is k𝑘kitalic_k-periodic. Equivalently, A𝐴Aitalic_A is k𝑘kitalic_k-periodic if, for all 𝐱d𝐱superscript𝑑\mathbf{x}\in\mathbb{N}^{d}bold_x ∈ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT and all unit vectors 𝐮isubscript𝐮𝑖\mathbf{u}_{i}bold_u start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, 𝐱A𝐱+k𝐮iAiff𝐱𝐴𝐱𝑘subscript𝐮𝑖𝐴\mathbf{x}\in A\iff\mathbf{x}+k\cdot\mathbf{u}_{i}\in Abold_x ∈ italic_A ⇔ bold_x + italic_k ⋅ bold_u start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∈ italic_A.

In other words, A𝐴Aitalic_A is periodic if it is a union of copies of a finite subset F𝐹Fitalic_F of the k×k××k𝑘𝑘𝑘k\times k\times\dots\times kitalic_k × italic_k × ⋯ × italic_k hypercube with a corner at the origin, translated in each direction by every nonnegative integer multiple of the hypercube’s width. See Figure 3. Note that if A𝐴Aitalic_A is k𝑘kitalic_k-periodic, then it is also ksuperscript𝑘k^{\prime}italic_k start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT-periodic for every positive integer multiple k=iksuperscript𝑘𝑖𝑘k^{\prime}=i\cdot kitalic_k start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT = italic_i ⋅ italic_k of k𝑘kitalic_k.

Refer to caption
Figure 3: A 2D periodic set A𝐴Aitalic_A. The finite set F={(0,0),(0,2),(1,1),(2,2)}𝐹00021122F=\{(0,0),(0,2),(1,1),(2,2)\}italic_F = { ( 0 , 0 ) , ( 0 , 2 ) , ( 1 , 1 ) , ( 2 , 2 ) }, a subset of the 3×3333\times 33 × 3 square {0,1,2}2superscript0122\{0,1,2\}^{2}{ 0 , 1 , 2 } start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT, is translated in both x𝑥xitalic_x and y𝑦yitalic_y directions by every nonnegative vector with entries that are multiples of 3. If the set is periodic but not constant, then there is some vector 𝐯𝐯\mathbf{v}bold_v such that the sequence 𝐲0,𝐲1,subscript𝐲0subscript𝐲1\mathbf{y}_{0},\mathbf{y}_{1},\dotsbold_y start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_y start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , …, each being the previous plus 𝐯𝐯\mathbf{v}bold_v (𝐯=(2,1)𝐯21\mathbf{v}=(2,1)bold_v = ( 2 , 1 ) in this example), is periodic but not constant, and then a regularly-spaced subsequence 𝐱0,𝐱1,subscript𝐱0subscript𝐱1\mathbf{x}_{0},\mathbf{x}_{1},\dotsbold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , …, alternating points in A𝐴Aitalic_A and points not in A𝐴Aitalic_A, satisfies Lemma 6.20. For brevity, the figure shows 𝐲0subscript𝐲0\mathbf{y}_{0}bold_y start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT as the origin, but in the proof of Lemma 6.20, 𝐲0subscript𝐲0\mathbf{y}_{0}bold_y start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT is chosen to be sufficiently far from the origin that, moving in direction 𝐯𝐯\mathbf{v}bold_v infinitely from that point will not cross any hyperplanes defined by the threshold sets of that proof.
Lemma 6.13.

Let Ad𝐴superscript𝑑A\subseteq\mathbb{N}^{d}italic_A ⊆ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT be a Boolean combination of mod sets. Then A𝐴Aitalic_A is periodic.

Proof 6.14.

We prove this by induction on the number of mod sets. For the base case, let A={𝐱𝐰𝐱cmodm}𝐴conditional-set𝐱𝐰𝐱modulo𝑐𝑚A=\{\mathbf{x}\mid\mathbf{w}\cdot\mathbf{x}\equiv c\mod m\}italic_A = { bold_x ∣ bold_w ⋅ bold_x ≡ italic_c roman_mod italic_m } be a single mod set, where 𝐰{0,,m1}d𝐰superscript0𝑚1𝑑\mathbf{w}\in\{0,\dots,m-1\}^{d}bold_w ∈ { 0 , … , italic_m - 1 } start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT and c,m𝑐𝑚c,m\in\mathbb{N}italic_c , italic_m ∈ blackboard_N are constants. Letting k=m𝑘𝑚k=mitalic_k = italic_m and F=A{0,,m1}d𝐹𝐴superscript0𝑚1𝑑F=A\cap\{0,\dots,m-1\}^{d}italic_F = italic_A ∩ { 0 , … , italic_m - 1 } start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT in Definition 6.12 works. Let 𝐱d𝐱superscript𝑑\mathbf{x}\in\mathbb{N}^{d}bold_x ∈ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT. Then for all 1id1𝑖𝑑1\leq i\leq d1 ≤ italic_i ≤ italic_d, 𝐰𝐱𝐰(𝐱+m𝐮i)modm𝐰𝐱modulo𝐰𝐱𝑚subscript𝐮𝑖𝑚\mathbf{w}\cdot\mathbf{x}\equiv\mathbf{w}\cdot(\mathbf{x}+m\mathbf{u}_{i})\mod mbold_w ⋅ bold_x ≡ bold_w ⋅ ( bold_x + italic_m bold_u start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) roman_mod italic_m, so 𝐰𝐱cmodm𝐰(𝐱+m𝐮i)cmodmiff𝐰𝐱modulo𝑐𝑚𝐰𝐱𝑚subscript𝐮𝑖modulo𝑐𝑚\mathbf{w}\cdot\mathbf{x}\equiv c\mod m\iff\mathbf{w}\cdot(\mathbf{x}+m\mathbf% {u}_{i})\equiv c\mod mbold_w ⋅ bold_x ≡ italic_c roman_mod italic_m ⇔ bold_w ⋅ ( bold_x + italic_m bold_u start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) ≡ italic_c roman_mod italic_m, meaning that 𝐱A𝐱+m𝐮iAiff𝐱𝐴𝐱𝑚subscript𝐮𝑖𝐴\mathbf{x}\in A\iff\mathbf{x}+m\mathbf{u}_{i}\in Abold_x ∈ italic_A ⇔ bold_x + italic_m bold_u start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∈ italic_A, so A𝐴Aitalic_A is k𝑘kitalic_k-periodic.

The inductive case amounts to showing that periodic sets are closed under Boolean operations of union, intersection, and complement. Clearly the complement of any periodic set is also periodic.

Inductively assume that A1,A2dsubscript𝐴1subscript𝐴2superscript𝑑A_{1},A_{2}\subseteq\mathbb{N}^{d}italic_A start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_A start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ⊆ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT are periodic; we argue that A1A2subscript𝐴1subscript𝐴2A_{1}\cup A_{2}italic_A start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ∪ italic_A start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT is periodic. Letting k𝑘kitalic_k be the least common multiple of their periods, we may assume both A1subscript𝐴1A_{1}italic_A start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT and A2subscript𝐴2A_{2}italic_A start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT are k𝑘kitalic_k-periodic with the same period k𝑘kitalic_k. Then for all 𝐱d𝐱superscript𝑑\mathbf{x}\in\mathbb{N}^{d}bold_x ∈ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT and all unit vectors 𝐮isubscript𝐮𝑖\mathbf{u}_{i}bold_u start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, 𝐱A1𝐱+k𝐮iA1iff𝐱subscript𝐴1𝐱𝑘subscript𝐮𝑖subscript𝐴1\mathbf{x}\in A_{1}\iff\mathbf{x}+k\cdot\mathbf{u}_{i}\in A_{1}bold_x ∈ italic_A start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ⇔ bold_x + italic_k ⋅ bold_u start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∈ italic_A start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT and 𝐱A2𝐱+k𝐮iA2iff𝐱subscript𝐴2𝐱𝑘subscript𝐮𝑖subscript𝐴2\mathbf{x}\in A_{2}\iff\mathbf{x}+k\cdot\mathbf{u}_{i}\in A_{2}bold_x ∈ italic_A start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ⇔ bold_x + italic_k ⋅ bold_u start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∈ italic_A start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT. Thus 𝐱A1A2𝐱+k𝐮iA1A2iff𝐱subscript𝐴1subscript𝐴2𝐱𝑘subscript𝐮𝑖subscript𝐴1subscript𝐴2\mathbf{x}\in A_{1}\cup A_{2}\iff\mathbf{x}+k\cdot\mathbf{u}_{i}\in A_{1}\cup A% _{2}bold_x ∈ italic_A start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ∪ italic_A start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ⇔ bold_x + italic_k ⋅ bold_u start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∈ italic_A start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ∪ italic_A start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT, so A1A2subscript𝐴1subscript𝐴2A_{1}\cup A_{2}italic_A start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ∪ italic_A start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT is also k𝑘kitalic_k-periodic. Similar reasoning shows A1A2subscript𝐴1subscript𝐴2A_{1}\cap A_{2}italic_A start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ∩ italic_A start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT is k𝑘kitalic_k-periodic (one can also appeal to DeMorgan’s Laws).

Each threshold set T𝑇Titalic_T is defined by a hyperplane that partitions dsuperscript𝑑\mathbb{N}^{d}blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT into the sets T𝑇Titalic_T (on one side of the hyperplane, including integer points on the hyperplane itself) and T¯¯𝑇\overline{T}over¯ start_ARG italic_T end_ARG (on the other side of the hyperplane). More generally, several threshold sets partition dsuperscript𝑑\mathbb{N}^{d}blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT into multiple disjoint subsets we call “regions”. Furthermore, any predicate that is a Boolean combination of threshold sets has constant output in any region; the next definition formalizes this.

Definition 6.15.

Let Ad𝐴superscript𝑑A\subseteq\mathbb{N}^{d}italic_A ⊆ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT be Boolean combination of threshold sets T1,,Tkdsubscript𝑇1subscript𝑇𝑘superscript𝑑T_{1},\dots,T_{k}\subset\mathbb{N}^{d}italic_T start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_T start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ⊂ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT. A region of A𝐴Aitalic_A is a convex polytope R0d𝑅superscriptsubscriptabsent0𝑑R\subset\mathbb{R}_{\geq 0}^{d}italic_R ⊂ blackboard_R start_POSTSUBSCRIPT ≥ 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT such that, for all 𝐱,𝐲Rd𝐱𝐲𝑅superscript𝑑\mathbf{x},\mathbf{y}\in R\cap\mathbb{N}^{d}bold_x , bold_y ∈ italic_R ∩ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT, for all 1ik1𝑖𝑘1\leq i\leq k1 ≤ italic_i ≤ italic_k, 𝐱Ti𝐲Tiiff𝐱subscript𝑇𝑖𝐲subscript𝑇𝑖\mathbf{x}\in T_{i}\iff\mathbf{y}\in T_{i}bold_x ∈ italic_T start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ⇔ bold_y ∈ italic_T start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT. The output of the region R𝑅Ritalic_R is the value 1 if RdA𝑅superscript𝑑𝐴R\cap\mathbb{N}^{d}\subset Aitalic_R ∩ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT ⊂ italic_A and 0 if RdA=𝑅superscript𝑑𝐴R\cap\mathbb{N}^{d}\cap A=\emptysetitalic_R ∩ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT ∩ italic_A = ∅. (Note these are the only two possibilities, since no individual threshold set Tisubscript𝑇𝑖T_{i}italic_T start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT is exited or entered as we move within R𝑅Ritalic_R.) A region R𝑅Ritalic_R is totally unbounded if, for all c𝑐c\in\mathbb{N}italic_c ∈ blackboard_N, Rcd𝑅superscriptsubscriptabsent𝑐𝑑R\cap\mathbb{N}_{\geq c}^{d}\neq\emptysetitalic_R ∩ blackboard_N start_POSTSUBSCRIPT ≥ italic_c end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT ≠ ∅, i.e., R𝑅Ritalic_R contains points that are arbitrarily large on all components. A region is called partially bounded if it is not totally unbounded.

Put another way, predicates defined by Boolean combinations of threshold sets are defined by (d1)𝑑1(d-1)( italic_d - 1 )-dimensional hyperplanes that partition dsuperscript𝑑\mathbb{N}^{d}blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT into regions, where in each region, the output of the predicate is all yes, or all no. In fact this is an exact characterization of Boolean combinations of threshold predicates.

Definition 6.16.

For any set Ad𝐴superscript𝑑A\subseteq\mathbb{R}^{d}italic_A ⊆ blackboard_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT, the recession cone of A𝐴Aitalic_A is

recc(A)={𝐯d(𝐱A)(λ>0)𝐱+λ𝐯A},recc𝐴conditional-set𝐯superscript𝑑for-all𝐱𝐴for-all𝜆0𝐱𝜆𝐯𝐴\mathrm{recc}(A)=\{\mathbf{v}\in\mathbb{R}^{d}\mid(\forall\mathbf{x}\in A)(% \forall\lambda>0)\ \mathbf{x}+\lambda\mathbf{v}\in A\},roman_recc ( italic_A ) = { bold_v ∈ blackboard_R start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT ∣ ( ∀ bold_x ∈ italic_A ) ( ∀ italic_λ > 0 ) bold_x + italic_λ bold_v ∈ italic_A } ,

the set of vectors 𝐯𝐯\mathbf{v}bold_v such that, from any point in A𝐴Aitalic_A, one can move in direction 𝐯𝐯\mathbf{v}bold_v forever without leaving A𝐴Aitalic_A.

{observation}

A region R𝑅Ritalic_R defined by threshold sets is totally unbounded if and only if recc(R)>0drecc𝑅superscriptsubscriptabsent0𝑑\mathrm{recc}(R)\cap\mathbb{R}_{>0}^{d}\neq\emptysetroman_recc ( italic_R ) ∩ blackboard_R start_POSTSUBSCRIPT > 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT ≠ ∅, i.e., the recession cone of R𝑅Ritalic_R contains a positive vector.

Lemma 6.17.

Let Ad𝐴superscript𝑑A\subseteq\mathbb{N}^{d}italic_A ⊆ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT be Boolean combination of threshold sets that is not eventually constant. Then there are two adjacent totally unbounded regions R0subscript𝑅0R_{0}italic_R start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT, R1subscript𝑅1R_{1}italic_R start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT with opposite outputs, such that the normal vector 𝐡𝐡\mathbf{h}bold_h of the hyperplane H𝐻Hitalic_H separating R0subscript𝑅0R_{0}italic_R start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT and R1subscript𝑅1R_{1}italic_R start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT has at least one negative component and at least one positive component.

Proof 6.18.

See Figure 5 for an example in 2D. Since A𝐴Aitalic_A is not eventually constant, it must have two totally unbounded regions R0subscript𝑅0R_{0}italic_R start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT and R1subscript𝑅1R_{1}italic_R start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT with opposite outputs; assume WLOG that Risubscript𝑅𝑖R_{i}italic_R start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT has output i𝑖iitalic_i. Let c0𝑐0c\geq 0italic_c ≥ 0 be sufficiently large that all partially bounded regions of A𝐴Aitalic_A are subsets of B=dcd𝐵superscript𝑑superscriptsubscriptabsent𝑐𝑑B=\mathbb{N}^{d}\setminus\mathbb{N}_{\geq c}^{d}italic_B = blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT ∖ blackboard_N start_POSTSUBSCRIPT ≥ italic_c end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT. Now, simply pick any points 𝐱0R0Bsubscript𝐱0subscript𝑅0𝐵\mathbf{x}_{0}\in R_{0}\setminus Bbold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ∈ italic_R start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ∖ italic_B and 𝐱1R1Bsubscript𝐱1subscript𝑅1𝐵\mathbf{x}_{1}\in R_{1}\setminus Bbold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ∈ italic_R start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ∖ italic_B. There is some path from 𝐱0subscript𝐱0\mathbf{x}_{0}bold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT to 𝐱1subscript𝐱1\mathbf{x}_{1}bold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT that follows only unit vectors (i.e., moves only to adjacent points that are distance 1 from the previous point), such that every intermediate point 𝐱superscript𝐱\mathbf{x}^{\prime}bold_x start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT also obeys 𝐱Bsuperscript𝐱𝐵\mathbf{x}^{\prime}\not\in Bbold_x start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ∉ italic_B.

Then this path never enters a partially bounded region of A𝐴Aitalic_A, since they are all subsets of B𝐵Bitalic_B. Thus, since the path starts in a region R0subscript𝑅0R_{0}italic_R start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT with output 0, ends in a region R1subscript𝑅1R_{1}italic_R start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT with output 1, there must be two adjacent points 𝐚,𝐛𝐚𝐛\mathbf{a},\mathbf{b}bold_a , bold_b on the path, where 𝐚𝐚\mathbf{a}bold_a is in a totally unbounded region with output 0 and 𝐛𝐛\mathbf{b}bold_b is in a totally unbounded region with output 1.

Finally, we must that the normal vector of the hyperplane separating R0subscript𝑅0R_{0}italic_R start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT from R1subscript𝑅1R_{1}italic_R start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT has a negative and a positive entry. Recall that a threshold set T𝑇Titalic_T is defined by T={𝐱d𝐰𝐱a}𝑇conditional-set𝐱superscript𝑑𝐰𝐱𝑎T=\{\mathbf{x}\in\mathbb{N}^{d}\mid\mathbf{w}\cdot\mathbf{x}\leq a\}italic_T = { bold_x ∈ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT ∣ bold_w ⋅ bold_x ≤ italic_a }, where 𝐰=(w1,,wd)d𝐰subscript𝑤1subscript𝑤𝑑superscript𝑑\mathbf{w}=(w_{1},\dots,w_{d})\in\mathbb{N}^{d}bold_w = ( italic_w start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_w start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT ) ∈ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT and a𝑎a\in\mathbb{N}italic_a ∈ blackboard_N (Definition 2.4). Since A𝐴Aitalic_A is a Boolean combination of threshold sets and R0,R1subscript𝑅0subscript𝑅1R_{0},R_{1}italic_R start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , italic_R start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT are adjacent with opposite outputs, there must be some threshold set T𝑇Titalic_T such that R1Tsubscript𝑅1𝑇R_{1}\subseteq Titalic_R start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ⊆ italic_T, but R0T=subscript𝑅0𝑇R_{0}\cap T=\emptysetitalic_R start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ∩ italic_T = ∅ (or vice versa, but assume R1Tsubscript𝑅1𝑇R_{1}\subseteq Titalic_R start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ⊆ italic_T WLOG, since we could replace T𝑇Titalic_T with T¯¯𝑇\overline{T}over¯ start_ARG italic_T end_ARG in the Boolean combination defining A𝐴Aitalic_A). Equivalently, we can think of the regions R0subscript𝑅0R_{0}italic_R start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT and R1subscript𝑅1R_{1}italic_R start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT as being separated by the hyperplane 𝐰𝐱=a𝐰𝐱𝑎\mathbf{w}\cdot\mathbf{x}=abold_w ⋅ bold_x = italic_a, with normal vector 𝐰𝐰\mathbf{w}bold_w and offset a𝑎aitalic_a, such that all points 𝐱R1𝐱subscript𝑅1\mathbf{x}\in R_{1}bold_x ∈ italic_R start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT obey 𝐰𝐱a𝐰𝐱𝑎\mathbf{w}\cdot\mathbf{x}\leq abold_w ⋅ bold_x ≤ italic_a, and all points 𝐱R0𝐱subscript𝑅0\mathbf{x}\in R_{0}bold_x ∈ italic_R start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT obey 𝐰𝐱>a𝐰𝐱𝑎\mathbf{w}\cdot\mathbf{x}>abold_w ⋅ bold_x > italic_a. The transition between the regions at points 𝐚𝐚\mathbf{a}bold_a and 𝐛𝐛\mathbf{b}bold_b involves crossing the hyperplane, where the inequality changes from aabsent𝑎\leq a≤ italic_a to >aabsent𝑎>a> italic_a, which defines the boundary between different outputs (0 in R0subscript𝑅0R_{0}italic_R start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT and 1 in R1subscript𝑅1R_{1}italic_R start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT). Therefore, the points on the hyperplane 𝐰𝐱=a𝐰𝐱𝑎\mathbf{w}\cdot\mathbf{x}=abold_w ⋅ bold_x = italic_a necessarily lie exactly at the boundary between these regions.

We show that 𝐰𝐰\mathbf{w}bold_w cannot be nonnegative or nonpositive. Suppose 𝐰𝟎𝐰0\mathbf{w}\geq\mathbf{0}bold_w ≥ bold_0 (scale the normal vector by 11-1- 1 otherwise). Since R1subscript𝑅1R_{1}italic_R start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT is totally unbounded, it contains points that are arbitrarily large on all components. More formally, there is a strictly increasing sequence 𝐱1<𝐱2<subscript𝐱1subscript𝐱2italic-…\mathbf{x}_{1}<\mathbf{x}_{2}<\dotsbold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT < bold_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT < italic_… such that all 𝐱iR1.subscript𝐱𝑖subscript𝑅1\mathbf{x}_{i}\in R_{1}.bold_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∈ italic_R start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT . Since 𝐰𝟎𝐰0\mathbf{w}\geq\mathbf{0}bold_w ≥ bold_0, limi𝐰𝐱i=subscript𝑖𝐰subscript𝐱𝑖\lim_{i\to\infty}\mathbf{w}\cdot\mathbf{x}_{i}=\inftyroman_lim start_POSTSUBSCRIPT italic_i → ∞ end_POSTSUBSCRIPT bold_w ⋅ bold_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = ∞. This contradicts the previous assumption that all points 𝐱R1𝐱subscript𝑅1\mathbf{x}\in R_{1}bold_x ∈ italic_R start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT obey 𝐰𝐱a𝐰𝐱𝑎\mathbf{w}\cdot\mathbf{x}\leq abold_w ⋅ bold_x ≤ italic_a (geometrically, we would cross the hyperplane somewhere and land in R0subscript𝑅0R_{0}italic_R start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT). Symmetric reasoning applies to the case 𝐰𝟎𝐰0\mathbf{w}\leq\mathbf{0}bold_w ≤ bold_0. We conclude that the separating hyperplane must have a normal vector 𝐰𝐰\mathbf{w}bold_w with at least one positive and at least one negative component, establishing the lemma.

The next lemma shows that the there exists a vector 𝐯>𝟎𝐯0\mathbf{v}>\mathbf{0}bold_v > bold_0 parallel to the hyperplane separating the two regions. In other words, we can move along H𝐻Hitalic_H while increasing every component.

{lemmarep}

Let H𝐻Hitalic_H be a hyperplane with normal vector 𝐡𝐡\mathbf{h}bold_h. Then there is a positive vector 𝐯>𝟎𝐯0\mathbf{v}>\mathbf{0}bold_v > bold_0 with 𝐯𝐡=0𝐯𝐡0\mathbf{v}\cdot\mathbf{h}=0bold_v ⋅ bold_h = 0 if and only if 𝐡𝐡\mathbf{h}bold_h has at least one negative component and at least one positive component.

Proof 6.19.

If 𝐯>𝟎𝐯0\mathbf{v}>\mathbf{0}bold_v > bold_0 and 𝐡𝟎𝐡0\mathbf{h}\geq\mathbf{0}bold_h ≥ bold_0 then 𝐯𝐡>0𝐯𝐡0\mathbf{v}\cdot\mathbf{h}>0bold_v ⋅ bold_h > 0. Similarly, if 𝐯>𝟎𝐯0\mathbf{v}>\mathbf{0}bold_v > bold_0 and 𝐡𝟎𝐡0\mathbf{h}\leq\mathbf{0}bold_h ≤ bold_0 then 𝐯𝐡<0𝐯𝐡0\mathbf{v}\cdot\mathbf{h}<0bold_v ⋅ bold_h < 0. So to get 𝐯𝐡=0𝐯𝐡0\mathbf{v}\cdot\mathbf{h}=0bold_v ⋅ bold_h = 0, 𝐡𝐡\mathbf{h}bold_h must have at least one positive and at least one negative element.

We construct 𝐯𝐯\mathbf{v}bold_v as follows: Let I+subscript𝐼I_{+}italic_I start_POSTSUBSCRIPT + end_POSTSUBSCRIPT denote the indices of the positive coordinates of 𝐡𝐡\mathbf{h}bold_h and Isubscript𝐼I_{-}italic_I start_POSTSUBSCRIPT - end_POSTSUBSCRIPT the indices of the negative coordinates. Our goal is to balance out the positive and negative parts of the dot product, given by 𝐯𝐡=iI+𝐯(i)𝐡(i)+iI𝐯(i)𝐡(i)𝐯𝐡subscript𝑖subscript𝐼𝐯𝑖𝐡𝑖subscript𝑖subscript𝐼𝐯𝑖𝐡𝑖\mathbf{v}\cdot\mathbf{h}=\sum_{i\in I_{+}}\mathbf{v}(i)\mathbf{h}(i)+\sum_{i% \in I_{-}}\mathbf{v}(i)\mathbf{h}(i)bold_v ⋅ bold_h = ∑ start_POSTSUBSCRIPT italic_i ∈ italic_I start_POSTSUBSCRIPT + end_POSTSUBSCRIPT end_POSTSUBSCRIPT bold_v ( italic_i ) bold_h ( italic_i ) + ∑ start_POSTSUBSCRIPT italic_i ∈ italic_I start_POSTSUBSCRIPT - end_POSTSUBSCRIPT end_POSTSUBSCRIPT bold_v ( italic_i ) bold_h ( italic_i ). Set 𝐯(i)𝐯𝑖\mathbf{v}(i)bold_v ( italic_i ) to be the sum of the positive coordinates of 𝐡𝐡\mathbf{h}bold_h if iI𝑖subscript𝐼i\in I_{-}italic_i ∈ italic_I start_POSTSUBSCRIPT - end_POSTSUBSCRIPT and the sum of the absolute values of negative coordinates of 𝐡𝐡\mathbf{h}bold_h otherwise:

𝐯(i)={jI|𝐡(j)|if iI+,jI+𝐡(j)if iI,0otherwise.𝐯𝑖casessubscript𝑗subscript𝐼𝐡𝑗if 𝑖subscript𝐼subscript𝑗subscript𝐼𝐡𝑗if 𝑖subscript𝐼0otherwise.\displaystyle\mathbf{v}(i)=\begin{cases}\sum_{j\in I_{-}}|\mathbf{h}(j)|&\text% {if }i\in I_{+},\\ \sum_{j\in I_{+}}\mathbf{h}(j)&\text{if }i\in I_{-},\\ 0&\text{otherwise.}\end{cases}bold_v ( italic_i ) = { start_ROW start_CELL ∑ start_POSTSUBSCRIPT italic_j ∈ italic_I start_POSTSUBSCRIPT - end_POSTSUBSCRIPT end_POSTSUBSCRIPT | bold_h ( italic_j ) | end_CELL start_CELL if italic_i ∈ italic_I start_POSTSUBSCRIPT + end_POSTSUBSCRIPT , end_CELL end_ROW start_ROW start_CELL ∑ start_POSTSUBSCRIPT italic_j ∈ italic_I start_POSTSUBSCRIPT + end_POSTSUBSCRIPT end_POSTSUBSCRIPT bold_h ( italic_j ) end_CELL start_CELL if italic_i ∈ italic_I start_POSTSUBSCRIPT - end_POSTSUBSCRIPT , end_CELL end_ROW start_ROW start_CELL 0 end_CELL start_CELL otherwise. end_CELL end_ROW

Substituting into the formula shows the correctness. For brevity, let p:=𝐯(i)assign𝑝𝐯𝑖p:=\mathbf{v}(i)italic_p := bold_v ( italic_i ) if iI+𝑖subscript𝐼i\in I_{+}italic_i ∈ italic_I start_POSTSUBSCRIPT + end_POSTSUBSCRIPT and n:=𝐯(i)assign𝑛𝐯𝑖n:=\mathbf{v}(i)italic_n := bold_v ( italic_i ) if iI𝑖subscript𝐼i\in I_{-}italic_i ∈ italic_I start_POSTSUBSCRIPT - end_POSTSUBSCRIPT as above.

𝐯𝐡𝐯𝐡\displaystyle\mathbf{v}\cdot\mathbf{h}bold_v ⋅ bold_h =iI+𝐯(i)𝐡(i)+iI𝐯(i)𝐡(i)absentsubscript𝑖subscript𝐼𝐯𝑖𝐡𝑖subscript𝑖subscript𝐼𝐯𝑖𝐡𝑖\displaystyle=\sum_{i\in I_{+}}\mathbf{v}(i)\mathbf{h}(i)+\sum_{i\in I_{-}}% \mathbf{v}(i)\mathbf{h}(i)= ∑ start_POSTSUBSCRIPT italic_i ∈ italic_I start_POSTSUBSCRIPT + end_POSTSUBSCRIPT end_POSTSUBSCRIPT bold_v ( italic_i ) bold_h ( italic_i ) + ∑ start_POSTSUBSCRIPT italic_i ∈ italic_I start_POSTSUBSCRIPT - end_POSTSUBSCRIPT end_POSTSUBSCRIPT bold_v ( italic_i ) bold_h ( italic_i )
=iI+(n)𝐡(i)+iI(p)𝐡(i)absentsubscript𝑖subscript𝐼𝑛𝐡𝑖subscript𝑖subscript𝐼𝑝𝐡𝑖\displaystyle=\sum_{i\in I_{+}}\left(n\right)\mathbf{h}(i)+\sum_{i\in I_{-}}% \left(p\right)\mathbf{h}(i)= ∑ start_POSTSUBSCRIPT italic_i ∈ italic_I start_POSTSUBSCRIPT + end_POSTSUBSCRIPT end_POSTSUBSCRIPT ( italic_n ) bold_h ( italic_i ) + ∑ start_POSTSUBSCRIPT italic_i ∈ italic_I start_POSTSUBSCRIPT - end_POSTSUBSCRIPT end_POSTSUBSCRIPT ( italic_p ) bold_h ( italic_i )
=niI+𝐡(i)+piI𝐡(i)absent𝑛subscript𝑖subscript𝐼𝐡𝑖𝑝subscript𝑖subscript𝐼𝐡𝑖\displaystyle=n\sum_{i\in I_{+}}\mathbf{h}(i)+p\sum_{i\in I_{-}}\mathbf{h}(i)= italic_n ∑ start_POSTSUBSCRIPT italic_i ∈ italic_I start_POSTSUBSCRIPT + end_POSTSUBSCRIPT end_POSTSUBSCRIPT bold_h ( italic_i ) + italic_p ∑ start_POSTSUBSCRIPT italic_i ∈ italic_I start_POSTSUBSCRIPT - end_POSTSUBSCRIPT end_POSTSUBSCRIPT bold_h ( italic_i )
=np+p(n)absent𝑛𝑝𝑝𝑛\displaystyle=np+p(-n)= italic_n italic_p + italic_p ( - italic_n )
=0.absent0\displaystyle=0.= 0 .

Finally, if 𝐯𝐯\mathbf{v}bold_v is not integer-valued, scale it by the least common multiple of all coordinate denominators to ensure 𝐯d𝐯superscript𝑑\mathbf{v}\in\mathbb{N}^{d}bold_v ∈ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT without altering the dot product.

Lemma 6.20.

Let ϕ:d{0,1}:italic-ϕsuperscript𝑑01\phi:\mathbb{N}^{d}\to\{0,1\}italic_ϕ : blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT → { 0 , 1 } be a semilinear predicate that is not eventually constant. Then there is an infinite sequence 𝐱0,𝐱1,subscript𝐱0subscript𝐱1italic-…\mathbf{x}_{0},\mathbf{x}_{1},\dotsbold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_… and constant c𝑐citalic_c, such that for all j𝑗j\in\mathbb{N}italic_j ∈ blackboard_N,

  1. 1.

    ϕ(𝐱j)ϕ(𝐱j+1)italic-ϕsubscript𝐱𝑗italic-ϕsubscript𝐱𝑗1\phi(\mathbf{x}_{j})\neq\phi(\mathbf{x}_{j+1})italic_ϕ ( bold_x start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) ≠ italic_ϕ ( bold_x start_POSTSUBSCRIPT italic_j + 1 end_POSTSUBSCRIPT ) (correct answer swaps for each subsequent point),

  2. 2.

    𝐱j𝐱j+1subscript𝐱𝑗subscript𝐱𝑗1\mathbf{x}_{j}\leq\mathbf{x}_{j+1}bold_x start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ≤ bold_x start_POSTSUBSCRIPT italic_j + 1 end_POSTSUBSCRIPT (inputs are increasing), and

  3. 3.

    𝐱j+1𝐱jcnormsubscript𝐱𝑗1subscript𝐱𝑗𝑐\|\mathbf{x}_{j+1}-\mathbf{x}_{j}\|\leq c∥ bold_x start_POSTSUBSCRIPT italic_j + 1 end_POSTSUBSCRIPT - bold_x start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ∥ ≤ italic_c (adjacent inputs are “close”).

Proof 6.21.

We associate to ϕitalic-ϕ\phiitalic_ϕ the set Ad𝐴superscript𝑑A\subseteq\mathbb{N}^{d}italic_A ⊆ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT where ϕ1(1)=Asuperscriptitalic-ϕ11𝐴\phi^{-1}(1)=Aitalic_ϕ start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT ( 1 ) = italic_A, i.e., ϕ(𝐱)=1𝐱Aiffitalic-ϕ𝐱1𝐱𝐴\phi(\mathbf{x})=1\iff\mathbf{x}\in Aitalic_ϕ ( bold_x ) = 1 ⇔ bold_x ∈ italic_A.

Since A𝐴Aitalic_A is semilinear, it is a Boolean combination of threshold sets T1,,Tksubscript𝑇1subscript𝑇𝑘T_{1},\dots,T_{k}italic_T start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_T start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT and mod sets M1,,Mlsubscript𝑀1subscript𝑀𝑙M_{1},\dots,M_{l}italic_M start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_M start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT. Recall Definition 6.15, where the threshold sets partition dsuperscript𝑑\mathbb{N}^{d}blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT into regions, where moving within a region does not cross and hyperplanes defining the threshold sets, thus does not change the Boolean value [𝐱Ti𝐱subscript𝑇𝑖\mathbf{x}\in T_{i}bold_x ∈ italic_T start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT?] for any Tisubscript𝑇𝑖T_{i}italic_T start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT. Suppose we have m𝑚mitalic_m regions R1,,Rm.subscript𝑅1subscript𝑅𝑚R_{1},\dots,R_{m}.italic_R start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_R start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT . Then we can rewrite ARj𝐴subscript𝑅𝑗A\cap R_{j}italic_A ∩ italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT as a Boolean combination of mod sets only, intersected with Rjsubscript𝑅𝑗R_{j}italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT. We do this by replacing each Tisubscript𝑇𝑖T_{i}italic_T start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT in the original Boolean expression with either dsuperscript𝑑\mathbb{N}^{d}blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT or \emptyset, depending whether RjTisubscript𝑅𝑗subscript𝑇𝑖R_{j}\subseteq T_{i}italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ⊆ italic_T start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT or RjTi=subscript𝑅𝑗subscript𝑇𝑖R_{j}\cap T_{i}=\emptysetitalic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ∩ italic_T start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = ∅, respectively.555 For example, if the expression is T1(M1T2)(M2T3)(M3M4)subscript𝑇1subscript𝑀1subscript𝑇2subscript𝑀2subscript𝑇3subscript𝑀3subscript𝑀4T_{1}\cup(M_{1}\cap T_{2})\cup(M_{2}\cup T_{3})\cup(M_{3}\cap M_{4})italic_T start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ∪ ( italic_M start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ∩ italic_T start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ) ∪ ( italic_M start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ∪ italic_T start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT ) ∪ ( italic_M start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT ∩ italic_M start_POSTSUBSCRIPT 4 end_POSTSUBSCRIPT ), if the points are in T2subscript𝑇2T_{2}italic_T start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT but not T1subscript𝑇1T_{1}italic_T start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT or T3subscript𝑇3T_{3}italic_T start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT, this becomes (M1d)(M2)(M3M4)=M1M2(M3M4)subscript𝑀1superscript𝑑subscript𝑀2subscript𝑀3subscript𝑀4subscript𝑀1subscript𝑀2subscript𝑀3subscript𝑀4\emptyset\cup(M_{1}\cap\mathbb{N}^{d})\cup(M_{2}\cup\emptyset)\cup(M_{3}\cap M% _{4})=M_{1}\cup M_{2}\cup(M_{3}\cap M_{4})∅ ∪ ( italic_M start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ∩ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT ) ∪ ( italic_M start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ∪ ∅ ) ∪ ( italic_M start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT ∩ italic_M start_POSTSUBSCRIPT 4 end_POSTSUBSCRIPT ) = italic_M start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ∪ italic_M start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ∪ ( italic_M start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT ∩ italic_M start_POSTSUBSCRIPT 4 end_POSTSUBSCRIPT ). (Note by the definition of region these are the only two possibilities.) Let Mjsubscriptsuperscript𝑀𝑗M^{\prime}_{j}italic_M start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT be this Boolean combination of mod sets, such that MjRj=ARjsubscriptsuperscript𝑀𝑗subscript𝑅𝑗𝐴subscript𝑅𝑗M^{\prime}_{j}\cap R_{j}=A\cap R_{j}italic_M start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ∩ italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT = italic_A ∩ italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT. By Lemma 6.13, Mjsubscriptsuperscript𝑀𝑗M^{\prime}_{j}italic_M start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT is periodic.

Consider a totally unbounded region Rj.subscript𝑅𝑗R_{j}.italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT . By Section 6.3, recc(Rj)reccsubscript𝑅𝑗\mathrm{recc}(R_{j})roman_recc ( italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) contains a positive vector 𝐯𝐯\mathbf{v}bold_v. We have two cases:

for some totally unbounded region Rjsubscript𝑅𝑗R_{j}italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT, MjRjsubscriptsuperscript𝑀𝑗subscript𝑅𝑗M^{\prime}_{j}\cap R_{j}italic_M start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ∩ italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT is not constant:

This is illustrated in Figures 3 and 4, which show two subcases. Figure 3 shows the subcase where, for some 𝐯recc(Rj)d𝐯reccsubscript𝑅𝑗superscript𝑑\mathbf{v}\in\mathrm{recc}(R_{j})\cap\mathbb{N}^{d}bold_v ∈ roman_recc ( italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) ∩ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT and point 𝐲0Rjsubscript𝐲0subscript𝑅𝑗\mathbf{y}_{0}\in R_{j}bold_y start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ∈ italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT, defining 𝐲i=𝐲0+i𝐯subscript𝐲𝑖subscript𝐲0𝑖𝐯\mathbf{y}_{i}=\mathbf{y}_{0}+i\mathbf{v}bold_y start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = bold_y start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT + italic_i bold_v, the sequence ϕ(𝐲0),ϕ(𝐲1),italic-ϕsubscript𝐲0italic-ϕsubscript𝐲1italic-…\phi(\mathbf{y}_{0}),\phi(\mathbf{y}_{1}),\dotsitalic_ϕ ( bold_y start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ) , italic_ϕ ( bold_y start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ) , italic_… is not constant. Since Mjsubscriptsuperscript𝑀𝑗M^{\prime}_{j}italic_M start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT is periodic, the sequence O=(ϕ(𝐲0),ϕ(𝐲1),)𝑂italic-ϕsubscript𝐲0italic-ϕsubscript𝐲1O=(\phi(\mathbf{y}_{0}),\phi(\mathbf{y}_{1}),\dots)italic_O = ( italic_ϕ ( bold_y start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ) , italic_ϕ ( bold_y start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ) , … ) is periodic with period p𝑝pitalic_p. So we can find a subsequence 𝐱0,𝐱1,subscript𝐱0subscript𝐱1italic-…\mathbf{x}_{0},\mathbf{x}_{1},\dotsbold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_… obeying all three conditions of the lemma. In particular, it suffices to choose a point 𝐱0=𝐲0RjAsubscript𝐱0subscript𝐲0subscript𝑅𝑗𝐴\mathbf{x}_{0}=\mathbf{y}_{0}\in R_{j}\cap Abold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = bold_y start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ∈ italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ∩ italic_A (resp. 𝐲0RjAsubscript𝐲0subscript𝑅𝑗𝐴\mathbf{y}_{0}\in R_{j}\setminus Abold_y start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ∈ italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ∖ italic_A ) let i<p𝑖𝑝i<pitalic_i < italic_p such that 𝐲iAsubscript𝐲𝑖𝐴\mathbf{y}_{i}\not\in Abold_y start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∉ italic_A (resp. 𝐲iAsubscript𝐲𝑖𝐴\mathbf{y}_{i}\in Abold_y start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∈ italic_A), letting 𝐱1=𝐲isubscript𝐱1subscript𝐲𝑖\mathbf{x}_{1}=\mathbf{y}_{i}bold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = bold_y start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, and let 𝐱2=𝐲psubscript𝐱2subscript𝐲𝑝\mathbf{x}_{2}=\mathbf{y}_{p}bold_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT = bold_y start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT, and subsequent elements of the subsequence are the same distances apart (𝐱3=𝐲p+i,𝐱4=𝐲2p,formulae-sequencesubscript𝐱3subscript𝐲𝑝𝑖subscript𝐱4subscript𝐲2𝑝italic-…\mathbf{x}_{3}=\mathbf{y}_{p+i},\mathbf{x}_{4}=\mathbf{y}_{2p},\dotsbold_x start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT = bold_y start_POSTSUBSCRIPT italic_p + italic_i end_POSTSUBSCRIPT , bold_x start_POSTSUBSCRIPT 4 end_POSTSUBSCRIPT = bold_y start_POSTSUBSCRIPT 2 italic_p end_POSTSUBSCRIPT , italic_…).

Figure 4 shows the subcase where, for all 𝐲0Rjsubscript𝐲0subscript𝑅𝑗\mathbf{y}_{0}\in R_{j}bold_y start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ∈ italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT and 𝐯recc(Rj)d𝐯reccsubscript𝑅𝑗superscript𝑑\mathbf{v}\in\mathrm{recc}(R_{j})\cap\mathbb{N}^{d}bold_v ∈ roman_recc ( italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) ∩ blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT, defining 𝐲i=𝐲0+i𝐯subscript𝐲𝑖subscript𝐲0𝑖𝐯\mathbf{y}_{i}=\mathbf{y}_{0}+i\mathbf{v}bold_y start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = bold_y start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT + italic_i bold_v, the sequence ϕ(𝐲0),ϕ(𝐲1),italic-ϕsubscript𝐲0italic-ϕsubscript𝐲1italic-…\phi(\mathbf{y}_{0}),\phi(\mathbf{y}_{1}),\dotsitalic_ϕ ( bold_y start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ) , italic_ϕ ( bold_y start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ) , italic_… is constant. However, since Mjsubscriptsuperscript𝑀𝑗M^{\prime}_{j}italic_M start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT is not constant, we can still find a sequence 𝐱0,𝐱1,subscript𝐱0subscript𝐱1italic-…\mathbf{x}_{0},\mathbf{x}_{1},\dotsbold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_…, but unlike the previous subcase, it is not a subsequence of points collinear along one vector 𝐯𝐯\mathbf{v}bold_v.

Since Mjsubscriptsuperscript𝑀𝑗M^{\prime}_{j}italic_M start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT is periodic and not constant, and since Rjsubscript𝑅𝑗R_{j}italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT is totally unbounded, for every 𝐱RjA𝐱subscript𝑅𝑗𝐴\mathbf{x}\in R_{j}\cap Abold_x ∈ italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ∩ italic_A, there is 𝐱𝐱superscript𝐱𝐱\mathbf{x}^{\prime}\geq\mathbf{x}bold_x start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ≥ bold_x such that 𝐱RjAsuperscript𝐱subscript𝑅𝑗𝐴\mathbf{x}^{\prime}\in R_{j}\setminus Abold_x start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ∈ italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ∖ italic_A, i.e., for every point in the region in A𝐴Aitalic_A, there is a larger point in Rjsubscript𝑅𝑗R_{j}italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT not in A𝐴Aitalic_A. Also, since Mjsubscriptsuperscript𝑀𝑗M^{\prime}_{j}italic_M start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT is periodic, there is a constant c𝑐citalic_c independent of 𝐱𝐱\mathbf{x}bold_x such that 𝐱𝐱cnormsuperscript𝐱𝐱𝑐\|\mathbf{x}^{\prime}-\mathbf{x}\|\leq c∥ bold_x start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT - bold_x ∥ ≤ italic_c. By symmetric reasoning, there is a 𝐱′′RjAsuperscript𝐱′′subscript𝑅𝑗𝐴\mathbf{x}^{\prime\prime}\in R_{j}\cap Abold_x start_POSTSUPERSCRIPT ′ ′ end_POSTSUPERSCRIPT ∈ italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ∩ italic_A such that 𝐱′′𝐱superscript𝐱′′superscript𝐱\mathbf{x}^{\prime\prime}\geq\mathbf{x}^{\prime}bold_x start_POSTSUPERSCRIPT ′ ′ end_POSTSUPERSCRIPT ≥ bold_x start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT and 𝐱′′𝐱cnormsuperscript𝐱′′superscript𝐱𝑐\|\mathbf{x}^{\prime\prime}-\mathbf{x}^{\prime}\|\leq c∥ bold_x start_POSTSUPERSCRIPT ′ ′ end_POSTSUPERSCRIPT - bold_x start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ∥ ≤ italic_c.

Let 𝐱0RjAsubscript𝐱0subscript𝑅𝑗𝐴\mathbf{x}_{0}\in R_{j}\cap Abold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ∈ italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ∩ italic_A be arbitrary. For all i𝑖i\in\mathbb{N}italic_i ∈ blackboard_N, choose 𝐱i+1Rjsubscript𝐱𝑖1subscript𝑅𝑗\mathbf{x}_{i+1}\in R_{j}bold_x start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT ∈ italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT based on 𝐱isubscript𝐱𝑖\mathbf{x}_{i}bold_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT as above, such that 𝐱i+1𝐱isubscript𝐱𝑖1subscript𝐱𝑖\mathbf{x}_{i+1}\geq\mathbf{x}_{i}bold_x start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT ≥ bold_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, 𝐱i+1𝐱icnormsubscript𝐱𝑖1subscript𝐱𝑖𝑐\|\mathbf{x}_{i+1}-\mathbf{x}_{i}\|\leq c∥ bold_x start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT - bold_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥ ≤ italic_c, and 𝐱i+1Asubscript𝐱𝑖1𝐴\mathbf{x}_{i+1}\in Abold_x start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT ∈ italic_A if i𝑖iitalic_i is odd and 𝐱i+1Asubscript𝐱𝑖1𝐴\mathbf{x}_{i+1}\not\in Abold_x start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT ∉ italic_A if i𝑖iitalic_i is even. Then the sequence 𝐱0,𝐱1,subscript𝐱0subscript𝐱1italic-…\mathbf{x}_{0},\mathbf{x}_{1},\dotsbold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_… satisfies the lemma.

for all totally unbounded regions Rjsubscript𝑅𝑗R_{j}italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT, MjRjsubscriptsuperscript𝑀𝑗subscript𝑅𝑗M^{\prime}_{j}\cap R_{j}italic_M start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ∩ italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT is constant:

This implies that the mod sets M1,,Mlsubscript𝑀1subscript𝑀𝑙M_{1},\dots,M_{l}italic_M start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_M start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT can be “factored out” of the Boolean expression defining A𝐴Aitalic_A in terms of threshold sets T1,,Tksubscript𝑇1subscript𝑇𝑘T_{1},\dots,T_{k}italic_T start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_T start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT and the mod sets M1,,Mlsubscript𝑀1subscript𝑀𝑙M_{1},\dots,M_{l}italic_M start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_M start_POSTSUBSCRIPT italic_l end_POSTSUBSCRIPT, which will give the same output as A𝐴Aitalic_A in totally unbounded regions. Put another way, A(R1Ru)𝐴subscript𝑅1subscript𝑅𝑢A\cap(R_{1}\cup\dots\cup R_{u})italic_A ∩ ( italic_R start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ∪ ⋯ ∪ italic_R start_POSTSUBSCRIPT italic_u end_POSTSUBSCRIPT ) is a Boolean combination of the threshold sets T1,,Tksubscript𝑇1subscript𝑇𝑘T_{1},\dots,T_{k}italic_T start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_T start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT, where R1,,Rusubscript𝑅1subscript𝑅𝑢R_{1},\dots,R_{u}italic_R start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_R start_POSTSUBSCRIPT italic_u end_POSTSUBSCRIPT represents all the totally unbounded regions.

By Lemma 6.17, two adjacent totally unbounded regions of A𝐴Aitalic_A have opposite outputs. See Figure 5 for an example of picking the points 𝐱0,𝐱1,subscript𝐱0subscript𝐱1italic-…\mathbf{x}_{0},\mathbf{x}_{1},\dotsbold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_… below. These adjacent regions are separated by some hyperplane Hjsubscript𝐻𝑗H_{j}italic_H start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT, such that HjAsubscript𝐻𝑗𝐴H_{j}\subseteq Aitalic_H start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ⊆ italic_A, but for some unit vector 𝐮isubscript𝐮𝑖\mathbf{u}_{i}bold_u start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, (Hj+𝐮i)A=subscript𝐻𝑗subscript𝐮𝑖𝐴(H_{j}+\mathbf{u}_{i})\cap A=\emptyset( italic_H start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT + bold_u start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) ∩ italic_A = ∅, i.e., all of Hjsubscript𝐻𝑗H_{j}italic_H start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT is contained in A𝐴Aitalic_A, but the entire hyperplane adjacent to Hjsubscript𝐻𝑗H_{j}italic_H start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT in direction 𝐮isubscript𝐮𝑖\mathbf{u}_{i}bold_u start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, consists of points not in A𝐴Aitalic_A. Note this is not true for general hyperplanes, e.g., one whose orthogonal vector is (1,1)11(1,1)( 1 , 1 ), where both unit vectors 𝐮1=(1,0)subscript𝐮110\mathbf{u}_{1}=(1,0)bold_u start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = ( 1 , 0 ) and 𝐮2=(0,1)subscript𝐮201\mathbf{u}_{2}=(0,1)bold_u start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT = ( 0 , 1 ) would move off the hyperplane, but in the “yes” direction where the point is still contained in the threshold set. However, since Hjsubscript𝐻𝑗H_{j}italic_H start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT is separating two totally unbounded regions, some strictly positive vector 𝐯>𝟎𝐯0\mathbf{v}>\mathbf{0}bold_v > bold_0 is parallel to Hjsubscript𝐻𝑗H_{j}italic_H start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT, i.e., obeys 𝐯𝐡=0𝐯𝐡0\mathbf{v}\cdot\mathbf{h}=0bold_v ⋅ bold_h = 0 for Hjsubscript𝐻𝑗H_{j}italic_H start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT’s orthogonal vector 𝐡𝐡\mathbf{h}bold_h. By Section 6.3, 𝐡𝐡\mathbf{h}bold_h has at least one positive coordinate (say i𝑖iitalic_i) and at least one negative coordinate (say k𝑘kitalic_k), so that unit vector 𝐮isubscript𝐮𝑖\mathbf{u}_{i}bold_u start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT moves to one side of Hjsubscript𝐻𝑗H_{j}italic_H start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT and 𝐮ksubscript𝐮𝑘\mathbf{u}_{k}bold_u start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT moves to the other side.

In this case, we let 𝐯>𝟎𝐯0\mathbf{v}>\mathbf{0}bold_v > bold_0 be some vector parallel to Hjsubscript𝐻𝑗H_{j}italic_H start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT, let 𝐱0Hjsubscript𝐱0subscript𝐻𝑗\mathbf{x}_{0}\in H_{j}bold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ∈ italic_H start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT, sufficiently large that the vector 𝐯𝐯\mathbf{v}bold_v, starting at 𝐱0subscript𝐱0\mathbf{x}_{0}bold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT, does not cross any of the hyperplanes of T1,,Tksubscript𝑇1subscript𝑇𝑘T_{1},\dots,T_{k}italic_T start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_T start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT (as in Figure 5). Define the rest of the infinite sequence as

𝐱1subscript𝐱1\displaystyle\mathbf{x}_{1}bold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT =𝐱0+𝐮,absentsubscript𝐱0𝐮\displaystyle=\mathbf{x}_{0}+\mathbf{u},= bold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT + bold_u ,
𝐱2subscript𝐱2\displaystyle\mathbf{x}_{2}bold_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT =𝐱0+𝐯,absentsubscript𝐱0𝐯\displaystyle=\mathbf{x}_{0}+\mathbf{v},= bold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT + bold_v ,
𝐱3subscript𝐱3\displaystyle\mathbf{x}_{3}bold_x start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT =𝐱0+𝐯+𝐮,absentsubscript𝐱0𝐯𝐮\displaystyle=\mathbf{x}_{0}+\mathbf{v}+\mathbf{u},= bold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT + bold_v + bold_u ,
𝐱4subscript𝐱4\displaystyle\mathbf{x}_{4}bold_x start_POSTSUBSCRIPT 4 end_POSTSUBSCRIPT =𝐱0+2𝐯,absentsubscript𝐱02𝐯\displaystyle=\mathbf{x}_{0}+2\mathbf{v},= bold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT + 2 bold_v ,
𝐱5subscript𝐱5\displaystyle\mathbf{x}_{5}bold_x start_POSTSUBSCRIPT 5 end_POSTSUBSCRIPT =𝐱0+2𝐯+𝐮,absentsubscript𝐱02𝐯𝐮\displaystyle=\mathbf{x}_{0}+2\mathbf{v}+\mathbf{u},= bold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT + 2 bold_v + bold_u ,
𝐱6subscript𝐱6\displaystyle\mathbf{x}_{6}bold_x start_POSTSUBSCRIPT 6 end_POSTSUBSCRIPT =𝐱0+3𝐯,absentsubscript𝐱03𝐯\displaystyle=\mathbf{x}_{0}+3\mathbf{v},= bold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT + 3 bold_v ,
𝐱7subscript𝐱7\displaystyle\mathbf{x}_{7}bold_x start_POSTSUBSCRIPT 7 end_POSTSUBSCRIPT =𝐱0+3𝐯+𝐮,absentsubscript𝐱03𝐯𝐮\displaystyle=\mathbf{x}_{0}+3\mathbf{v}+\mathbf{u},= bold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT + 3 bold_v + bold_u ,
\displaystyle\vdots

By the arguments given above, for all odd i𝑖iitalic_i, ϕ(𝐱i)=0italic-ϕsubscript𝐱𝑖0\phi(\mathbf{x}_{i})=0italic_ϕ ( bold_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) = 0 and for all even i𝑖iitalic_i, ϕ(𝐱i)=1italic-ϕsubscript𝐱𝑖1\phi(\mathbf{x}_{i})=1italic_ϕ ( bold_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) = 1, satisfying condition (1). If j𝑗jitalic_j is even, then 𝐱j+1=𝐱j+𝐯+𝐮subscript𝐱𝑗1subscript𝐱𝑗𝐯𝐮\mathbf{x}_{j+1}=\mathbf{x}_{j}+\mathbf{v}+\mathbf{u}bold_x start_POSTSUBSCRIPT italic_j + 1 end_POSTSUBSCRIPT = bold_x start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT + bold_v + bold_u, so clearly 𝐱j𝐱j+1subscript𝐱𝑗subscript𝐱𝑗1\mathbf{x}_{j}\leq\mathbf{x}_{j+1}bold_x start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ≤ bold_x start_POSTSUBSCRIPT italic_j + 1 end_POSTSUBSCRIPT, satisfying condition (2). If j𝑗jitalic_j is odd, then 𝐱j+1=𝐱j𝐮+𝐯subscript𝐱𝑗1subscript𝐱𝑗𝐮𝐯\mathbf{x}_{j+1}=\mathbf{x}_{j}-\mathbf{u}+\mathbf{v}bold_x start_POSTSUBSCRIPT italic_j + 1 end_POSTSUBSCRIPT = bold_x start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT - bold_u + bold_v. Since 𝐯>𝟎𝐯0\mathbf{v}>\mathbf{0}bold_v > bold_0, we have 𝐯𝐮𝟎𝐯𝐮0\mathbf{v}-\mathbf{u}\geq\mathbf{0}bold_v - bold_u ≥ bold_0, so 𝐱j+1𝐱jsubscript𝐱𝑗1subscript𝐱𝑗\mathbf{x}_{j+1}\geq\mathbf{x}_{j}bold_x start_POSTSUBSCRIPT italic_j + 1 end_POSTSUBSCRIPT ≥ bold_x start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT, satisfying condition (2). Finally, 𝐱j+1𝐱j𝐯+1normsubscript𝐱𝑗1subscript𝐱𝑗norm𝐯1\|\mathbf{x}_{j+1}-\mathbf{x}_{j}\|\leq\|\mathbf{v}\|+1∥ bold_x start_POSTSUBSCRIPT italic_j + 1 end_POSTSUBSCRIPT - bold_x start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ∥ ≤ ∥ bold_v ∥ + 1, satisfying condition (3).

Refer to caption
Figure 4: A totally unbounded region Rjsubscript𝑅𝑗R_{j}italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT (between two gray lines with slope 1/2121/21 / 2 defined by two threshold sets), where within Rjsubscript𝑅𝑗R_{j}italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT, the Boolean combination Mjsubscriptsuperscript𝑀𝑗M^{\prime}_{j}italic_M start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT of mod sets that is not constant (see proof of Lemma 6.20 for definitions of Rjsubscript𝑅𝑗R_{j}italic_R start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT and Mjsubscriptsuperscript𝑀𝑗M^{\prime}_{j}italic_M start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT), but that is constant along any vector in recc(R)recc𝑅\mathrm{recc}(R)roman_recc ( italic_R ), which contains only multiples of the vector (2,1)21(2,1)( 2 , 1 ). This illustrates one case of Lemma 6.20, where we can find an increasing sequence of points 𝐱0,𝐱1,,subscript𝐱0subscript𝐱1\mathbf{x}_{0},\mathbf{x}_{1},\dots,bold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , with alternating outputs.
Refer to caption
Figure 5: A Boolean combination of threshold sets in 2D, illustrating the intuition of Lemma 6.17. Each threshold set is defined by a line (hyperplane in higher dimensions). The threshold sets partition the first quadrant into a finite number of regions. There are four (unlabeled) finite regions near the origin. There are five infinite regions labeled R1,R2,R3,R4,R5.subscript𝑅1subscript𝑅2subscript𝑅3subscript𝑅4subscript𝑅5R_{1},R_{2},R_{3},R_{4},R_{5}.italic_R start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_R start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , italic_R start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT , italic_R start_POSTSUBSCRIPT 4 end_POSTSUBSCRIPT , italic_R start_POSTSUBSCRIPT 5 end_POSTSUBSCRIPT . Within each region, either all points are contained in the set (output 1, shaded gray regions R1,R4,R5subscript𝑅1subscript𝑅4subscript𝑅5R_{1},R_{4},R_{5}italic_R start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_R start_POSTSUBSCRIPT 4 end_POSTSUBSCRIPT , italic_R start_POSTSUBSCRIPT 5 end_POSTSUBSCRIPT), or all points are not (output 0, shaded white regions R2,R3subscript𝑅2subscript𝑅3R_{2},R_{3}italic_R start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , italic_R start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT). Since the set is not eventually constant, there are infinite regions with opposite outputs, and two such regions must be adjacent; R3subscript𝑅3R_{3}italic_R start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT and R4subscript𝑅4R_{4}italic_R start_POSTSUBSCRIPT 4 end_POSTSUBSCRIPT in this example. The points 𝐱0,𝐱1,subscript𝐱0subscript𝐱1\mathbf{x}_{0},\mathbf{x}_{1},\dotsbold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … illustrate the intuition of the last paragraph of the proof of Lemma 6.20. The vector 𝐯𝐯\mathbf{v}bold_v is parallel to a line separating the two adjacent opposite-output regions R3subscript𝑅3R_{3}italic_R start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT and R4subscript𝑅4R_{4}italic_R start_POSTSUBSCRIPT 4 end_POSTSUBSCRIPT. Points 𝐱0,𝐱2,𝐱4,subscript𝐱0subscript𝐱2subscript𝐱4\mathbf{x}_{0},\mathbf{x}_{2},\mathbf{x}_{4},\dotsbold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , bold_x start_POSTSUBSCRIPT 4 end_POSTSUBSCRIPT , … are on the line, thus are in R4subscript𝑅4R_{4}italic_R start_POSTSUBSCRIPT 4 end_POSTSUBSCRIPT and have output 1, and points 𝐱1,𝐱3,subscript𝐱1subscript𝐱3\mathbf{x}_{1},\mathbf{x}_{3},\dotsbold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , bold_x start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT , … are just above the line (off of it by unit vector 𝐮2subscript𝐮2\mathbf{u}_{2}bold_u start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT), thus are in R3subscript𝑅3R_{3}italic_R start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT and have output 0.
{thmrep}

If a noncollapsing, all-voting, entirely execution bounded CRD stably decides a predicate ϕitalic-ϕ\phiitalic_ϕ, then ϕitalic-ϕ\phiitalic_ϕ is eventually constant.

\opt

submissionA complete proof appears in the appendix.

{proofsketch}

This proof is similar to that of Theorem 6.9. In that proof, we repeatedly add a “constant amount of additional input {X2}subscript𝑋2\{X_{2}\}{ italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT } or {X1}subscript𝑋1\{X_{1}\}{ italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT }, which flips the output”. For more general semilinear, but not eventually constant, predicates, we dig into the structure of the semilinear set to find a sequence of constant-size vectors representing additional inputs that flip the correct answer. Any predicate that is not eventually constant has infinitely many yes inputs and infinitely many no inputs, but in general they could be increasingly far apart: e.g., ϕ(𝐱)=1italic-ϕ𝐱1\phi(\mathbf{x})=1italic_ϕ ( bold_x ) = 1 if and only if 2n𝐱<2n+1superscript2𝑛norm𝐱superscript2𝑛12^{n}\leq\|\mathbf{x}\|<2^{n+1}2 start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT ≤ ∥ bold_x ∥ < 2 start_POSTSUPERSCRIPT italic_n + 1 end_POSTSUPERSCRIPT for even n𝑛nitalic_n. For the potential function argument to work, each subsequence input needs to be at most a constant larger than the previous.

But if ϕitalic-ϕ\phiitalic_ϕ is semilinear (and not eventually constant) then we can show that there is a sequence of increasing inputs 𝐱0𝐱1𝐱2subscript𝐱0subscript𝐱1subscript𝐱2\mathbf{x}_{0}\leq\mathbf{x}_{1}\leq\mathbf{x}_{2}\leq\dotsbold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ≤ bold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ≤ bold_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ≤ …, each a constant distance from the next (𝐱j+1𝐱j=O(1)normsubscript𝐱𝑗1subscript𝐱𝑗𝑂1\|\mathbf{x}_{j+1}-\mathbf{x}_{j}\|=O(1)∥ bold_x start_POSTSUBSCRIPT italic_j + 1 end_POSTSUBSCRIPT - bold_x start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ∥ = italic_O ( 1 )), flip** the output (ϕ(𝐱j)ϕ(𝐱j+1)italic-ϕsubscript𝐱𝑗italic-ϕsubscript𝐱𝑗1\phi(\mathbf{x}_{j})\neq\phi(\mathbf{x}_{j+1})italic_ϕ ( bold_x start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) ≠ italic_ϕ ( bold_x start_POSTSUBSCRIPT italic_j + 1 end_POSTSUBSCRIPT )). Roughly, this is true for one of two reasons. Using Theorem 2.5, ϕitalic-ϕ\phiitalic_ϕ is a Boolean combination of threshold and mod sets. Either the mod sets are not combined to be trivially \emptyset or dsuperscript𝑑\mathbb{N}^{d}blackboard_N start_POSTSUPERSCRIPT italic_d end_POSTSUPERSCRIPT, in which case we can find some vector 𝐯𝐯\mathbf{v}bold_v that, followed infinitely far from some starting point 𝐱0subscript𝐱0\mathbf{x}_{0}bold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT (so 𝐱i=𝐱0+i𝐯subscript𝐱𝑖subscript𝐱0𝑖𝐯\mathbf{x}_{i}=\mathbf{x}_{0}+i\mathbf{v}bold_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = bold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT + italic_i bold_v) periodically hits both yes inputs (ϕ(𝐱j)=1italic-ϕsubscript𝐱𝑗1\phi(\mathbf{x}_{j})=1italic_ϕ ( bold_x start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) = 1) and no inputs (ϕ(𝐱j)=0italic-ϕsubscript𝐱𝑗0\phi(\mathbf{x}_{j})=0italic_ϕ ( bold_x start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) = 0). \optsubmission,full(See Figures 3 and 4.) Otherwise, the mod sets can be removed and simplify the Boolean combination to only threshold sets, in which case the infinite sequence 𝐱0,𝐱1,subscript𝐱0subscript𝐱1\mathbf{x}_{0},\mathbf{x}_{1},\dotsbold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … can be obtained by moving along a threshold hyperplane that separates yes from no inputs. \optsubmission,full(See Figure 5.)

Proof 6.22.

This proof is similar to that of Theorem 6.9, with the vectors 𝐯isubscript𝐯𝑖\mathbf{v}_{i}bold_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT defined below playing the role of the “constant amount of additional input {X2}subscript𝑋2\{X_{2}\}{ italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT } or {X1}subscript𝑋1\{X_{1}\}{ italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT } that flips the correct answer” in that proof.

Let 𝒟=(Λ,R,Σ,ΥY,ΥN,𝐬)𝒟Λ𝑅ΣsubscriptΥYsubscriptΥN𝐬\mathcal{D}=(\Lambda,R,\Sigma,\Upsilon_{\mathrm{Y}},\Upsilon_{\mathrm{N}},% \mathbf{s})caligraphic_D = ( roman_Λ , italic_R , roman_Σ , roman_Υ start_POSTSUBSCRIPT roman_Y end_POSTSUBSCRIPT , roman_Υ start_POSTSUBSCRIPT roman_N end_POSTSUBSCRIPT , bold_s ) be a CRD obeying the stated conditions, and suppose for the sake of contradiction that 𝒟𝒟\mathcal{D}caligraphic_D stably decides a semilinear predicate ϕitalic-ϕ\phiitalic_ϕ that is not eventually constant.

By Lemma 6.20, there is an infinite sequence 𝐱0,𝐱1,subscript𝐱0subscript𝐱1italic-…\mathbf{x}_{0},\mathbf{x}_{1},\dotsbold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_… such that

  1. 1.

    ϕ(𝐱i)ϕ(𝐱i+1)italic-ϕsubscript𝐱𝑖italic-ϕsubscript𝐱𝑖1\phi(\mathbf{x}_{i})\neq\phi(\mathbf{x}_{i+1})italic_ϕ ( bold_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) ≠ italic_ϕ ( bold_x start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT ) (i.e., the correct answer swaps for each subsequent input)

  2. 2.

    𝐱i𝐱i+1subscript𝐱𝑖subscript𝐱𝑖1\mathbf{x}_{i}\leq\mathbf{x}_{i+1}bold_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ≤ bold_x start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT, i.e., the inputs are increasing (on at least one coordinate(s)), and

  3. 3.

    for some constant c𝑐citalic_c, 𝐱i+1𝐱icnormsubscript𝐱𝑖1subscript𝐱𝑖𝑐\|\mathbf{x}_{i+1}-\mathbf{x}_{i}\|\leq c∥ bold_x start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT - bold_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥ ≤ italic_c, i.e., adjacent inputs are “close”.

Assume WLOG that ϕ(𝐱0)=0italic-ϕsubscript𝐱00\phi(\mathbf{x}_{0})=0italic_ϕ ( bold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ) = 0. For each i𝑖i\in\mathbb{N}italic_i ∈ blackboard_N, let 𝐯i=𝐱i+1𝐱isubscript𝐯𝑖subscript𝐱𝑖1subscript𝐱𝑖\mathbf{v}_{i}=\mathbf{x}_{i+1}-\mathbf{x}_{i}bold_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = bold_x start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT - bold_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, noting by condition (2) that 𝐯i0subscript𝐯𝑖0\mathbf{v}_{i}\geq 0bold_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ≥ 0.

We consider the sequence of stable configurations 𝐚0,𝐚1,𝐚2,subscript𝐚0subscript𝐚1subscript𝐚2italic-…\mathbf{a}_{0},\mathbf{a}_{1},\mathbf{a}_{2},\dotsbold_a start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_a start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , bold_a start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , italic_… defined as follows. Let 𝐚0subscript𝐚0\mathbf{a}_{0}bold_a start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT be a stable configuration reachable from 𝐱0subscript𝐱0\mathbf{x}_{0}bold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT; since the correct answer is no, all species present in 𝐚0subscript𝐚0\mathbf{a}_{0}bold_a start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT vote no. Now add 𝐯0subscript𝐯0\mathbf{v}_{0}bold_v start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT to 𝐚0subscript𝐚0\mathbf{a}_{0}bold_a start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT. By additivity, the configuration 𝐚0+𝐯0subscript𝐚0subscript𝐯0\mathbf{a}_{0}+\mathbf{v}_{0}bold_a start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT + bold_v start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT is reachable from 𝐱1=𝐱0+𝐯0subscript𝐱1subscript𝐱0subscript𝐯0\mathbf{x}_{1}=\mathbf{x}_{0}+\mathbf{v}_{0}bold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = bold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT + bold_v start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT. Since the correct answer for 𝐱1subscript𝐱1\mathbf{x}_{1}bold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT is yes, 𝒟𝒟\mathcal{D}caligraphic_D must go from 𝐚0+𝐯0subscript𝐚0subscript𝐯0\mathbf{a}_{0}+\mathbf{v}_{0}bold_a start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT + bold_v start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT to a stable “yes” configuration, call this 𝐚1subscript𝐚1\mathbf{a}_{1}bold_a start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT. Now add 𝐯1subscript𝐯1\mathbf{v}_{1}bold_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT to 𝐚1subscript𝐚1\mathbf{a}_{1}bold_a start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT. Since the correct answer is no, 𝒟𝒟\mathcal{D}caligraphic_D must now reach from 𝐚1+𝐯1subscript𝐚1subscript𝐯1\mathbf{a}_{1}+\mathbf{v}_{1}bold_a start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT + bold_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT to a stable “no” configuration, call it 𝐚2subscript𝐚2\mathbf{a}_{2}bold_a start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT. By condition (3), each 𝐯isubscript𝐯𝑖\mathbf{v}_{i}bold_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT obeys 𝐯i<cnormsubscript𝐯𝑖𝑐\|\mathbf{v}_{i}\|<c∥ bold_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥ < italic_c for some constant c𝑐citalic_c.

Continuing in this way, we have a sequence of stable configurations 𝐚0,𝐚1,subscript𝐚0subscript𝐚1italic-…\mathbf{a}_{0},\mathbf{a}_{1},\dotsbold_a start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT , bold_a start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_… where all species in 𝐚isubscript𝐚𝑖\mathbf{a}_{i}bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT vote yes for odd i𝑖iitalic_i, and all species in 𝐚isubscript𝐚𝑖\mathbf{a}_{i}bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT vote no for even i𝑖iitalic_i. Since 𝒟𝒟\mathcal{D}caligraphic_D is noncollapsing, the size of the configurations 𝐚isubscript𝐚𝑖\mathbf{a}_{i}bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT increases without bound as i𝑖i\to\inftyitalic_i → ∞. (Possibly 𝐚i+1<𝐚inormsubscript𝐚𝑖1normsubscript𝐚𝑖\|\mathbf{a}_{i+1}\|<\|\mathbf{a}_{i}\|∥ bold_a start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT ∥ < ∥ bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥, i.e., the size is not necessarily monotonically nondecreasing, but for all sufficiently large j>i𝑗𝑖j>iitalic_j > italic_i, we have 𝐚j>𝐚inormsubscript𝐚𝑗normsubscript𝐚𝑖\|\mathbf{a}_{j}\|>\|\mathbf{a}_{i}\|∥ bold_a start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ∥ > ∥ bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥.)

Since all species vote, for some constant δ>0𝛿0\delta>0italic_δ > 0, to get from 𝐚i+𝐯isubscript𝐚𝑖subscript𝐯𝑖\mathbf{a}_{i}+\mathbf{v}_{i}bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT + bold_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT to 𝐚i+1subscript𝐚𝑖1\mathbf{a}_{i+1}bold_a start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT, at least δ𝐚i𝛿normsubscript𝐚𝑖\delta\|\mathbf{a}_{i}\|italic_δ ∥ bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥ reactions must occur. This is because all species in 𝐚isubscript𝐚𝑖\mathbf{a}_{i}bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT must be removed since they vote the opposite of the voters in 𝐚i+1subscript𝐚𝑖1\mathbf{a}_{i+1}bold_a start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT, and each reaction removes at most O(1)𝑂1O(1)italic_O ( 1 ) molecules. (Concretely, let δ=1/max(𝐫,𝐩)R𝐫𝐩𝛿1subscript𝐫𝐩𝑅norm𝐫norm𝐩\delta=1/\max_{(\mathbf{r},\mathbf{p})\in R}\|\mathbf{r}\|-\|\mathbf{p}\|italic_δ = 1 / roman_max start_POSTSUBSCRIPT ( bold_r , bold_p ) ∈ italic_R end_POSTSUBSCRIPT ∥ bold_r ∥ - ∥ bold_p ∥, i.e., 1 over the most net molecules consumed in any reaction.)

Since 𝒟𝒟\mathcal{D}caligraphic_D is entirely execution bounded, by Theorem 6.5, 𝒟𝒟\mathcal{D}caligraphic_D has a linear potential function Φ(𝐱)=𝐰𝐱Φ𝐱𝐰𝐱\Phi(\mathbf{x})=\mathbf{w}\cdot\mathbf{x}roman_Φ ( bold_x ) = bold_w ⋅ bold_x, where 𝐰𝟎𝐰0\mathbf{w}\geq\mathbf{0}bold_w ≥ bold_0. Adding 𝐯isubscript𝐯𝑖\mathbf{v}_{i}bold_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT to 𝐚isubscript𝐚𝑖\mathbf{a}_{i}bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT increases ΦΦ\Phiroman_Φ by 𝐰(𝐯i)𝐰subscript𝐯𝑖\mathbf{w}(\mathbf{v}_{i})bold_w ( bold_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ), which is bounded above by a constant since 𝐯i<cnormsubscript𝐯𝑖𝑐\|\mathbf{v}_{i}\|<c∥ bold_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥ < italic_c. Since 𝐚inormsubscript𝐚𝑖\|\mathbf{a}_{i}\|∥ bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥ grows without bound, the number of reactions to get from 𝐚i+𝐯isubscript𝐚𝑖subscript𝐯𝑖\mathbf{a}_{i}+\mathbf{v}_{i}bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT + bold_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT to 𝐚i+1subscript𝐚𝑖1\mathbf{a}_{i+1}bold_a start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT increases without bound as i𝑖i\to\inftyitalic_i → ∞, and since each reaction strictly decreases ΦΦ\Phiroman_Φ by at least 1, the total change in ΦΦ\Phiroman_Φ that results from adding 𝐯isubscript𝐯𝑖\mathbf{v}_{i}bold_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT and then going from 𝐚i+𝐯isubscript𝐚𝑖subscript𝐯𝑖\mathbf{a}_{i}+\mathbf{v}_{i}bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT + bold_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT to 𝐚i+1subscript𝐚𝑖1\mathbf{a}_{i+1}bold_a start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT is unbounded in i𝑖iitalic_i, so unboundedly negative for sufficiently large i𝑖iitalic_i (negative once i𝑖iitalic_i is large enough that δ𝐚i𝐰(𝐯i)+2𝛿normsubscript𝐚𝑖𝐰subscript𝐯𝑖2\delta\|\mathbf{a}_{i}\|\geq\mathbf{w}(\mathbf{v}_{i})+2italic_δ ∥ bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥ ≥ bold_w ( bold_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) + 2).

However, ΦΦ\Phiroman_Φ started at the constant Φ(𝐱0)Φsubscript𝐱0\Phi(\mathbf{x}_{0})roman_Φ ( bold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT ). Before 𝐚inormsubscript𝐚𝑖\|\mathbf{a}_{i}\|∥ bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥ is large enough that δ𝐚i𝐰(𝐯i)+2𝛿normsubscript𝐚𝑖𝐰subscript𝐯𝑖2\delta\|\mathbf{a}_{i}\|\geq\mathbf{w}(\mathbf{v}_{i})+2italic_δ ∥ bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∥ ≥ bold_w ( bold_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) + 2 (i.e., large enough that the net change in ΦΦ\Phiroman_Φ is negative resulting from adding a single input and going to the next stable configuration), ΦΦ\Phiroman_Φ could increase, if Φ(𝐯i)Φsubscript𝐯𝑖\Phi(\mathbf{v}_{i})roman_Φ ( bold_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) is larger than the net decrease in ΦΦ\Phiroman_Φ due to following reactions to get from 𝐚i+𝐯isubscript𝐚𝑖subscript𝐯𝑖\mathbf{a}_{i}+\mathbf{v}_{i}bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT + bold_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT to 𝐚i+1subscript𝐚𝑖1\mathbf{a}_{i+1}bold_a start_POSTSUBSCRIPT italic_i + 1 end_POSTSUBSCRIPT.

However, since 𝒟𝒟\mathcal{D}caligraphic_D is noncollapsing, this can only happen for a constant number of i𝑖iitalic_i (so ΦΦ\Phiroman_Φ never reaches more than a constant above its initial value Φ(𝐱0)Φsubscript𝐱0\Phi(\mathbf{x}_{0})roman_Φ ( bold_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT )), after which point ΦΦ\Phiroman_Φ strictly decreases after each round of this process.

At some point in this process, 𝒟𝒟\mathcal{D}caligraphic_D will not be able to reach all the way to the next 𝐚isubscript𝐚𝑖\mathbf{a}_{i}bold_a start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT without ΦΦ\Phiroman_Φ becoming negative, a contradiction.

The statement of Theorem 6.9 does not mention the concept of a leader, but it would typically apply to leaderless CRDs. A CRD may be execution bounded from configurations with a single leader, but not execution bounded when multiple leaders are present (preventing the use of Theorem 6.5, which requires the CRD to be execution bounded from all configurations). For example, in Lemma 4.5, reaction (9) occurs finitely many times if the leader/voter SYsubscript𝑆𝑌S_{Y}italic_S start_POSTSUBSCRIPT italic_Y end_POSTSUBSCRIPT or SNsubscript𝑆𝑁S_{N}italic_S start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT has count 1. However, if SYsubscript𝑆𝑌S_{Y}italic_S start_POSTSUBSCRIPT italic_Y end_POSTSUBSCRIPT and SNsubscript𝑆𝑁S_{N}italic_S start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT can be present simultaneously (e.g., if we start with two leaders), then the reactions SY+VNNSY+VYNsubscript𝑆𝑌subscript𝑉𝑁𝑁subscript𝑆𝑌subscript𝑉𝑌𝑁S_{Y}+V_{NN}\mathop{\rightarrow}\limits S_{Y}+V_{YN}italic_S start_POSTSUBSCRIPT italic_Y end_POSTSUBSCRIPT + italic_V start_POSTSUBSCRIPT italic_N italic_N end_POSTSUBSCRIPT → italic_S start_POSTSUBSCRIPT italic_Y end_POSTSUBSCRIPT + italic_V start_POSTSUBSCRIPT italic_Y italic_N end_POSTSUBSCRIPT and SN+VYNSN+VNNsubscript𝑆𝑁subscript𝑉𝑌𝑁subscript𝑆𝑁subscript𝑉𝑁𝑁S_{N}+V_{YN}\mathop{\rightarrow}\limits S_{N}+V_{NN}italic_S start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT + italic_V start_POSTSUBSCRIPT italic_Y italic_N end_POSTSUBSCRIPT → italic_S start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT + italic_V start_POSTSUBSCRIPT italic_N italic_N end_POSTSUBSCRIPT can flip between VNNsubscript𝑉𝑁𝑁V_{NN}italic_V start_POSTSUBSCRIPT italic_N italic_N end_POSTSUBSCRIPT and VYNsubscript𝑉𝑌𝑁V_{YN}italic_V start_POSTSUBSCRIPT italic_Y italic_N end_POSTSUBSCRIPT infinitely often in an unbounded execution.

If the CRN is leaderless, however, we have the following, which says that if it is execution bounded from valid initial configurations, then it is execution bounded from all configurations.

{lemmarep}

If a leaderless CRD or CRC is execution bounded, then it is entirely execution bounded.

{proofsketch}\opt

submissionA proof is in the appendix. Since 𝒞𝒞\mathcal{C}caligraphic_C is leaderless, the sum of two valid initial configurations is also valid. Thus if we can produce some species from a valid initial configuration, we can produce arbitrarily large counts of all species by adding up sufficiently many initial configurations. This means that for any configuration 𝐱𝐱\mathbf{x}bold_x, from any sufficiently large valid initial configuration 𝐢𝐢\mathbf{i}bold_i, some 𝐲𝐱𝐲𝐱\mathbf{y}\geqq\mathbf{x}bold_y ≧ bold_x is reachable from 𝐢𝐢\mathbf{i}bold_i. But if 𝒞𝒞\mathcal{C}caligraphic_C is execution bounded from 𝐢𝐢\mathbf{i}bold_i, since 𝐢𝐲𝐢𝐲\mathbf{i}\Rightarrow\mathbf{y}bold_i ⇒ bold_y, it must also be execution bounded from 𝐲𝐲\mathbf{y}bold_y, thus also from 𝐱𝐱\mathbf{x}bold_x since by additivity any reactions applicable to 𝐱𝐱\mathbf{x}bold_x are also applicable to 𝐲𝐲\mathbf{y}bold_y.

Proof 6.23.

Let 𝒞𝒞\mathcal{C}caligraphic_C be a leaderless CRD or CRC. Let 𝐱𝐱\mathbf{x}bold_x be any configuration. We first show that some 𝐲𝐱𝐲𝐱\mathbf{y}\geqq\mathbf{x}bold_y ≧ bold_x is reachable from a valid initial configuration 𝐢𝐢\mathbf{i}bold_i.

We may assume without loss of generality that 𝒞𝒞\mathcal{C}caligraphic_C only contains species producible from valid initial configurations, otherwise we obtain an equivalent CRN by removing those unproducible species from 𝒞𝒞\mathcal{C}caligraphic_C.

Since 𝒞𝒞\mathcal{C}caligraphic_C is leaderless, the sum of two valid initial configurations is also valid. Then each species S𝑆Sitalic_S being producible means that there is a valid initial configuration 𝐢S,1subscript𝐢𝑆1\mathbf{i}_{S,1}bold_i start_POSTSUBSCRIPT italic_S , 1 end_POSTSUBSCRIPT such that for some 𝐲S,1subscript𝐲𝑆1\mathbf{y}_{S,1}bold_y start_POSTSUBSCRIPT italic_S , 1 end_POSTSUBSCRIPT, 𝐢S,1𝐲S,1subscript𝐢𝑆1subscript𝐲𝑆1\mathbf{i}_{S,1}\Rightarrow\mathbf{y}_{S,1}bold_i start_POSTSUBSCRIPT italic_S , 1 end_POSTSUBSCRIPT ⇒ bold_y start_POSTSUBSCRIPT italic_S , 1 end_POSTSUBSCRIPT and 𝐲S,1(S)1subscript𝐲𝑆1𝑆1\mathbf{y}_{S,1}(S)\geq 1bold_y start_POSTSUBSCRIPT italic_S , 1 end_POSTSUBSCRIPT ( italic_S ) ≥ 1, i.e., at least one copy of S𝑆Sitalic_S can be produced. Let 𝐢S,k=k𝐢S,1subscript𝐢𝑆𝑘𝑘subscript𝐢𝑆1\mathbf{i}_{S,k}=k\cdot\mathbf{i}_{S,1}bold_i start_POSTSUBSCRIPT italic_S , italic_k end_POSTSUBSCRIPT = italic_k ⋅ bold_i start_POSTSUBSCRIPT italic_S , 1 end_POSTSUBSCRIPT. By additivity, 𝐢S,k𝐲S,ksubscript𝐢𝑆𝑘subscript𝐲𝑆𝑘\mathbf{i}_{S,k}\Rightarrow\mathbf{y}_{S,k}bold_i start_POSTSUBSCRIPT italic_S , italic_k end_POSTSUBSCRIPT ⇒ bold_y start_POSTSUBSCRIPT italic_S , italic_k end_POSTSUBSCRIPT, where 𝐲S,k=k𝐲S,1subscript𝐲𝑆𝑘𝑘subscript𝐲𝑆1\mathbf{y}_{S,k}=k\cdot\mathbf{y}_{S,1}bold_y start_POSTSUBSCRIPT italic_S , italic_k end_POSTSUBSCRIPT = italic_k ⋅ bold_y start_POSTSUBSCRIPT italic_S , 1 end_POSTSUBSCRIPT, noting that 𝐲S,k(S)ksubscript𝐲𝑆𝑘𝑆𝑘\mathbf{y}_{S,k}(S)\geq kbold_y start_POSTSUBSCRIPT italic_S , italic_k end_POSTSUBSCRIPT ( italic_S ) ≥ italic_k. In other words, all species are producible in arbitrarily large counts from some valid initial configuration.

Now we argue all species can be made simultaneously arbitrarily large count from some valid initial configuration; in particular, we can reach a configuration with counts at least 𝐱𝐱\mathbf{x}bold_x. Let 𝐢=SΛ𝐢S,𝐱(S)𝐢subscript𝑆Λsubscript𝐢𝑆𝐱𝑆\mathbf{i}=\sum_{S\in\Lambda}\mathbf{i}_{S,\mathbf{x}(S)}bold_i = ∑ start_POSTSUBSCRIPT italic_S ∈ roman_Λ end_POSTSUBSCRIPT bold_i start_POSTSUBSCRIPT italic_S , bold_x ( italic_S ) end_POSTSUBSCRIPT. Since each 𝐢S,𝐱(S)𝐲S,𝐱(S)subscript𝐢𝑆𝐱𝑆subscript𝐲𝑆𝐱𝑆\mathbf{i}_{S,\mathbf{x}(S)}\Rightarrow\mathbf{y}_{S,\mathbf{x}(S)}bold_i start_POSTSUBSCRIPT italic_S , bold_x ( italic_S ) end_POSTSUBSCRIPT ⇒ bold_y start_POSTSUBSCRIPT italic_S , bold_x ( italic_S ) end_POSTSUBSCRIPT, by additivity we have 𝐢𝐲𝐢𝐲\mathbf{i}\Rightarrow\mathbf{y}bold_i ⇒ bold_y, where 𝐲=SΛ𝐲S,𝐱(S)𝐲subscript𝑆Λsubscript𝐲𝑆𝐱𝑆\mathbf{y}=\sum_{S\in\Lambda}\mathbf{y}_{S,\mathbf{x}(S)}bold_y = ∑ start_POSTSUBSCRIPT italic_S ∈ roman_Λ end_POSTSUBSCRIPT bold_y start_POSTSUBSCRIPT italic_S , bold_x ( italic_S ) end_POSTSUBSCRIPT. Then for each SΛ𝑆ΛS\in\Lambdaitalic_S ∈ roman_Λ, 𝐲(S)𝐱(S)𝐲𝑆𝐱𝑆\mathbf{y}(S)\geq\mathbf{x}(S)bold_y ( italic_S ) ≥ bold_x ( italic_S ), so 𝐲𝐱𝐲𝐱\mathbf{y}\geqq\mathbf{x}bold_y ≧ bold_x.

Since all executions from 𝐢𝐢\mathbf{i}bold_i are finite, all executions from 𝐲𝐲\mathbf{y}bold_y are finite. By additivity, any sequence of reactions applicable to 𝐱𝐱\mathbf{x}bold_x is also applicable to 𝐲𝐲\mathbf{y}bold_y. Thus all executions from 𝐱𝐲𝐱𝐲\mathbf{x}\leqq\mathbf{y}bold_x ≦ bold_y must be finite as well, i.e., 𝒞𝒞\mathcal{C}caligraphic_C is entirely execution bounded since 𝐱𝐱\mathbf{x}bold_x is an arbitrary configuration.

Section 6.3 lets us replace “entirely execution bounded” in Section 6.3 with “leaderless and execution bounded”:

Corollary 6.24.

If a noncollapsing, all-voting, leaderless, execution bounded CRD stably decides a predicate ϕitalic-ϕ\phiitalic_ϕ, then ϕitalic-ϕ\phiitalic_ϕ is eventually constant.

In particular, since the original model of population protocols [angluin2004computation] defined them as leaderless and all-voting—and since population protocols are noncollapsing—we have the following.

Corollary 6.25.

If an execution bounded population protocol stably decides a predicate ϕitalic-ϕ\phiitalic_ϕ, then ϕitalic-ϕ\phiitalic_ϕ is eventually constant.

{toappendix}

6.4 Feedforward CRNs

We show that another common constraint, feedforwardness, significantly reduces computational power, making it impossible to decide even simple mod and threshold sets.

Definition 6.26.

A CRN is reaction-feedforward if reactions can be ordered r1,r2,,rnsubscript𝑟1subscript𝑟2subscript𝑟𝑛r_{1},r_{2},\ldots,r_{n}italic_r start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_r start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , … , italic_r start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT such that, for all k<𝑘k<\ellitalic_k < roman_ℓ, no reactant of rksubscript𝑟𝑘r_{k}italic_r start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT appears in rsubscript𝑟r_{\ell}italic_r start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT (as either reactant or product).

Reaction-feedforward CRNs are significant in the sense that many continuous real-valued CRNs computing numerical-valued functions (where the count of some species Y𝑌Yitalic_Y is interpreted as the output, e.g., 2XY2𝑋𝑌2X\to Y2 italic_X → italic_Y computes f(x)=x/2𝑓𝑥𝑥2f(x)=\lfloor x/2\rflooritalic_f ( italic_x ) = ⌊ italic_x / 2 ⌋) can be computed by reaction-feedforward CRNs [chen2023rate].666 The definition of feedforward in reference [chen2023rate] is different from the definition given here, being based on an ordering of species rather than reactions. However, it is straightforward to verify by inspection that the CRNs given for the positive results of [chen2023rate] are reaction-feedforward according to Definition 6.26. Compared to general CRNs, reaction-feedforward CRNs are easy to analyze and prove correctness. One reason is that, if a reaction-feedforward CRN can reach terminal configuration from 𝐱𝐱\mathbf{x}bold_x at all, then it is execution bounded from 𝐱𝐱\mathbf{x}bold_x.

There is a similar definition, called simply feedforward in [chen2023rate], based on ordering of species rather than reactions. We use the term species-feedforward to avoid confusion with Definition 6.26. We say a reaction (𝐫,𝐩)𝐫𝐩(\mathbf{r},\mathbf{p})( bold_r , bold_p ) produces a species S𝑆Sitalic_S if 𝐩(S)>𝐫(S)𝐩𝑆𝐫𝑆\mathbf{p}(S)>\mathbf{r}(S)bold_p ( italic_S ) > bold_r ( italic_S ), and it consumes S𝑆Sitalic_S if 𝐫(S)>𝐩(S)𝐫𝑆𝐩𝑆\mathbf{r}(S)>\mathbf{p}(S)bold_r ( italic_S ) > bold_p ( italic_S ).

Definition 6.27.

A CRN is species-feedforward if species can be ordered S1,S2,,Snsubscript𝑆1subscript𝑆2subscript𝑆𝑛S_{1},S_{2},\ldots,S_{n}italic_S start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_S start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT , … , italic_S start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT such that every reaction producing a species Ssubscript𝑆S_{\ell}italic_S start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT consumes a earlier species Sksubscript𝑆𝑘S_{k}italic_S start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT where k<𝑘k<\ellitalic_k < roman_ℓ.

Although the term “linear potential function” was not used in [chen2023rate], it is shown in [chen2023rate, Lemma 4.8] that species-feedforward CRNs have a linear potential function (assigning weight 1Ki1superscript𝐾𝑖\frac{1}{K^{i}}divide start_ARG 1 end_ARG start_ARG italic_K start_POSTSUPERSCRIPT italic_i end_POSTSUPERSCRIPT end_ARG to species Sisubscript𝑆𝑖S_{i}italic_S start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT for a suitably large constant K𝐾Kitalic_K), thus are entirely execution bounded. The same is not always true of reaction-feedforward CRNs, for example X2X𝑋2𝑋X\mathop{\rightarrow}\limits 2Xitalic_X → 2 italic_X is reaction-feedforward but not execution bounded. However, we can use similar techniques to proofs used for so-called noncompetitive CRNs in [vasic2022programming] to show “reasonable” reaction-feedforward CRNs are execution bounded.

Lemma 6.28.

Suppose in a reaction-feedforward CRN that 𝐢𝐜𝐢𝐜\mathbf{i}\Rightarrow\mathbf{c}bold_i ⇒ bold_c by execution P𝑃Pitalic_P, and 𝐢𝐝𝐢𝐝\mathbf{i}\Rightarrow\mathbf{d}bold_i ⇒ bold_d by execution Q𝑄Qitalic_Q. If any reaction occurs less in P𝑃Pitalic_P than Q𝑄Qitalic_Q, then 𝐜𝐜\mathbf{c}bold_c is not terminal.

Proof 6.29.

Here we equivalently think of an execution from 𝐢𝐢\mathbf{i}bold_i as a sequence of reactions, since from those and 𝐢𝐢\mathbf{i}bold_i we can deduce the configurations in the execution. Define #(rk,P)#subscript𝑟𝑘𝑃\#(r_{k},P)# ( italic_r start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT , italic_P ) as the number of times reaction rksubscript𝑟𝑘r_{k}italic_r start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT occurs in the execution P𝑃Pitalic_P. Let rksubscript𝑟𝑘r_{k}italic_r start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT be the first reaction in the reaction-feedforward order such that #(rk,P)<#(rk,Q)#subscript𝑟𝑘𝑃#subscript𝑟𝑘𝑄\#(r_{k},P)<\#(r_{k},Q)# ( italic_r start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT , italic_P ) < # ( italic_r start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT , italic_Q ). Assume, for brevity of explanation, that rksubscript𝑟𝑘r_{k}italic_r start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT has only one reactant, denoted A𝐴Aitalic_A; the argument below, however, is general and applies to any number of reactants in rksubscript𝑟𝑘r_{k}italic_r start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT.

By the definition of a reaction-feedforward CRN, the reactions rk+1subscript𝑟𝑘1r_{k+1}italic_r start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT through rnsubscript𝑟𝑛r_{n}italic_r start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT do not affect the count of A𝐴Aitalic_A. Further, reactions r1subscript𝑟1r_{1}italic_r start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT through rk1subscript𝑟𝑘1r_{k-1}italic_r start_POSTSUBSCRIPT italic_k - 1 end_POSTSUBSCRIPT can only produce A𝐴Aitalic_A and not consume it, reactions r1subscript𝑟1r_{1}italic_r start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT through rksubscript𝑟𝑘r_{k}italic_r start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT can increase the count of A𝐴Aitalic_A, and among them, only rksubscript𝑟𝑘r_{k}italic_r start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT can decrease it. Let m=#(rk,P)𝑚#subscript𝑟𝑘𝑃m=\#(r_{k},P)italic_m = # ( italic_r start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT , italic_P ). Let Qsuperscript𝑄Q^{\prime}italic_Q start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT represent the prefix sequence (𝐢,𝐱1,,𝐱p)𝐢subscript𝐱1subscript𝐱𝑝(\mathbf{i},\mathbf{x}_{1},\ldots,\mathbf{x}_{p})( bold_i , bold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , bold_x start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT ) of Q𝑄Qitalic_Q where the transition 𝐱p𝐱p+1subscript𝐱𝑝subscript𝐱𝑝1\mathbf{x}_{p}\Rightarrow\mathbf{x}_{p+1}bold_x start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT ⇒ bold_x start_POSTSUBSCRIPT italic_p + 1 end_POSTSUBSCRIPT corresponds to the (m+1)𝑚1(m+1)( italic_m + 1 )st execution of reaction rksubscript𝑟𝑘r_{k}italic_r start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT. The configuration 𝐱psubscript𝐱𝑝\mathbf{x}_{p}bold_x start_POSTSUBSCRIPT italic_p end_POSTSUBSCRIPT is thus the configuration just before rksubscript𝑟𝑘r_{k}italic_r start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT occurs more in Q𝑄Qitalic_Q than in P𝑃Pitalic_P.

Note that reactions r1subscript𝑟1r_{1}italic_r start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT through rk1subscript𝑟𝑘1r_{k-1}italic_r start_POSTSUBSCRIPT italic_k - 1 end_POSTSUBSCRIPT occur at least as often in P𝑃Pitalic_P as in Q𝑄Qitalic_Q (i.e. #(ri,P)#(ri,Q)#subscript𝑟𝑖𝑃#subscript𝑟𝑖𝑄\#(r_{i},P)\geq\#(r_{i},Q)# ( italic_r start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT , italic_P ) ≥ # ( italic_r start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT , italic_Q ) for i=1𝑖1i=1italic_i = 1 to k1𝑘1k-1italic_k - 1). Therefore, they occur at least as often in P𝑃Pitalic_P as in Qsuperscript𝑄Q^{\prime}italic_Q start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT, since Qsuperscript𝑄Q^{\prime}italic_Q start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT is a prefix of Q𝑄Qitalic_Q. Moreover, by our choice of Qsuperscript𝑄Q^{\prime}italic_Q start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT, #(rk,P)=#(rk,Q)#subscript𝑟𝑘𝑃#subscript𝑟𝑘superscript𝑄\#(r_{k},P)=\#(r_{k},Q^{\prime})# ( italic_r start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT , italic_P ) = # ( italic_r start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT , italic_Q start_POSTSUPERSCRIPT ′ end_POSTSUPERSCRIPT ). So A𝐴Aitalic_A is present in 𝐜𝐜\mathbf{c}bold_c, i.e. 𝐜(A)>0𝐜𝐴0\mathbf{c}(A)>0bold_c ( italic_A ) > 0. Thus, rksubscript𝑟𝑘r_{k}italic_r start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT is applicable at 𝐜𝐜\mathbf{c}bold_c, so 𝐜𝐜\mathbf{c}bold_c is not terminal.

The following corollary implies that any reaction-feedforward CRN that can reach a terminal configuration from 𝐢𝐢\mathbf{i}bold_i is execution bounded from 𝐢𝐢\mathbf{i}bold_i.

Corollary 6.30.

In a reaction-feedforward CRN 𝒞𝒞\mathcal{C}caligraphic_C, if there is a terminal configuration 𝐜𝐢subscript𝐜𝐢\mathbf{c}_{\mathbf{i}}bold_c start_POSTSUBSCRIPT bold_i end_POSTSUBSCRIPT reachable from initial configuration 𝐢𝐢\mathbf{i}bold_i, then 𝐜𝐢subscript𝐜𝐢\mathbf{c}_{\mathbf{i}}bold_c start_POSTSUBSCRIPT bold_i end_POSTSUBSCRIPT is reached by every sufficiently long execution from 𝐢𝐢\mathbf{i}bold_i. Furthermore, all of these executions are permutations of the same number of each reaction type. In particular, 𝒞𝒞\mathcal{C}caligraphic_C is execution bounded from 𝐢𝐢\mathbf{i}bold_i.

Proof 6.31.

Let P𝑃Pitalic_P be the execution leading from 𝐢𝐢\mathbf{i}bold_i to 𝐜𝐢subscript𝐜𝐢\mathbf{c}_{\mathbf{i}}bold_c start_POSTSUBSCRIPT bold_i end_POSTSUBSCRIPT. Consider any execution Q𝑄Qitalic_Q with |Q|>|P|𝑄𝑃|Q|>|P|| italic_Q | > | italic_P |. By the pigeonhole principle, Q𝑄Qitalic_Q must involve more occurrences of some reaction r𝑟ritalic_r than P𝑃Pitalic_P does. By Lemma 6.28, this would imply that 𝐜𝐢subscript𝐜𝐢\mathbf{c}_{\mathbf{i}}bold_c start_POSTSUBSCRIPT bold_i end_POSTSUBSCRIPT is not terminal, which contradicts the premise that 𝐜𝐢subscript𝐜𝐢\mathbf{c}_{\mathbf{i}}bold_c start_POSTSUBSCRIPT bold_i end_POSTSUBSCRIPT is terminal. Therefore, no execution Q𝑄Qitalic_Q can be longer than P𝑃Pitalic_P. Consider any execution Q𝑄Qitalic_Q where |Q|=|P|𝑄𝑃|Q|=|P|| italic_Q | = | italic_P |. Q𝑄Qitalic_Q must be a permutation of P𝑃Pitalic_P, as any deviation resulting in more of any reaction would, by the pigeonhole principle, lead to a contradiction of the terminality of 𝐜𝐢subscript𝐜𝐢\mathbf{c}_{\mathbf{i}}bold_c start_POSTSUBSCRIPT bold_i end_POSTSUBSCRIPT. To address the possibility of a shorter terminal execution, consider any execution Q𝑄Qitalic_Q with |Q|<|P|𝑄𝑃|Q|<|P|| italic_Q | < | italic_P |. There must be some reaction r𝑟ritalic_r occurring more frequently in P𝑃Pitalic_P than in Q𝑄Qitalic_Q, and by Lemma 6.28, Q𝑄Qitalic_Q cannot reach a terminal configuration.

As noted, in the model of continuous CRNs, it is known that all the functions that can be stably computed (the continuous, piecewise linear functions) can be stably computed by reaction-feedforward CRNs [chen2023rate]. In contrast, with discrete CRNs computing predicates, we show that reaction-feedforward CRNs cannot stably decide all semilinear sets by giving two counterexamples, showing that reaction-feedforward CRDs can decide neither “most” mod sets (6.31) nor “most” threshold sets (6.32). Specifically, we chose the parity and majority predicate as our counterexamples, although the techniques generalize to more complex mod and threshold sets, e.g., [X1+2X23mod5?]delimited-[]subscript𝑋12subscript𝑋2modulo35?[X_{1}+2X_{2}\equiv 3\mod 5?][ italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT + 2 italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ≡ 3 roman_mod 5 ? ].

{lemmarep}

Reaction-feedforward CRDs can’t stably decide the parity predicate [X1mod2?]delimited-[]𝑋modulo12?[X\equiv 1\mod 2?][ italic_X ≡ 1 roman_mod 2 ? ].

Proof 6.32.

We show that in any possible construction, the input species must be a reactant of two distinct reactions. By letting the CRN stabilize and then introducing another input molecule, there must exist a set of rules inverting the output in either way, consisting of at least two reactions with X𝑋Xitalic_X as reactant, breaking the reaction-feedforward condition.

Consider the set of even numbers. A simple, non-reaction-feedforward CRD that decides parity is:

Y+XN𝑌𝑋𝑁\displaystyle Y+X\rightarrow Nitalic_Y + italic_X → italic_N
N+XY𝑁𝑋𝑌\displaystyle N+X\rightarrow Yitalic_N + italic_X → italic_Y

where X𝑋Xitalic_X is the input species, Y𝑌Yitalic_Y is a yes voter, and N𝑁Nitalic_N is a no voter, initialized with 1Y1𝑌1Y1 italic_Y and nX𝑛𝑋nXitalic_n italic_X. In either way to order these reactions, a reactant of the first reaction appears in the second reaction. Thus, the CRN is not reaction-feedforward.

To show that no such CRN could decide parity, we show that any construction requires us to have at least one reactant reappear in a later reaction, or even stronger: at least one species must be a reactant of two distinct reactions. Specifically, this is true for the input species X𝑋Xitalic_X.

To motivate the choice of species, let’s consider an even simpler parity computing CRD.

X+XY𝑋𝑋𝑌\displaystyle X+X\rightarrow Yitalic_X + italic_X → italic_Y
Y+XX𝑌𝑋𝑋\displaystyle Y+X\rightarrow Xitalic_Y + italic_X → italic_X

where X𝑋Xitalic_X is both input and votes no, Y𝑌Yitalic_Y votes yes, initialized with 1Y1𝑌1Y1 italic_Y and nX𝑛𝑋nXitalic_n italic_X. Only the input species appears twice as a reactant. Intuitively, this is true for all CRDs because we expect the input to be able to change our answer in either way, reversing the previous one.

Suppose for the sake of contradiction that there is a reaction-feedforward CRD 𝒞𝒞\mathcal{C}caligraphic_C which stably decides whether the initial number n=#X𝑛#𝑋n=\#Xitalic_n = # italic_X of input X𝑋Xitalic_X is even. We withhold two copies of X𝑋Xitalic_X and let 𝒞𝒞\mathcal{C}caligraphic_C stabilize on the correct output of yes. Denote ΥΥ\Upsilonroman_Υ as the set of yes voters. We denote the no voters with Υ¯Λ\Υ¯Υ\ΛΥ\overline{\Upsilon}\triangleq\Lambda\backslash\Upsilonover¯ start_ARG roman_Υ end_ARG ≜ roman_Λ \ roman_Υ. Only species contained in ΥΥ\Upsilonroman_Υ are present in the stable, correct output configuration.

Now, we release one of the remaining copies of X𝑋Xitalic_X. We first run the chain reaction (if any) starting from only one X𝑋Xitalic_X. Let ΩX:={S𝐱𝗋𝖾𝖺𝖼𝗁({1X}):𝐱(S)>0}assignsubscriptΩ𝑋conditional-set𝑆:𝐱𝗋𝖾𝖺𝖼𝗁1𝑋𝐱𝑆0\Omega_{X}:=\{S\mid\exists\mathbf{x}\in\mathsf{reach}(\{1X\}):\mathbf{x}(S)>0\}roman_Ω start_POSTSUBSCRIPT italic_X end_POSTSUBSCRIPT := { italic_S ∣ ∃ bold_x ∈ sansserif_reach ( { 1 italic_X } ) : bold_x ( italic_S ) > 0 } be the set of species producible from {1X}1𝑋\{1X\}{ 1 italic_X } (e.g., if there is no reaction X𝑋X\mathop{\rightarrow}\limits...italic_X → …, then ΩXsubscriptΩ𝑋\Omega_{X}roman_Ω start_POSTSUBSCRIPT italic_X end_POSTSUBSCRIPT is just {X}𝑋\{X\}{ italic_X }). Without loss of generality, we assume ΩXΥsubscriptΩ𝑋Υ\Omega_{X}\subseteq\Upsilonroman_Ω start_POSTSUBSCRIPT italic_X end_POSTSUBSCRIPT ⊆ roman_Υ, that is, all of X𝑋Xitalic_X’s direct products are yes-voters (if not, exchange ΥΥ\Upsilonroman_Υ and Υ¯¯Υ\overline{\Upsilon}over¯ start_ARG roman_Υ end_ARG in what follows). To correct the answer (n+1nmod2not-equivalent-to𝑛1modulo𝑛2n+1\not\equiv n\bmod 2italic_n + 1 ≢ italic_n roman_mod 2), 𝒞𝒞\mathcal{C}caligraphic_C must consume all species currently present and produce at least one copy of a species in Υ¯¯Υ\overline{\Upsilon}over¯ start_ARG roman_Υ end_ARG. It follows that for all XΩX𝑋subscriptΩ𝑋X\in\Omega_{X}italic_X ∈ roman_Ω start_POSTSUBSCRIPT italic_X end_POSTSUBSCRIPT, 𝒞𝒞\mathcal{C}caligraphic_C contains a reaction with X𝑋Xitalic_X as a reactant. Further, none of these reactions contain a reactant of Υ¯¯Υ\overline{\Upsilon}over¯ start_ARG roman_Υ end_ARG, since none are present in the current configuration.

Finally, we release the last remaining copy of X𝑋Xitalic_X. Again, we produce the set ΩXsubscriptΩ𝑋\Omega_{X}roman_Ω start_POSTSUBSCRIPT italic_X end_POSTSUBSCRIPT from X𝑋Xitalic_X. To invert the vote again, we must consume all YΥ¯𝑌¯ΥY\in\overline{\Upsilon}italic_Y ∈ over¯ start_ARG roman_Υ end_ARG and produce at least one member of ΥΥ\Upsilonroman_Υ. The reaction(s) consuming Υ¯¯Υ\overline{\Upsilon}over¯ start_ARG roman_Υ end_ARG must have a member of ΩXsubscriptΩ𝑋\Omega_{X}roman_Ω start_POSTSUBSCRIPT italic_X end_POSTSUBSCRIPT as a reactant since the configuration is stable without ΩXsubscriptΩ𝑋\Omega_{X}roman_Ω start_POSTSUBSCRIPT italic_X end_POSTSUBSCRIPT. Further, the reaction cannot be any of the ones from before since they contain a member of Υ¯¯Υ\overline{\Upsilon}over¯ start_ARG roman_Υ end_ARG as reactant.

Since there are least two reactions sharing a common species as reactant, the reactions cannot be ordered such that no reactant of the first of these reactions appears in the latter one. This makes 𝒞𝒞\mathcal{C}caligraphic_C non-reaction-feedforward, contradicting our initial assumption.

{lemmarep}

Reaction-feedforward CRDs can’t stably decide the majority predicate [X1X2?]delimited-[]subscript𝑋1subscript𝑋2?[X_{1}\geq X_{2}?][ italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ≥ italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ? ].

Proof 6.33.

Suppose, for the sake of contradiction, there exists a reaction-feedforward CRD 𝒞𝒞\mathcal{C}caligraphic_C which stably decides the predicate. We let 𝒞𝒞\mathcal{C}caligraphic_C stabilize on input {nX1,nX2}𝑛subscript𝑋1𝑛subscript𝑋2\{nX_{1},nX_{2}\}{ italic_n italic_X start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_n italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT } (yielding output yes), while withholding two copies of X2subscript𝑋2X_{2}italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT. We release one X2subscript𝑋2X_{2}italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT. Again, we consider the full set of species a single X2subscript𝑋2X_{2}italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT could produce before reacting with other molecules (denoted ΩX2subscriptΩsubscript𝑋2\Omega_{X_{2}}roman_Ω start_POSTSUBSCRIPT italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT end_POSTSUBSCRIPT). Without loss of generality, we consider all of them yes voters i.e. ΩX2ΥsubscriptΩsubscript𝑋2Υ\Omega_{X_{2}}\subseteq\Upsilonroman_Ω start_POSTSUBSCRIPT italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT end_POSTSUBSCRIPT ⊆ roman_Υ. The correct output now changes to no, and all yes voters must be consumed by reactions that only have reactants which are yes voters and further, these reactions contain all species in ΩX2subscriptΩsubscript𝑋2\Omega_{X_{2}}roman_Ω start_POSTSUBSCRIPT italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT end_POSTSUBSCRIPT as reactants.

Once the vote has reversed and stabilized, it contains only species of Υ¯Λ\Υ¯Υ\ΛΥ\overline{\Upsilon}\triangleq\Lambda\backslash\Upsilonover¯ start_ARG roman_Υ end_ARG ≜ roman_Λ \ roman_Υ. We release the last X2subscript𝑋2X_{2}italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT and let it produce ΩX2subscriptΩsubscript𝑋2\Omega_{X_{2}}roman_Ω start_POSTSUBSCRIPT italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT end_POSTSUBSCRIPT. Since ΩX2ΥsubscriptΩsubscript𝑋2Υ\Omega_{X_{2}}\subseteq\Upsilonroman_Ω start_POSTSUBSCRIPT italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT end_POSTSUBSCRIPT ⊆ roman_Υ i.e. all elements are yes voters, but the correct vote is still no, all XΩX2𝑋subscriptΩsubscript𝑋2X\in\Omega_{X_{2}}italic_X ∈ roman_Ω start_POSTSUBSCRIPT italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT end_POSTSUBSCRIPT must be consumed again. This time, they must be consumed in reactions involving no voters, must be distinct reactions from those in the previous step. Thus, all species XΩX2𝑋subscriptΩsubscript𝑋2X\in\Omega_{X_{2}}italic_X ∈ roman_Ω start_POSTSUBSCRIPT italic_X start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT end_POSTSUBSCRIPT appear at least twice as a reactant, breaking the reaction-feedforward condition.

7 Conclusion

\opt

full We explored the computational capabilities of execution bounded Chemical Reaction Networks (CRNs), which terminate after a finite number of reactions. This constraint aligns the model with practical scenarios where fuel supply is limited.

Our findings illustrate that the computational power of these CRNs varies significantly based on structural choices. Specifically, CRNs with an initial leader and the ability to allow only the leader to vote can stably compute all semilinear predicates and functions in O(xlogx)𝑂norm𝑥norm𝑥O(\|x\|\log\|x\|)italic_O ( ∥ italic_x ∥ roman_log ∥ italic_x ∥ ) parallel time. Without an initial leader, and requiring all species to vote, these networks are limited to computing eventually constant predicates. This limitation holds considerable weight for decentralized systems modeled by population protocols, which inherently exhibit these traits. Additionally, we introduced a new characterization of execution bounded networks through a nonnegative linear potential function, providing a novel theoretical tool for analyzing the physical constraints CRNs.

A key question remains open: Can execution bounded CRNs compute semilinear functions and predicates within polylogarithmic time? Angluin, Aspnes and Eisenstat introduced a fast population protocol that simulates a register machine with high probability. This protocol can perform standard operations like comparison, addition, subtraction, and multiplication and division by constants in O(log5n)𝑂superscript5𝑛O(\log^{5}n)italic_O ( roman_log start_POSTSUPERSCRIPT 5 end_POSTSUPERSCRIPT italic_n ) time [AngluinAE2008Fast]. Chen, Doty and Soloveichik applied this construction to CRNs in [Chen2012DeterministicFunction], showing that semilinear functions can be computed by CRNs without error in expected polylogarithmic time in the kinetic model. Central to their success in both cases is the “phase clock”, which generates a clock signal to indicate the probable completion of an epidemic style chain reaction and orders more recent instructions to overwrite older ones. This clock is inherently unbounded in its execution, cycling through m𝑚mitalic_m stages.

References

  • [1] Dana Angluin, James Aspnes, Zoë Diamadi, Michael J Fischer, and René Peralta. Computation in networks of passively mobile finite-state sensors. In PODC 2004: Proceedings of the twenty-third annual ACM symposium on Principles of distributed computing, pages 290–299, 2004.
  • [2] Dana Angluin, James Aspnes, and David Eisenstat. Fast computation by population protocols with a leader. Distributed Computing, 21(3):183–199, September 2008.
  • [3] Dana Angluin, James Aspnes, David Eisenstat, and Eric Ruppert. The computational power of population protocols, 2006.
  • [4] Ho-Lin Chen, David Doty, Wyatt Reeves, and David Soloveichik. Rate-independent computation in continuous chemical reaction networks. Journal of the ACM, 70(3), May 2023.
  • [5] Ho-Lin Chen, David Doty, and David Soloveichik. Deterministic function computation with chemical reaction networks. Natural Computing, 13(4):517–534, 2014. Preliminary version appeared in DNA 2012.
  • [6] David Doty and Monir Hajiaghayi. Leaderless deterministic chemical reaction networks. Natural Computing, 14(2):213–223, 2015. Preliminary version appeared in DNA 2013.
  • [7] Julius Farkas. Theorie der einfachen ungleichungen. Journal für die reine und angewandte Mathematik (Crelles Journal), 1902(124):1–27, 1902.
  • [8] David Gale. The theory of linear economic models. University of Chicago press, 1960.
  • [9] Daniel T. Gillespie. Exact stochastic simulation of coupled chemical reactions. Journal of Physical Chemistry, 81(25):2340–2361, 1977.
  • [10] S. Ginsburg and E. H. Spanier. Semigroups, Presburger formulas, and languages. Pacific Journal of Mathematics, 16(2):285–296, 1966.
  • [11] Ryuichi Ito. Every semilinear set is a finite union of disjoint linear sets. Journal of Computer and System Sciences, 3(2):221–231, 1969.
  • [12] Richard M Karp and Raymond E Miller. Parallel program schemata. Journal of Computer and system Sciences, 3(2):147–195, 1969.
  • [13] Olvi L Mangasarian. Nonlinear programming. SIAM, 1994.
  • [14] Christos H Papadimitriou. On the complexity of integer programming. Journal of the ACM (JACM), 28(4):765–768, 1981.
  • [15] Charles Rackoff. The covering and boundedness problems for vector addition systems. Theoretical Computer Science, 6(2):223–231, 1978.
  • [16] David Soloveichik, Matthew Cook, Erik Winfree, and Jehoshua Bruck. Computation with finite stochastic chemical reaction networks. Natural Computing, 7(4):615–633, 2008.
  • [17] Marko Vasić, Cameron Chalk, Austin Luchsinger, Sarfraz Khurshid, and David Soloveichik. Programming and training rate-independent chemical reaction networks. Proceedings of the National Academy of Sciences, 119(24):e2111552119, 2022.