[lecture notes in computer science] cellular automata volume 4173 || simulation of d′-dimensional...

10

Click here to load reader

Upload: stefania

Post on 11-Oct-2016

225 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: [Lecture Notes in Computer Science] Cellular Automata Volume 4173 || Simulation of d′-Dimensional Cellular Automata on d-Dimensional Cellular Automata

Simulation of d′-Dimensional Cellular Automataon d-Dimensional Cellular Automata

Christoph Schebens [email protected]

University of Karlsruhe (TH), Germany

Abstract. In this paper a fast and space efficient method for simulatinga d′-dimensional cellular automaton (CA) on a d-dimensional CA (d <d′) is introduced. For d′ = 2 and d = 1 this method is optimal (undercertain assumptions) with respect to time as well as space complexity.Let in this case t(n) be the time complexity and r(n) the side lengthof the smallest square enclosing all used cells. Then the simulation doesnot need more than O(r2) cells and has a running time of O(r · t). Inthe general case d′ = d+1 a version with the time and space complexityof O(t2) will be presented. Finally it will be shown, how it is possibleto simulate a 2d-dimensional CA on a d-dimensional CA in a similarlyefficient way.

1 Introduction

Recently the simulation of a CA of higher dimensionality on a CA of lowerdimensionality has received some renewed attention [2]. This problem has beenconsidered before [1]. The constructions in this paper are significantly moreefficient than those by Poupet [2] and it is much easier to get a reduction from2d to d dimensions than with the construction by Achilles et al. [1]; furthermoreone does not need the constructibility condition required there.

Definition 1 (CA). A CA is a tuple A = (R, N, Q, �, δ), where

– R = Zd is the underlying grid,

– N ⊆ Zd is the finite neighborhood;

w.l.o.g. we assume von Neumann neighborhood– Q is the finite set of states,– � ∈ Q is the quiescent state,– δ : QN → Q is the local transition function.

The global transition function is defined as usual1 as

Δ :

{QR → QR

c �→ c′ where c′(z) = δ(n �→ c(z + n)

), n ∈ N

1 Because N is subset of Zd, the mapping + in the definition of the global transition

function is the same as in the group (Zd, +).

S. El Yacoubi, B. Chopard, and S. Bandini (Eds.): ACRI 2006, LNCS 4173, pp. 131–140, 2006.c© Springer-Verlag Berlin Heidelberg 2006

Page 2: [Lecture Notes in Computer Science] Cellular Automata Volume 4173 || Simulation of d′-Dimensional Cellular Automata on d-Dimensional Cellular Automata

132 C. Scheben

We will use the following notion of simulation for this paper:

Definition 2 (Simulation). A CA A = (Zd, NA, QA, �, δA) simulates a CAB = (Zd′

, NB, QB, �, δB), if there are functions

e : QZd′

B → QZd

A f : Zd′ → Z

d

g : QA → QB hb : N → N for each b ∈ Zd′

such that for each finite configuration cB, all cells b ∈ Zd′

and all t ∈ N holds:

Δt(cB)(b) = g(Δhb(t)(e(cB))(f(b))

)We require e to always map finite configuration on Z

d to finite configuration Zd′

.Of course, all functions involved should be computable and in fact “simple”. Weare not going to formalize this aspect, but it will be clear that the constructionsdescribed below are simple.

A simulates B synchronously, if hb = hb′ for all b, b′ ∈ Zd′

. A cell z ∈ Zd

represents the state q ∈ QB (at the point in time t), if g(Δt(cA)(z)) = q isfulfilled.

The main problems are to find a useful mapping f from the d′D-space in thedD-space as well as an algorithm for the transmission of states. If neighboringcells a and b of B are mapped to distant cells f(a) and f(b) the simulation (atleast the obvious one) of one step of B requires informations to be exchangedbetween f(a) and f(b) in several steps.

The paper is organized as follows: In Section 2 a simulation method will beexplained for the case of 2D → 1D simulation. In Section 3 it will be generalizedto (d + 1)D → dD and in Section 4 to the case d′D → dD. Throughout thispaper we consider the case d′ > d. (The opposite direction is considered in [1].)

2 Simulation of 2D on 1D CA

We start with the description of a function f mapping the cells of the 2D-CAto the cells of the 1D-CA (Subsection 2.1). In Subsections 2.2 and 2.3 we willexplain, how the 1D-CA simulates one step of the 2D-CA. The computationalcomplexity of the construction will be discussed in Subsection 2.4.

2.1 The Spiral Mapping

Let f : Z2 → Z denote the “spiral mapping” as depicted in Fig. 1. Obviously f

is injective. It is easily seen that f(n, n) grows quadratically with the distancen to the origin: f(n, n) = (2n + 1)2 − 1.

The set of cells of the 2D-CA, which have a distance k to the origin withrespect to the maximum norm, is denoted as the k-th sphere of the 2D-CA. Theimages of these cells under f in the 1D-CA, will be called the k-th 1D-sphere.

The upper right corner of a 2D-sphere is called the sphere-exit-cell, its leftneighbor is called the sphere-entrance-cell. Sphere-exit-cells in Figure 1 are forexample the cells 8, 24, 48 and 80, sphere-entrance-cells are 1, 9, 25, and 49.

Page 3: [Lecture Notes in Computer Science] Cellular Automata Volume 4173 || Simulation of d′-Dimensional Cellular Automata on d-Dimensional Cellular Automata

Simulation of d′-Dimensional Cellular Automata 133

Fig. 1. Mapping of (a, b) ∈ Z2 to Z according to the spiral around the origin

2.2 Shifting States in the 1D-CA

We now turn to the problem of transmission of the 2D-states in the 1D-CA.A closer look at the mapping f reveals, that in any case two 2D-neighbors are

also neighbors in the 1D-CA. If the cells are marked unambiguously according totheir position (up, down, left, right) as in figure 2, a 1D-cell is able to identify the2D-positions of its 1D-neighbors. Thus in the critical moment a cell can read the2D-states of two of the 2D-neighbors off their 1D-neighbors (exception: sphere-exit-cell and sphere-entrance-cell; see below). The other two 2D-neighbors arelocated in one or two neighboring spheres. In case of corner-cells, the two 2D-neighbors are located in the outer sphere. For the other cells one is located inthe outer and one is located in the inner sphere.

If one shifts for every 1D-sphere the 2D-states in the right way to the cellsof the next higher 1D-sphere and afterwards the states of the higher sphereback to the lower one, than every cell knows the 2D-states of the neighbors oftheir preimage-cell. Sphere-entrance- and sphere-exit-cells have to be treated ina slightly different way.

Algorithm 1 (State shifting)

1. The 1D-image of the entrance-cell of a 2D-sphere starts and sends its 2D-state including its position-marking towards the direction of the next highersphere. As soon as the signal passes the right neighbor, this one appends asignal with its own 2D-state as well as position marking. All other cells ofthe sphere behave analogously: They append their 2D-state as well as theirmarking as soon as the last signal of the arising signal-chain passes.

2. As soon as the first signal reaches the first cell after the entrance-cell of thenext sphere, which is not a corner-cell, the signal ends in this cell and the cellmemorizes the transmitted 2D-state as well as the transmitted marking. Allother signals, not coming from a corner, proceed analogously: They ignorethe entrance-cell of the next sphere as well as all corner-cells and end, assoon as they find a cell, which has not received a signal yet. Corner-cells

Page 4: [Lecture Notes in Computer Science] Cellular Automata Volume 4173 || Simulation of d′-Dimensional Cellular Automata on d-Dimensional Cellular Automata

134 C. Scheben

Fig. 2. Mapping f(a, b) for |a|, |b| ≤ 2 with marked greatest cell. The cells are markedaccordingly to their position (up, down, left, right) related to the origin. The cornershave two markings and so they are unambiguously identifiable.

behave a bit different, because the state has to be transmitted to two cells.They ignore the sphere-entrance-cell too, but they do not end at the firstcells, which has not received a signal yet. In stead they transmit their stateand marking to this cell and end at the second cell, which has not receiveda signal yet (and is not a corner cell).

3. Exception handling: Simultaneously with step 1 the exit-cell of the spheretransmits its 2D-state directly to the entrance-cell of the next sphere. Fur-thermore the special treatment for corner-cells in step 2 is not applied to thesphere-exit-cell.

Moreover, the cell at the origin acts in a different way. It behaves similarto a corner-cell, but it transmits its state to the four neighbors positioned inthe next sphere. We assume that the cell at the origin knows, that it is theorigin.

In the same way, the states are shifted back. The only relevant difference is, thatevery corner-cell collects two signals.

The algorithm also works, if the next sphere is not constructed yet, becausethe cells of the next sphere can be marked in a correct way by the transmittedmarkings. Once again some attention has to be paid to the corner-cells. Thesehave to mark a corner-cell after marking the first normal cell. In addition, themarking of the largest cell has to be shifted.

In oder to prevent constructing too many cells later, the algorithm is”aborted” for the last sphere, if the signal, which was sent at first, notices thefollowing two conditions. First that all cells of the sphere represent the quiescentstate of the 2D-CA and second that the sphere is the greatest one. The lattercan be recognized by the signal, because the last cell of the sphere is marked asthe greatest cell. ”Aborting” means that the states are moved indeed but thatthe new cells will not be marked. This will be of importance in the next section,because the chronological dependencies would be mixed up, if one would abortthe shifting directly after reaching the greatest cell.

Page 5: [Lecture Notes in Computer Science] Cellular Automata Volume 4173 || Simulation of d′-Dimensional Cellular Automata on d-Dimensional Cellular Automata

Simulation of d′-Dimensional Cellular Automata 135

2.3 Simulation 2D → 1D

Up to now it was shown, how 2D-states can be shifted form one sphere into thenext one. Now it shall be explained, how the whole simulation works.

Let the cells of the k-th sphere of the 1D-CA be in the configuration c′i andlet the configuration c′i represent the i-th 2D-configuration. That means c′i(z

′)represents ci(z) if z′ = f(z), z ∈ Sk. Here and in the following Sk denotes thek-th sphere in the 2D-CA, and we also use the abbreviation Kk =

⋃ii≤k Si for

the “filled” sphere. In addition, the cells of the k-th sphere shall be synchronizedand marked according to Figure 2.

Then the (i + 1)-th simulation step of the k-th sphere is performed in thefollowing way:

Algorithm 2 (Simulation 2D → 1D)

1. Shift and wait: The sphere-entrance-cell starts the algorithm for shiftingthe 2D-states into the next sphere (sphere k+1) as described in the previoussubsection. After the states have arrived, they wait until the sphere k + 1synchronizes and switches to the next 2D-state. Now the cells of the spherek + 1 are in the states corresponding to the i-th 2D-configuration.

2. Exchange: Sphere k + 1 performs two actions: First the cells of the sphereexchange their states with the shifted states of the sphere k and second thesphere starts with step 1 to prepare the next simulation step (for the spherek + 1) itself. The exchange of the states is executed in the following way(compare Fig. 2):(a) Upper horizontal cells accept the shifted state as the state of their lower

2D-neighbor.(b) Lower horizontal cells accept the shifted state as the state of their upper

2D-neighbor.(c) In the same way left and right vertical cells accept the shifted state as

the state of their right and left 2D-neighbor respectively.(d) The shifted signals accept the states of the cells of the sphere k+1 the

other way round, i.e. signals of upper cells accept the state of the cor-responding (k+1)-cell as the state of their upper 2D-neighbor and soon.

(e) Corner-cells of the sphere k + 1 accept no state (that means that theydid not got states from the sphere k).

3. Shift back: After the states were exchanged, the cell of the last shifted state(meaning the greatest cell of the sphere k + 1, which got a state) initiatesthe shifting back as was described in Subsection 2.2. This cell can identifyitself as “last shifted cell”, because its right neighbor is marked as upperright corner, which is the sphere-exit-cell.

4. Exception handling: Simultaneously to the state shifting in step 1 theentrance-cell of the sphere k sends its current 2D-state to the exit-cells of thesame sphere. This one memorizes the state as the state of its left 2D-neighbor.At the same time the sphere-exit-cell sends its 2D-state to the entrance-cell.The sphere-entrance-cell again memorizes the transmitted state as the 2D-state of its right 2D-neighbor.

Page 6: [Lecture Notes in Computer Science] Cellular Automata Volume 4173 || Simulation of d′-Dimensional Cellular Automata on d-Dimensional Cellular Automata

136 C. Scheben

5. Synchronization: After the last state is shifted back (this one belongs tothe entrance-cell of the sphere k), the entrance-cell initiates a synchronizationof the cells of its sphere.

6. New states: If the cells are synchronized, they compute their new 2D-state.This is possible, because the 2D-states either(a) have been shifted up from the lower sphere,(b) have been acquired from the upper sphere through the own shifting op-

eration,(c) the 2D-states are kept ready from the own 1D-neighbors of the cell or(d) were transmitted through step (4). This happens in the special case of

the entrance- and exit-cell of the sphere (in the 1D-CA).

There is still a special case to be examined: What happens, if the last sphere(w.l.o.g. let this be the sphere i) constructs a new sphere i + 1? In this case thecells of the sphere i+1 know the states of all 2D-neighbors immediately, becauseall 2D-states, expect the one shifted up, correspond to the quiescent state. Thusthe sphere i + 1 could synchronize and switch to the next state immediately– while simultaneously shifting back the states. But this should not happen,because then the sphere i+1 would be approximately half of a simulation phaseahead of sphere i. Therefore the first computation step of the sphere i+1 will bedelayed artificially until it is ensured, that the sphere i is a computation step inadvance of the sphere i+1. This can be achieved by initiating the synchronizationof the sphere i + 1 only after the sphere i shifts its states to the sphere i + 1again. At this point it becomes clear that the spheres work asynchronously. Butthe sphere k is maximal one computation step in advance of the the sphere k+1,because the sphere k always waits for the sphere k + 1 at step 1. According tothe statement above, the sphere k is always exactly one step in advance of thesphere k + 1.

2.4 Complexity of the 2D → 1D Simulation

We use the same definition for the Landau symbols O, Θ, Ω, o, ω like in [4]. Lett be the time complexity of the 2D-CA and let r denote the side length of thesmallest square enclosing all cells which were non-quiescent (hence the spacecomplexity is O(r2)). The time and space complexity of the 1D-CA shall beexamined in terms of r and t.

The greatest sphere of the 1D-CA is also the slowest one. That means thatthe t-th configuration was completely computed, when the greatest sphere – thesphere r – switches to the t-th configuration. Because every step of the describedalgorithm is bounded by O(|Sr|) and the origin executes O(r + t) computationsteps, the runtime of 1D-CA is bounded by O(|Sr | · (t + r)), and thus becauseof |Sr| = 8r and r ≤ r0 + t by

O(|Sr | · (t + r)) = O(8r · (t + r)) = O(r · t + r2) = O(r · t) .

The space complexity is bounded by O(f(r, r)) = O((2r + 1)2 − 1) = O(r2)(where f(a, b) is the spiral mapping). So in the 1D-CA most memory is wasted,when the 2D-CA uses only the cells of one direction.

Page 7: [Lecture Notes in Computer Science] Cellular Automata Volume 4173 || Simulation of d′-Dimensional Cellular Automata on d-Dimensional Cellular Automata

Simulation of d′-Dimensional Cellular Automata 137

Next, it will be shown, that the algorithm is optimal under certain assump-tions with respect to memory as well as time complexity.

Let f : Z2 → Z be any mapping of the cells of a 2D-CA B on the cells of a 1D-

CA A such that for some constant m the number |f−1(a)| of B-cells simulatedby any A-cell a is bounded by m.

Lemma 1. Under the given assumption, the algorithm for the 2D → 1D simu-lation is optimal with respect to the space complexity Θ(r2).

Proof. After assumption a cell of the 1D-CA is able to simulate only a finitenumber of cells of the 2D-CA, thus the 1D-CA uses at least 1

c · r2 cells. But thenthe space complexity of Θ(r2) is optimal.

Define the function k : N → N as

k(r) = max{|f(a) − f(b)| | a, b ∈ Kr and a and b are neighbors

}where the distance is to be measured as the number of “steps from neighbor toneighbor”.

Lemma 2. k(r) ∈ Ω(r).

Proof. In the 2D-CA the distance between two cells a, b ∈ Kr is at most 2r cells.Let a′ = max{f(x) | x ∈ Kr} and b′ = min{f(x) | x ∈ Kr} the largest and thesmallest index respectively of a cell of the 1D-CA A simulating a cell from Kr.

Assume k(r) ∈ o(r). Then |a′ − b′| ≤ 2r · k(r) ∈ o(r2). But being able tosimulate all cells from Kr in o(r2) cells contradicts Lemma 1.

From this lemma immediately follows that at least all naıve simulation techniqueswhich rely on exchanging B-states between simulating A-cells have to spend k(r)steps for the simulation of one step of a Kr-subcube of B. Hence a running timein Θ(r · t) cannot be avoided.

To summarize this section we note:

1. The space complexity could be decreased only if one would find a simulation,which does not simply assign a finite number of B-cells to each A-cell.

2. The time complexity could be decreased only if either one could decreasethe space complexity or if one would find a way, where the images don’thave to exchange their states after a constant number of steps. The secondpossibility cannot be excluded, but on the other hand one would not expectintuitively, that the simulation could be done faster than in Θ(r · t).

3 Generalization (d + 1)D → dD

We will now show how the simulation method can be extended to d dimensionsin an easy way. In this case we define the mapping f as

f : Zd+1 → Z

d : (a1, ..., ad+1) �→ (a1, ..., ad−1, fspiral(ad, ad+1)) .

Page 8: [Lecture Notes in Computer Science] Cellular Automata Volume 4173 || Simulation of d′-Dimensional Cellular Automata on d-Dimensional Cellular Automata

138 C. Scheben

The (d + 1)D → dD simulation works similar to the 2D → 1D case, because inA each cell can access 2(d − 1) B-neighboring states directly the A-neighbors.

The part of the simulation which involves the spiral only has to be changedslightly with respect to the above description:

1. Two cycles after a computation step the 2D-states of a sphere are also trans-mitted (synchronously) to the d−1 parallel neighbor spheres. If such a sphereis not marked yet, then the markings are taken over and a computation stepis executed immediately.

2. A new 1D-sphere will be constructed at every step. This construction alwaystakes place and does not depend on whether the sphere will be needed ornot. This guarantees, that the parallel spheres always maintain an offset oftwo cycles.

This way the constructed (d + 1)D → dD simulation has a runtime and a spacecomplexity of O(t2). It should be mentioned, that it is possible to constructanother synchronous (d + 1)D → dD simulation with a space complexity ofO(r2) and a time complexity of O(r2 · t) (see [3]; because of the page restrictionfor the paper we leave this out).

4 Generalization d′D → dD

Considering the results from the previous subsection, a (simple-minded) gener-alization to the case d′D → dD consists in the application of the demonstratedmethod d′−d times. But such a simulation is very inefficient for large differencesd′ − d. For example the simulation of a 10D-CA on a 1D-CA would result in aruntime of O(t2

10) = O(t1024). This is not satisfactory.

The aim of this section is to reduce the running time at least for dimensionsd′ = 2x · d, x ∈ N to O(t2

x

). With this a 16D-CA as well as a 10D-CA couldbe simulated on a 1D-CA with a runtime of O(t16). This even is optimal ford′ = 2x · d, x ∈ N, if the d′D-CA has a space complexity of O(t).

Let f be defined as

f : Zd′

= Z2d → Z

d : (a1, ..., a2d) �→ (fspiral (a1, a2), ..., fspiral (a2d−1, a2d)) .

This approach adds one possible source of complications:The mappings are linked now (Fig. 3). Thus, after constructing a new sphere

on one of the axis of the dD-CA and after execution of the first computation stepone has to start a new 2D → 1D simulation in the remaining d−1 dimensions. Atthis point it could happen, that a perpendicular started simulation in a domainworks faster than the simulation in one of the other directions (e.g. this is thecase in the domain (2, 1) in Fig. 3). But a cell is not able to switch to the next 2D-state, until the states of all directions have been received. Thus, the 1D-spheresare no longer synchronized one by one, but they are combined to domains. Thesedomains are synchronized as a whole as soon as the cell, which is the closest tothe origin, has received all states (Fig. 3). The domains are chosen in a way, that

Page 9: [Lecture Notes in Computer Science] Cellular Automata Volume 4173 || Simulation of d′-Dimensional Cellular Automata on d-Dimensional Cellular Automata

Simulation of d′-Dimensional Cellular Automata 139

Fig. 3. Simulation 4D → 2D. The cells of the framed areas will be synchronizedaltogether.

all cells, which are located in every direction in the same 1D-sphere, are mergedinto one domain.

Also in this simulation, a new 1D-sphere will be constructed at every step.Like above the sphere is always constructed independent of its further use. Thisguarantees at every time, that the domains are marked completely in one step.

This 2dD → dD simulation has a time and space complexity of O(t2) (likethe (d + 1)D → dD simulation). For proving the optimality one considers, thatthe ratio between the diameter of the d′D-CA and the diameter of the dD-CA isquadratic, because it is l′d

′= (2r+1)d′

= (2r+1)2d = ((2r+1)2)d = (l2)d. Nowone uses the same arguments as in Subsection 2.4. Through successive executionone reaches the desired aim.

5 Conclusion

The most suitable method for comparison with the methods presented in thispaper, seems to be the 3D → 2D simulation method of Poupet [2]. Table 1summarizes the resulting overheads of different methods for the 3D → 2Dsimulation.

Table 1. Comparison of simulation methods for the 3D → 2D simulation

simulation Achilles [1] Poupet [2] present synchronous [3]

time O(t2) O(t4) O(t2) O(r2 · t)space O(t3) O(t9) O(t2) O(r2)

The algorithm presented in this paper outmatch the one from [2]: Beside thehigher speed and the smaller space requirements it is possible to construct acompletely synchronous simulation. It also needs less space than the simulationfrom [1].

Page 10: [Lecture Notes in Computer Science] Cellular Automata Volume 4173 || Simulation of d′-Dimensional Cellular Automata on d-Dimensional Cellular Automata

140 C. Scheben

Poupet’s simulation could be generalized to the d + 1 → d case (with d ≥ 2)without difficulties. Table 2 summarizes the resulting overheads for the (d +1)D → dD simulation. The results of the comparison with [2] are the same as inthe 3D → 2D case. But in addition it shows, that the space efficiency is muchbetter than in [1] – especially for d � 1.

Table 2. Comparison of simulation methods for the (d + 1)D → dD simulation

simulation Achilles [1] Poupet [2] present synchronous [3]

time O(t2) O(t4) O(t2) O(r2 · t)space O(td+1) O(t9) O(t2) O(r2)

Furthermore we are able to simulate a d′-dimensional CA on a d-dimensionalCA with a time and space complexity of at most O(t2

�ld(d′/d)�). It is unclear,

whether a similar efficiency could be achieved using the simulations in [1] and[2].

In the future we will investigate, whether the principle of the 2D → 1Dsimulation can be generalized in such a way, that one gets an optimal algorithmfor the (d + 1)D → dD simulation, too. At least in the case of the 3D → 2Dsimulation one could imagine something like that. In addition a direct 3D → 1Dsimulation could be useful for improving the idea from Section 4 further.

References

1. Achilles, A.-C., Kutrib, M., Worsch, T.: On relations between arrays of processing el-ements of different dimensionality, Proc. Parcella 1996, pp. 13–20, Akademie-Verlag,Berlin, 1996.

2. Poupet, V.: Simulating 3D Cellular Automata with 2D Cellular Automata, J. Fialaet al. (Eds.): MFCS 2004, LNCS 3153, pp. 439–450, 2004, Springer-Verlag, BerlinHeidelberg, 2004.

3. Scheben, C.: Simulation von d′-dimensionalen Zellularautomaten auf d-dimensio-nalen Zellularautomaten, Studienarbeit, Univ. Karlsruhe, 2006.

4. Cormen, T. H., Leiserson, C. E., Rivest, R. L., Stein, C.: Introduction to algorithms,Cambridge, Mass. : MIT Press, 2001.