1 Introduction

A reversible cellular automaton (RCA) is a cellular automaton (CA) whose global function is injective. A number-conserving cellular automaton (NCCA) is a cellular automaton whose states are integers and whose transition function keeps the sum of all cells constant throughout its evolution. Both can be seen as some kind of modeling of the physical conservation laws of mass or energy. Although both constraints seem to be ‘natural’ constraints for a cellular automaton [6], it was conjectured that one-dimensional reversible and number-conserving cellular automata (RNCCA) only have a limited computing ability. Particularly in the case of radius 1/2 (2-neighbor), it was shown that RNCCAs are characterized by shift-identity product cellular automata (SIPCA) [5]. But recently it was also shown that a 4-neighbor RNCCA is computation-universal [7]. In this paper we explore the whole list of radius 1 (3-neighbor) RNCCAs up to 4-state by exhaustive search. In contrast to the radius 1 / 2 case, there are three new types of nontrivial RNCCAs in the case of 4-state. We also show that one of the types is useful because it is possible to compose new associated nontrivial RNCCAs of this type by modifying a trivial RNCCA when the number of states is larger than four.

2 Preliminaries

Definition 1

A n-state deterministic one-dimensional cellular automaton is defined by \(A=(\mathbb {Z}, N, Q, f)\), where \(\mathbb {Z}\) is the set of all integers, the neighborhood \(N=\{n_1,\ldots ,n_k\}\) is a finite subset of \(\mathbb {Z}\), \(Q=[\![0,\ldots , n-1]\!]\) is the set of states of each cell, \(f : Q^k\rightarrow Q\) is a mapping called the local transition function.

A configuration over Q is a mapping \(\alpha :\mathbb {Z}\rightarrow Q\). Then \(\mathrm{Conf}(Q) = \{\alpha \mid \alpha :\mathbb {Z}\rightarrow Q\}\) is the set of all configurations over Q. The global function of A is \(F:\mathrm{Conf}(Q) \rightarrow \mathrm{Conf}(Q)\) defined as \(F(\alpha )(i)=f(\alpha (i+n_1),\ldots ,\alpha (i+n_k)) \text{ for } \text{ all } \alpha \in \mathrm{Conf}(Q), \ i\in \mathbb {Z}.\)

We call the value \(r=(\max _{1\le i\le k}n_i-\min _{1\le i\le k}n_i)/2\) the radius of A. A neighborhood \(\{-1,0,1\}\) corresponds to radius 1, while a neighborhood \(\{0,1\}\) corresponds to radius 1 / 2. In these cases we replace N by r in the notation of cellular automata. We employ the Wolfram numbering [9] W(f) to represent the local function f: \(W(f)=\sum f(x_1,\ldots ,x_{2r+1}) n^{ n^{2r} x_1 +n^{2r-1} x_2+\ldots +n^0 x_{2r+1} }\) where the sum is applied on \((x_1,\ldots ,x_{2r+1})\in Q^{2r+1}\). Note that the Wolfram numbering of a n-state CA, expressed in radix n form is the concatenation of the values of its local transition function.

In the sequel, we denote any finite configuration with the finite sequence of its states: \([x_{0}, x_1, x_2,\ldots , x_m]\) where \(x_i \in Q\).

Definition 2

A CA A is reversible iff its global function F is injective. A is said to be number-conserving iff \(\forall c \in \mathrm{Conf}_F(Q), \sum _{i\in \mathbb {Z}} \{F(c)(i)-c(i)\}=0\) where \(\mathrm{Conf}_F(Q)\) denotes the set of all finite configurations (i.e. configurations in which the number of nonzero cells is finite.)

Definition 2 is equivalent to the general definition in the infinite case [3].

Definition 3

For a state \(q\in Q\setminus \{0\}\) of \(A = (\mathbb {Z}, 1, Q, f)\), we call q a stable state if \(f(0,q,0)=q,f(q,0,0)=0,f(0,0,q)=0\), q is a right (resp. left) propagating state, if \(f(0,q,0)\!=\!0,f(q,0,0)\!=\!q,f(0,0,q)\!=\!0\) (resp. \(f(0,q,0)\!=\!0,f(q,0,0)\!=\!0,f(0,0,q)\!=\!q\)). For a state \(q\in Q\setminus \{0\}\) of \(A = (\mathbb {Z}, 1/2, Q, g)\), we call q a stable state if \(g(q,0)\!=\!q,g(0,q)\!=\!0\), q is a left propagating state, if \(g(q,0)\!=\!0,g(0,q)\!=\!q\). We denote the set of stable, right propagating, left propagating states by \(Q_{\downarrow },Q_{\searrow }\), and \(Q_{\swarrow }\) (\(\subset Q\)) respectively.

We recall a necessary and sufficient condition for radius 1 CAs to be number-conserving, as a special case of results from [2].

Proposition 1

A deterministic one-dimensional CA \(A = (\mathbb {Z}, 1, Q, f)\) is number-conserving iff there exists a function \(\varphi :Q^2 \rightarrow \mathbb {Z}\) such that

$$f(\ell ,c,r) = c - \varphi (\ell , c) + \varphi (c, r) \text{ for } \text{ all } c, \ell , r \in Q.$$

The function \(\varphi \) represents the movement of numbers between two neighboring cells. We call this function \(\varphi \) the flow function.

3 Radius 1 RNCCAs and Their Composition Methods

In this section we denote each RNCCA with an expression of the form \(q\!-\!n\!-\!i\) where q is the size of its neighborhood, n the number of states, and \(i\quad (=1,2,\ldots )\) is an index which indicates the local rules arranged in the ascending order of the Wolfram numbering (\(W(f_i) < W(f_{i+1})\)). See Table 1 and Appendix.

Table 1 Flow function values of radius 1 (3-neighbor) 4-state RNCCAs

As far as the radius 1 / 2 case, RNCCAs are characterized by shift-identity product cellular automata (SIPCA) [5]. The possible function by SIPCA signals is only a crossing of a stable state and a left propagating state. Thus a typical behavior is trivial and its time evolution is similar to the one depicted in Fig. 1 3-4-4 (Type I). Its state set Q is \(Q_{\downarrow }\cup Q_{\swarrow }\cup Q_{\swarrow \downarrow }\) where \(Q_{\swarrow \downarrow }=\{a+b\quad |\quad a\in Q_{\downarrow }, b\in Q_{\swarrow } \}\). An RNCCA whose state number is a prime, is only a left shift or the identity [5], thus \(2\!-\!p\!-\!1\) is a left shift and \(2\!-\!p\!-\!2\) is the identity, when p is a prime number. Appendix 1 proposes the cases up to 10-state.

Schranko and Oliveira [8] introduced a way of constructing RNCCA rules with a large neighborhood by the composition of radius 1 / 2 RNCCA rules. Their scheme in the cases ranging from radius 1 / 2 to 1 is as follows:

Proposition 2

 [8] Given two radius 1 / 2 RNCCAs: \(A_1 = (\mathbb {Z}, 1/2, Q, g_1)\) and \(A_2 = (\mathbb {Z}, 1/2, Q, g_2)\), \(A = (\mathbb {Z}, 1, Q, f)\) is a radius 1 RNCCA, where \(f(\ell ,c,r) \equiv g_1 \circ g_2(\ell ,c,r)=g_1(g_2(\ell ,c),g_2(c,r))\) for any \(\ell ,c,r \in Q\).

This procedure does not produce any complex behavior. If \(a \in Q\) is a left propagating (resp. a stable) state of both \(A_1\) and \(A_2\) then a is a left propagating (resp. a right propagating) state of A. Otherwise a is a stable state of A. So they also conjectured that every q-state n-neighbor RNCCA rule is a composition of q-state radius 1 / 2 RNCCA rules. This is not true because there is a counter-example in [5] and we show it even in the case of radius 1 and 4-state. By exhaustive search, there are 21 RNCCAs with radius 1 and 4-state (among 89588 NCCAs). Appendix 2 shows the result. Although enumeration of RCAs is hard even in the 4-state case, enumeration of NCCAs is easier because it is possible to reduce the search domain by Proposition 1 (see also [2]). So we first enumerated NCCAs and checked their reversibility by [1].

Fig. 1
figure 1

Time space diagrams of 4-state RNCCAs of each type

Their flow function values are shown in Table 1. They are classified into four types (see Fig. 1). 3-1, 4, 5, 8, 9, 16, 18, 20, 21 (type I) are composed by the above method. Type II rules: 3-2,6,17,19 have one left (or right) propagating state and one stable state and their collision shifts the stable state to the right (or to the left). Each type II rule can be induced by a related type I rule: \(3\!-\!4\!-\!4 \rightarrow 3\!-\!4\!-\!2, 3\!-\!4\!-\!8 \rightarrow 3\!-\!4\!-\!6, 3\!-\!4\!-\!18 \rightarrow 3\!-\!4\!-\!17, 3\!-\!4\!-\!20 \rightarrow 3\!-\!4\!-\!19\) respectively by replacing two flow functions values. Type III rules: \(3\!-\!4\!-\!3,7,11,13\) have two left (or right) propagating states and one stable state. Their collision is performed by swapping two signals (i.e. it does not make the sum of two signal values). Type IV rules: 3-4-10, 12, 14, 15 have no propagating state.

Next, we show that a type II RNCCA can be induced by a type I RNCCA even when the state number is larger than four.

Proposition 3

Let \(A = (\mathbb {Z}, 1, Q, f)\). Suppose A is a RNCCA composed by Proposition 2 and \(s\in Q\) is a stable state and \(r\in Q\) is a right (resp. left) propagating state, then there is an injective NCCA which has an associated type II rule.

Proof

We only show the result when r is a right propagating state. The proof in the case of a left propagating state is similar.

Let \(r,r',r'' \in Q_{\searrow } \cup \{0\}\) and \(s,s' \in Q_{\downarrow } \cup \{0\}\). Choose two states \(r_0\) and \(s_0\) such that \(r_0 \in Q_{\searrow }\) and \(s_0 \in Q_{\downarrow }\). The CA A must attain the transition: \([r+s,0,r_0+s_0,r'+s'] {\mathop {\rightarrow }\limits ^{f}} [r''+s,r,s_0,r_0+s']\) since r and \(r_0\) are right-propagating states and the flow function \(\varphi \) of f should have the value: \(\varphi (0, r_0+s_0)=0\). If we modify the value of the flow function \(\varphi (0, r_0+s_0)\) to \(s_0\), the transition becomes \([r+s,0,r_0+s_0,r'+s'] {\mathop {\rightarrow }\limits ^{f}} [r''+s,r+s_0,0,r_0+s']\). But the transition to the configurations already exists, i.e., \([r+s,s_0,r_0,r'+s'] {\mathop {\rightarrow }\limits ^{f}} [r''+s,r+s_0,0,r_0+s']\). These transitions have to be changed to the transition \([r+s,s_0,r_0,r'+s'] {\mathop {\rightarrow }\limits ^{f}} [r''+s,r,s_0,r_0+s']\). This can be done by changing the flow function value of \(\varphi (s_0, r_0)=0\) to \(-s_0\). This modification swaps the configurations \([r''+s,r+s_0,0,r_0+s']\) and \([r''+s,r,s_0,r_0+s']\). Even if a configuration contains the sequence more than once (maybe infinitely often), the modification only affects every finite length sequence, keeping thus injectivity because the number of configurations for which preimages are changed is equal. The modification also keeps the number-conservation since it is applied to the values of the flow function. \(\quad \square \)

Example 1

A type I 6-state radius 1 RNCCA \(A_6\) can be combined from two radius 1 / 2 RNCCAs 2-6-4 and 2-6-6 (in Appendix 1). 2-6-6 is the identity and 2-6-4 has a stable state 1 and two left propagating state 2 and 4. Thus \(A_6\) has \(Q_{\searrow }=\{1\}\), \(Q_{\downarrow }=\{2,4\}\), and \(Q_{\swarrow }=\varnothing \). Its flow function \(\varphi (x, y)\) has the following values:

\(\begin{array}{lrlrlrlrlrlrlrlr} (5, 5) &{} -1, &{} (5, 4) &{} -1, &{} (5, 3) &{} -1, &{} (5, 2) &{} -1, &{} (5, 1) &{} -1, &{} (5, 0) &{} -1, &{} (4, 5) &{} 0, &{} (4, 4) &{} 0, \\ (4, 3) &{} 0, &{} (4, 2) &{} 0, &{} (4, 1) &{} -4, &{} (4, 0) &{} 0, &{} (3, 5) &{} -1, &{} (3, 4) &{} -1, &{} (3, 3) &{} -1, &{} (3, 2) &{} -1, \\ (3, 1) &{} -1, &{} (3, 0) &{} -1, &{} (2, 5) &{} 0, &{} (2, 4) &{} 0, &{} (2, 3) &{} 0, &{} (2, 2) &{} 0, &{} (2, 1) &{} 0, &{} (2, 0) &{} 0, \\ (1, 5) &{} -1, &{} (1, 4) &{} -1, &{} (1, 3) &{} -1, &{} (1, 2) &{} -1, &{} (1, 1) &{} -1, &{} (1, 0) &{} -1, &{} (0, 5) &{} 4, &{} (0, 4) &{} 0, \\ (0, 3) &{} 0, &{} (0, 2) &{} 0, &{} (0, 1) &{} 0, &{} (0, 0) &{} 0. \\ \end{array}\)

Replacing two values, \(\varphi (0, 3) = 2, \varphi (2, 1) = -2\) gives a 6-state type II RNCCA. Moreover replacing two values, \(\varphi (0, 5) = 4, \varphi (4, 1) = -4\) gives another 6-state type II RNCCA.

4 Conclusion

In this paper, we present the exhaustive search result of radius 1 RNCCAs up to four states. There are three types of nontrivial RNCCA rules in the case of four states. Although our result deny Schranko and Oliveira’s conjecture [8], it remains still open whether the complexity of radius 1 RNCCA is sufficient to provide a universal CA or not. Collision of two propagating (or stable) signals cannot change their states as far as this method is employed. To obtain a more complex behavior, another way of collisions seems to be required.