Cellular Automata: Jarkko Kari
Cellular Automata: Jarkko Kari
Jarkko Kari
Spring 2013
University of Turku
Preliminaries
1.1
Introduction
We start the notes with basic definitions and several examples of interesting cellular automata. We then continue with classical results related to injectivity and surjectivity. Chapters that follow (not necessarily in this order) discuss linear (additive) cellular automata,
reversibility, limit sets, classifications of cellular automata, universality, conservation laws in
cellular automata, topological dynamics of cellular automata, algorithmic questions, etc.
1.2
that takes as input a finite pattern and always correctly determines if the input pattern
eventually dies out.
Over the years Game-of-life enthusiasts have compiled a vast library of patterns with
various behaviors. The following terminology is used for various categories of objects:
still life: a fixed point pattern. The update rule keeps each cell unchanged. The
simplest non-empty still life is the block, a two-by-two block of living cells. Another
still life is shown in Figure 2(a).
oscillator : temporally periodic pattern. The update rule may change the pattern but
after some number of steps the original pattern reappears in the same location and
orientation. Still life is a special type of oscillator. The smallest oscillator is the blinker
consisting of three living cells in a line. Another oscillator with period two is shown in
Figure 2(b).
spaceship: a pattern that after some number of steps reappears, possibly in a different
location of the grid. A particular spaceship called glider is shown in Figure 2(c). An
oscillator is a stationary spaceship that does not move.
gun: a finite pattern that like an oscillator periodically returns back to the
initial state, but in addition, emits spaceships. A glider gun emitting gliders is shown
in Figure 2(d).
Objects from different categories emerge when Game-of-life is started in a random initial
configuration. During the evolution the objects interact with each other through collisions
with gliders and other moving structures. Collisions create new objects which in turn participate in interactions, leading to extraordinary complexity.
1.3
Basic Definitions
This chapter introduces the most basic definitions and notations. Throughout these notes,
abbreviation CA refers to cellular automata (plural) or cellular automaton (singular).
Let d be a positive integer. A d-dimensional cellular space is Zd . Elements of Zd are
called cells. Let S be a finite state set. Elements of S are called states. A configuration of a
d-dimensional CA with state set S is a function
c : Zd S
that assigns a state to each cell. The state of cell ~n Zd is c(~n). A configuration should be
understood as an instantaneous description, or a snapshot, of all the states in the system of
cells at some moment of time. Most frequently we consider one- and two-dimensional spaces,
in which cases the cells form a line indexed by Z or an infinite checker board indexed by Z2 ,
respectively.
(a)
(b)
(c)
(d)
Figure 2: Sample Game of Life objects: (a) still life, (b) oscillator, (c) glider, (d) glider gun.
We adapt the common mathematical notation that the set of functions from set A into
d
set B is denoted by B A . So the set of all configurations is S Z . In the one-dimensional case
d = 1 the set of configurations is S Z , the set of functions Z S.
A d-dimensional neighborhood vector (of size m) is a tuple
N = (~n1 , ~n2 , . . . , ~nm )
(1)
where each ~ni Zd and ~ni 6= ~nj for all i 6= j. The elements ~ni specify the relative locations
of the neighbors of each cell: Cell ~n Zd has m neighbors ~n + ~ni for i = 1, 2, . . . , m.
The local update rule (or the local rule, the update rule, or simply the rule) of a CA with
state set S and size m neighborhood is a function
f : S m S
that specifies the new state of each cell based on the old states of its neighbors. If the
neighbors of a cell have states s1 , s2 , . . . , sm then the new state of the cell is f (s1 , s2 , . . . , sm ).
4
In cellular automata all cells use the same rule, and the rule is applied at all cells simultaneously. This causes a global change in the configuration: Configuration c is changed into
configuration c0 where for all ~n Zd
c0 (~n) = f [c(~n + ~n1 ), c(~n + ~n2 ), . . . , c(~n + ~nm )].
(2)
G : S Z S Z .
Function G is our main object of study. Typically, function G is iterated, i.e. applied
repeatedly, which produces a time evolution
c 7 G(c) 7 G2 (c) 7 G3 (c) 7 . . .
of the system. Here c is the initial configuration of the evolution, and the sequence
orb(c) = c, G(c), G2 (c), G3 (c), . . .
is the orbit of c. Time refers to the number of applications of G performed: Each application
of G takes one time step, so Gt (c) is the configuration at time t, for all t = 0, 1, 2, . . ..
Sometimes we also consider two-way infinite orbits, i.e. sequences
. . . , c2 , c1 , c0 , c1 , c2 , . . .
of configurations where G(ci ) = ci+1 for all i Z. Here time t flows through all integers and
there is no initial configuration.
In summary: To specify a CA one needs to specify the following items (some of which may
be clear from the context):
the dimension d Z+ ,
the finite state set S,
the neighborhood vector N = (~n1 , ~n2 , . . . , ~nm ), and
the local update rule f : S m S.
We therefore formally define the corresponding CA to be the 4-tuple A = (d, S, N, f ). The
global transition function determined by these items according to (2) will be denoted by
G[A], or simply by G when the CA A is clear from the context. Any function G that is the
transition function of some CA is called a CA function.
We usually identify a CA function G with the CA that determines it in the sense that
we talk about cellular automaton G. Strictly speaking, however, the same function G is
determined by different cellular automata (4-tuples). We say that two CA A and B are
equivalent if G[A] = G[B]. Clearly equivalent CA have the same dimension d and state
5
set S but they may differ in their neighborhood vectors. However, we see in the following
section that there is a unique equivalent CA whose neighborhood vector is minimal in the
sense that it is included in the neighborhoods of all equivalent CA. Other equivalent CA can
only have additional dummy neighbors that have no influence on the next state.
Example 1. (xor ) Let d = 1, S = {0, 1}, N = (0, 1) and f : {0, 1}2 {0, 1} be
f (a, b) = a + b
(mod 2).
The cells form a line, indexed by Z. Each cell changes its state by adding the state of its
right neighbor to its own old state modulo 2. This is known as the exclusive or (xor) logic
operation.
Consider, for example, the initial configuration c0 where c0 (0) = 1 and c0 (i) = 0 for
all i 6= 0, i.e. a single cell is in state 1. Then c1 = G(c0 ) has c1 (0) = c1 (1) = 1 and
c2 (i) = 0 for all i 6= 1, 0. Continuing likewise, we get the time evolution c2 = G(c1 ),
c3 = G(c2 ) etc. Figure 3 shows a diagram where we have drawn configurations as horizontal
rows of states and depicted values 0 and 1 by white and black squares as well typically do
in our examples. The topmost row shows the initial configuration c0 , and the following rows
represent consecutive elements of the orbit orb(c0 ). Time increases downwards.
Time
Figure 3: The space-time diagram of the xor CA of Example 1 starting from an initial
configuration with a single cell in state 1.
(a)
(b)
(c)
(d)
Figure 4: (a) a fixed point, (b) a periodic orbit, (c) an eventually fixed orbit and (d) an
eventually periodic orbit.
As a final observation of this section we state the following simple fact:
Proposition 1 If G and H are CA functions, so is their composition G H.
7
1.4
Neighborhoods
Let N = (~n1 , ~n2 , . . . , ~nm ) be a d-dimensional neighborhood vector. For any ~n Zd we denote
N (~n) = (~n + ~n1 , ~n + ~n2 , . . . , ~n + ~nm ),
and for any K Zd we denote
N (K) = {~n + ~ni | ~n K and i = 1, 2, . . . , m }.
In other words, N (~n) is the ordered sequence of the neighbors of cell ~n, while N (K) is
the unordered set of neighbors of cells in K. In particular, N ({~n}) is the unordered set
of neighbors of cell ~n. Clearly N = N (~0), and N ({~0}) is the unordered set that contains
the elements of the neighborhood vector N . The order of the elements in N is essentially
irrelevant: it only matters as the order in which the m input values are given in the local
rule f : S m S. So when specifying a CA it is enough to give the unordered version
N ({~0}) of N , as long as we make the role of different neighbors clear in the description of
the local rule.
In two-dimensional spaces the von Neumann- and the Moore- neighborhoods shown in
Figure 5 are often used. Game-of-life has the Moore-neighborhood. We generalize the
Moore-neighborhood and call the d-dimensional neighborhood Mrd consisting of all
(k1 , k2 , . . . , kd ) Zd where |ki | r for all i = 1, 2, . . . , d
the radius-r neighborhood. It contains (2r + 1)d elements. We also generalize the von
Neumann -neighborhood and call the d-dimensional neighborhood Vrd consisting of
d
(k1 , k2 , . . . , kd ) Z where
d
X
|ki | r
i=1
the radius-r von Neumann -neighborhood. The classical von Neumann and Moore neighborhoods of Figure 5 are then V12 and M12 . Note that in the one-dimensional case Vr1 = Mr1 .
(a)
(b)
Figure 5: The (a) von Neumann and (b) Moore neighbors of cell c.
8
The following, small neighborhoods will be sometimes used: The radius- 12 neighborhood
consists of all (k1 , k2 , . . . , kd ) Zd where each ki {0, 1}, and the radius- 21 von Neumann
-neighborhood consists of all (k1 , k2 , . . . , kd ) Zd where at most one ki is 1 and all others
are 0. In the one-dimensional case these both consist of the cell and its immediate right
neighbor. The xor CA of Example 1 has the radius- 12 neighborhood.
Consider a CA with neighborhood vector N = (~n1 , ~n2 , . . . , ~nm ) and local rule f : S m
S. We call ~nj a dummy neighbor if f (s1 , . . . , sm ) = f (t1 , . . . , tm ) whenever si = ti for all
i 6= j. This means that the the jth neighbor of a cell has no effect on the next state of that
cell, and hence ~nj can be removed from the neighborhood vector. We obtain an equivalent
CA with m 1 neighbors. Let us say a CA has minimal neighborhood if it has no dummy
neighbors. By removing all dummy neighbors from any CA we obtain an equivalent CA that
has minimal neighborhood. This minimal neighborhood CA is unique:
Proposition 2 If A and B are equivalent CA and have minimal neighborhoods then A = B
(up to reordering the neighbors in the neighborhood vector).
Proof. It is enough to show that the neighborhood vectors of A and B contain the same
elements. Let ~n be an arbitrary element of the neighborhood vector of A, that is, cell ~n is a
neighbor of cell ~0 in A. Because A has no dummy neighbors there exist two configurations
c and e such that c(~n) 6= e(~n), c(~k) = e(~k) for all ~k 6= ~n and c0 (~0) 6= e0 (~0) where we have
denoted c0 = G(c) and e0 = G(e) and G is the global transition function of A. Since A and
B are equivalent, G is also the transition function of B. This means that ~n has to be a
neighbor of ~0 also in B, as otherwise we would have c0 (~0) = e0 (~0).
In the same way, every neighbor in B is also a neighbor in A.
1.5
Elementary CA
Elementary CA are one-dimensional cellular automata with two states and radius-1 neighborhood: d = 1, S = {0, 1}, N = (1, 0, 1) and f : S 3 S. They differ from each other
only in the choice of the local rule f . There are 256 elementary CA because the number of
different local rules S 3 S is 28 = 256. Note, however, that some of the 256 elementary
rules are identical up to renaming the states or reversing right and left, so the number of
essentially different elementary rules is smaller, only 88.
Elementary rules were extensively studied and empirically classified by S.Wolfram in the
1980s. He introduced a naming scheme that has since become standard: Each elementary
rule is specified by an eight bit sequence
f (111) f (110) f (101) f (100) f (011) f (010) f (001) f (000)
where f is the local update rule of the CA. The bit sequence is the binary expansion of an
integer in the interval 0 . . . 255, called the Wolfram number of the CA.
Example 2. The 8 bit binary expansion of the decimal number 102 is 01100110 so the
elementary CA with Wolfram number 102 has the local update rule
f (111) = 0,
f (011) = 0,
f (110) = 1,
f (010) = 1,
f (101) = 1,
f (001) = 1,
f (100) = 0,
f (000) = 0,
Example 3.(rule 110 ) The 8 bit binary expansion of the decimal number 110 is 01101110
so the elementary CA with Wolfram number 110 has the local update rule
f (111) = 0,
f (011) = 1,
f (110) = 1,
f (010) = 1,
f (101) = 1,
f (001) = 1,
f (100) = 0,
f (000) = 0,
This CA has become known since it was recently proved to be computationally universal.
The cover page of these notes contains a snapshot of the space-time diagram of rule 110
started from a random initial configuration.
Wolframs numbering scheme is easily generalized to larger neighborhoods and state sets.
One-dimensional, radius-r CA with k states is identified by a number that contains k 2r+1
base-k digits.
S.Wolfram experimented in the 80s with elementary CA, and based on empirical observations of their behavior on random initial configurations he classified them into four classes.
These are known as Wolfram classes of CA. The definitions are not mathematically rigorous, and more precise classifications (which well discuss later) have since been proposed.
Wolfram defined the classes as follows:
(W1) Almost all initial configurations lead to the same uniform fixed point configuration,
(W2) Almost all initial configurations lead to a periodically repeating configuration,
(W3) Almost all initial configurations lead to essentially random looking behavior,
(W4) Localized structures with complex interactions emerge.
Figure 6 shows examples of typical space-time diagrams in each class. Wolfram conjectured
that class (W4) cellular automata are computationally universal. In addition to rule 110
also elementary CA 54 is in class (W4).
1.6
Finite configurations
d
10
Figure 6: Space-time diagrams of sample cellular automata from each of the four Wolfram
classes.
of cells not in state s. Configuration c is called s-finite if supp s (c) is a finite set, that is, all
but a finite number of cells are in state s. Let us denote
d
Fs (d, S) = {c S Z | c is s-finite }.
d
Clearly, if c is s-finite then G(c) is t-finite where t = f (s, s . . . , s). In particular, in the
presence of quiescent state q, finite configurations are mapped into finite configurations. In
this case we denote by
GF : F F
the restriction of G on finite configurations.
In Example 1 (xor CA), we can name state 0 quiescent, in which case the space-time
diagram in Figure 3 depicts a time-evolution according to GF . In Game-of-life (Section 1.2)
the white square (no life) is taken as the quiescent state.
1.7
Periodic configurations
Let ~r Zd . Assuming a fixed and known state set S, the translation ~r determined by ~r
is the global transition function of the CA whose neighborhood contains only ~r and whose
local rule is the identity function. In other words,
d
~r : S Z S Z
d
maps c 7 c0 where c0 (~n) = c(~n + ~r) for all ~n S Z . It is obvious that for all ~r, ~s Zd and
k Z we have
~r ~s = ~r+~s , and
(3)
~rk = k~r .
For each dimension i = 1, 2, . . . , d we call the translation by one cell down in dimension
i a shift and denote it by i . More precisely, if we denote the ith coordinate unit vector
~ei = (0, . . . , 0, 1, 0, . . . 0),
then i = ~ei . It follows from (3) that every translation is a composition of shifts. In the
one-dimensional case the only shift 1 is called the left shift and we denote it simply by .
The following proposition states an elementary but important property of cellular automata, based on the fact that all cells use the same local update rule:
Proposition 3 Let G be an arbitrary CA function and a translation. Functions G and
commute, i.e., G = G:
d
G - Zd
S
SZ
Zd
G - Zd
S
12
Proof. Let be the translation determined by ~r Zd , and let G be the transition function
d
of CA A = (d, S, N, f ) where N is as in (1). For arbitrary c S Z and ~n Zd we have
(G(c))(~n) = G(c)(~n + ~r)
= f [c(~n + ~r + ~n1 ), c(~n + ~r + ~n2 ), . . . , c(~n + ~r + ~nm )]
= f [ (c)(~n + ~n1 ), (c)(~n + ~n2 ), . . . , (c)(~n + ~nm )]
= G( (c))(~n),
so (G(c)) = G( (c)) and, furthermore, G = G.
(a)
(b)
Figure 7: (a) A spatially periodic configuration that is not totally periodic, and (b) a totally
periodic configuration.
Let G be a CA function and suppose configuration c is ~r-periodic. According to Proposition 3
~r (G(c)) = G(~r (c)) = G(c)
13
so also G(c) is ~r-periodic. In particular, if c is totally periodic then also G(c) is totally
periodic. We denote by
GP : P P
the restriction of G on totally periodic configurations.
Finite configurations and periodic configurations are used in effective simulations of cellular automata on computers. Periodic configurations are often referred to as the periodic
boundary conditions on a finite cellular array. For example, in the case d = 2 this is equivalent to running the CA on a torus that is obtained by gluing together the opposite sides
of a rectangle. One should, however, keep in mind that the behavior of a CA can be quite
different on finite, periodic and general configurations, so experiments done with periodic
boundary conditions may sometimes be misleading.
One final remark: Periodicity of a configuration defined in this section refers to spatial
periodicity. This should not be confused with temporal periodicity of a configuration defined
at the end of Section 1.3, that is, the property that the configuration repeats itself under
the CA evolution.
1.8
Compactness principle
Topology plays an important role in the theory of cellular automata. The configuration space
d
S Z can be given a compact topology under which all CA functions G are continuous. We
delay the detailed discussion of this. Instead we prove two statements that capture essential
features of the topological approach.
d
Consider an infinite sequence c1 , c2 , . . . of configurations, each ci S Z . We say that the
d
sequence converges and c S Z is its limit if for every ~n Zd there exists some k Z+ such
that ci (~n) = c(~n) for all i k. In other words: if we look at an arbitrary cell and browse
through a converging sequence c1 , c2 , . . . then from some moment on we always see the same
state. It is obvious that if a limit exists it is unique, and we denote this limit by
lim ci .
A subsequence of c1 , c2 , . . . is another sequence ci1 , ci2 , . . . where i1 < i2 < . . .. A subsequence is hence obtained by picking infinitely many elements of the sequence, preserving
their relative order. Obviously every subsequence of a converging sequence also converges
and has the same limit.
The first proposition states the compactness of the configuration space:
Proposition 4 Every sequence of configurations has a converging subsequence.
d
Note: The proof is essentially the same as the proof of weak Konigs lemma which states
that an infinite binary tree contains an infinite path. The proof did not require the axiom
of choice. (The same result could also be briefly proved using Tychonoffs theorem, but that
is equivalent to the axiom of choice.)
Our next proposition states a continuity property of CA functions:
Proposition 5 Let G be a CA function and c1 , c2 , . . . a converging sequence of configurations. Then also the sequence G(c1 ), G(c2 ), . . . converges and
lim G(ci ) = G(c)
where
c = lim ci .
i
15