Justine Seastres Saint Mary’s College of California Department of Mathematics May 16, 2016

Cellular Automata and the Game of Life

Supervisors: Professor Porter Professor Sauerberg 2 Contents

1 Introduction 1

2 A Closer Look at Cellular Automata 3 2.1 Key Characteristics ...... 3 2.2 State ...... 3 2.3 Dimension ...... 3 2.4 Neighborhoods ...... 3 2.5 Local Update Function ...... 3 2.6 Conclusion ...... 4

3 One-Dimensional Cellular Automata 5 3.1 Definition ...... 5 3.2 Local Transition Function ...... 5

4 Two Dimensional Cellular Automata 6

5 Example: Conway’s Game of Life 7 5.1 History ...... 7 5.2 Description ...... 7 5.3 Rules ...... 7 5.4 Mathematics of the Game of Life ...... 9 5.5 Drawing out a Life Board ...... 10 5.6 Pattern Emergence ...... 11 5.6.1 Still Life ...... 11 5.6.2 Oscillators/Life Forms ...... 11 5.6.3 Spaceship ...... 12 5.7 Garden of Eden ...... 12 5.7.1 Definitions ...... 13 5.7.2 Moore-Myhill Theorem ...... 13 5.8 Applications in the Real World ...... 15 5.8.1 Physical Reality of the Universe ...... 15 5.8.2 Biology ...... 15 5.8.3 Computers and Cryptography ...... 16 5.9 Bibliography ...... 18

1 Introduction

“Cellular automata may be viewed as computers, in which data represented by initial configura- tions is processed by time evolution”

-Stephen Wolfram

Cellular Automata is an idea formulated in the 1940s by John von Neumann, a Hungarian- American mathematician. He had previously attended the University of Budapest to study chemical engineering, later earning his doctorate in mathematics. Through his interest in both fields of study, Von Neumann began to develop this idea of self-reproduction. He first explored this topic using three dimensional models. His first failed attempt at this concept involved imple- menting replication through robotics. Afterward, studying liquid motion allowed him to further

1 observe how different patterns could emerge over certain amounts of time, which influenced Von Neumann even more when studying discrete models. Later on, he was especially interested in biological phenomenon, and how they could be manipulated and demonstrated through a ma- chine. Over the course of 30 years, he and his partner Stanislaw Ulam researched and developed this discrete model and new dynamical system. Their research was primarily focused on the basic ideas of self-reproduction and adaptation, with his work being analogous to the idea of DNA being the instructions for copying preced- ing cells. A main component of Von Neumann’s study was the adaptation of self-reproducing machines, which have the ability to replicate themselves. When applied to these machines, this action can lead to solving self-generated complex and abstract problems. In particular, there are certain machines which function under conditions set by its neigh- boring environment. We can think of this machine in graphical terms, by considering a model consisting of an infinite array of cells in a Euclidean plane, similar to the layout of a checker- board. Each square, or cell, is surrounded by other cells and each has its own previously defined active or inactive “state”. After some time, this lattice of cells reproduces itself through each time step, with the cells either evolving into a new state or maintaining their active status, based on its surrounding cells. Based off of the size and capability of this computing machine, these changes could lead to evolution or self-reproduction. We note that specific is obtained from a cellular space by admitting only a finite, connected set of cells on the checker- board. Therefore, the discrete time steps and evolution of this distinct portion of the grid as a whole is considered local to only those specific cells. More information on the general rules and properties of neighboring cells will appear later on in this paper.

Therefore, with this knowledge, we can now define a cellular automaton as the collection of “colored” cells on a grid that evolves through a number of discrete time steps according to a set of rules based on the state of neighboring cells. In other words, it is the coupling of cells based on a particular rule set. We refer to the plural of this as cellular automata. With John von Neumann’s revolutionary work towards the automata theory, we are able to gain insight into various fields of study, from computational universality, computer processing, cryptography, and even other sciences related to biology! Von Neumann even created the first virus using cellular automata, and is now known as the “Father of Computer Virology.” But for now, we will focus on the logistics of cellular automata, and its importance and adaptation towards creating the idea of the Game of Life.

2 2 A Closer Look at Cellular Automata 2.1 Key Characteristics When studying these dynamical systems, we must observe that cellular automata are defined by uniformity, sychronity, and locality.

Definition 2.4.1. For a group of cells to be defined under uniformity, all of the states of the cells are updated by the same rules. Definition 2.4.2. The synchronity of a cellular automaton is defined as the state of all cells being updated at the same time. Definition 2.4.3. The locality refers to the set of rules being applied to the specified cells in the specific, or ”local”, finite lattice of cells. We can now study the specific properties of cellular automata.

2.2 State We write S for the finite set of states.A state, denoted as s, where s ∈ S is one of the the one or more finite numbers that determines the cell’s condition. It was mentioned earlier that a cellular automaton is a collection of colored cells, which can indicate the state of the cell. The simplest, most common case is when there are two different states. There are various ways to define these states: active/quiescent, alive/dead, on/off, 0/1, black/white.

2.3 Dimension

We can denote a d−dimensional cellular space as Zd, where the cells it consists of are the elements of this space. We observe a d-dimensional figure; we restrict our observation regarding this area of study to d ≥ 2 dimensions. A one-dimensional figure is presented as a row, whereas a two-dimensional figure gives us a wider range of rows resulting in various shapes, the most common of which is a square.

2.4 Neighborhoods

A neighborhood consists of all the cells surrounding the observed, central cell in Zd. The neighborhood vector with size k is

N = (n1, n2, ..., nk)

d for all nk ∈ Z . In other words, each element nk identifies the relative locations of the d neighboring cells, where n ∈ Z has k neighbors n + np for p = 1, 2, ...k.

2.5 Local Update Function The state of a cell is affected at some discrete time step, t. A cellular automaton evolves through this transition function. This local update function governs how each cell changes its state from the present state to the next. It can be denoted as

f : Sm → S

3 The change of each cell’s state is based on a set of rules that utilizes the present state of the cell and its neighbors. At the end of each time step, we see a resulting pattern arise, known as the configuration, c. These instantaneous patterns are functions written out as

d c : Z → S

Thus, the state of each cell n ∈ Zd is c(n).

2.6 Conclusion In the end, to be able to fully define a cellular automaton, one must be able to identify these properties:

1. Dimension of d ∈ Z+ 2. Finite state set S

3. Neighborhood vector N = (n1, n2, ..., nm)

4. Local Update Function c : Zd → S Under these properties are we able to contain and observe the behavior of these self-replicating machines.

4 3 One-Dimensional Cellular Automata 3.1 Definition A one-dimensional cellular automaton refers to a configuration having d = 1 dimension.[5] Therefore, the cells are displayed side-by-side in a row, with two neighboring cells, and are indexed by Z.

ci−2 ci−1 ci ci+1 ci+2

3.2 Local Transition Function We now consider a neighborhood surrounding the cell c with a range r that represents the cells to the left and right of c. Thus, the cell has a neighborhood with 2r + 1 cells.

Let the ith cell’s state at time t be ci(t), so the subsequent time step is denoted as ci(t + 1). Then, we can define ρ, the local transition function, as a function where the next state depends on the current state and the state of the two neighbors. It can be denoted as

ρ[ci−1(t), ci(t), ci+1(t)] ≡ ci(t + 1) mod 2

In other words, we see the mathematical representation of the cells’ state at each time step. It is in mod 2 since there are two different states.

Example 3.1. Let us consider the set of rules in which ci(t + 1) = ci−1(t) + ci(t) + ci+1(t). Thus, by modular arithmetic, we are given

as the states of each cell at each time step, using the local transition function.

5 4 Two Dimensional Cellular Automata

Two-dimensional cellular automata have most of the same properties as the one-dimensional cellular automata. However, instead of being displayed in a row of cells, the cells forming this cellular automata are indexed by Z2. This is presented to be a larger shape consisting of multiple rows of cells. Many are displayed, however not limited, in a square formation.

There are two types of neighborhoods that are considered with two-dimensional cellular au- tomata. consists of all eight cells that surround the central cell.Von Neumann neighborhoods are composed of the four cells which are directly adjacent to the cen- tral cell’s edges. A Moore neighborhood consists of all eight cells that surround the central cell. [5]

Figure 1: Figure 2: Moore Neighborhood(left), von Neumann neighborhood(right)

We can then denote the central cell as (i, j) as a way to identify the location of the the cells relative to it.

Figure 2: The coordinates of each cell displayed

6 5 Example: Conway’s Game of Life 5.1 History “The game made Conway instantly famous, but it also opened up a whole new field of mathe- matical research, the field of cellular automata ... Because of Life’s analogies with the rise, fall and alterations of a society of living organisms, it belongs to a growing class of what are called “simulation games” (games that resemble real life processes)” -Martin Gardner John Conway, an English mathematician, was a prominent figure in studying number theory, coding theory, knot theory, and finite groups. He is most widely known for his work on computer simulations that run by a set of simple rules to exemplify simple cellular life. In the 1970s, Con- way invented this idea of the Game of Life, utilizing Von Neumann’s idea of cellular automata. He wanted to create a method in which one can convert biological reproductions into a game-like simulation. Through this, he closely studied realistic patterns of life, and intertwined it with the ideas of the self-replicating machines. In turn, he produced a system which closely imitated real-life processes to simulate the rise and fall of a society’s population.

5.2 Description This game requires no players, implementing the predetermined rules based on its neighbor- ing cells as a means of “advancing” through each time step. The dimensions and states are determined using the ideas and structure of the Moore neighborhood, with states of all the sur- rounding eight cells being of interest. We consider this chessboard-like set up of a 3x3 square of cells, each occupying a state of “alive” or “dead”. These states can be denoted mathematically as “1” or “0”, or geometrically on the board as “black” or “white.” We now consider the rules which determine the subsequent state of each cell. [1]

5.3 Rules Conway realized that the process of maintaining or transforming the numbers in a population is governed by various key elements: Deaths, Survivals, and Births. These elements are imple- mented into the rules below. • Survivals: A cell alive at a certain time t will remain alive at the next time step, t + 1, if and only if it is surrounded by 2 or 3 living cells. Each of these cells are surrounded by 3 cells, and therefore all will remain in their current states.

t=0 t=1

Figure 3: Survival

7 • Deaths: Overcrowding occurs when a living cell at time t is surrounded by 4 or more living cells at time t + 1.

t = 0 t = 1 t = 2

Figure 4: Death by overcrowding

We see in the Figure r that there are some cells which do not die according to the idea of underpopulation. Instead, there is another phenomena which is occurring called under- population. This occurs when a living cell at time t is surrounded by less than 2 living cells at time t + 1. As we iterate through each time step, cells continually die until we are left with no more at t =3.

t=0 t=1 t=2

Figure 5: Death by overpopulation

• Births: A dead cell at time t can be “revived” if surrounded by exactly 3 living cells.

t=0 t=1

Figure 6: An example of birth, or ’revival’

These rules resemble real-life patterns. Each time there is a state of overpopulation or under- population, then the center cell will “die” or switch to a state of 0. If the center cell is surrounded by 2 or 3 cells, it is in survival mode and stays in a state of “alive”. A “dead” cell can be revived to an “alive” state when it is surrounded by exactly 3 “alive” cells.

8 5.4 Mathematics of the Game of Life We want to observe the mathematics behind Game of Life. First we must revisit the mathematics of a general Cellular Automatan[8]. The configuration is denoted as

d c : Z → S The Game of Life deals with a two-dimensional cellular automata. We can then similarly define a life board set as the set G of all life board functions, g, where g ∈ G such that

G = {g | g : Z × Z → {1, 0}} However, to observe the set of functions within a given area, we must look at a finite life board set, FXY ⊆ G. The finite life board set is denoted as

FXY = {g | g : Z × Z → {1, 0}} where

g(x, y) = 0 if (x, y) 6∈ [i, j] × [k, l] for some closed, bounded integral intervals [i, j][k, l] particular to g, where X = j−i and Y = l−k

Now, we can define the game of life function as the function φ : G → G0, ( 1 ( if z = 2, 3) OR if (g(i, j) = 0 and z = 3) φ(g(i, j)) = 0 otherwise where for each g(i, j)

 i+1 j+1  X X z =  g(a, b) − g(i, j) a=i−1 b=j−1

9 5.5 Drawing out a Life Board We can draw out a our Game of Life configurations by graphing the coordinates of each state onto the life board. Let’s generate our own life board g under the these local rules: ( 1 (i = −2, −1, or 0) and (j = 1) φ(g(i, j)) = 0 otherwise

Figure 7: Coordinates Graphed

The states of these cells would be graphed as

Figure 8: Representing the State of Each Cell through Binary States

We can then incorporate this into colored cells on a grid:

Figure 9: Representing the State of Each Cell through Color

10 5.6 Pattern Emergence We can now observe the idea of patterns. But first we must define two key elements in observing pattern emergence. Note that we are still using Von Neumann Neighborhoods.

Definition. A pattern represents the different formations or configurations. Definition. The period represents the number of repeating formations triggered from the pat- tern through each time step.

Knowing these two terms allows us to observe the discrete nature of these patterns, and how they evolve at each time step. We can now observe the three most common categories of Game of Life patterns. Note that we are not limited to these three, however they are the ones which come up the most often when visually representing these configurations.

5.6.1 Still Life • Definition. A still life is a stable, finite, and nonempty pattern. It has a period of 1, since it does not oscillate past one pattern.

• Example: Block Through each time step, the configuration stays the same.

t = 0, 1, 2...∞

5.6.2 Oscillators/Life Forms • Definition. An oscillator is a pattern which oscillate periodically. It has a period of at least two, to oscillate between a set of variations of patterns.

• Example: Oscillator

t = 0 t = 1 t = 2 t = 3

11 5.6.3 Spaceship • Definition. A spaceship is a pattern that moves across the game board. It can have an infinite period, which can end or be terminated according to the finite life board that it is displayed on.

• Example: An example of this is the pattern. This specific pattern is one which consists of 5-cells that repeats itself every four generations. It appears to move across a grid at a right, diagonal, and downward motion, as shown below.

t = 0 t = 1 t = 2 t = 3 t = 4

One of the most common spaceships is called the gosper glider . Through each iteration, we see two guns shooting at each other to produce a glider, which moves in a diagonal, downward motion. It is of the form below

The discovery of this pattern led to more findings in the relationship between cellular au- tomata and the Turing machine, and how both can be applied to the idea of universal computa- tion.[2]

5.7 Garden of Eden When observing patterns, it is easier to discover patterns which do no have a predecessor, or the configuration at the immediate, previous time step. Observe both patterns below at time step t = 0 and t = 1

12 t = 0 t = 1

t = 0 t = 1

We see two patterns (out of other various patterns) which are predecessors of the block con- figuration on the left hand side. Though most patterns commonly have various predecessors, it is interesting to closely study the idea of configurations which do not have any.

John W. Tukey came up with a cellular automaton configuration that can have no prior configuration generating it and have no inverse function.[5] In other words, at one time, there are patterns of cell states that cannot arise in a given cellular space except at time zero. Another name for this configuration is called an orphan. By connecting the ideas of injectivity and sur- jectivity for the global function of cellular automata in the Euclidean plane, it has been proven that this configuration exists. There is no past, but only a present and future. Essentially, these configurations can only arise as the initial state, since they have no ancestors.

How did this idea come about? If we consider a finite n number of cells, it is evident that there are at most 2n possible outcomes from the transition function. We also note that, from our observation above, that having two different configurations with the same predecessor leaves us with 2n − 1 configurations, where one configuration does not have a predecessor. Both Edward Moore and John Myhill further studied this phenonemon, but in terms of an infinite number of cells.

5.7.1 Definitions Definition 5.7.1. Finite configurations G are ones such that all but a finite number of cells in the lattice are in quiescent state.

Definition 5.7.2. A distinct f is injective, or one-to-one, if x 6= y, implies f(x) 6= f(y). In other words, all points x and y must have distinct images f(x) and f(y). Definition 5.7.3. For a F : G → G, Surjectivity (onto) means that for every g ∈ G, there exists g0 ∈ G such that f(g) = g0.

5.7.2 Moore-Myhill Theorem Moore-Myhill Theorem. If C is the collection of all finite configurations and F : C → C is the global transition function, then F is not injective if and only if it is not surjective.[5]

13 Theorem Explained: If F is not injective (with more than one predecessor), then conversely F is not surjective (no predecessor). Therefore, F relates to how a cellular automaton is reversible (or invertible). Being reversible, we are able to go back to a specific predecessor at each time step.

We also note that the Garden of Eden has no pre-images, which means that the set G−1 is empty. To reiterate, if the cellular automata is not surjective, then there are Garden of Eden configurations.

This illustration shows the display of one Garden of Eden configuration, discovered by Roger Banks. This configuration is one of a few that have been found to exist. This cannot be derived from another configuration, therefore it is in its initial state.

14 5.8 Applications in the Real World We now come to see the specfic applications of Game of Life and Cellular Automata.

5.8.1 Physical Reality of the Universe An interesting study is one that refers to the idea of Cellular Automata, particularly the Game of Life, being a physical representation of the universe. Andrew Ilachinski studies this idea more in depth in his book Cellular Automata: A Discrete Universe [6]. He states that “if without in any way disturbing a system, we can know with certainty the value of a physical quantity of that system, then there exists an element of physical reality corresponding to that physical quantity” (56). With that, the patterns of automata can mimic the behavior of the universe. We can also view the observations that Stephen Wolfram has made in his book A New Kind of Science. There, he connects cellular automata with other fields of sciences, and names them all “rules”. He links mathematics, empirical studies, and engineering together to emphasize the idea of computing. With this computing, he is able to prove in Rule 110 that the idea of Turing Complete, another dynamical system, is the basis for universal cellular automata. Both are then proven to create this system can compute any mathematical computation. With this idea of computational universality, we can relate this idea to being able to represent the universe. Albert Eisntein once asked “why is it possible that mathematics, a product of human thought that is independent of experience, fits so excellently the objects of physical reality?” Though no theory has been proven in this area, it is interesting to note the conjectures that many scientists and mathematicians have made in speculating this seemingly outlandish, yet somewhat tangible idea.

5.8.2 Biology The behavior of life or cells can be simulated through cellular automata. These biological models can display bacterial growth, seashell patterns, and predator-prey behavior. But one of the most intriguing displays of cellular automata in biology are the genetic algorithms. We can display the patterns of natural selection in this way. When observing each chromosome, we want to apply a fitness test in order to assess their capabilities. Applying these rules, which are similar to those of the Game of Life, will result in a representation of the evolution. This is a perfect example of emergent computation, or incorporating natural selection and analyzing pattern structures. Below is an image showing this evolution at various, increasing time steps.

We can also utilize this method to observe water and fish/shark populations.

15 And even further, we can also display the time evolution of a single avalanche.

This method of incorporating cellular automata is extremely useful for biologists, and any other scientists, wanting to visually observe patterns in nature and in life.[5]

5.8.3 Computers and Cryptography • Computer Viruses John von Neumann is known as the “Father of Computer Virology” because of his inno- vations with cellular automata 1949. He created a computer program which implemented the idea of cellular automata, incorporating patterns which were untraceable. Thus, the idea of a virus was created. [4]

• Cryptography Stephen Wolfram also studied the idea of cellular automata being able to calculate random- ness in physical systems.[7] With this, it is a method which can be utilized in cryptography. Utilizing stream ciphers, it is easy to apply the local time function (as introduced in Section 3) in order to represent a random sequence. Reiterating

ρ[ci−1(t), ci(t), ci+1(t)] = ci(t + 1) mod 2

16 This represents all iterations of the function. As stated earlier, the behavior of cellular automata makes it is easier to acquire future iterations as opposed to past iterations, since it is possible to have numerous predecessors for each configuration. Because of its nature, this idea has also been a concept in public key cryptography.

17 5.9 Bibliography 1. Berlekamp, Elwyn R., John H. Conway, and Richard K. Guy. Winning Ways for Your Mathematical Plays. Wellesley, MA: A.K. Peters, 2004. Print. 2. ”Cellular Automaton.” from Wolfram MathWorld. N.p., n.d. Web. 15 Apr. 2016.

3. Codd, E. F. Cellular Automata. New York: Academic, 1968. Print. 4. Kari, Jarkko. ”Properties of Limit Sets of Cellular Automata.” Cellular Automata and Cooperative Systems (1993): 311-21. 5. Schiff, Joel L. Cellular Automata: A Discrete View of the World. Hoboken, NJ: Wiley- Interscience, 2008. 6. Ilachinski, Andrew. Cellular Automata: A Discrete Universe. Singapore: World Scientific, 2001. Print. 7. Wolfram, Stephen. ”Cryptography with Cellular Automata.” Lecture Notes in Computer Science Advances in Cryptology — CRYPTO ’85 Proceedings (n.d.): 429-32. Web. 8. J.J.Behrens, The Game of Life, Senior Mathematics Major Essay, St. Mary’s College of CA, 1999.

18