A faster algorithm for the FSSP in one-dimensional CA with multiple speeds
aa r X i v : . [ c s . CC ] M a r A faster algorithm for the FSSP in one-dimensional CAwith multiple speeds
Thomas WorschKarlsruhe Institute of Technology, Department of Informatics worsch at kit.edu
March 31, 2020
Abstract
In cellular automata with multiple speeds for each cell i there is a positive integer p i such that this cell updates its state still periodically but only at times which are amultiple of p i . Additionally there is a finite upper bound on all p i .Manzoni and Umeo have described an algorithm for these (one-dimensional) cel-lular automata which solves the Firing Squad Synchronization Problem. This algo-rithm needs linear time (in the number of cells to be synchronized) but for manyproblem instances it is slower than the optimum time by some positive constant fac-tor. In the present paper we derive lower bounds on possible synchronization timesand describe an algorithm which is never slower and in some cases faster than theone by Manzoni and Umeo and which is close to a lower bound (up to a constantsummand) in more cases. The
Firing Squad Synchronization Problem (FSSP) has a relatively long history in the fieldof cellular automata. The formulation of the problem dates back to the late fifties and firstsolutions were published in the early sixties. A general overview of different variants ofthe problem and solutions with many references can be found in [3]. Readers interestedin more recent developments concerning several specialized problems and questions arereferred to the survey [4].In recent years asynchronous CA have received a lot of attention. In a “really” asyn-chronous setting (when nothing can be assumed about the relation between updates ofdifferent cells) it is of course impossible to achieve synchronization. As a middle groundthe FSSP has been considered in what Manzoni and Umeo [2] have called
CA with multiplespeeds , abbreviated in the following as
MS-CA . In these CA different cells may update theirstates at different times. But there is still enough regularity so that the problem setting ofthe FSSP makes sense: As in standard CA there is a global clock. For each cell i there is apositive integer p i such that this cell only updates its state at times t which are a multipleof p i . We will call p i the period of cell i . Additionally there is a finite upper bound onall p i , so that it can be assumed that each cell has stored p i as part of its state. This alsomeans that there are always times (namely the multiples of the least common multiple ofall periods) when all cells update their states simultaneously.The rest of this paper is organized as followed: In Section 2 we fix some notation, re-view the basics of standard CA in general and of the FSSP for them. In Section 3 cellularautomata with multiple speeds ( MS-CA ) and the corresponding FSSP will be introduced.Since most algorithms for the FSSP make heavy use of signals, we have a closer look at1hat can happen with them in
MS-CA . In Section 4 some lower bounds for the synchro-nization times will be derived. Finally, in Section 5 an algorithm for the FSSP in
MS-CA will be described in detail. Z denotes the set of integers, N + the set of positive integers and N = N + ∪ { } . For k ∈ N and M ⊂ Z we define k · M = { km | m ∈ M } . For k ∈ N + let N k = { i ∈ N + | ≤ i ≤ n } .The greatest common divisor of a set M of numbers is abbreviated as gcd M and theleast common multiple as lcm M .We write B A for the set of all functions f : A → B . The cardinality of a set A isdenoted | A | .For a finite alphabet A and k ∈ N we write A k for the set of all words over A havinglength k , A ≤ k for S ki =0 A i , and A ∗ = S ∞ i =0 A i . For a word w ∈ A ∗ and some k ∈ N thelongest prefix of w which has length at most k is denoted as pfx k ( w ) , i. e. pfx k ( w ) is theprefix of length k of w or the whole word w if it is shorter than k . Analogously sfx k ( w ) isused for suffixes of w .Usually cellular automata are specified by a finite set S of states, a neighborhood N ,and local transition function f : S N → S . In the present paper we will only considerone-dimensional CA with Moore neighborhood N = {− , , } with radius .Therefore a (global) configuration of a CA is a function c : Z → S , i. e. c ∈ S Z . Givena configuration c and some cell i ∈ Z the so-called local configuration observed by i in c isthe mapping g : N → S : n c ( i + n ) and denoted by c i + N . In the standard definitionof CA the local transition function f induces a global transition function F : S Z → S Z describing one step of the CA from c to F ( c ) by requiring that F ( c )( i ) = f ( c i + N ) holdsfor each i ∈ Z .By contrast in MS-CA it is not possible to speak about the successor configuration. Therelevant definitions will be given and discussed in the next section.Before, we quickly recap the
Firing Squad Synchronization Problem (FSSP). A CA solv-ing the FSSP has to have a set of states S ⊇ { , G , _ , F } . For n ∈ N + the problem instanceof size n is the initial configuration I n = c where c ( i ) = if i ≤ c (1) = G c ( i ) = _ if < i ≤ n c ( i ) = if i > n Cells outside the segment between and n are in a state which is supposed to be fixedby all transitions. State G is the initial state for the so-called general , state _ is the initialstate for all other cells, and state F indicates the cells have been synchronized.The goal is to find a local transition function which makes the CA transit from each I n to configuration F n in which all cells , . . . , n are in state F (the other cells still all instate ) and no cell ever was in state F before. In addition the local transition function hasto satisfy f ( _ , _ , _ ) = _ and f ( _ , _ , ) = _ , which prohibits the trivial “solution” to haveall cells enter state F in the first step and implies that “activities” have to start at the G -celland spread to other cells from there.Within the framework of synchronization let’s call the set supp( c ) = { i ∈ Z | c ( i ) = } the support of configuration c . As a consequence of all these requirements during acomputation starting with some problem instance I n all subsequent configurations havethe same support N n .It is well known that there are CA which achieve synchronization in time n − (for n ≥ ) and that no CA can be faster, not even for a single problem instance.2 CA with multiple speeds
MS-CA
A cellular automaton with multiple speeds (
MS-CA ) is a specialization of standard CA.Its specifiation requires a finite set P ⊆ N + of so-called possible periods (in [2] they arecalled lengths of update cycles). Before a computation starts a period has to be assignedto each cell which remains fixed throughout the computation. Requiring P to be finite ismeaningful for several reasons:• It can be shown [2, Prop. 3.1] that otherwise it is impossible to solve the FSSP for MS-CA with one fixed set of states.• We want that each cell can make its computation depend on its own period andthose of its neighbors to the left and right, but of course the analogue of the localtransition function should still have a finite description. To this end we want to beable to assume that each has its own period stored in its state.For the rest of the paper we assume that the set of states is always of the form S = P × S ′ ,and that the transition function never changes the first component. We will denote theperiod of a cell i as p i . For s = ( p, s ′ ) ∈ S = L × S ′ we write π p and π s for the projectionson the first and second component and analogously for global configurations. For a globalconfiguration c ∈ S Z we write P ( c ) = { p i | i ∈ supp( c ) } (or simply P if c is clear fromthe context) for the set of numbers that are periods of cells in the support of c ; cells in state can be ignored because they don’t change their state by definition.For MS-CA it is not possible to speak about the successor configuration. Instead itis necessary to know how many time steps have already happened since the CA started.Borrowing some notation from asynchronous CA, for any subset A ⊆ Z of cells and any c ∈ S Z denote by F A ( c ) the configuration reached from c if exactly the cells in A updatetheir states according to f and all other cells do not change their state: ∀ i ∈ Z : F A ( c )( i ) = ( f ( c i + N ) if i ∈ Ac ( i ) if i / ∈ A (Thus, the global transition function of a standard CA is F Z .) Given some MS-CA C andsome time t denote by A t = { i ∈ Z | t mod p i } the set of so-called active cells at time t . Then, for each initial configuration c the computation resulting from it is the sequence ( c , c , c , . . . ) where c = c and c t +1 = F A t ( c t ) for each t ∈ N . In particular this means,that at time t = 0 all cells will update their states according to f . More generally this istrue for all t ∈ p c · N , where p c is the least common multiple of all p ∈ P , i. e. all t thatare a multiple of all elements in P . We will speak of a common update when t = p c .The observations collected in the following lemma are very simple and don’t need anexplicit proof. Lemma 1.
Let g = gcd P be the greatest common divisor of all p ∈ P and let P ′ = { p/g | p ∈ P } . Let A t = { i ∈ Z | t mod p i } as before.1. For each t / ∈ g · N + the set A t is empty.2. For each computation C = ( c , c , . . . ) for each k ∈ N c kg +1 = c kg +2 = · · · = c kg + g .3. The computation C ′ = ( c , c g , c g , . . . ) results when using P ′ instead of P and exactlythe same local transition function. . When all cells involved in a computation C have the same period p , C is simply a p times slower “copy” of the computation in a standard CA. Therefore the interesting cases are whenever | P | ≥ and gcd P = 1 . We will assumethis for the rest of the paper without always explicitly mentioning it again. Fact 2. If | P | ≥ and gcd P = 1 then there is at least one odd number p that can be usedas a period. MS-CA
Since almost all CA algorithms for the synchronization problem make extensive use ofsignals, they are also our first example for some
MS-CA . Figure 1 shows a sketch of aspace-time diagram. Time is increasing in the downward direction (throughout this paper).When a cell is active at time t a triangle between the old state in row t and the new statein row t + 1 indicates the state transition. The numbers in the top row are the periods ofthe cells.At this point it is not important to understand how an appropriate local transitionfunction could be designed to realize the depicted signal. But, assuming that this can bedone, the example has been chosen such that the signal is present in a cell i for the firsttime exactly p i steps after it was first present in the left neighbor i − . > common update > > > > > > > common update > > > > > > > common update > > Figure 1: Sketch of how a basic signal could move right in a
MS-CA as fast as possible. Thenumbers in the top row are the periods of the cells. Time is going down. Triangles indicateactive state transitions, i. e. when they are missing the state has to stay the same.One possibility to construct such computations is the following. Putting aside an ap-propriate number of cells at either end, the configuration consists of blocks of cells. Ineach block all cells have some common period p and there are k = p c /p cells in the block.4or example, in Figure 1 p c = 6 (at least one can assume that, since only periods , , and are used) and there are cells with period and cells with period . Let’s number thecells in such a block from to k .Assume that a signal should move to the right as fast as posible. For each such blockthe following holds: If the signal appears in the left neighbor of such a block for the firsttime after a common update at some time t , then it can only enter cell of the block attime t + p , cell of the block at time t + 2 p etc., and hence the last cell k of the block attime t + kp = t + p c . That cell is the left neighbor of the next block. Hence by inductionthe same is true for every block and the passage of the signal through each block will take p c steps. This happens to be the sum of all periods of cells in one block.Unfortunately there are also cases in which signals are not delayed by the increase ofthe periods of some cells. Figure 2 shows a situation where periods and are assignedto subsequent cells alternatingly. As can be seen, a signal can move from each cell to nextone in every step, including a change of direction at the right border. G > > > > > > > > > > > < < < < < Figure 2: Basic signal first moving right and bouncing back at the border with speed although half of the cells has only period . MS-CA
In the standard setting for each n there is exactly one problem instance of the FSSP oflength n .In MS-CA we will assume that the set of states is always of the form S = P × S ′ . Wewill call a configuration c ∈ S Z a problem instance for the MS-FSSP if two conditions aresatisfied:• π s ( c ) is a problem instance for the FSSP in standard CA.• The period of all border cells is the same as that of G -cell .By definition border cells never change their state, no matter what their period is. Thesecond condition just makes sure that formally a period is assigned even to border cells,5ut this does not change the set of periods that are present in the cells of the support thatdo the real work.Now for each size n there are | P | n problem instances of the MS-FSSP .It should be clear that the minimum synchronization time will at least in some casesdepend on the periods. Assume that there are two different p, q ∈ P , say p < q . Then,when all cells have p i = p synchronization can be achieved more quickly than whenall cells have p i = q . A straightforward transfer of a (time optimal) FSSP algorithm forstandard CA (needing n + O (1) steps) yields a MS-CA running in time (2 n − p . This isfaster than any MS-CA with uniform period q can be which needs (2 n − q (see Section 4). MS-CA
In the case of standard CA the argument used for deriving lower bounds for the synchro-nization time uses the following observation. Whenever an algorithm makes the leftmostcell fire at some time t , it can only be correct if changing the border state in cell n + 1 to state _ (i. e. increasing the size of the initial configuration by ) can possibly (and in factwill) have an influence on the state of cell at time t . If t ≤ n − changing the state atthe right end cannot have an influence on cell . But then adding n cells in state _ to theright will still make cell enter state F at time t , while the now rightmost cell n will nothave had any chance to leave its state.This argument can of course be transferred to MS-CA , and it means that one has tofind out the minimum time to send a signal to the rightmost cell of the support and backto cell . Theorem 3.
For every
MS-CA solving the
MS-FSSP there are constants a > and d suchthat for infinitely many n ≥ there are at least a n problem instances c of size n such that C needs at least n X i =1 p i ! − d steps for synchronization of c .Proof. The example in Figure 1 can be generalized.We first define a set M of periods we will make use of. According to Fact 2 the set P ′ = { p ∈ P | p is odd } is not empty. If | P ′ | ≥ then let M = P ′ and q = max M . If | P ′ | = 1 then let M = P ′ ∪ { q } where q = max( P \ P ′ ) (choosing the maximum is notimportant; we just want to be concrete). Let m c = lcm M .We will use blocks of length b p = m c /p of sucessive cells with the same period p (asin Figure 1). As will be seen it is useful to have at least one odd b p . Indeed, b q = m c /q isodd (because q is the only possibly even number in M ).Since there are at least different numbers p ∈ M , there are also at least differentblock lengths in B = { b p | p ∈ M } , denoted as b and b ′ .Consider now all problem instances similar to Figure 1. Let m ∈ N + • The periods of the first cells are the same but otherwise arbitrary.• The rest of the cells is partitioned into m blocks. There are m blocks consistingof b cells and the period of all cells in that block is m c /b and there are m blocksconsisting of b ′ cells and the period of all cells in that block is m c /b ′ .• At the right end of the instance there is a segment consisting of h cells of period q where h = ⌊ b q / ⌋ . Since b q is odd, one has h + 1 = b q .6or each m the total size of the problem instances is m ( b + b ′ )+1+ h which is linearin m , and there are (cid:0) mm (cid:1) different arrangements of the blocks. This number is known tobe larger than m / (2 m + 1) (proof by induction). Formulated the other way around forthese problem sizes n there is a number of problem instances which exponential in m andhence also in n (for some appropriately chosen base a > ).It remains to estimate the synchronization time for these problem instances. As alreadydescribed in Subsection 3.2 a signal that is supposed to first move to the right border asfast as possible and then back to cell will arrive in cell after the first (common) update.From that time on for each block it will take exactly m c steps to “traverse” each blockwhich is also the sum of all periods of the cells in the block.For the passage through the last h + 1 cells forth and back have a look at Figure 3. Eachcell is passed twice, once when the signal moves right and once when it moves back to theleft, each time for q steps. The only exception is the rightmost cell, where the signal staysonly for the duration of period, i. e. q steps. Altogether these are (2 h + 1) q = m c stepswhich is exactly the same number of steps as for each full block to the left. Consequentlythe position of the signal moving back to the left is for the first time in the cell to the rightof a full block immediatly after a common update.Summing up all terms for the movement of a signal from the very first cell to the rightborder and back results in a time of t = 1 + m · m c + m · m c + h · q + q + h · q + m · m c + m · m c + p + 1 This contains twice the term t ′ = m · m c + m · m c + h · q = n − X i =3 p i = n X i =1 p i ! − p − p − p n hence t = 1 + t ′ + p n + t ′ + p + 1 = 1 + 2 n X i =1 p i ! − p − p − p n + p n + p + 1= 2 n X i =1 p i ! − p − p − p n + 2 as claimed.It can be observed that in the case that all p i = 1 the formula becomes the well-knownlower bound of n − .In the following section we will describe an algorithm which achieves a running timewhich is slower than the lower bound in Theorem 3 by only a constant summand. MS-CA
To the best of our knowledge the paper by Manzoni and Umeo [2] is the only work on theFSSP in one-dimensional
MS-CA until now. They describe an algorithm which achievessynchronization in time n · p max where p max = max { π p ( c ( i )) | ≤ i ≤ n } is maximumperiod used by some cell in the initial configuration c .Below we will describe an algorithm which proofs the following:7 > commonupdate > > > > > > > commonupdate > > > > < < commonupdate < < < < < < commonupdate < < < < < < Figure 3: Reflection of a “fast” signal at the right border. We use m c = 6 , q = 2 , hence b q = 3 , h = 1 and h + 1 = 2 . Therefore at the right end there are always h + 1 = 2 cells with period . We have introduced small spaces to make the boundaries of the lastfull block of cells with period better visible. On the left hand side the last full block has cells of period and on the right hand side the last full block has cells of period . Formore details see the proof of Theorem 3. Theorem 4.
For each P there is a constant d and an algorithm which synchronizes each MS-FSSP instance c of size n with periods p , . . . , p n ∈ P in time n X i =1 p i ! + d (1)In the case of standard CA all p i = 1 and formula (1) becomes n + d which is only aconstant number of d + 2 steps slower than the fastest algorithms possible.8 .1 Core idea for synchronization In the proof of a lower bound above we have constructed problem instances consistingof blocks consisting of cells with identical period. The arrangement was chosen in such away that a signal, even if it were to move as fast as possible, would have to spend p steps ina cell with period p before moving on. In a standard CA this is the time a signal with speed needs to move across p cells. Which leads to the idea to have each cell with period p ofthe MS-CA simulate p cells of a standard CA (solving the FSSP). We’ll call the simulatedcells virtual cells or v-cells for short, and where disambiguation seems important call thecells of the MS-CA host cells . States of v-cells will be called v-states.
From now on, assume that we are given some standard CA for the standard FSSP. Its setof states will be denoted as Q . Algorithm 5.
As a first step we will sketch the components of the set S of states of the MS-CA .We already mentioned in Subsection 3.3 that we assume S to be of the form S = P × S .Let t c = lcm P denote the least common multiple of all p ∈ P . Since in the algorithmbelow host cells will have to count from up to t c − , we require that the set of statesalways contains a component T = { i ∈ Z | ≤ i < t c } . Hence S = P × T × S , andwe assume that the transition function will in each step update the T -component of a cellby incrementing it by its period, modulo t c . Imagine that this is always “the last part” of atransition whenever a cell is active. Thus an active cell can identify the common updatesby the fact that its T -component is . But of course it is equally easy for an active cell toidentify an activation that is the last before a common update.Next, each host cell will have to store the states of some v-cells. As will be seen thiswill not only comprise the states of the p v-cells it is going to simulate, but also the statesof v-cells simulated by neighboring host cells; we will call these neighboring v-cells . Tothis end we choose S = P × T × Q ≤ t c × Q ≤ p max × Q ≤ t c × S . We will denote the newlyintroduced components of a cell as x , y , and z . In x a host cell will accumulate the statesof more and more neighboring v-cells from the left. Analogously, in z a host cell willaccumulate the states of more and more neighboring v-cells from the right. In the middlecomponent y a host cell will always store the states of the p v-cells it has to simulate itself.The simulation will run in cycles each of which is t c steps long and begins with a com-mon update. During one cycle a cell with period p will be active t c /p times. Whenever ahost cell is active it collects as many neighboring v-states as possible, but at most t c fromeither side. More precisely this is done as depicted in the following table: ( x − , y − , z − ) ( x , y , z ) ( x , y , z )(sfx t c ( x − y − ) , y , pfx t c ( y z ) In other words, the states of the own v-cells are not changed, but more and moreneighboring v-states are being collected. We will show in Lemma 6 below that during thelast activation of a cycle, i. e. the last activation before a common update, after havingcollected neighboring v-states, the length of the x and z components are in fact t c and notshorter. It is therefore now possible for each host cell to replace the v-states of its p v-cellsby the v-states those v-cells would be in after t c steps. The x and z components are resetto the empty word. 9t is during the last activation of a cycle that a host will compute state F for each of itsv-cells. The immediately following activation is a common update for all host cells. Theywill simultaneously detect that their v-cells reached the “virtual F ” and all enter the “realfiring state”.For a proof of Theorem 4 only the following two aspects remain to be considered. Lemma 6.
After one cycle of algorithm 5 each host cell will have collected the states of t c neighboring v-cells, to the left and to the right.Proof. Without loss of generality we only consider the case to the left. We will prove byinduction on the global time that for all ¯ t ∈ N the following holds:For t = ¯ t mod t c for each cell with components ( x, y, z ) as above and with period p and for all j ∈ N with ≤ j ≤ t : If jp = t then the cell is active and after the transition | x | ≥ min( jp, t c ) .If ¯ t = 0 then t = 0 , j = 0 , and obviously | x | ≥ holds.Now assume that the statement is true for all times less or equal some ¯ t − . Again,nothing has to be done if t = 0 ; assume therefore that t > .Consider a cell with components ( x, y, z ) and period p and its left neighbor with com-ponents ( x ′ , y ′ , z ′ ) and period q , and therefore | y ′ | = q . Let ¯ t ′ be the time when the leftneighbor was active for the last time before ¯ t , and let t ′ = ¯ t ′ mod t c . Then t ′ < t , t ′ = kq for some k , and since it was the last activation before t , t ′ + q = ( k + 1) q ≥ t . By in-duction hypothesis the left neighbor already had | x ′ | ≥ min( kq, t c ) . The new x of the cellunder consideration is x = sfx t c ( x ′ y ′ ) which then has length at least min( t c , | x ′ y ′ | ) ≥ min( t c , min( kq, t c ) + q ) = min( t c , ( k + 1) q ) . Since ( k + 1) q ≥ jp the proof is almostcomplete.Strictly speaking the above argument does not hold when the left neighbor is a bordercell. But in that case a cell can treated by its neighbor as if that has already x filled with t c states . Lemma 7.
For a problem instance c of size n with periods p , . . . , p n the time needed byAlgorithm 5 for synchronization can be bounded by n X i =1 p i ! + d . (2) Proof.
The total number of v-cells simulated is k = P ni =1 p i . A time optimal FSSP al-gorithm for standard CA needs k − steps for the synchronization of that many cells.During each cycle of length t c exactly t c steps of each v-cell are simulated, except possiblyfor the last cycle. During that, the F v-state may be reached in less than t c steps.Hence the total number of steps is t c ·⌊ (2 k − /t c ⌋ + t c +1 ≤ k + d = (2 P ni =1 p i )+ d for some appropriately chosen constant d .To sum up taking together Theorem 3 and Theorem 4 one obtains Corollary 8.
For each P there is a constant d such that there is an MS-CA for the
MS-FSSP which needs synchronization time (2 P ni =1 p i ) + d and for infinitely many sizes n there are a n problem instances ( a > ) for which there is a lower bound on the synchronization timeof (2 P ni =1 p i ) − d . Outlook
In this paper we have described a
MS-CA for the synchronization problem which is some-times faster and never slower than the one by Manzoni and Umeo. For a number of probleminstances which is exponential in the number of cells to be synchronized the time neededis close to some lower bound derived in Section 4. An initial version of the proof could beimproved thanks to an anonymous reviewer.While higher-dimensional
MS-CA have been considered [1], in the present paper wehave restricted ourselves to the one-dimensional case. In fact it is not completely clear howto generalize the algorithm described above to two-dimensional CA. The
MS-CA describedin this paper it is essential that• from one cell to another one there is only one shortest path• and it is clear how many v-cells a cell should simulate.The generalization of this approach to -dimensional CA is not obvious for us. In additionthe derivation of reasonably good lower bounds on the synchronization times seem to bemore difficult, but if one succeeds that might give a hint as to how to devise an algorithm.As a matter of fact, the same happened in the one-dimensional setting.Similarly it is not clear how to apply the ideas in the case of CA solving some other problem, not the FSSP, because only (?) for the FSSP it is obvious which state(s) to choosefor the v-cells in the initial configuration.Both aspects, algorithms and lower bounds, are interesting research topics but needmuch more attention. Even in the -dimensional case there is still room for improvementas has been seen in Figure 2.It remains an open problem how cells with different update periods should be orderedto ensure that they can be synchronized as soon as possible. References [1] Manzoni, L., Porreca, A.E., Umeo, H.: The firing squad synchronization problem onhigher-dimensional CA with multiple updating cycles. In: Fourth International Sym-posium on Computing and Networking, CANDAR 2016, Hiroshima, Japan, November22-25, 2016, pp. 258–261 (2016)[2] Manzoni, L., Umeo, H.: The firing squad synchronization problem on CA with multipleupdating cycles. Theor. Comput. Sci. , 108–117 (2014)[3] Umeo, H.: Firing squad synchronization problem in cellular automata. In: Encyclope-dia of Complexity and Systems Science, pp. 3537–3574. Springer (2009)[4] Umeo, H.: How to synchronize cellular automata – recent developments –. Fundam.Inform.171