Reversible Cellular Automata

2 downloads 0 Views 234KB Size Report
Cellular automata (CA) are discrete dynamical systems and models of ... to mimic reversible physical phenomena more closely than any other computa-.
Reversible Cellular Automata Jarkko Kari1,2, 2

1 Department of Mathematics, FIN-20014 University of Turku, Finland Department of Computer Science, University of Iowa, Iowa CIty, IA 52242, USA [email protected]

Abstract. Reversible cellular automata (RCA) are models of massively parallel computation that preserve information. This paper is a short survey of research on reversible cellular automata over the past fourty plus years. We discuss the classic results by Hedlund, Moore and Myhill that relate injectivity, surjectivity and reversibility with each other. Then we review algorithmic questions and some results on computational universality. Finally we talk about local reversibility vs. global reversibility.

1

Introduction

Cellular automata (CA) are discrete dynamical systems and models of massively parallel computation that share many properties of the physical world. They consist of very large numbers of simple elements that operate in parallel and interact only locally. The update rules are invariant with respect to location and time. Most interestingly, by choosing proper update rules one can program into the system fundamental properties of microscopic physics such as reversibility and conservation laws without sacrificing computational universality. Reversible cellular automata (RCA), also known as invertible cellular automata, are cellular automata that fully preserve information. They are capable to mimic reversible physical phenomena more closely than any other computational model proposed so far. Lattice gases are a perfect example of this. But more importantly, because RCA obey fundamental laws of physics, their hardware implementation may – at least in principle – be more energy efficient than the implementations of irreversible systems used today. According to the Landauer’s principle erasure of one bit of information at absolute temperature T always dissipates at least kT ln 2 Joule of energy, where k is the Bolzmann’s constant. This will eventually become prohibitive for further miniaturization and increasingly dense packing of irreversible gates such as AND and OR. Reversible computation has been proposed as an alternative where no bits need to be erased, hence avoiding the kT ln 2 lower bound on the energy dissipation. RCA are among the most closely studied types of cellular automata: There has been a steady stream of results since the early 60’s until today. This survey article presents these results in a compact form. We give references to the original sources where complete proofs can be found. 

Research supported by the Academy of Finland grant 54102

C. De Felice and A. Restivo (Eds.): DLT 2005, LNCS 3572, pp. 57–68, 2005. c Springer-Verlag Berlin Heidelberg 2005 

58

2

Jarkko Kari

Definitions and Classic Results

A cellular automaton is an infinite lattice of finite state machines, called cells. The cells are located at the integer lattice points of the d-dimensional Euclidean space. We refer to the cells by their coordinates, i.e. cells are addressed by the elements of Zd . Let S be the finite state set. A configuration of the CA is a function c : Zd −→ S where c(x) is the current state of the cell x. The set S Z of all configurations is denoted by C(d, S), or briefly C when d and S are known from the context. Constant functions are called homogeneous configurations. The cells change their states synchronously at discrete time steps. The next state of each cell depends on the current states of the neighboring cells according to an update rule. All cells use the same rule, and the rule is applied to all cells at the same time. The neighboring cells may be the nearest cells surrounding the cell, but more general neighborhoods can be specified by giving the relative offsets of the neighbors. Let N = (x1 , x2 , . . . , xn ) be a vector of n distinct elements of Zd . Then the neighbors of a cell at location x ∈ Zd are the n cells at locations x + xi , for i = 1, 2, . . . , n. d

The local rule is a function f : S n −→ S where n is the size of the neighborhood. State f (a1 , a2 , . . . , an ) is the new state of a cell whose n neighbors were at states a1 , a2 , . . . , an one time step before. This update rule then determines the global dynamics of the CA: Configuration c becomes in one time step the configuration e where, for all x ∈ Zd , e(x) = f (c(x + x1 ), c(x + x2 ), . . . , c(x + xn )). We say that e = G(c), and call G : C −→ C the global transition function of the CA. We have seen that cellular automata are dynamical systems that are homogeneous and discrete in both time and space, and they are updated locally. A d-dimensional CA is specified by a triple (S, N, f ) where S is the state set, d N ∈ (S Z )n is the neighborhood vector, and f : S n −→ S is the local update rule. We usually identify a cellular automaton with its global transition function G, and talk about cellular automaton function G, or simply cellular automaton G. In algorithmic questions G is however always specified using the three finite items S, N and f . Let us call a CA injective (surjective) if and only if its global function G is one-to-one (onto, respectively). The CA is bijective if G is both onto and one-toone. A cellular automaton with global function G is called reversible or invertible if there is cellular automaton function F such that G◦F = F ◦G = id where id is the identity function. Then F and G are the inverse automata of each other. One can effectively decide whether two given cellular automata are inverses of each other: One can namely effectively form the compositions of the two automata and test whether the compositions are equal to the identity function.

Reversible Cellular Automata

59

Example 1. Let d = 1, N = (0, 1) and S = {0, 1}. Cells are laid on a line and indexed by Z. Each cell i has two neighbors: i itself and i + 1. Let the local rule f be the modulo two addition. This CA is not injective as the two homomogeneous configurations c0 and c1 consisting entirely of 0’s and 1’s, respectively, are both mapped into the same configuration c0 . The CA is, however, surjective. We call this CA the Xor -automaton. 2.1

The Curtis-Hedlund-Lyndon Theorem

Let y ∈ Zd be arbitrary. The translation τy by y is the CA with the single element neighborhood (−y) and the identity local rule. Every translation is a composition of shifts, i.e. translations by a single cell in one of the coordinate directions. Homogeneousity in space means that every CA function G commutes with every translation τ , that is, G ◦ τ = τ ◦ G. Topology turns out to be a useful tool in cellular automata theory. Let us endow the set C with the Cantor topology, i.e. the topology generated by the basis of cylinder sets Cyl(c, M ) = {e ∈ C | e(x) = c(x) for all x ∈ M } for c ∈ C and finite M ⊆ Zd . Cylinder sets are both open and closed in the Cantor topology. This topology is induced by a metric, and most importantly, the topology is compact. Relevance to cellular automata stems from the fact that all cellular automata functions are continuous in this topology. In fact, a classic result from 1969 known as the Curtis-Hedlund-Lyndon theorem states also the converse: Theorem 1 ([6]). A function G : S Z −→ S Z is the global transition function of a cellular automaton if and only if d

d

(i) G is continuous, and (ii) G commutes with shifts. If G is a reversible CA function then G : C −→ C is by definition bijective. Conversely, suppose that G is a bijective CA function. Then G has an inverse function that clearly commutes with the shifts. The inverse function is also continuous because the space C is compact. So by the Curtis-Hedlund-Lyndon theorem the inverse is a CA function. We have proved: Corollary 1 ([6]). A cellular automaton G is reversible if and only if it is bijective. The point of the corollary is that in bijective CA each cell can determine its previous state by looking at the current states in some bounded neighborhood around them. In symbolic dynamics literature it is customary to call reversible (one-dimensional) cellular automata automorphisms of the shift dynamical system.

60

2.2

Jarkko Kari

The Garden of Eden-Theorem

Sometimes one state q ∈ S is specified as a quiescent state. It should be stable, which means that f (q, q, . . . , q) = q. The quiescent configuration Q is the configuration where all cells are quiescent: Q(x) = q for all x ∈ Zd . A configuration d c ∈ S Z is called finite if only a finite number of cells are non-quiescent, i.e. the support {x ∈ S Z | c(x) = q} is finite. Let us denote by CF (d, S), or briefly CF , the subset of S Z that contains only the finite configurations. Because of the stability of q, finite configurations remain finite in the evolution of the CA, so the restriction GF of G on the finite configurations is a function CF −→ CF . A periodic configuration, or more precisely, a spatially periodic configuration is a configuration that is invariant under d linearly independent translations. This is equivalent to the existence of d positive integers t1 , t2 , . . . , td such that for every x ∈ Zd and every i = 1, 2, . . . , d we have d

c(x) = c(x + ti ei ), where ei is the i’th unit coordinate vector. Let us denote by CP (d, S), or briefly CP , the set of periodic configurations. Cellular automata are homogeneous in space and consequently they preserve periodicity of configurations. The restriction GP of G on the periodic configurations is hence a function CP −→ CP . Finite configurations and periodic configurations are used in 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 be misleading. One should also keep in mind that GF may be bijective even if the CA is not reversible. This has led to some confusion on the terminology, especially in some online resources where only finite configurations are considered. Example 2. Let d = 1, N = (0, 1) and S = {00, 01, 10, 11}. The first bit of each state is a control symbol that does not change. If the control symbol of a cell is 0 then the cell is inactive and does not change its state. If the control symbol is 1 then the cell is active and applies the Xor rule of Example 1 on the second bit. In other words,  ab, if a = 0, f (ab, cd) = ax, if a = 1, where x = b + d (mod 2). State 00 is the quiescent state. This Controlled-Xor automaton is easily seen bijective on finite configurations. It is not injective on unrestricted configurations as two configurations, all of whose cells are active, have the same image if their second bits are complements of each other.

Reversible Cellular Automata

61

If G is not surjective then there exist Garden-of-Eden configurations, that is, configurations without a pre-image. A trivial property of any finite set is that a function from the set into itself is injective if and only if it is surjective. In cellular automata the same is true only in one-direction: an injective CA is always surjective, but the converse is not true. However, finite configurations behave more like finite sets: GF is injective if and only if G is surjective. This result, known as the Garden-of-Eden theorem, is one of the oldest results in the theory of cellular automata. The two directions of the theorem are due to E.F. Moore in 1962 [16] and J. Myhill in 1963 [19]: Theorem 2 ([16, 19]). GF is injective if and only if G is surjective. It is trivial that the injectivity of the full function G implies the injectivity of its restrictions GF and GP , so we immediately get the following corollary: Corollary 2. Injective CA are also surjective. Hence injectivity, bijectivity and reversibility are equivalent. Notice that sets CF and CP are dense in C. Then it follows from the continuity of G and the compactness of C that the surjectivity of GF or GP implies the surjectivity of G. The next theorem summarizes these and other known relations. The proofs can be found, for example, in [4]. The results are summarized in Figures 1 and 2. Theorem 3. The following implications are true in every dimension d: – – – –

If If If If

G is injective then GP and GF are injective, GP or GF is surjective then G is surjective, GP is injective then GP is surjective, G is injective then GF is surjective.

G injective

GP injective

GF surjective

GF injective

G surjective

GP surjective

Fig. 1. Implications between injectivity and surjectivity properties in one-dimensional CA

62

Jarkko Kari

G injective

?

GP injective

GF surjective ?

GP surjective ?

GF injective

G surjective

Fig. 2. Implications between injectivity and surjectivity properties in two- and higher dimensional CA

In addition, the following implications are true for one-dimensional CA: – If GP is injective then G is injective, – If G is surjective then GP is surjective. The two non-implications in Figure 1 are proved by the automata Xor and Controlled-Xor of Examples 1 and 2, respectively. Notice that in two- and higher dimensional cases there are three implications whose status is unknown.

3

The Inverse Automaton

There are natural algorithmic questions that arise. How does one determine if a given CA is reversible ? If the CA is reversible how does one find its inverse ? How large can the neighborhood of the inverse automaton be ? In the one-dimensional case S.Amoroso and Y.Patt gave already in 1972 algorithms to test whether a given CA is reversible or surjective [1]: Theorem 4 ([1]). There exist algorithms to determine if a given one-dimensional cellular automaton is injective or surjective. Elegant decision algorithms based on de Bruijn graphs were later designed by K. Sutner [22]. In higher dimensional spaces the questions are however much harder. It was shown in [10] that the questions are then undecidable (see also [8]): Theorem 5 ([10]). There are no algorithms to determine if a given two-dimensional cellular automaton is injective or surjective. Even though Corollary 1 guarantees that in bijective CA every cell can determine its previous state based on the current states in some fixed neighborhood of the cell, Theorem 5 implies that this neighborhood may be very large. There can be no computable upper bound on the radius of the neighborhood, because

Reversible Cellular Automata

63

otherwise we could test all candidate inverses one-by-one. Let us say that a CA has radius r if all elements of its neighborhood vector N belong to the set {−r, . . . , r}d . Corollary 3. For every computable function h : N −→ N there exists a twodimensional CA of radius one whose inverse function is not computed by any CA of radius h(s), where s is the number of states. In contrast, in the one-dimensional space the inverse automaton can only have a relatively small neighborhood. Consider a one-dimensional CA with s states and the two element neighborhood vector (0, 1). It is fairly easy to establish a qudratic O(s2 ) upper bound on the neighborhood radius of the inverse CA. Recently we improved this bound and showed that the inverse neighborhood consists of at most s − 1 consecutive cells [3]. This bound is tight since examples are known that require precisely s − 1 elements in the inverse neighborhood [9]. Theorem 6 ([3, 9]). A one-dimensional RCA with s states and neighborhood (0, 1) has an inverse whose neighborhood consists of at most s − 1 consecutive positions. This bound is tight. If the neighborhood in the forward direction is contained in m rather than two consecutive positions then a similar argument shows that the inverse neighborhood is contained in sm−1 − 1 consecutive positions [3]

4

Computational Universality

Another natural line of investigation is to study the computational power of RCA. It is clear that any Turing machine can be simulated by a one-dimensional CA. In 1977 T.Toffoli demonstrated how any d-dimensional CA can be simulated by a d + 1-dimensional RCA [23]. As a corollary we obtain a two-dimensional universal RCA. The result was improved in [17] where it was shown that reversible Turing machines can be simulated by one-dimensional reversible CA. This establishes the existence of universal one-dimensional reversible CA, since reversible Turing machines can be computationally universal [2]. A direct reversible one-dimensional simulation of an arbitrary one-dimensional CA (with finite configurations) was presented in [18]. Theorem 7 ([17]). One-dimensional reversible cellular automata exist that are computationally universal. An elegant universal two-dimensional RCA was presented by N.Margolus in 1984 [15]. This Billiard Ball RCA introduced the concept of space partitioning as a tool to enforce reversibility. In this technique the update is done in two steps (see Figure 3): In the first step the plane is partitioned into 2 × 2 blocks along, say, odd coordinates. A permutation π1 of S 4 is applied inside each block, where S is the state set. In the second step the partitioning is shifted so that

64

Jarkko Kari

Fig. 3. The Margolus neighborhood. Odd updates use the solid partitioning, even updates the dashed partitioning

the plane is partitioned along even coordinates, and another permutation π2 of S 4 is applied. This technique became known as the Margolus neighborhood. In the billiard ball computer we have π1 = π2 . The state set is binary, and we denote the states as white and black. The permutations π1 and π2 only make the following exchanges:

All other 2 × 2 blocks are unchanged. Because of the alternating partitioning, a single black state propagates on the plane in one of the four diagonal directions that depends on the parity of its location. With such a simple update rule it is possible to simulate the motion and collisions of billiard balls of positive diameter. Walls from which the balls bounce can also be created, and all these constructs can be combined to perform arbitrary computation [15]. A CA that uses the Margolus neighborhood is trivially reversible – the inverse automaton applies the inverse permutations. Also other physical constraints can be easily programmed into a CA that uses such a neighborhood. For example, the number of black cells is automatically preserved if the permutations are such that they conserve black states. Strictly speaking Margolus neighborhood is not a CA neighborhood in the sense of our definitions. The local update rule is different for even and odd cells. But if we consider “supercells” that consist of 2 × 2 blocks then all cells are identical. Also time steps become identical if we combine the even and odd clock cycles into one update step. In this strict sense the billiard ball computer by Margolus has 24 = 16 states and neighborhood radius one.

5

Local Invertibility

In view of our motivation in physics and computation – namely implementing reversible massively parallel computers using some reversible physical systems

Reversible Cellular Automata

65

– reversibility of the global transition function G does not seem like the most relevant property to study. Even though G : C −→ C is one-to-one on infinite configurations, the local rule f that produces G is not one-to-one. Function f is then useless if we want to implement G using finite, reversible logic gates. Rather, we prefer local rules that, unlike f , are themselves reversible, such as the permutations in the Margolus neighborhood. In [25] the natural question was asked whether all reversible cellular automata can be implemented using reversible local update rules. This question was answered affirmatively in [11] for one- and two-dimensional cellular automata. In higher dimensional spaces the question remains open, although in [5] it was shown how to simulate any RCA of any dimension by a locally reversible RCA. For simplicity we only consider the one-dimensional case here. Let G be a one-dimensional RCA whose neighborhood is within {−l, . . . , r} and suppose the inverse G−1 has neighborhood within {−l , . . . , r }. Take an arbitrary configuration c, write G(c) under c, and extract the state contents of the cells within the stair-like shape shown in Figure 4. We obtain some element of S m where S is the state set and m is the number of cells within the shape. We repeat this for all configurations c ∈ S Z . Let L ⊆ S m be the set of “left stairs” we can extract this way. Note that typically L = S m because the states we extract from c restrict G(c) and vice versa. For example, if G = id is the identity function then the extractions from c and G(c) in the middle part of the stair must be identical.

c G(c)

l

max{r, l’}

r’

Fig. 4. Extraction of left stairs

The dimensions of the stair shape are chosen large enough to prevent the influence of the states on either side of the stair to the other side. We repeat the analogous process to obtain the set R of “right stairs”, as illustrated in Figure 5. Let us denote by λ and ρ the total widths of the left and the right stairs, respectively, that is λ = l + max{r, l } + r , and ρ = l + max{r , l} + r. We are interested in the cardinalities of sets L and R. For example, if G = id then |L| = sλ and |R| = sρ where s = |S| is the number of states. If G is the shift to the left then |L| = sλ+1 and |R| = sρ−1 . It was shown in [11] that always |L| · |R| = sλ+ρ . Let us associate with G the number ϕ(G) =

|L| . sλ

66

Jarkko Kari c G(c)

l’

max{r’, l}

r

Fig. 5. Extraction of right stairs

Function ϕ has the interesting property that it is a group homomorphism from the group of RCA functions with state set S into the multiplicative group of rational numbers [11], i.e. we have that ϕ(G ◦ F ) = ϕ(G)ϕ(F ) for any RCA G and F over the same state set. Consider a one-dimensional RCA G that uses a generalized Margolus neighborhood: the update consists of t steps: G = G1 ◦ G2 ◦ . . . ◦ Gt . Each step Gi is a block permutation rule: it partitions the configuration space into blocks of equal length ki and applies some permutation πi of S ki on each block. One can easily see that ϕ(Gi ) = 1, that is, each Gi belongs to the kernel ker(ϕ) of the homomorphism ϕ. It follows then that also G ∈ ker(ϕ). This means that functions that are outside the kernel – for example the shifts – cannot be expressed as a composition of block permutation rules. Conversely, if G is a one-dimensional RCA function that satisfies ϕ(G) = 1 then it is a composition G = G1 ◦ G2 where both G1 and G2 are block permutations that use blocks of length k1 = k2 = ρ + λ. The first block permutation G1 computes in each block of configuration c two adjacent left/right stairs, and stores these stairs at the left/right ends of the block, see Figure 6. The second rule G2 takes right/left stairs and decodes them into blocks of G(c). We have the following result: Theorem 8 ([11]). A one-dimensional RCA G is a composition of block permutation rules if and only if ϕ(G) = 1. In this case two block permutations with block sizes λ + ρ suffice. As block permutations are locally reversible, we conclude that all one-dimensional RCA can be implemented using finite reversible logic gates. (Those RCA c G1

G2 G(c)

Fig. 6. Factoring RCA G into a sequence of two block permutations G1 and G2

Reversible Cellular Automata

67

that are not in the kernel of ϕ can be combined with a shift or a shift-like function before applying Theorem 8.) A more complex analysis shows that an analogous result applies to two-dimensional RCA [11]. In this case two group homomorphisms are found, corresponding to the two dimensions of the space, and those RCA that are in the kernels of both homomorphisms can be factored into a sequence of two-dimensional block permutation rules. Three block permutations are sufficient in this case [12]. Factoring in higher dimensional spaces is still open, but what is known is that in the d-dimensional space any RCA that is a composition of some block permutations is a composition of at most d + 1 block permutations: Theorem 9 ([12]). If G1 , G2 , . . . , Gt are d-dimensional block permutation rules then there are d + 1 block permutation rules B1 , B2 , . . . , Bd+1 such that G1 ◦ G2 ◦ . . . ◦ Gt = B1 ◦ B2 ◦ . . . ◦ Bd+1 .

6

Conclusion

We have briefly surveyed some developments in the theory of reversible cellular automata. RCA are interesting mathematical objects to study. In the future, they potentially play a role in the design of energy efficient massively parallel computers. Applications in data coding (e.g. cryptography and compression) are also possible. Interesting developments not covered in this survey include many results on reversible and surjective CA whose local update rule is additive or has some other algebraic structure [7, 13, 14, 21].

References 1. S. Amoroso and Y. Patt, Decision Procedures for Surjectivity and Injectivity of Parallel Maps for Tessellation Structures, Journal of Computer and System Sciences 6 (1972) 448–464. 2. C. Bennett, Logical reversibility of computation, IBM Journal of Research and Development 6 (1973) 525–532. 3. E. Czeizler and J. Kari, A tight linear bound on the neighborhood of inverse cellular automata, To appear in the Proceedings of ICALP 2005, Lecture Notes in Computer Science, Springer, 2005. 4. B. Durand, Global properties of 2D cellular automata, in: Cellular Automata and Complex Systems, E. Goles and S. Martinez (Eds.), Kluwer, 1998. 5. J. Durand-Lose, Representing reversible cellular automata with reversible block cellular automata, in: Discrete Models, Combinatorics, Computation and Geometry, R. Cori, J. Mazoyer, M. Morvan and R. Mosery (Eds.), 145–154, Springer, 2001. 6. G. Hedlund, Endomorphisms and automorphisms of shift dynamical systems, Math. Systems Theory 3 (1969) 320–375. 7. M. Ito, N. Osato and M. Nasu, Linear Cellular Automata over Zm , Journal of Computer and System Sciences 27 (1983) 125–140.

68

Jarkko Kari

8. J. Kari, Reversibility of 2D cellular automata is undecidable, Physica D 45 (1990) 379–385. 9. J. Kari, On the Inverse Neighborhoods of Reversible Cellular Automata, in: Lindenmayer Systems, Impacts on Theoretical Computer Science, Computer Graphics, and Developmental Biology, G. Rozenberg, A. Salomaa (Eds.), 477–495, SpringerVerlag, 1992. 10. J. Kari, Reversibility and surjectivity problems of cellular automata, Journal of Computer and System Sciences 48 (1994) 149–182. 11. J. Kari, Representation of reversible cellular automata with block permutations,Mathematical Systems Theory 29 (1996) 47–61. 12. J. Kari, On the circuit depth of structurally reversible cellular automata, Fundamenta Informatica 38 (1999) 93–107. 13. J. Kari, Linear Cellular Automata with Multiple State Variables, in: Proceedings of STACS’2000, 17th Annual Symposium on Theoretical Aspects of Computer Science, Lecture Notes in Computer Science 1770, 110–121, Springer-Verlag, 2000. 14. G. Manzini and L. Margara, Invertible Linear Cellular Automata over Zm : Algorithmic and Dynamical Aspects, Journal of Computer and System Sciences 56 (1998) 60–67. 15. N. Margolus, Physics-like models of computation, Physica D 10 (1984) 81–95. 16. E.F. Moore, Machine Models of Self-reproduction, Proceedings of the Symposium in Applied Mathematics 14 (1962) 17–33. 17. K. Morita and M. Harao, Computation Universality of one.dimensional reversible (injective) cellular automata, IEICE Transactions E72 (1989) 758–762. 18. K. Morita, Reversible simulation of one-dimensional irreversible cellular automata, Theoretical Computer Science 148 (1995) 157–163. 19. J. Myhill, The Converse to Moore’s Garden-of-Eden Theorem, Proceedings of the American Mathematical Society 14 (1963) 685–686. 20. D. Richardson, Tessellations with Local Transformations, Journal of Computer and System Sciences 6 (1972) 373–388. 21. T. Sato, Decidability of some problems of linear cellular automata over finite commutative rings, Information Processing Letters 46 (1993) 151–155. 22. K. Sutner, De Bruijn graphs and linear cellular automata, Complex Systems 5 (1991) 19–31. 23. T. Toffoli, Computation and construction universality of reversible cellular automata, Journal of Computer and System Sciences 15 (1977) 213–231. 24. T. Toffoli and N. Margolus, Cellular Automata Machines, MIT Press, 1987. 25. T. Toffoli and N. Margolus, Invertible cellular automata: a review, Physica D 45 (1990) 229–253.