CDM
Cellular Automata
Klaus Sutner Fall 2013
Outline
21 Elementary Cellular Automata
2 Analysis of Cellular Automata
Recall: Feedback Shift-Registers
3r3 r2 r1 r0
⊕
c1 c2 c3 c4
A few bit-registers and a simple feedback function.
Iteration produces complicated and useful behavior: selecting the taps in a judicious manner, we can obtain bit-sequences with very long periods (near-Hamiltonian sequences).
Generalizations?
4So simple Boolean functions can create rather complicated and useful behavior when iterated. Can One Exploit This Phenomenon?
Are there are other interesting systems of similar type? Can one develop a good theory of the systems?
Can they be used to solve computational tasks? Efficiently?
We will consider one fairly straightforward generalization: linear cellular automata.
Configurations
5We start with a linear sequence of 1-bit registers, calledcellsin this context. Each cell communicates with its 2 immediate neighbors:
r0 r1 r2 r3 r4 r5 r6 r7
Aconfigurationof this system is an assignment of Boolean values to all the cellsC, a map
X:C→2
Localize
6To update a configurationX in positioniwe can only use the current values of the immediate neighbors of celli:
Xi−1, Xi, Xi+1 Xi′
Clearly we can describe this update operation by a ternary Boolean function
ρ:2×2×2→2
The idea is to apply this map at all cells to update a given configuration. First, a closer look at the cell layout.
A Taxonomy
7In the picture we can think ofC={0,1, . . . , n−1}. So, configurations are just finite bit sequences (or words if you like).
But it also makes sense to considerC=N. In this case a configuration is an ω-sequence, a one-way infinite sequence.
Lastly, we could haveC=Z. In this case a configuration is a bi-infinite
sequence, sometimes called aζ-sequence.
Two-Way Infinite is Easier
8We have alocal mapρ:23→2 that we need to extend to aglobal map Gρ:C −→ C
This is straightforward in the bi-infinite case:
Gρ(X)(i) =ρ(X(i−1), X(i), X(i+ 1))
In other words, apply the local map simultaneously (there is a global clock) and in parallel at all cells to get the next configuration.
Elementary Cellular automata
9So as a data structure, aone-dimensional, bi-infinite, elementary cellular automaton (ECA)is simply a ternary Boolean function.
“One-dimensional” is clear: we are not dealing with higher dimensional grids. “Bi-infinite”: well . . .
The “elementary” comes from the fact that we only consider Boolean values and immediate neighbors. Obviously one could use larger alphabets and/or larger neighborhoods.
Pleasant Surprise: ECA already display many of the interesting features of these more complicated systems.
Information Flow
10Note that there is a “speed of light” in this system: information cannot propagate from instantaneously from a cell to a far-away cell: every cell has its own light cone.
Einstein
11Cellular automata are often referred to asphysics-likemodels of computation. By homogeneity, the “laws of physics” in a CA are the same everywhere. By locality, there is no spooky action at a distance.
Since the local rule is deterministic, so is the whole system. Einstein might have liked cellular automata.
Of course, to get something vaguely resembling some aspect of physics one needs to deal with 2-dim or 3-dim cellular automata. For example, there are interesting ways to simulate fluid-dynamics.
Boundary Conditions
12Note that our definition of the global map does not directly apply to (one-way) infinite and finite grids of cells: the border cells don’t have enough neighbors. There are two standard solutions (and variations thereof):
Fixed boundary conditions: assume there is another cell in state 0. This works for infinite and finite grids.
Cyclic boundary conditions: assume the grid wraps around (circle of cells). This only works for finite grids.
Cellular Automata
13So, in order to specify a general (one-dimensional, elementary) cellular automaton we need the following information:
the local mapρ, a ternary Boolean function a description of the grid topology
for the infinite/finite case a specification of boundary conditions. It is not too surprising that the critical part is the Boolean function, the topology does not matter that much (for some definition of “much”). So we are dealing with 256 basic ECA, plus variants.
Ranking ECA
14Since every ternary Boolean function is given by its list of values, eight bits
a0, a1, . . . , a7 we can think of these bits as a number written in reverse binary. For example, ECA number 160 corresponds to(0,0,0,0,0,1,0,1).
Less cryptically, the local map is
ρ(x, y, z) =x∧z
Go to WolframAlpha to see the Boolean functions corresponding to the 256 ECA.
Additive ECA
15Recall that we started with feedback shift registers which are based on exclusive or. One might wonder what happens when the local map of a ECA is based on xor.
There are two interesting cases: rule 90 and 150
ρ90(x, y, z) =x⊕z ρ150(x, y, z) =x⊕y⊕z
It is easy to see that in this case the global map is also linear with respect toF2: Gρ(X+Y) =Gρ(X) +Gρ(Y).
So it suffices in a sense to understand their behavior on one-point configurations (corresponding to unit vectors).
Alas, “linear” in connection with CA means one-dimensional. So, these rules are calledadditive.
Exercise
18Exercise
Compute the fractal dimension of the pattern generated by ECA 90.
Exercise
Give a real proof that your computation is correct.
Exercise
Compute the fractal dimension of the pattern generated by ECA 150.
Exercise
Elementary Cellular Automata
2 Analysis of Cellular Automata
Wolfram’s Classes
21A characterization based on heuristics (aka looking at pictures).
W1: Evolution leads to homogeneous fixed points.
W2: Evolution leads to periodic configurations.
W3: Evolution leads to chaotic, aperiodic patterns.
W4: Evolution produces persistent, complex patterns of localized structures.
Automatic Classification
22Since there are lots of CA (if we drop the constraint of being elementary) it would be very nice to have automatic tools to check their properties.
Amoroso and Patt 1972: decidability of reversibility and surjectivity. KS 1991: efficient quadratic time algorithm, automata theory. J. Kari 1990: undecidable in dimensions 2 and higher.
Bad News
23Stronger classifications along the lines of Wolfram’s Classes are quite hopeless.
Theorem
It isΠ2-complete to test if all orbits end in fixed points.
Theorem
It isΣ3-complete to test if all orbits are decidable.
Theorem
Local Theory
24If orbits are too complicated, maybe one can still handle weaker properties, just like injectivity and surjectivity.
Think of a cellular automaton as a first-order structure:
Aρ=hC,i
where the configurationsC are words (finite, infinite, bi-infinite) andX Y
Keeping Things Simple
25FOL can only handle boundedly many applications of the global map, so in a sense we are looking at local properties ofA.
Some Formulae
26∀x∃y(yx)
∀x, y, z(xz∧yz⇒x=y)
∀x∃y, z(yx∧zx∧ ∀u(ux⇒u=y∨u=z))
But these require stronger logic (MSO,TrCL, . . . ):
∀x(x∗ 0)
∀x∃z(x ∗
Decidability
27Theorem
The first-order theory of one-dimensional cellular automata is decidable.
Unfortunately, the complexity is not elementary: nested complementation wreaks havoc on efficiency.
There are tricks that can help, bug the sad truth is that only a tiny fragment of first-order logic is decidable in the real world.
The Spectrum
28For finite CA one needs to be a bit careful, we have to deal with additional parametern.
Ideally, given any sentenceϕ, we would like to understand its spectrum:
spec(ϕ) ={n∈N|Anρ|=ϕ}
Regular Spectra
29ECA 90: spec(injective) =∅. ECA 154: spec(injective) =odd. ECA 150: spec(injective) =N−3N.
Theorem
Spectra are regular: the language{0n|n∈spec(ϕ)}is regular. Moreover, a
Graphical Computing
30So how does one analyze ECAs?
One important method is simulation: compute the orbit of some/all configurations on finite grids of different sizes.
Plot a 2-dimensional picture of these orbits and hope to find some patterns by visual inspection.
We can also look at phasespace, the directed graph obtained from the global map applied to all configurations of some rather limited size. For larger configurations we can only sample.
Of course, in the end pictures mean little: one has to be able to turn the pictures into theorems. Alas, it can be a long, long way from pretty pictures to a theorem.
Transients
33A table of all transient/period pairs, and the number of configurations that attain them. t p count t p count 1 1 21 5 1 80 1 2 160 5 2 40 2 1 40 6 1 10 2 2 115 7 1 30 3 1 150 8 1 10 3 2 235 9 1 10 4 1 40 4 2 20
Probably not a good idea to try to find a closed form for the actual counts, but the length of the transients should be OK. Also note that long transients seem to lead to fixed points.
Line of Attack
34Every configuration inCn other than0can be written in the form
X = 10n110n2
. . .10nk−110nk
wheren=Pk
i=1(ni+ 1)and1≤k.
Then the transient is essentiallymaxniand the period is 1 or 2 essentially
depending on the parity of theni.
Note the qualifier “essentially”, things are bit more complicated than that (one has to deal with special cases for small values ofni).
Exercise
Carry out the details of this argument. Make sure to verify your results experimentally.
ECA 54
35Multiple Seeds
36Apparently not bad. More complicated seeds don’t seem to cause too much trouble, either.
Disaster
37n= 23,t= 24,p= 690
ECA 73
38ECA 45
39Pseudo-Random Bits
40Feedback-shift registers can be used to produce cheap pseudo-random bits. Is there an ECA that could produce reasonable pseudo-random bits? One might suspect that binary nearest neighbor CA are too restricted to produce anything useful.
But actually there is a candidate: ECA number 30.
This CA was used in the Connection Machine as a PRN generator and is still used in Mathematica.
Elementary Cellular Automata
Analysis of Cellular Automata
Computation and CA
44In the glory days when people were building actual CA hardware one could use these CA-machines to do simulations in physics. Of course, without massively parallel hardware CA are not a particularly useful model.
But how about other computations?
Is there anything one can do nicely on a CA, not necessarily an elementary one?
For example, how about the most basic non-regular language, the Dyck language of balanced parentheses?
Computing By Pictures
45For convenience, use a three-symbol alphabetΣ ={L, R, b}wherebstands for blank,Lfor “(” andR for “)”. The basic idea is very simple:
LRturns intobb: matching parens disappear.
bRturns intoRb: a right paren moves left in free space. Everything else does not change.
The Local Map
46Here is the local replacement rule (where−means any symbol).
(−, L, R) → b
(L, R,−) → b
(−, b, R) → R
(b, R,−) → b
(−, x,−) → x
An Accepting Computation
47Correctness proof by picture.
Two Non-Accepting Computations
48Both computations below fail, but for different reasons.
Majority
49Here is another simple task: build a CA that determines Majority. In other words, the CA should be able to detect whether a given binary input
configuration has more 0’s or more 1’s (lets assume we are working on a grid of odd length).
As usual, it is not clear how the CA should signal it’s output, so let’s agree to the following.
If the input configuration has more 1’s than 0’s, evolve to all 1’s. Otherwise evolve to all 0’s.
Here is the catch: the CA itself should also be binary. Clearly, width 3 won’t go very far here, so one typically uses a neighborhood of size 7: there are2128
such CAs, perhaps one of them will work. Standard application ofgenetic programming.
Firing Squad Problems
51Here is a type of computation more closely linked to multiple-processor devices: what is the best way to synchronize all the processors in a one-dimensional grid when communication is strictly local?
In the classical form of the FSP we havensoldiers lined up, but the numbern
is unknown to them.
At time0soldier number 1 (the general) is in a special state, all others are quiescent.
At timetall soldiers are in a special “firing” state, and no one has been in the firing state at any time prior tot.
It is not hard to come up with solutions if each soldier is allowed to have many internal states – the hard part is to have few states and keeptsmall.
Moews
52A width 3 CA with 13 states.
Waksman
53Mazoyer
54Universal Computation
55So we can build certain cellular automata for special purpose computations, but how about a universal computer?
A cellular automaton that can simulate any Turing machine?
Actually, slightly more ambitious: a cellular automaton that can simulate any other CA? These are calledintrinsically universal cellular automata.
This may sound hard, but it’s actually not that bad: it is trivial to simulate a Turing machine by a one-dimensional CA.
And with more sweat, we can simulate arbitrary CAs on an appropriately constructed one.
Intrinsically Universal CA
56An example of an intrinsically universal CA, simulating ECA 90. It usesk= 19
The Real Question
61More interesting is this question: how small can the neighborhood and alphabet be to get universality?
The intrinsically universal one was constructed, every part of the local rule is carefully planned.
Langton’s machine was discovered in the sense that he searched through lots of machines on 8 states and width 5. It looks universal, but no one has a proof.
Wild Idea: Could there possibly be an elementary cellular automaton that is universal?
A Huge Surprise
64Theorem (Cook)
Elementary cellular automaton number 110 is universal.
Of course, the computation is very slow, and the initial configuration horribly complicated.
This is the first example of a small universal machine that wasdiscovered, not
constructed.
One technical complication: this only works for configurations of the form
ω
u w vω
The details are quite messy, see Cook’s paper inComplex Systems. By now the proof has undergone enough scrutiny to be generally accepted as correct. It cannot be verified by a proof checker at this point, though.