Analyzing Cellular Automata Klaus Sutner Carnegie Mellon University Pittsburgh, PA 15213 sutnerqcs.cmu.edu, http://www.cs.cmu.edu/~sutner Abstract We demonstrate automata, a Mathematica/C+i- hybrid system, that facilitates computation with finite state machines. In particular, we describe two applications of the system to the analysis of cellular automata. 1 The Applications We willfirstbriefly describe two applications of our package to the study of cellular automata, more detailed accounts can be found in the references. In both cases, extensive computational experiments were required to formulate appropriate conjectures. Mathematica is used as a general compute engine and also as a repository for data, text, and graphics. The external part of the package is specialized to perform computations on largefinitestate machines quickly. The combination of both components makes it easy to handle large scale computations in a clear and easily reproducible fashion. The ability to quickly generate and modify samples on demand also turned out to be very helpful in the construction of the actual proofs.
444 Innovation In Mathematics 1.1 Exponential Blow-Up The first application concerns the connection between linear cellular automata, or LCAs for short, and classical automata theory, in particular the theory of regular languages. More that a decade ago, S. Wolfram conducted exhaustive computational studies on LCAs. Part of the effort undertaken by Wolfram and his coworkers was an analysis of the minimal finite state machines associated with LCAs, see [12]. For the sake of this exposition, we can consider an LCA to be a continuous, shift-invariant map p : E» E on the space of all biinfinite words over some alphabet E. The map is represented by afinitedata structure of the form p : E» E. The finite subwords of all infinite words p(x) that occur after one time step form a regular language (p), and can therefore be described in terms of afinitestate machine. Typical examples of such languages are finite complement languages. Likewise, the subwords occurring after t steps in the evolution of a configuration can be recognized by a suitable finite state machine. A detailed table of the sizes of these machines can be found in the reference. Exploiting particular properties of these languages, one can show that they are accepted by a machine whose transition diagram is strongly connected, and whose states have distinct behavior. This machine is unique up to isomorphism and is referred to as the minimal Fischer automaton of the LCA. As it turns out, the minimal Fischer automaton is a subautomaton of the ordinary minimal automaton for (/?), and therefore the size of the former is bounded by the size of the latter. For the sake of simplicity we will confine ourselves to binary LCAs, i.e., automata with only two states 0 and 1. In this case, it is easy to see that the minimal automaton associated to an LCA p of width w has size at most 2^. Moreover, there are some examples of LCAs of width 3, 4 and 5 that actually reach this bound. As a matter of fact, the corresponding minimal Fischer automata have size 2^ 1, and differ from the minimal automata only in the absence of a sink state. On the other hand, if one iterates a LCA p of a given width u>, obtaining LCAs p* of width w(t) = t(w -1)4-1, it appears that the size of the minimal automata is significantly lower than the theoretical upper bound 2^. The question arises whether the complexity of the languages associated with the iterates p* of an LCA p can reach the upper bound for all or at least several values of, see also Problem 12 in [11]. We answer this question in the negative. In fact, we have the following theorem.
Innovation In Mathematics 445 Theorem 1.1 For every width w > 1 there is a binary LCA p of width w whose associated minimal finite state machine has size 2^. Deleting the sink from this automaton produces the minimal Fischer automaton. On the other hand, iterates p* cannot produce machines of this size. Lemma 1.1 Let p be a binary LCA. Then none of the iterates p*, t > 2, exhibits full exponential blow-up. Detailed proofs can be found in the forthcoming [5]. Is is conjectured there that the number of binary LCAs of width w that exhibit full exponential blow-up is actually 2 ~*2^~^, though we are currently able to account only for a few of these machines. 1.2 Binary Chebyshev Polynomials and a- Automata The LCAs that producefinitestate machines of maximal size from the last section are complicated in the sense that the patterns produced during the evolution of configurations are hard to describe in terms of classical finite state machines. At the other end of the spectrum lie additive cellular automata, such as the wellknown elementary CAs with rule numbers 90 and 150. Since the global maps are surjective (and even open) in this case, the corresponding minimal automaton has simply one state. However, the situation becomes more complicated when we try to understand the behavior of these automata on finite grids. Here we consider the generalization of rule 90 to be a binary 2-dimensional cellular automaton that determines the next state of a cell by adding the states of all four neighbors modulo 2. Likewise, rule 150 would generalize to an automaton where the summation includes the center cell. We refer to these automata as a and a+ automata, respectively. A good amount of information on these automata can be found in [1, 3, 7,, 2J. For example, the a-automaton on an n x m grid is reversible iff n + 1 and?7i -f 1 are coprime. Surprisingly, there are no comparable simple results for o~~^automata. As a matter of fact, the only characterization available at this point is the following. Consider a sequence of polynomials over the 2-element field F? defined by TTQ = 0 and where Un denotes the n-th Chebyshev polynomial of the second kind. A more helpful representation of the TT-polynomials is in terms of a second order homo-
446 Innovation In Mathematics geneous recurrence over ^[xj: = 1, For any polynomial p(x) in F^[x\ let p+(x) be the image of p under the involution x i > x + 1. Then we have Theorem 1.2 7%e cr+ -automaton over the n x m grid is reversible iff the polynomials 7ivJ+i(x) and7r,n+i(x) are coprime. It turns out that every irreducible polynomial over ^[x] occurs as a factor of some 7T</. Call the minimal such d the depth of the corresponding irreducible polynomial. The problems of determining the reversibility of the cr+ -automaton on an n x m grid are caused by the fact that the involution x» > x -f 1 changes the depth of an irreducible polynomial in an apparently very complicated fashion. 2 The automata System The results just mentioned deal with rather different aspects of cellular automata, and involve drastically different proof techniques-automata theory in the first case, and field theory in the second. They do share one important feature, though: both theorems would be difficult to conjecture, much less to prove, without a good amount of experimental computation. In the proper computational environment combination of experimental computation and abstract reasoning traces a path that leads to the theorems and their proofs. As a starting point to the theorem about Fischer automata, consider the sizes of the minimal automata associated with all 256 elementary CAs (binary linear CAs of width 3). The theoretical upper bound for the number of states is 16, and the lower bound is 1. size freq. 1 30 2 2 3 16 4 56 5 32 6 7 2 10 24 11 20 12 14 15 16 16 The interesting part here are the 16 machines of maximal complexity 2\ Using some general theory about machines recognizing so-called transitive factorial regular languages one is lead to study Fischer automata rather than the whole
Innovation In Mathematics 447 minimal automaton. In the case of the 16 machines from the picture, deleting the sink from the minimal machines produces the Fischer automaton. A more earful study of these Fischer automata shows that they are almost permutation automata: their transition relation very nearly induces a permutation of the state set for each input symbol. It is then natural to study almost-permutation automata for CAs of larger width. As it turns out, many of these automata exhibit drastic exponential blow-up during deterministic simulation. Here is an example. The following table shows the gaps A between the theoretical maximum complexity 2^ and the actual size of the power automaton associated with 192 automata that arise from binary LCAs of width 5. As one can see, half of the automata have maximum complexity, and most of the differences are powers of 2 and are due to certain forbidden subsets of the form QQ U pow(qi) in the power automaton. A freq. A freq. 0 4096 124 1 512 12 296 2 96 170 4 40 256 224 240 512 160 16 20 1024 120 32 32 1052 64 352 204 256 Unfortunately, it appears to be difficult to account for all the machines with maximal size. For some of them, however, one can demonstrate that the blow-up does in fact occur, and that the resulting power automata are already reduced, i.e., isomophic to the minimial automaton. The Fischer automata consist of one giant strongly connected component that differs from the whole rutomaton only in that it does not contain the sink. The proof that blow-up occurs is a somewhat tedious argument using monoids of operations on the power set of the nondeterministic automaton that are induced by input sequences. In automata, it is not hard to construct these monoids and see how they act on the state set, and these computational experiments were very helpful in organizing the proof. For the second problem dealing with binary Chebyshev polynomials the ability to calculate conveniently with polynomials over F^ is exceedingly helpful. In particular the factorization algorithm was heavily used. Apart from dealing with the polynomials directly, it is also necessary to study the maps they induce on the pattern spaces associated with the additive CAs under consideration when various linear operators are substituted. Both domains can be handled with reasonable ease in Mathematica, Moreover, producing graphical images of the
44 Innovation In Mathematics patterns can be helpful to discover algebraic properties. The symmetry of certain patterns, for example, was crucial in finding a proof for certain periodicity properties of the binar Chebyshev polynomials. Once the analysis is under way, it is very helpful to be able to determine the depth of an irreducible polynomial r quickly, where by depth we mean the minimal n such that r divides TT^ (of course, an existence argument is required). The following table shows the position of some of the 30 irreducible polynomials r of degree as well as their images r+ relative to the TT-hierarchy. Needless to say, in hindsight it is not too hard to present computation-free proofs, arguments that hide the actual process of discovery and present purely abstract arguments. One might argue that at least for educational purposed the full, unexpurgated version is of greater value. Also, in the absence of computational support, the proofs could not be found without much greater effort on the side of the investigator. Modern media such as Mathematica notebooks that combine textual and graphical descriptions with executable code are ideally suited for this type of exposition. number image depth irreducible polynomial 1 2 3 4 5 6 7 17 12 15 29 13 10 16 23 51 255 255 255 1-f 1-h x^ 4- x* -f x^ 4- x* 25 26 27 2 29 30 30 27 26 11 4 25 5 5 255 1 + In order to support experimental work of the type just described, the automata package has two components, implemented in Mathematica and C-f+, respectively. To a degree, both components can function independently of each other. For example, the external part of the package has a little compiler that parses and
Innovation In Mathematics 449 executes commands in a very specialized command language, custom designed for the manipulation of finite state machines and cellular automata. Typically, the stand alone code is used to cope with computations involving simple machine operations on a large set of input data. The data can be conveniently generated in Mathematica, written out tofile,processed off-line by the external code, and the results written to anotherfile.the output can than be read back into Mathematica and further analyzed there. All the external algorithms are also implemented internally in Mathematica. In fact, many of them werefirstproto-typed in Mathematica and then translated into fast C-H code. The external code is carefully tuned for speed (though currently not for memory consumption). For example, unsigned int type bit vectors are used for deterministic simulation for small machines, and for minimization Hopcroft's O(nlogn) algorithm is used. The two components interact via MathLink to produce an environment that combines most of the advantages of both approaches, while avoiding the obvious drawbacks. A more detailed description of the automata package can be found in the proceedings of IMS'95 (or rather, the appendix thereto), as well as in [9] and [10]. We will give a demonstration of the latest version of the package, and will show some of the crucial computations mentioned above in real time, on a laptop computer. The current version of the package is based on Mathematica 3.0. Unfortunately, we have not yet been able to take full advantage of all the new features in the system. In particular the much improved type-setting abilities are not yet fully incorporated. Neither is the new help system at the time of this writing. The improved compilation mechanism should be useful to speed up some of the internal code. Beyond these obvious adjustments, future developments will include facilities to cope with transducers rather than just acceptors, as is currently the case. Some more facilities for the analysis of the phase space of-reasonably smallfinite cellular automata will also be added in the next release. The semigroup related part of the package will be somewhat expanded, though Krohn-Rhodes decomposition will most likely remain an attractive but rather elusive target. Indeed, unlike with groups, semigroups have not been dealt with systematically in computer algebra, so a lot of groundwork needs to be done before one can think about implementing semigroups in any reasonable way.
450 Innovation In Mathematics Bibliography [1] B. Andrasfai. Cellular automata in trees. In Finite and Infinite Sets, volume 37, pages 35-45. Colloquia Mathematica Societatis Janos Bolyai, Eger, Hungary, 191. [2] R. Barua and S. Ramakrishnan. cr-game, (7+ -game, and two-dimensional cellular automata. Theoretical Computer Science, 154(2) :349-366, 1996. [3] O. Martin, A. M. Odlyzko, and S. Wolfram. Algebraic properties of cellular automata. Commun. Math. Phys., 93:219-25, 194. [4] J. E. Pin. Varieties of Formal Languages. Foundations of Computer Science. Plenum Publishing Corporation, 196. [5] K. Sutner. Linear cellular automata and Fischer automata. To appear in Parallel Computing. [6] K. Sutner. <j-automata and Chebyshev polynomials. Submitted to TCS. [7] K. Sutner. On cr-automata. Complex Systems, 2(l):l-2, 19. [] K. Sutner. Linear cellular automata and the Garden-of-Eden. Mathematical Intelligencer, ll(2):49-53, 199. [9] K. Sutner. Finite state machines and syntactic semigroups. The Mathemat- 2co JowrrW, 2(l):7-7, 1992. [10] K. Sutner. Implementing finite state machines. In N. Dean and G. Shannon, editors, Computational Support for Discrete Mathematics, volume 15, pages 347-365. DIMACS, 1994. [11] S. Wolfram. Twenty problems in the theory of cellular automata. Physica #a, T9:170-13, 195. [12] S. Wolfram. Theory and Applications of Cellular Automata. World Scientific, 196.