A Simulation of Oblivious Multi-Head One-Way Finite Automata by Real-Time Cellular Automata
aa r X i v : . [ n li n . C G ] D ec Journ´ees Automates Cellulaires 2010 (Turku), pp. 65-75
A SIMULATION OF OBLIVIOUS MULTI-HEAD ONE-WAYFINITE AUTOMATA BY REAL-TIME CELLULAR AUTOMATA
ALEX BORELLOLaboratoire d’Informatique Fondamentale de Marseille, 39 rue Fr´ed´eric Joliot-Curie, 13453Marseille, France
E-mail address : [email protected] Abstract.
In this paper, we present the simulation of a simple, yet significantlypowerful, sequential model by cellular automata. The simulated model is calledoblivious multi-head one-way finite automata and is characterised by having itsheads moving only forward, on a trajectory that only depends on the length of theinput. While the original finite automaton works in linear time, its correspondingcellular automaton performs the same task in real time, that is, exactly the lengthof the input. Although not truly a speed-up, the simulation may be interestingand reminds us of the open question about the equivalence of linear and real timeson cellular automata.
1. Introduction
Cellular automata (CA for short), first introduced by J. von Neumann [7] asself-replicating systems, are recognised as a major model of massively parallel com-putation since A. R. Smith, in 1969, used this Turing-complete model to computefunctions [8]. Their simple and homogeneous description as well as their ability todistribute and synchronise the information in a very efficient way contribute to theirsuccess. However, to determine to what extent CA can fasten sequential computa-tion is not a simple task.As regards specific sequential problems, the gain in speed by the use of CA ismanifest [1, 2, 3]. But when we try to get general simulations, we have to face thedelicate question of whether parallel algorithms are always faster than sequentialones. An inherent difficulty arises from the fact that efficient parallel algorithmsmake often use of techniques that are radically different from the sequential ones.There might also exist a faster CA for each singular sequential solution whereas nogeneral simulation exists.Hence, no surprise: the known simulations of Turing machines by CA provideno parallel speed-up. The early construction of Smith [8] simulates one step of theTuring machine by one step of the CA. Furthermore, no faster simulations havebeen reported yet, even for almost all restricted variants. In particular, we do not
F.1.1, F.1.2.
Key words and phrases: simulation, oblivious multi-head one-way finite automata, cellular au-tomata, real time.
656 A. BORELLO know whether any finite automata with k heads can be simulated on CA in less than O ( n k ) steps, which is the sequential time complexity.We will not give answers to such issues here, but we shall examine in this contexta simple sequential model, called oblivious multi-head finite automata. This devicewas introduced by M. Holzer in [4] as multi-head finite automata with an additionalconstraint of obliviousness: the trajectory of the heads only depends on the lengthof the input. As emphasised in [4], such finite automata lead to significant compu-tational power: they characterise parallel complexity NC . Their properties havebeen further discussed in [5].We will focus on the one-way version of this model, that is, for which the readingheads can only move forward (that makes it strictly less powerful). While no truespeed-up can be hoped for, as these one-way finite automata already perform theirtask in linear time, we will describe a simulation of them by real-time CA, that is, CAworking in linear time with a multiplicative constant equal to 1. Whereas specifyingthis constant is usually irrelevant, CA represent a particular case amongst modelsof computation, as we do not know whether linear and real times are equivalent forit. The article is organised as follows: section 2 introduces the two models consid-ered, section 3 displays some of their features and abilities and section 4 presentsthe simulation algorithm.
2. Definitions
Given an integer k ≥
1, a one-way k -head finite automaton is a finite automatonreading an input word using k heads that can move to the right or stand still. Definition 2.1.
A (deterministic) one-way multi-head finite automaton (1DFA( k )for short) is a septuple (Σ, Q, ⊳ , q , Q a , k, δ ), where Σ is a finite set of input symbols (or letters ), Q is a finite set of states , ⊳ / ∈ Σ is the (right) end-marker , q ∈ Q isthe initial state, Q a ⊆ Q is the set of the accepting states, k ≥ numberof heads and δ : Q × (Σ ∪ { ⊳ } ) k → Q × { , } k the transition function ; 1 meansto move the head one letter to the right and 0 to keep it on its current letter.For the heads to be unable to move beyond the end-marker, we require that if δ ( q, a , . . . , a k ) = ( q ′ , m , . . . , m k ), then for any i ∈ J , k K , a i = ⊳ ⇒ m i = 0.A configuration of a 1DFA( k ) on an input word w ∈ Σ n at a certain time t ≥ p, q ) where p ∈ J , n K k is the position of the multi-head and q the currentstate. The computation of such a device on this input word starts with all heads onthe first letter, and ends when all heads have reached the end-marker. If the currentstate is then within Q a , the word is said to be accepted, otherwise it is rejected.The language L ( F ) recognised by a 1DFA( k ) F is the set of the words accepted by F . One can notice a 1DFA( k ) ends its computation in linear time.We will focus now on data-independent 1DFA (1DIDFA), a particular class of1DFA for which the path followed by the heads only depends on the length of theinput word, not on the letters thereof. ROM 1DIDFA TO REAL-TIME CA 67
Definition 2.2.
Given k ≥
1, a 1DFA( k ) F is said to be oblivious (or data-independent ) if there exists a function f F : N → N k such that the position ofits multi-head at time t ∈ N on any input word w is f F ( | w | , t ). A cellular automaton is a parallel synchronous computing model consisting ofan infinite number of finite automata called cells which are distributed on Z andshare the same transition function, depending on the considered cell’s previous stateas well as its two neighbours’. Definition 2.3. A cellular automaton is a quintuple (Σ , Q, , Q a , δ ), where Σ isthe finite set of input symbols (or letters ), Q ⊃ Σ is the finite set of states and δ : Q → Q the transition function . ∈ Q \ Σ is a particular quiescent state,verifying δ ( , , Q a ⊆ Q is the set of the accepting states.A configuration is a function C : Z → Q . A site is a cell at a certain time stepof the computation we consider; h c, t i will denote the state of the site ( c, t ) ∈ Z × N .The computation of a CA C on an input word w of size n ≥ n − C w associated to w . Then the cells updatein parallel their respective states according to δ : for all ( c, t ) ∈ Z × N , h c, t + 1 i = δ ( h c − , t i , h c, t i , h c + 1 , t i ).This input word is accepted in time t ≥ n if and only if cell 0 (the origin) isin an accepting state at time t . The language L τ ( C ) recognised by the automatonin time τ : N → N is the set of the words w it accepts in time τ ( | w | ). If τ is theidentity function Id, L τ ( C ) is said to be recognised in real time .Real time represents for CA the most simple time complexity that is nontrivial,in the sense it is the minimal time required for the output to depend on all lettersof the input. Yet, it is significantly powerful, as we do not even know whether lineartime can achieve strictly more. Real time had already been evoked in [8].
3. Preliminaries
We would like to simulate a 1DIDFA on a CA as fast as possible. A computationof a general 1DFA requires a number of time steps that is linear in the size of theinput word. Whereas it is rather easy for a CA to simulate such a device in lineartime, there is a priori no obvious way to reduce this time bound. But we can do it inthe case of DIDFA by taking the constraint of obliviousness into account. Though,before performing such a simulation, we should detail some useful features of DIDFAand CA. Notice CA are defined herein with the standard neighbourhood of radius 1, that is, such thatthe state of a cell at time t + 1 depends on the states at time t of this same cell and its two nearestneighbours. Let F = (Σ , Q, ⊳ , q , Q a , k, δ ) be a 1DIDFA, n ≥ w ∈ Σ n be a word of size n . Let us look at the computation of F on input word w . For themulti-head is composed of k heads, it can be regarded as a device moving one pointat a time in any direction within the set W = J , n K k .As F is data-independent, we can separate the path P taken by the multi-headfrom the consecutive states of the automaton (depending on the letters of w ). Inother words, we can take a look at the path of the multi-head on input word a n , forany a ∈ Σ; it will be the same for w . Hence, the trajectory will become periodicafter at most | Q | moves, until one head reaches an end-marker. Then, while thelatter head does not move any longer, after another | Q | moves the trajectory willbecome periodic again, and so on until all heads have reached the end of the inputword. The key points of W where a head reaches the end-marker will be useful to usand denoted as finite sequence ( p i ) i ∈ J ,k K , with p = (0 , . . . ,
0) and p k = ( n, . . . , n ). Some notations.
For convenience, we number the heads such that for all i ∈ J , k − K , head i is the one that reaches the end-marker as the multi-head arrives at keypoint p i +1 . For all i ∈ J , k K and all j ∈ J , k − K , we denote the ( j +1)-th coordinateof p i by p i,j , and if i < k name P i ⊆ P the portion of trajectory that lies between p i and p i +1 . p p p p P P P Figure 1: A representation of W for k = 3. The periodic parts of the path of themulti-head are drawn in black. A given computation of a CA can be easily represented by drawing successiveconfigurations each one above its predecessor. We thus obtain a space-time diagram ,composed of sites, of which we only need to represent those in a non-quiescent state.We will often have to perform several rather independent computations at thesame time; this can easily be done by a ‘product’ automaton which works with afinite number of layers , each one of which supports a specific computation. Althoughrather independent, the layers can communicate between one another to exchangeinformation, as any cell can see all of them.
ROM 1DIDFA TO REAL-TIME CA 69
Compression of the input word.
In section 4, we will need to compress the input bysome rational factor ρ ≥
2. This is easy to do with a CA. It consists in having theinput word written on the (discrete) straight line of equation t − ρ − c + 1),where t represents the time and c a cell, as shown on fig. 2. As the concerned sites‘know’ that they lie on this straight line, a computation using the compressed inputword can then occur within the triangle of real time (in light grey on fig. 2). Acceleration by a constant.
For any constant T ∈ N and any CA C , there exists aCA C ′ such that L Id ( C ′ ) = L Id+ T ( C ). In other words, to prove that a given languageis CA-recognisable in real time, it suffices to exhibit a CA recognising it in timeId + T . For more details, one can refer to [6]. n − t − ρ − c + 1) ρ = 2 n − t − ρ − c + 1) ρ = 5 / ← − t Figure 2: Schematic space-time diagrams during which input word w is compressedby rational factor ρ . Each sequence of linked dots represent a letter of w . The sites containing the compressed version of w are encircled. Noticethat even though it seems the letters could be shifted one time step earlier,this first step is in fact used to mark the last letter; it is necessary becauseof rounding issues.
4. Simulation
Theorem 4.1.
Given k ≥ , for any DIDFA( k ) F recognising a language L , thereexists a CA C recognising L in real time. The rest of this paper will be devoted to the proof of this theorem. We assumenow that we have a 1DIDFA( k ) F = (Σ, Q, ⊳ , q , Q a , k, δ ). We will define a CA C = (Σ , Q ′ , , Q ′ a , δ ′ ) such that L Id ( C ) = L . Instead of giving the full description ofits state set and transition function, we will describe its behaviour on an arbitraryinput word w ∈ Σ n , given an integer n ≥
1. Within this coming description (andsimilarly in the whole article) the terms ‘constant’ and ‘finite’ refer to quantitiesthat do not depend on n . The general principle of the simulation is rather simple: instead of having k headsmoving along w , we will have (at least) k copies of w shifted over a segment S ofsites (of strictly increasing time steps) so that each site sees the correct letters of w .Moreover, the letters for each head will be seen in reverse order compared to what F does.Each part P i of the trajectory of the multi-head can be assimilated to a discretestraight line, with no aperiodic part. Indeed, as illustrated in fig. 3, the distance(in letters) between any point of P i and the point of this line corresponding to sametime step is bounded by some value K = O ( | Q | ). Thus, during the execution of C over w , before doing anything, all cells bearing the input will gather the letters oftheir K nearest neighbours. This is done in time K . p i p i +1 P i O ( | Q | ) O ( | Q | ) O ( | Q | ) Figure 3: P i lies within a band of width O ( | Q | ), here drawn in white. It can hencebe assimilated to a (discrete) straight line, provided a counter (within theshifting copies of w during the execution of C ) indicates for each pointof this line the corresponding position within the period of P i . Noticethat although the band can broaden as i increases, this index only risesup to a constant value, so that the maximal width K remains boundedindependently of the size of the input. We will set S = { ( c, n − − c + T ) : c ∈ J , n − K } , where T , which is to bedefined (cf. subsection 4.3), is an integer greater than K that does not depend on n .The result of the execution is to appear on site s = (0 , n − T ). To know whichspeed the copies of w should be shifted at over each site of S , the latter segmentshould be divided into parts S i , each one of which corresponds to part P i of P . Inother words, we want to mark some key sites s i = ( c i , n − − c i + T ) ∈ S thatrepresent key points p i ∈ P . The main difficulty is that key cell c i has to representcoordinate p i,j for any head j .For this purpose, we observe first that for all ( i, j ) ∈ J , k K × J , k − K , since eachpart of P is as illustrated in fig. 3, there exists α i,j ∈ Q ∩ [0 ,
1] such that | p i,j − α i,j n | ≤ K , whatever the size n of the input. One can notice that we automatically have α ,j = 0 and α i,j = 1 for all i > j , and that ( α i,j ) i is an increasing sequence for all j .Then, we provisionally assume that α j,j = 0 ⇒ j = 0, and set key cell c i = ⌊ α i n ⌋ ,where α i = Q k − j = i α j,j . The case wherein there exists some j that does not verifythis hypothesis will be treated in subsection 4.6. ROM 1DIDFA TO REAL-TIME CA 71
Now, how to mark site s i ? No trouble if i = 0, as c is the origin. If i >
0, itis also feasible: it suffices to send a signal from the origin at speed ς i = α i − α i ≤ α i , we have divided by 2 in case some keycells would be too far from the origin to be marked in time (in CA configurations,information cannot travel at speed of absolute value strictly greater than 1). Allour computation has hence to be performed within half as much space than what S provides. In any case, the definition of α i is based on the assumption that thecopies of the input shifting over S i are compressed versions of w . s s s s S c c c n − t = 0 t = Kt = Tt = n − T { { { S S S D D D Figure 4: Schematic space-time diagram of the marking of cells c i , for k = 3.Notice that ( c i ) i = ( ⌊ α i n ⌋ ) i is always an increasing sequence (since α i = α i,i α i +1 ≤ α i +1 ), with c = 0 and c k = ⌊ n ⌋ . For each i ∈ J , k K , we want to compress input word w (on a specific layer ℓ i − corresponding to head i −
1) by factor α i as illustrated in fig. 2, that is, on somestraight line D i of direction vector (1 , ς i ) = (1 , α i − D i such that it crosses the origin at any time t > ⌊ ς i ⌋ . Thus, we will make allsuch lines cross the origin at the same time T ∈ N . As ( ς i ) i is a decreasing sequenceand as we have done some computations in time K beforehand, we set T = K + ⌊ ς ⌋ .Hence, we have finally set D i to be the line of equation t − T = cς i (cf. fig. 4). Consider some head j ∈ J , k − K and an integer i ∈ J , j K . On layer ℓ j ,which corresponds to this head, we want to shift the compressed input at someconstant speed ς i,j ∈ ] − , ς i ] between D i +1 and D i , so that the correct letters passover S i . One can notice ς j,j = 0 by the definition of α j +1 and α j . But this notnecessarily the case when i < j . Indeed, ς i,j should be defined as equal to β i,j − β i,j ,with β i,j = α i − α i,j α i +1 − α i α i +1 ,j − α i,j if α i +1 ,j − α i,j > β i,j = α i otherwise. This way, ς i,j is the speed of the signal we would use to mark cell c i,j = ⌊ β i,j n ⌋ (cf. fig. 5). c n − t = 0 t = Kt = Tt = n − T ( ℓ ) − → ς , c n − − → ς , − → ς , ( ℓ ) cc , = ⌊ β , n ⌋ n − − → ς , − → ς , − → ς , ( ℓ ) p p p p Figure 5: Different compressed copies of the input shifted over S , with the trajectoryof the letter initially contained by some cell c displayed. Layer ℓ j corre-sponds to head j < k = 3. In this example, we have ( α , , α , , α , ) =( , , ). Hence, ( α , α , α , α ) = (0 , , , ) and β , = . Now that we have ensured the correct letters are seen in reverse order for eachhead on each segment S i , how do we get site s to know the result of the executionof F over w ? All we need to know is whether the final state of F is accepting, thatis, belongs to Q a .Let p be a point of P such that p = p . One can observe that if we know q , thestate F is in when its multi-head is on p , as well as the letter l j ∈ Σ each head j reads when the multi-head lies on the predecessor p ′ of p , then we can compute ROM 1DIDFA TO REAL-TIME CA 73 the possible states of F at point p ′ . That is, the subset Q ′ of Q such that for all q ′ ∈ Q , δ ( q ′ , l , . . . , l k − ) = ( q, p − p ′ ) ⇔ q ′ ∈ Q ′ . Likewise, if we know F is in astate of Q ′′ ⊆ Q at point p , we can determine the subset Q ′ such that for all q ′ ∈ Q , δ ( q ′ , l , . . . , l k − ) ∈ Q ′′ × { p − p ′ } ⇔ q ′ ∈ Q ′ . We will refer to this process as reading δ backward .Let then s = ( c + 1 , t −
1) be a site of S . As the letters it sees come fromcompressed versions of w , it can represent a (finite) range of points of P insteadof only one, depending on the part S i it belongs to. Now suppose it contains somesubset of Q for each of the successive points of P it represents. Suppose also thesesubsets are consistent with one another (regarded as the possible states F is in ateach of these points). Then successor site s ′ = ( c, t ) can read δ backward a finite(but sufficient) number of times to get the possible subsets of its own points.Site s k represents the last points of P , amongst which the very last point p k .So, we initiate our ‘reverse’ computation by setting the state of s k (on some layer ℓ on which this computation is to be held) to contain subset Q a for point p k andconsistent ones for the predecessors it represents. By induction, every element of S will contain subsets that are consistent with Q a on layer ℓ . In particular, s willhave the corresponding subset Q for p , so that it just has to check whether q ∈ Q to know if w is accepted by F . In the preceding construction, we have put some details or particular cases aside.First, we have to mention that the whole process obviously works only for inputwords of size greater than some value depending on K (for all P i to be assimilatedto straight lines as in fig. 3). Nevertheless, that leaves us a finite number of wordsthat are treated as special cases, so that the result is not affected. Possibilities.
As each P i is not a real straight line, the next part P i +1 of the pathdepends on which point of the period of P i the multi-head is at (that is, which stateit is in over word a n ) when head i reaches the end-marker. In particular, therecan be at most | Q | possible values α i , depending on n . Anyway, that makes a finitenumber of possible ( k − α , . . . , α k − ), and we can thus process all of themin parallel.Remains to elect the right tuple at site s or before. It can be done by looking atthe remainder of the Euclidean division of n − | Q | by some finite value f ( | Q | ). Thatcan be easily checked, for instance, on line D k with a finite counter. The choice willbe known at site s k and spread toward s . Aperiodic parts.
It may seem we know at any site along any S i , thanks to whatprecedes, which points of the period of P i we are simulating and so, which availableletters the cell has to use. This is in fact not true yet: when reaching site s i , wehave to take the aperiodic part of P i into account, and therefore we must be able tomodify the last | Q | moves (that is, to adjust the choice of letters) we have simulatedbackward. That can be done by adding to the sites of S a finite memory of theletters seen. Immobile heads.
Suppose that, contrary to the hypothesis made in subsection 4.2,there exists some j > α j,j = 0. That means that head j remainsmotionless until p j and then covers the totality of the input during P j . The troubleis that it implies for all i ≤ j , α i = 0. Therefore, s j = s j − = · · · = s , so that alinear number of moves would have to be simulated on a single site.A simple trick allows us to overcome this problem: for all j ∈ J , k − K , we set α ′ j,j = α j,j if α j,j > α ′ j,j = otherwise , and set α ′ , = α , = 0. Then, in ourconstruction, we replace any α j,j by α ′ j,j .Finally, for each j > α j,j = 0, we still have to adjust shift speed ς j,j ,which is equal to 0. All we have to do is to replace it by ς ′ j,j = α j − α j (only for this j ),which makes the totality of the copy of w on layer ℓ j shift over S j . As regards indices i < j , we do not need to redefine the corresponding speed ς i,j , since head j makesno more moves. Conclusion
We have described a construction that simulates oblivious multi-head one-wayfinite automata on real-time cellular automata. This is better (if linear and realtimes are not equivalent) than what would achieve the na¨ıve (though nontrivial)simulation of general multi-head finite automata, which would result in a linear-time CA.In any case, this result fully exploits the obliviousness of the sequential compu-tation. Now, it is another challenge to get a similar parallel algorithm without theconstraint of data-independence.
Acknowledgement
I would like to thank G. Richard and V. Terrier for introducing me to the matterof DIDFA (which resulted in a common article about a speed-up of two-way DIDFAby CA). I would also like to thank J. Fert´e for useful brainstorming sessions beforethe blackboard and V. Poupet for his help.
References [1] A. J. Atrubin. A one-dimensional real-time iterative multiplier.
IEEE Transactions on Elec-tronic Computers , 14(1):394–399, 1965.[2] Stephen N. Cole. Real-time computation by n-dimensional iterative arrays of finite-state ma-chines.
IEEE Trans. Comput. , 18(4):349–365, 1969.[3] Karel ˇCul´ık II. Variations of the firing squad problem and applications.
Information ProcessingLetters , 30(3):152–157, 1989.[4] Markus Holzer. Multi-head finite automata: Data-independent versus data-dependent compu-tations.
Theoretical Computer Science , 286(1):97–116, 2002.[5] Markus Holzer, Martin Kutrib, and Andreas Malcher. Multi-head finite automata: Charac-terizations, concepts and open problems. In Turlough Neary, Damien Woods, Anthony KarelSeda, and Niall Murphy, editors,
The Complexity of Simple Programs (CSP’08) , EPTCS, pages93–107, 2008.[6] Jacques Mazoyer and Nicolas Reimen. A linear speed-up theorem for cellular automata.
Theo-retical Computer Science , 101(1):59–98, 1992. Notice we could have chosen any rational value strictly between 0 and 1 instead of . ROM 1DIDFA TO REAL-TIME CA 75 [7] John von Neumann.
Theory of Self-Reproducing Automata . University of Illinois Press, Urbana,IL, USA, 1966.[8] Alvy R. Smith III. Simple computation-universal cellular spaces.
Journal of the ACM ,18(3):339–353, 1971.
This work is licensed under the Creative Commons Attribution-NoDerivs License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nd/3.0/http://creativecommons.org/licenses/by-nd/3.0/