Digital calculus: Cellular automata dynamics in closed form

Digital calculus:
Cellular automata dynamics
arXiv:1505.02543v2 [nlin.CG] 31 Jul 2015
in closed form
V. Garcı́a-Morales ∗
Departament de Termodinàmica, Universitat de València,
E-46100 Burjassot, Spain
Abstract
A simple mathematical expression for the universal map for cellular automata is
found in closed form with the help of a digit function, whose most basic properties
are established. This result is found after proving a theorem on the composition of
functions on finite sets. The expression (and the technique used to obtain it) opens
the possibility of gaining mathematical insight in any cellular automaton rule since
it constitutes at the same time a simple and fast algorithm to implement any such
rule.
Key words: symbolic dynamics, cellular automata, algebra, complexity
1
Introduction
Cellular automata (CA) constitute an important tool in the study of complex systems [1,2,3,4].
CA have been satisfactorily used to model physical [5], chemical [6] and biological processes and,
∗ Corresponding author. Tel: +49 15224020629
Email address: [email protected] (V. Garcı́a-Morales).
Preprint submitted to Elsevier
3 August 2015
in certain cases, constitute an alternative to continuous models described by partial differential
equations [7]. Natural patterns as those found in some seashells, like the Conus marmorea [8] can
readily be obtained with CA [1]. Although such patterns may involve many microscopic degrees
of freedom, a coarse graining of them can also be generally described by cellular automata [9,10]
and the latter can thus be used to capture the collective behavior of spatiotemporal pattern
forming systems.
Despite involving only a finite number p of dynamical states and the interactions having a finite
range, already the most elementary CA can generate the highest complexity [1,14]. The mathematical description of such systems in terms of discrete maps seems to have been only recently
attempted [4,11] and previous researchers have mostly relied upon the computer to get insight
in CA behavior. In the monumental work [4], Chua has pointed out how useful is to have mathematical expressions to gain insight on CA behavior: nonlinear dynamical methods, number
theoretical, algebraic and statistical techniques can then be fruitfully applied to these systems.
Chua describes a universal neuron which provides a mathematical description for Wolfram’s
256 elementary CA [4]. However, this model generally depends on eight adjustable parameters
that need to be sought with the computer, and which are then tabulated occupying several
pages in [4]. Ozelim et. al. [11] have also introduced the so-called iota-delta function to describe
Wolfram’s elementary CA. Again, however, their model depends on freely adjustable parameters that need to be tabulated separately: in order to describe CA behavior, such numerical
parameter values need to be given as input together with the specification of the dynamical
state of the cells. In our opinion, the presence of such parameters in the equations is an obvious
major drawback from a mathematical point of view.
In [12] we have introduced a universal map for cellular automata which does not depend on any
adjustable parameter and which is not only able to simulate Wolfram’s 256 elementary CA,
but any deterministic CA with any number of dynamical states. This map can also be easily
extended to any number of dimensions. In [13] and [14] we have discussed some symmetries
of the universal CA map that help to classify the rules into symmetry classes [13] and to
2
understand the kind of symmetry breaking that leads to complexity at this elementary level
[14]. We have termed B-calculus the mathematical techniques introduced in [12] because these
strongly rely on a function of two arguments that is called the boxcar or B-function [12]
1
B(x, y) =
2
x+y
x−y
−
|x + y| |x − y|
!
(1)
This function constitutes the building block of B-calculus. It returns the sign of the second
argument y, if −|y| < x < |y|, sign y/2 if x = y and ’0’ otherwise. The B-function is thus
an even function of its first argument and an odd function of its second one. The function is
represented in Fig. 1.
As introduced in [12], the universal map is given in terms of a sum that involves pl+r+1 terms,
where p is the alphabet size and l and r denote the number of neighbors to the left and to the
right (respectively) of the symbol that is updated at the next time step. In this paper we reduce
this sum to a single evaluation over the neighborhood values: the universal map is fully reduced
to a closed form with mathematical structure. The approach makes use of a digit function whose
main mathematical properties are first established. Then, we show how the digit function alone
is able to describe all deterministic CA in 1D. Extensions to more dimensions also become
trivial although we refrain from discussing them here.
We briefly describe the universal map for cellular automata, whose closed form we then derive.
Let us consider a 1D ring containing a total number of Ns sites. An input is given as initial
j
s
condition in the form of a vector x0 = (x10 , ..., xN
0 ). Each of the x0 is an integer in [0, p−1] where
superindex j ∈ [1, Ns ] specifies the position of the site on the 1D ring. At each t the vector
s
xt = (x1t , ..., xN
t ) specifies the state of the CA. Periodic boundary conditions are considered so
j
s +1
s
that xN
= x1t and x0t = xN
t
t . Let xt+1 be taken to denote the value of site j at time step
t + 1. Formally, its dependence on the values at the previous time step is given through the
mapping xjt+1 =
l
j
j−r
Rpr (xj+l
), which we abbreviate as xjt+1 =
t , ...xt , ..., xt
l
Rpr (xjt ) with the
understanding that the function on the r.h.s depends on all site values within the neighborhood,
with range ρ = l + r + 1, which contains the site j updated at the next time (l and r denote the
3
number of cells to the left and to the right of site j respectively). We take the convention that
j increases to the left. The integer number n in base 10, which runs between 0 and pr+l+1 − 1,
indexes all possible neighborhood values coming from the different configurations of site values.
Each of these configurations compares to the dynamical configuration reached by site j and its
r and l first-neighbors at time t and given by
njt =
l
X
pk+r xj+k
t
(2)
k=−r
We will refer to this latter quantity often as the neighborhood value. The possible outputs an
for each configuration n are also integers ∈ [0, p − 1]. An integer number R can then be given
in the decimal base to fully specify the rule l Rpr as
R≡
pr+l+1
X−1
an p n .
(3)
n=0
This is the so-called Wolfram code of the CA dynamics. With all these specifications we have
the following universal map [12]
xjt+1 = l Rpr (xjt ) =
pr+l+1
X−1
n=0

l
X

1
pk+r xj+k
,  = anj
an B  n −
t
t
2
k=−r
(4)
This map, although describing all 1D deterministic cellular automata which are first order in
time has the shortcoming that it generally depends on a sum which can contain up to pl+r+1
terms. Although Eq. (4) is advantageous in a certain sense because the B-functions in the map
behave as an orthonormal base (thus making the transition to a Hilbert space clear, if the an
are allowed to take on complex values) the map is computationally demanding for l + r + 1 of
p large and a closed form can be desirable in certain cases to gain further mathematical insight
and to test the validity of certain calculations with the computer. The finding of such closed
form is the goal of the next section.
4
2
The digit function
Let now p > 1, p ∈ N. The representation in radix p of x ∈ R is a (generally infinite) sequence
of the form
x = aN pN + aN −1 pN −1 + . . . + a0 + a−1 p−1 + a−2 p−2 + . . .
(5)
where the ak∈Z ’s, the so-called digits of the expansion, are all positive or negative, with absolute
values being integers in S, the set of integer numbers between 0 and p − 1. Every real number
can be represented in this form. Let b. . .c denote the closest lower integer (floor function) and
d. . .e the closest upper integer (ceiling function). The following function
sign(x)p−D bpD |x|c ≡ aN pN + aN −1 pN −1 + . . . + a0 + a−1 p−1 + a−2 p−2 + . . . + a−D p−D
(6)
is the rational truncation to precision D in radix p of the real number x. We thus realize the
following interesting fact: the operators b. . .c and multipliying by pD do not commute [15], i.e.
bpD . . .c =
6 pD b. . .c. Indeed, we have
sign(x) p−D bpD |x|c − b|x|c = a−1 p−1 + a−2 p−2 + . . . + a−D p−D
(7)
which gives the rational truncation to precision D in radix p of the fractional part of x. Let us
consider x nonnegative for simplicity. Now, note that
$
%
x
= aN pN −k + aN −1 pN −k−1 + . . . + ak+1 p + ak
k
p
(8)
and
$
p
x
pk+1
%
= aN pN −k + aN −1 pN −k−1 + . . . + ak+1 p
(9)
whence, by subtracting both equations, we obtain the digit ak .
The digit function, for p ∈ N, k ∈ Z and x ∈ R is then defined as [15]
$
%
$
x
x
dp (k, x) = k − p k+1
p
p
%
(10)
and gives the k-th digit of the real number x (when it is non-negative) in a positional numeral
5
system in radix p > 1. If p = 1 the digit function satisfies d1 (k, x) = d1 (0, x) = 0 and it does
not relate to a positional numeral system.
With the digit function we can express Eq. (5) as
blogp |x|c
pk dp (k, |x|)
X
x = sign(x)
(11)
k=−∞
Note that the digit function is also defined for x negative since in that case we have, from the
definition
&
dp (k, −x) = p
x
pk+1
'
&
'
x
− k = dp (k, pk+1 − x)
p
(12)
where we have used that b−yc = −dye (for any real number y).
Most of the properties of the digit function are made apparent by plotting dp (k, x) for a fixed
value of p as a function of x and different values for k, as shown in Fig. 2, where d3 (k, x) is
shown for k = −2, −3, −4 in the interval x ∈ [0, 1]. The digit function is a staircase of p levels
taking discrete integer values between 0 and p − 1. Each time that x is divisible by pk+1 the
ascent of the staircase is broken and the level is set again to zero and a new staircase begins.
The next proposition formalizes some of these properties.
Proposition 1. The digit function satisfies (for n and m nonnegative integers)
dp (k, x + npk+1 ) = dp (k, x)
dp (k, pk x) = dp (0, x)
dp (0, dp (k, x)) = dp (k, x)
dp (0, n + dp (0, m)) = dp (0, n + m)
dp (0, ndp (0, m)) = dp (0, nm)
(13)
(14)
(15)
(16)
(17)
dp (n, pm ) = dp (m, pn ) = B m − n,
dp (k, n) =
m>n
X
1
2
dp (k, j)dp (j, pn )
(18)
(19)
j=0
Proof Eq. (13) follows directly from the definition. We have
6
x + npk+1
x + npk+1
x
x
)=
−
p
= k + np − p k+1 + n
k
k+1
p
p
p
p
$ %
$
%
$ %
$
%
x
x
x
x
= k + np − p k+1 − np = k − p k+1 ≡ dp (k, x)
p
p
p
p
$
dp (k, x + np
k+1
%
$
%
$
%
$
%
(20)
Eq. (14) is also trivial to prove
pk x
x
pk x
= dp (0, x)
−
p
=
bxc
−
p
dp (k, p x) =
pk
pk+1
p
$
%
$
%
$ %
k
Eq. (15) follows by noting that dp (k, x) is an integer 0 ≤ dp (k, x) ≤ p − 1. Then
$
%
dp (k, x)
dp (0, dp (k, x)) = dp (k, x) − p
= dp (k, x)
p
(21)
since bdp (k, x)/pc = 0. Eq. (16) is proved by using Euclidean division, since we can always
write m = ap + b with a, b integers and b = dp (0, m). Therefore
dp (0, n + dp (0, m)) = dp (0, n + ap + dp (0, m)) = dp (0, n + m)
(22)
where Eq. (13) has also been used. Eq. (17) is also proved in a similar way, using the distributive
property of ordinary addition and multiplication as well. Eq. (18) is simply proved from the
definition and Eq. (19) is a simple consequence of it. 2
The zeroth digit of the non-negative integer n in any radix p, dp (0, n), governs the divisibility of
n by the radix and yields the remainder of that division. In Fig. (3) dp (0, 60) (top) and dp (0, 59)
(bottom) are plotted vs. p. There are several interesting features that we notice immediately.
In the case n = 60 the function touches the abscissa at the radix values that divide 60. Such
intersections are absent in the case n = 59 (save, of course, p = 59) because 59 is prime. Of
course,
QA−1
p=2
dp (0, A) 6= 0 only if A is prime.
We also see linearly decreasing branches with different slopes after a certain threshold value of
p. This behavior is readily understood by the definition of the digit function. Note that, from
Eq. (10), when p is sufficiently large the digit function reduces to
7
dp (0, n) = n − p
= n − 2p
= n − 3p
if n/2 < p ≤ n
if n/3 < p ≤ n/2
if n/4 < p ≤ n/3
etc. The function values are all contained within a triangle formed by the lines f1 (p) = p − 1
and f2 (p) = n − p. The following property follows easily
n
Y
dp (0, p − 1) =
p=2
3
n
Y
(p − 1) = (n − 1)!
(23)
p=2
Main results
More significant digits exhibit even a more complex and non-monotonic behavior. Remarkably,
though, those significant digits can be used to split the composition of two functions over finite
sets. This is the result contained in the following theorem.
Theorem 1. (Composition-decomposition theorem.) Let g : S N → A and f : A → S
be two functions on finite sets S consisting of all integers ∈ [0, p − 1] and A consisting of all
integers ∈ [0, pN − 1] with p, N ∈ N and let k ∈ S N . We have

f (g(k)) = dp g(k),
N −1
pX

pn f (n) =
P N
P N


 p −1 n
 p −1 n


 n=0 p f (n) 
 n=0 p f (n) 

 − p

pg(k)
n=0
pg(k)+1
(24)
Proof. From Eq. (14) we have

dp g(k),
N −1
pX


pn f (n) = dp 0,
n=0
N −1
pX

pn−g(k) f (n)
(25)
n=0
This function extracts the zeroth digit of the quantity
PpN −1 n−g(k)
p
f (n),
n=0
i.e. the value of f (n)
for which the exponent of the accompanying power of p within the sum is zero. But this happens
when n = g(k) from which the result follows. 2
We have now all what we need to prove our main result.
8
Theorem 2. (Universal map for CA in closed form.) Eq. (4) is equivalent to

xjt+1 = dp 
l
X

pk+r xtj+k , R =



 P
l
p
k=−r
R
k=−r
pk+r xtj+k






 − p
R
Pl
p1+
k=−r
pk+r xtj+k




(26)
Proof. Let us take N = l + r + 1. Eq. (4) can be seen as the composition of two functions. The
first one g(k) =
Pr
k=−l
pk+r xj+k
sends the N integers xj+k
(each ∈ [0, p − 1]) to one integer
t
t
njt ∈ [0, pN − 1] ≡ [0, pl+r+1 − 1] and hence qualifies as a valid function g(k) for the compositiondecomposition theorem. The second one, f (n) = an sends the integers n ∈ [0, pN − 1] to one
integer ∈ [0, p − 1]. Thus, by the composition decomposition theorem we have, by replacing
g(k) and f (n) under this identification

xjt+1
= dp 
l
X
pk+r xj+k
,
t
pl+r+1
X

p n an 
(27)
n=0
k=−r
from which, by using Eq. (3), the result follows. 2
The above result replaces a sum over pl+r+1 − 1 terms by just only one term evaluated on
the neighborhood of the site at location j. Furthermore, we do not need to give any table of
configurations as input but just only the Wolfram code (a nonnegative integer R ∈ [0, pp
l+r+1
])
and the neighborhood parameters p, l and r directly. For example, the celebrated Wolfram’s rule
110 takes the simple form

xjt+1 = d2 
1
X

2k+r xj+k
, 110
t
(28)
k=−1
The maps for all Wolfram’s 256 CA with l = r = 1 and p = 2 are thus simply obtained as

xjt+1 = d2 
1
X

2k+r xj+k
, R
t
(29)
k=−1
by giving an input R ∈ [0, 255].
As a further illustration, the rule xjt+1 = d2
P
2
k=−2
2k+r xj+k
, 1771466136 is plotted in Fig.
t
4 starting from an arbitrary initial condition. This rule displays many coherent soliton-like
structures that are created and annihilated against a quiescent background.
With Eq. (26) alone we are able to explore the whole CA rule space within computational
9
reach and go even beyond, because the mathematical expression is valid for arbitrarily large
parameter values regardless of our computational power to carry out the simulations of a given
rule.
References
[1] S. Wolfram, A New Kind of Science (Wolfram Media Inc., Champaign, IL, 2002).
[2] A. Adamatzky, Identification of Cellular Automata (Taylor and Francis, London, 1994).
[3] A. Wuensche and M. Lesser,
The Global Dynamics of Cellular Automata (Addison-Wesley,
Reading, MA, 1992).
[4] L. O. Chua, A Nonlinear Dynamics Perspective of Wolfram’s New Kind of Science, vol. I-VI
(World Scientific, Singapore, 2013).
[5] B. Chopard and M. Droz, Cellular Automata Modeling of Physical Systems (Cambridge University
Press, Cambridge, UK, 2005).
[6] L. B. Kier, P. G. Seybold, and C.-K. Cheng, Modeling Chemical Systems using Cellular Automata
(Springer, New York, 2005).
[7] T. Toffoli, Physica D 10, 117 (1984).
[8] H. Meinhardt, The Algorithmic Beauty of Sea Shells (Springer, Heidelberg, 2003).
[9] N. Israeli and N. Goldenfeld, Phys. Rev. Lett. 92, 074105 (2004).
[10] N. Israeli and N. Goldenfeld, Phys. Rev. E 73, 026203 (2006).
[11] L. C. d. S. M. Ozelim, A. L. B. Cavalcante, and L. P. d. F. Borges, Complex Systems 21, 283
(2013).
[12] V. Garcia-Morales, Phys. Lett. A 376, 2645 (2012).
[13] V. Garcia-Morales, Phys. Lett. A 377, 276 (2013).
10
[14] V. Garcia-Morales, Phys. Rev. E 88, 042814 (2013).
[15] V. Garcia-Morales, Found. Phys. 45, 295 (2015).
11
List of Figures
The B-function for real-valued arguments (top) and for y = ± constant in the
second argument (bottom).
13
The digit function d3 (k, x) plotted for k = −2, −3, −4 (from top to bottom) in
the interval x ∈ [0, 1]
14
3
The digit function dp (0, 60) (top) and dp (0, 59) (bottom) plotted vs. p.
15
4
2
k+r j+k
xt , 1771466136
Spatiotemporal evolution of the rule xjt+1 = d2
k=−2 2
starting from an arbitrary initial condition on a ring of 400 sites and 200 time
steps. Time flows from top to bottom.
1
2
P
12
16
Fig. 1. The B-function for real-valued arguments (top) and for y = ± constant in the second argument
(bottom).
13
Fig. 2. The digit function d3 (k, x) plotted for k = −2, −3, −4 (from top to bottom) in the interval
x ∈ [0, 1]
14
Fig. 3. The digit function dp (0, 60) (top) and dp (0, 59) (bottom) plotted vs. p.
15
P
2
k+r xj+k , 1771466136 starting from
2
Fig. 4. Spatiotemporal evolution of the rule xjt+1 = d2
t
k=−2
an arbitrary initial condition on a ring of 400 sites and 200 time steps. Time flows from top to bottom.
16