An Introduction to Cellular Automata - unipi.itgroups.di.unipi.it › ... › publications ›...

65
An Introduction to Cellular Automata Daniele Sgandurra An Introduction to Cellular Automata Bio-inspired Models of Computation Seminar Daniele Sgandurra Università di Pisa 16 October 2009

Transcript of An Introduction to Cellular Automata - unipi.itgroups.di.unipi.it › ... › publications ›...

An Introduction toCellular Automata

Daniele Sgandurra

An Introduction to Cellular AutomataBio-inspired Models of Computation Seminar

Daniele Sgandurra

Università di Pisa

16 October 2009

An Introduction toCellular Automata

Daniele Sgandurra

Outline

IntroductionMotivation

Cellular AutomatonHistoryCellular SystemsCellular AutomataWolfram ClassesVariants and Extensions

Extended TopicsGarden of EdenFiring Squad Synchronization ProblemSelf-Reproducibility

Conclusion

An Introduction toCellular Automata

Daniele Sgandurra

IntroductionMotivation

Part I

Introduction

An Introduction toCellular Automata

Daniele Sgandurra

IntroductionMotivation

Motivation

Evolution has rediscovered several times multicellularity as away to build complex living systems:

I multicellular systems are composed by many copies of aunique fundamental unit, i.e. the cell;

I the local interaction between cells influences the fate andthe behavior of each cell;

I the result is a heterogeneous system composed bydifferentiated cells that act as specialized units, even ifthey all contain the same genetic material and haveessentially the same structure.

An Introduction toCellular Automata

Daniele Sgandurra

IntroductionMotivation

Fields of Application

The concept of many simple systems with geometricallystructured local interaction is relevant to:

I Artificial Life and Evolutionary Experiments, where itallows the definition of arbitrary “synthetic universes”.

I Computer Science and Technology for the implementationof parallel computing engines and the study of the rules ofemergent computation.

An Introduction toCellular Automata

Daniele Sgandurra

IntroductionMotivation

Fields of Application

I Physics, Biology, and other sciences, for the modelingand simulation of complex biological, natural, and physicalsystems and phenomena, and research on the rules ofstructure and pattern formation:

I more generally, the study of complex systems, i.e.,systems composed by many simple units thatinteract non-linearly.

I Mathematics, for the definition and exploration of complexspace-time dynamics and of the behavior of dynamicalsystems.

An Introduction toCellular Automata

Daniele Sgandurra

IntroductionMotivation

Modeling Complex PhenomenaMany complex phenomena are the result of the collectivedynamics of a very large number of parts obeying simple rules.

Unexpected global behaviors and patterns can emerge fromthe interaction of many systems that “communicate” onlylocally.

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Part II

Cellular Automaton

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Historical NotesI The best-known way in which cellular automata were

introduced (and which eventually led to their name) wasthrough work by John von Neumann in trying to developan abstract model of self-reproduction in biology.

I Around 1947 - perhaps based on chemical engineering -von Neumann began by thinking about models based on3D factories described by partial differential equations.

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Historical NotesI And following a 1951 suggestion from Stanislaw Ulam

(who may have already independently considered theproblem) he simplified his model and ended up with a 2Dcellular automaton.

I Stanislaw Ulam and others used computers at LosAlamos to produce a handful of examples of what theycalled recursively defined geometrical objects - essentiallythe results of evolving generalized 2D cellular automatafrom single black cells.

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Historical Notes

I In the 1970s a two-state, two-dimensional cellularautomaton named Game of Life became very widelyknown, particularly among the early computingcommunity.

I Invented by John Conway, and popularized by MartinGardner in a Scientific American article.

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Historical NotesI In 1983 Stephen Wolfram published the first of a series of

papers systematically investigating a very basic butessentially unknown class of cellular automata, which heterms elementary cellular automata.

I In 2002 he published his results in the 1280-page text “ANew Kind of Science”, which extensively argued that thediscoveries about cellular automata are not isolated factsbut are robust and have significance for all disciplines ofscience.

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Definitions

I Cell: a single element of a cellular space, the smallest unitof the space.

I Cellular Space: a lattice space made up of cells, each ofwhich is in one of several predefined states.

I Cellular Automaton: a structure built in a cellular space,an automaton built out of cells.

I Local Rule: the rule governing the transition betweenstates. The definition of a cell’s finite state machine. It’scalled “local”, because it only uses the Neighborhood asit’s input.

I Neighborhood: the cells surrounding a cell, that influenceit’s next state. The choice of neighborhood influences thebehaviour of the cellular space.

I Configuration: a snapshot of all cell states, representing asingle point in time. It’s usually the starting point or aresult of running a cellular space.

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Modeling Cellular Systems

We want to define the simplest nontrivial model of a cellularsystem. We base our model on the following concepts:

I Cell and cellular space;

I Neighborhood (local interaction);

I Cell state;

I Transition rule.

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Modeling Cellular Systems

We do not model all the details and characteristics of biologicalmulticellular organisms but we obtain simple models wheremany interesting phenomena can still be observed.

I There are many kinds of cellular system models based onthese concepts.

I The simplest model is called Cellular Automaton (CA).

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Cellular Space

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Neighborhood

I Informally, it is the set of cells that can influence directly agiven cell.

I In homogeneous cellular models it has the same shapefor all cells.

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Examples of Classic Neighborhood

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

State Set and Transition Rule

I The value of the state of each cell belongs to a finite set,whose elements we can assume as being numbers.

I The value of the state is often represented by cell colors.There can be a special quiescent state s0.

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

State Set and Transition RuleI The transition rule is the fundamental element of the CA.

It specifies the new state corresponding to each possibleconfiguration of states of the cells in the neighborhood.

I The transition rule can be represented as a transitiontable, although this becomes rapidly impractical.

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Boundary ConditionsI If the cellular space has a boundary, cells on the

boundary may lack the cells required to form theprescribed neighborhood.

I Boundary conditions specify how to build a “virtual”neighborhood for boundary cells.

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Initial Conditions

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Example: Modeling Traffic

I We construct an elementary model of car motion in asingle lane, based only on the local traffic conditions.

I The cars advance at discrete time steps and at discretespace intervals.

I A car can advance (and must advance) only if thedestination interval is free.

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Example: Traffic JamRunning the traffic CA with a high-density random initialdistribution of cars we observe a phenomenon of backwardpropagation of a region of extreme traffic congestion (trafficjam).

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

In Practice

To implement and run a CA experiment:

1. assign the geometry of the CA space.

2. assign the geometry of the neighborhood.

3. define the set of states of the cells.

4. assign the transition rule.

5. assign the boundary conditions.

6. assign the initial conditions of the CA.

7. repeatedly update all the cells of the CA, until somestopping condition is met:

I a pre-assigned number of steps is attained;I the CA is in a quiescent state, or cycles in a loop.

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Informal Definition of CAA Cellular Automaton is:

I a geometrically structured andI discrete collection ofI identical (simple) systems called cellsI that interact only locallyI with each cell having a local state (memory) that can take

a finite number of valuesI and a (simple) rule used to update the state of all cellsI at discrete time stepsI and synchronously for all the cells of the automaton

(global “signal”)

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Formal Definition of CAA Cellular Automaton is:

I an n-dimensional lattice ofI identical and synchronous finite state machinesI whose state s is updated (synchronously) following a

transition function (or transition rule) φI that takes into account the state of the machines

belonging to a neighborhood N of the machine, andwhose geometry is the same for all machines

si(t + 1) = φ(sj(t)), sj ∈ Ni

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Special RulesI The transition table of a generic CA can have an

enormous number of entries. Special rules can have morecompact definitions.

I A rule is totalistic if the new value of the state dependsonly on the sum of the values of the states of the cells inthe neighborhood:

si(t + 1) = φ

∑j

sj(t)

, sj ∈ Ni

I A rule is outer totalistic if the new value of the statedepends on the value of the state of the updated cell andon the sum of the values of the states of the other cells inthe neighborhood

si(t + 1) = φ

si(t),∑

j

sj(t)

, sj ∈ Ni , j 6= i

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Rules for 1D CA

I k states, range (or radius) r ;

I kk2r+1possible rules; e.g., k = 2, r = 1→ 256;

I k (2r+1)(k−1)+1 totalistic rules: e.g., k = 2, r = 1→ 16.

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Wolfram Classes

Wolfram defined four classes into which cellular automata canbe divided depending on their behavior. In order of complexitythe classes are:

1 Nearly all initial patterns evolve quickly into a stable,homogeneous state.

I Any randomness in the initial pattern disappears.

2 Nearly all initial patterns evolve quickly into stable oroscillating structures.

I Some of the randomness in the initial pattern mayfiltered out, but some remains. Local changes to theinitial pattern tend to remain local.

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Wolfram Classes

3 Nearly all initial patterns evolve in a pseudo-random orchaotic manner.

I Any stable structures that appear are quicklydestroyed by the surrounding noise. Local changesto the initial pattern tend to spread indefinitely.

4 Nearly all initial patterns evolve into structures thatinteract in complex and interesting ways.

I Class 2 type stable or oscillating structures may bethe eventual outcome, but the number of stepsrequired to reach this state may be very large, evenwhen the initial pattern is relatively simple. Localchanges to the initial pattern may spread indefinitely.

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Rule Code for Elementary CA

I Elementary CA: 256 1D binary CA (k = 2) with minimalrange (r=1).

I Wolfram’s Rule Code (here blue=0, yellow=1)

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Examples of Elementary CA

As said before, there are four qualitative behavioral classes:

1. uniform final state;

2. simple stable or periodic final state;

3. chaotic, random, non-periodic patterns;

4. complex, localized, propagating structures.

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Examples of Application: RNGRule 30 is used by Mathematica as its Random NumberGenerator (RNG are ubiquitous in bio-inspired experiments).

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Variants and Extensions

The basic CA is:

I discrete in space, time and state;

I updates all its cells synchronously;

I uses the same neighborhood geometry and transition rulefor all cells.

We can relinquish some of these prescriptions and obtain:

I Asynchronous CA (for example, mobile automata, whereonly one cell is active at each time step, and the transitionrule specifies the fate of the activation);

I one problem for hardware implementation of cellularspaces is the synchronous operation that can limitthe size of spaces that can be simulated.

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Variants and Extensions

I Continuous-state CA (Coupled Map Lattices);

I replacing the discrete states with a continuousrepresentation, we get a very interesting constructionthat can simulate processes in gases and fluids.

I Non-homogeneous (or non-uniform) CA;

I different rules for every cell;I different rules for different regions (e.g., boundary

cells);I the rules could be determined according to some

data external to the cellular space.

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Probabilistic CA

So far we have considered only deterministic CA. To modelmany phenomena it is useful to transition rules that dependingon some externally assigned probability. Example: The forestfire model:

I Each cell contains a tree (green), a burning tree (yellow),or is empty (black).

I A burning tree becomes an empty cell.

I A green tree with at least a burning neighbor becomes aburning tree.

I A green tree without burning neighbors becomes aburning tree with probability f (probability of lightning).

I An empty cell grows a green tree with probability g(probability of growth).

The parameters can be varied in a continuous range andintroduce some “continuity” in the discrete world of CA models.

An Introduction toCellular Automata

Daniele Sgandurra

Cellular AutomatonHistory

Cellular Systems

Cellular Automata

Wolfram Classes

Variants and Extensions

Probabilistic CA

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

Part III

Extended Topics

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

Garden of Eden

I A Garden of Eden configuration is a configuration whichcannot appear on the lattice after one time step, no matterwhat the initial configuration.

I Each Garden of Eden configuration contains at least onefinite pattern with no predecessor:

I such a pattern is called an orphan.

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

Garden of Eden

I By definition, a cellular automaton is surjective (i.e., itsglobal mapping is onto), if and only if it has no Garden ofEden configuration.

I The Garden of Eden theorem, due to Edward F. Mooreand John Myhill, states that the class of surjective cellularautomata and those which are injective over finiteconfigurations coincide.

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

Garden of Eden

I A cellular automaton has a Garden of Eden, if and only ifit has two different finite configurations that evolve into thesame configuration in one step.

I As a corollary, every injective cellular automaton (i.e., onewith one-to-one global mapping) is surjective, hence alsobijective. However, note that surjective cellular automatado not need to be injective.

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

Garden of Eden

G|F denotes the functions restricted to finite configurations,G|P those restricted to the periodic ones and GoE the Gardenof Eden configurations.

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

Garden of Eden

I If there are two configurations which cannot bedistinguished, there are Garden of Eden configurations.

I For the converse proposition, suppose if possible thatevery pair of configurations cannot be distinguished, andthat there exists a square Garden of Eden configuration Gof side n.

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

Garden of Eden

If A is the number of states, ν the number of non GoE configuration:

A(kn−2)2≤ ν ≤ (An2

− 1)k2

which, for large k , contradicts Moore’s inequality:

(An2− 1)k2

< A(kn−2)2

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

Firing Squad ProblemProposed by John Myhill in 1957 and published (with asolution) in 1962 by Edward Moore:

I Consider a finite but arbitrary number of identical finitestate machines (soldiers) arranged in a line;

I At time t = 0, each soldier is initialized to the quiescent(idle) state, except for the soldier on the far left (thegeneral).

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

Firing Squad Problem

I The state of each soldier at each discrete time-step t > 0is dependent on its state and the state of its two neighborsat time t − 1 (except for the two soldiers at either end,each of whose state depends only on itself and its soleneighbor).

I In addition, if a soldier and its neighbors are in thequiescent state, then the soldier will remain quiescent atthe next time-step.

I The problem is to define a finite set of states and statetransition rules for the soldiers such that all soldiers entera distinguished state (fire) at the same time and for thevery first time.

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

Solution

I A solution using a minimal number of states wasintroduced by Jacques Mazoyer in 1988, whose solutionuses only six states.

I Robert Balzer had earlier proven that no four-statesolution exists.

I Umeo, Yun‘es, and Kamikawa found 4-state FSSPsolutions based on Wolfram’s algebraic rule 60 and150, respectively. The solutions can synchronize aninfinite set of arrays, but not all.

I A solution using a minimal amount of time was later foundby Professor E. Goto at MIT, whose solution usesthousands of states and requires exactly 2n − 2 units oftime for n soldiers.

I It is proven that a solution using a smaller amount of timecannot exist.

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

General Solution

I A general solution to the FSSP involves propagating twowaves down the line of soldiers: a fast wave and a slowwave moving three times as slow.

I The fast wave bounces of the other end of the line andmeets the slow wave in the center.

I The two waves then split into four waves, a fast and slowwave moving in either direction from the cent-re,effectively splitting the line into two equal parts.

I This process continues, subdividing the line until eachdivision is of length 1. At this moment, every soldier fires.

I This solution requires 3n units of time for n soldiers.

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

General Solution

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

A Time-Optimal Solution

I The general sends to the right signals S1,S2,S3, . . . ,Si atspeeds 1, 1

3 ,17 , . . . ,

1(2i−1−1)

.

I The signal S1 reflects at the right end of the line (like thefast wave in the preceding section), and meets signal Si(i > 2) at cell n

2i−1 .

I When S1 reflects, it also creates a new general at the rightend.

I Signals Si are constructed using auxiliary signals, whichpropagate to the left. Every second time a signal moves(to the right), it sends an auxiliary signal to the left.

I S1 moves on its own at speed 1 while each of the slowersignals moves only when it gets an auxiliary signal.

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

General Solution

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

General Solution

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

Comparison of FSS Algorithms

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

The Growth of Complexity

I Usually a machine produces machines less complex thanitself: can we prove formally that there exist machineswhich can produce more complex machines?

I von Neumann’s approach:

I a machine capable of self-reproduction wouldproduce machines of equal complexity;

I if the self-reproduction process could tolerate some“error” (robust self-reproduction) then some of theresulting machines might have greater complexitythan the original one.

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

Self-Replicating MachineI A self-replicating machine is an artificial construct that is

theoretically capable of autonomously manufacturing acopy of itself using raw materials taken from itsenvironment

I A detailed conceptual proposal for a physicalnon-biological self-replicating system was first put forwardby John von Neumann in lectures delivered in 1948 and1949, when he proposed a kinematic self-reproducingautomaton model.

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

Self-Reproducing Automata

I von Neumann defined an automaton composed by auniversal constructor UC and a description D(M) of themachine to be generated.

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

Self-Reproducing Automata

I von Neumann automata is quite complex (29 states percell, and about 200.000 active cells).

I states constituting means of signal carriage andlogical operation, and acting upon signalsrepresented as bit streams.

I A “tape” of cells encodes the sequence of actions to beperformed by the machine.

I Using a writing head (termed a construction arm) themachine can print out (construct) a new pattern ofcells, allowing it to make a complete copy of itself,and the tape.

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

von Neumann’s Automaton

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

Quine

I A quine is a computer program which produces a copy ofits own source code as its only output.

I A quine is a fixed point of an execution environment, whenthe execution environment is viewed as a function.

I Quines are possible in any programming language thathas the ability to output any computable string, as a directconsequence of Kleene’s recursion theorem.

I A quine takes no input:allowing input would permit the source code to be fedto the program via the keyboard, opening the sourcefile of the program, and similar mechanisms.

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

Quine

I We want the quine to be correct C code, so it has to beginsomething like this:

#include <stdio.h>

intmain (void){

I The first thing we want to do is print all what precedes.We could write:

printf("#include <stdio.h>\n\nint\nmain (void)\n{\n");

I Then we need to print this line itself:

printf("printf(\"#include <stdio.h>\\n\\nint\\nmain (void)\\n{\\n\");\n");

I And so on. It should be obvious that this is not going towork.

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

Quine

I The problem is that we need to print something, so we usea character string (s) to print it, and then we need to prints itself, so we use another character string, and so on...

I If we intend to print s, we don’t need another string: wecan use s itself. So let’s give it another try:

char *s="#include <stdio.h>\n\nint\nmain (void)\n{\n";printf(s); printf("char *s=\"%s\";\n",s);

I Central idea: it is possible to reuse the data used torepresent the code to print the data themselves.

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

Quine

I Now we’re using s “as it stands”, but that won’t workbecause it contains some backslashes.

I Since we are writing in C, we can exploit some propertiesof the printf function:

char *s1="#include <stdio.h>%c%cint%cmain (void)%c{%c";char *s2=" char *s1=%c%s%c;%c char *s2=%c%s%c;%c";char n=’\n’, q=’"’;printf(s1,n,n,n,n,n);printf(s2,q,s1,q,n,q,s2,q,n)

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

QuineA complete example:#include <stdio.h>

intmain (void){

char *s1="#include <stdio.h>%c%cint%cmain (void)%c{%c";char *s2=" char *s%c=%c%s%c;%c char *s%c=%c%s%c;%c";char *s3=" char n=’%cn’, q=’%c’, b=’%c%c’;%c";char *sp=" printf(";char *s4="%ss1,n,n,n,n,n);%c";char *s5="%ss2,’1’,q,s1,q,n,’2’,q,s2,q,n);%ss2,’3’,q,s3,q,n,’p’,q,sp,q,n);%c";char *s6="%ss2,’4’,q,s4,q,n,’5’,q,s5,q,n);%ss2,’6’,q,s6,q,n,’7’,q,s7,q,n);%c";char *s7="%ss2,’8’,q,s8,q,n,’9’,q,s9,q,n);%ss2,’0’,q,s0,q,n,’x’,q,sx,q,n);%c";char *s8="%ss3,b,q,b,b,n);%ss4,sp,n);%ss5,sp,sp,n);%c";char *s9="%ss6,sp,sp,n);%ss7,sp,sp,n);%ss8,sp,sp,sp,n);%c";char *s0="%ss9,sp,sp,sp,n);%ss0,sp,sp,n,n,n);%c return 0;%c}%c";char *sx="--- This is an intron. ---";char n=’\n’, q=’"’, b=’\\’;printf(s1,n,n,n,n,n);printf(s2,’1’,q,s1,q,n,’2’,q,s2,q,n); printf(s2,’3’,q,s3,q,n,’p’,q,sp,q,n);printf(s2,’4’,q,s4,q,n,’5’,q,s5,q,n); printf(s2,’6’,q,s6,q,n,’7’,q,s7,q,n);printf(s2,’8’,q,s8,q,n,’9’,q,s9,q,n); printf(s2,’0’,q,s0,q,n,’x’,q,sx,q,n);printf(s3,b,q,b,b,n); printf(s4,sp,n); printf(s5,sp,sp,n);printf(s6,sp,sp,n); printf(s7,sp,sp,n); printf(s8,sp,sp,sp,n);printf(s9,sp,sp,sp,n); printf(s0,sp,sp,n,n,n);return 0;

}

> gcc quine.c -o quine> ./quine > quine2.c> diff quine.c quine2.c>

An Introduction toCellular Automata

Daniele Sgandurra

Extended TopicsGarden of Eden

Firing SquadSynchronization Problem

Self-Reproducibility

Conclusion

References

[1] Harald NiescheIntroduction to Cellular Automata

[2] Marianne DelormeAn Introduction to Cellular AutomataCellular Automta: a parallel device, Mathematics and Its Application, Kluwer: 5-49, 1998.

[3] Palash SarkarA Brief History of Cellular AutomataACM Computing Surveys (CSUR), Volume 32, Issue 1 (March 2000), pp. 80 - 107

[4] Stephen WolframUniversality and complexity in cellular automataPhysica D: Nonlinear Phenomena, Vol. 10, No. 1-2. (January 1984), pp. 1-35.

[5] Kojiro Kobayashi and Darin GoldsteiOn Formulations of Firing Squad Synchronization ProblemsLCNS 3699, pp. 157-168

[6] Umeo, Hiroshi and Yanagihara, TakashiA Small Five-State Non-Optimum-Time Solution to the Firing Squad Synchronization Problem: AGeometrical ApproachFundamenta Informaticae, Volume 91 , Issue 1 (January 2009)

[7] Myhill, J.The converse of Moore’s Garden-of-Eden theoremProceedings of the American Mathematical Society 14: 685-686.