Docsity
Docsity

Prepara i tuoi esami
Prepara i tuoi esami

Studia grazie alle numerose risorse presenti su Docsity


Ottieni i punti per scaricare
Ottieni i punti per scaricare

Guadagna punti aiutando altri studenti oppure acquistali con un piano Premium


Guide e consigli
Guide e consigli

Two-Tape Simulation of Multitape Turing Machines: Speeding Up Computation with Fewer Tapes, Esercizi di Logica Matematica

This document, authored by f. C. Hennie and r. E. Stearns, discusses the simulation of multitape turing machines using a two-tape machine. The authors demonstrate that a given function's computation time on a k-tape machine can be simulated using a two-tape machine with at most computation time t log t. This trade-off between the number of tapes and speed of computation is significant in its own right and can be used in diagonalization arguments to prove the existence of functions that can be computed within certain time bounds but not others.

Tipologia: Esercizi

2018/2019

Caricato il 13/07/2019

Utente sconosciuto
Utente sconosciuto 🇮🇹

1 documento

1 / 14

Toggle sidebar

Documenti correlati


Anteprima parziale del testo

Scarica Two-Tape Simulation of Multitape Turing Machines: Speeding Up Computation with Fewer Tapes e più Esercizi in PDF di Logica Matematica solo su Docsity! Two-Tape S imula t ion of Mult i tape Turing Machines F. C. HENNIE Massachusetts Institute of Technology,* Cambridge, Massachusetts AND R. E. STEARNS General Electric Company,f Schenectady, New York Abstract, I t has long been known that increasing the number of tapes used by a Turing machine does not provide the abili ty to compute any new functions. On the other hand, the use of extra tapes does make it possible to speed up the computation of certain functions. I t is known that a square factor is sometimes required for a one-tape machine to behave as a two- t ape machine and that a square factor is always sufficient. The purpose of this paper is to show that, if a given function requires computation time T for a k-tape realization, then i t requires at most computation time T log T for a two-tape realization. The proof of this fact is constructive; given any k-tape machine, i t is shown how to design an equivalent two-tape machine tha t operates within the stated time bounds. In ~ddition to being interesting in its own right, the tr~de-off relation between number of tapes and speed of computation can be used in a diagonalization argument to show tha t if T(n) and U(n) are two time functions such that T(n) log T(n) inf U(n) - 0 then there exists a function that can be computed within the time bound U(n) but not within t he time bound T(n). 1. Introduction The study of computability by computer-like devices was initiated by Turing [1], who postulated that the functions that c~n be mechanically evMuated are pre- cisely those functions that can be computed by a finite-state device with a single unbounded read-write tape. Such a device is commonly called a Turing machine. When slight variations ia input-output procedure are used, Turing machines may be applied to other problems such as generating sequences or recognizing sets. Thus functions, sequences and sets can be classified as "computable" or "noncom- putable" depending on whether or not they can be defined by an appropriate Turing machine. ..... With the advent of the modern high-speed computer, interest in computabiliW has spread to questions concerning the ' difficulty" or "complexity" of a calculation. One fruitful measure of the complexity of a computation is the number of time units needed to carry out that computation. For any function T(n) of integers into integers, we say that a given function, sequence or set is T(n)-computable if and only if there is some (~ppropriately modified) Turing machine which, depending on the context, either computes the nth term of ~ sequence in T(n) operations or proc- esses an input sequence of length n within T(n) operations. Three modifications of * Depar tment of Electrical Engineering Research and Development Center 533 Journal of the Association for Computing Machlnery, Vol. 13, No. 4 (October~ 1966), pp. 533-546 534 F . C . t I E N N I E AND R. E . S T E A R N S the Turing machine for which this complexity criterion has been studiect ~tre dis- cussed later. The common feature of these models is that they all contain a Yinite- state device which controls one or more unbounded tapes. The use of more them o~e tape does not give a machine any extra power, but it does enable some caicul~tions to be completed in fewer operations, and is ~ step toward making the Tm'ing ma- chine model more like present computers. A central problem in the theory of computational complexity is to determine how much faster a problem can be done on a k~-tape machine than on a k2-tupe ma- chine. Not only is this problem interesting in its own right, but certain proofs based on Cantor diagonal techniques depend on the speed with which one is able to simu- late a sequence of machines with arbitrary numbers of tapes by a single machine that must have a fixed number of tapes. Such applications are discussed in later sections where the specific models are discussed. Hartmanis and Stearns [2] have shown that any k-tape machine can be simu- lated by a one4ape machine whose computation time is no greater than the square of the computation time of the k-tape machine. Hennie [3] has shown that there are cases in which reducing the number of tapes from two to one actually requires a squaring of the computation time. Thus more efficient simulation techniques can only be obtained by using more than one tape. The object of this paper is to describe a scheme whereby n operations of a many- tape Turing machine can be simulated by n log n operations of a two-tape Turing machine. This improvement over the one-tape case allows a corresponding improve- ment in results proved by diagonal techniques. These applications are discussed in later sections. 2. Preliminary Considerations The purpose of this section is to describe our obiectives more explicitly. However. the definitions and proofs must of necessity be somewhat informal because a com- pletely rigorous treatment would require a prohibitive amount of space and would obscure the simple principles upon which the construction is based. The basic multitape Turing machine model we are trying to simulate may be de- scribed as a computing device that has a finite automaton as a control unit. At- tached to this control unit is a fixed number of tapes which are linear, unbounded at both ends and ruled into an infinite sequence of squares. The control unit has one reading head assigned to each tape, and each head rests on a single square of the assigned tape. There are a finite number of distinct symbols which can appear on the tape squares. Each combination of symbols under the reading heads, together with the state of the control unit, determines a unique machine operation. A machine operation consists of overprinting ~ symbol on each tape square under the heads, shifting each tape independently either one square left, one square right or no squares and changing the state of the control unit. The machine is then ready to perform its next operation as determined by the tapes and control state. I f a given operation does not call for any tape shift, change of tape symbol or change of state, then the machine is said to have stopped. In order to use a machine for calculations, one must add some means of supply- ing input data to the machine and obtaining output data from it. In later sections several ways of doing this are considered. However, for the purposes of simulation, i~i! T W O - T A P E S I M U L A T I O N OF M U L T I T A P E T U R I N G MACHINES 537 to be recorded within the corresponding track on the storage tape of M2 in accord- ance with the following rules. 1. Within any given level of any given storage area, either every square is full or every square is empty. Note that a distinction must be made between empty squares and squares that are being used to store blanks from Mk's tape. If the tapes of Mk are initially blank, then M2's storage tape is also initially blank, but these blanks must represent the situation in which the lower level of each track stores blanks from M~'s tapes, while the upper level of each track is empty. 2. Within any given track, if the upper level of the ith left (right) storage area is full, then the lower level of the same area must also be full, and both levels of the ith right (left) area must be empty. Conversely, if the lower level of the ith left (right) area is empty, then the upper levei of the same area must also be empty, and both levels of the ith right (left) area must be full The upper level of tile home column is always empty; the lower level, hereafter referred to as the home square, is always full. At the beginning of a simulation, the upper level of every area will be empty, and the lower level of every area will be full. 8. The symbols stored within any given track must be arranged in such a way that the corresponding pattern on Mk's tape can be obtained as follows. Starting with the leftmost nonblank symbol in the given track, read through the various storage areas from left to right, ignoring empty areas. To the left of the home square, all the symbols stored in the lower levei of a given area are to be read before those in the upper level. To the right of the home square this order is reversed. As an example, Figure 2a shows a typical configuration of symbols that might appear within one track of the storage tape. Here the letters represent symbols from Mk's tape alphabet, while blanks represent empty squares. The reader may verify that this configuration satisfies rules I and 2. According to rule 3, it represents the p a t t e r n . . , t h e q u i e k g r a y f o x j u m p . . . on M~'s tape, with the sym- bol "y" under M~'s reading head. Suppose that at the beginning of some step in its simulation, one of the tracks on M2's storage tape contains the configuration of symbols shown in Figure 2a, and that during its next move Mk overprints its scanned symbol with an "m" and shifts the tape in question to the right. In order to imitate this action, M2 must change the symbol in the home square to an "m" and then rearrange the entire configuration of symbols so that the symbol "a" appears in the home square and rules 1 through 3 are satisfied. This can be done quickly by simply shifting the symbol "a" into the home square and putting the displaced symbol "m" in the upper level of the first~ right-hand storage area, as shown in Figure 2b. Now suppose that the next step in M2s computation requires overprinting the scanned symbol with an "i" and shifting the tape one more square to the right. In this ease, the rearrangement of the symbols on M~'s tape is not quite so simple. The symbol that. must be moved into the home square currently appears in the upper level of the third left-hand storage area. It is not possible simply to shift. this symbol into the home square and leave the rest of the third storage area intact, for each level of a storage area must be either completely full or completely empty (rule 1). The quickest way to restore proper order is to remove all of the symbols. from the upper level of the third storage area and relocate them in the lower levels of the first and second left-hand storage areas. Because of the way in which the ~38 F.C. IIENNIE AND R. E. STEARNS ~home ~quore , , r m o x 4 - - ~ _ - ] b home ~quore home ~quare Fro. 2a-c. Two mzcce~ive cleamlps ?ii! lengths of the storage areas have been chosen, three of these symbols will just fill up the first and second areas, leaving the fourth wmbol "r" for tile home square. In order to satisfy rule 2, the upper levels of the flint two right-hand storage areas must now be emptied out and the lower level of the third right-hand storage area must be filled in. Fortunately, the mzmber of symbols that appears in the upper level of the first two areas, together with the symbol "i" displaced from the honm square, just matches the mzmber of available squares in the lower level of the third right- hand storage az,!a. Thus the symbols can be reshuffled as shown in Figure 2c to create a new pattern that satisfies rules 1 and 2 and accurately reflects M2s new tape pattx.,,rn. With the examples of Figure 2 in mind, we shall now state general rules for re- arranging symbols within one of M2's storage tracks. If it is a~umed that the appro- priate overprinting has alrealy been done, and that M= is to imitate a shift of Mk's tape toward the right, the procedure ks as follows. 4. Search to the left h'om the home square until the first notmmpty square is found. Let i be tile number of the left-hand storage area that contains this square. 5. If the upper track of the ith left*hand storage area is full, collect all the symbols in that level and relocate them (in the proper order) in the lower levels of the first i - 1 left-hand storage areas, with the rightmost symbol going in the home square. If the upper level of the ith left-hand storage area is empty, collect the symbols in the lower level and relocate them in the same way. 6. Collect all the symbols in both levels of the first i - 1 right-hand storage areas, together with the one symbol displaced from the home square, ~md relocate them (in the proper order) in the lower levels of the first i--1 right-hand storage areas, with the excess symbols going in the ith storage area. The lower level of this area is to be used if it is available; otherwise the upper level is to be used. If M, should shift its tape to the left instead of to the right, it is only necessary to interchange the words "left" and "right" in these three rules. In either case the process of rearranging the symbols will be referred to as a cleanup of order i. The transition from Figure 2b to Figure 2c represented a third-order cleanup. In this ease, the upper level of the third left-hand storage area was full, so the first part of + L, ++++++ ++++t+ F~a, aa,,-b~ A +hi~d++oPd+P c,+ean+++p trivhd ~ppli<u~on o+ + h i e 5 t.o ~he r~+.~, whea ~he upDer Dvcl i+ erupt.y,, Figun~ 3 h ~ ~:~°.~a pmvMed: ~ ~tmws a th~rd-ord,r ele~mu p o~ ° %is W~u~+ We ~+~k~ it ~++ ~qL~vider~ that {he pmcedua~ +. workg~; L~.:.. ~h~ {>~eh eh~anup resu~8 m +~ eo~.~*.m+~Lmn that semi:ilk:+.++ nile+ I ~hrma~h :'+ ,rod taint i+.~ s~iU~ble ~+se ~ s, abaequeat, appiic~+Ao'a of r*.~h.'.~ 4 through {~. The teade~ m+~y easily ver~[y t. |is ~.+.I{" by eapenmm~me~o~ with ~ {ewe x~rqF+k~s~ ]b must+, ~ remembered ~,h~:~t vv++ bare bee,~, ~>o~/{dering m'dy o+~ +*~" MF++~ +.avv+ m~.~s{ h~ f~e~, d+:+~%a up mxeh track ~m il+ ~mn~+~/e u~fu~, ~ea~h eDfmup b~.t~f~g g,,v~l>ed bY g~m n~k~8 ~iv+m aboweL Of *:OUr.S+ {h{; eieamap~ 0~, t}m various tmeka am~ fight ~hffta+ oar cte~mup seh~mo, we ~haH ~iow i~di c ~ +] htg~w +~h~ ~ ? r n e e~n be ae~:o~'~p{i++hed by ~ o{ Ma ca.[L+ for the ghKt.h~g o~ ~ome pa~hr@ar ~a{~ m ~he n R h t A{te~ • r~.+rprm~ng the +ym~ml origi~#.ly m the he, me ~q~.mm ~.he, ++~c~hige M ~ move~ }~ smmRe.4.a+~+ + he,Hi towaJ?d the ]~+.~+~ U~H ig ¢~m~ ~0 +~he {~i~g sq~.l,~r~ eon~,~d~lif~f< g 8yrtd~}~ ~m~n the rope ~dphah~:.~ o£ M~ + g+:}r eaeh ~uam };hg~ the ++tori~ge4<~p+a tm~d move~ o+a++r. M~ n~+.,hes ++he deaired +ym~:+L the number ~f m~tmre~ ma~:ked ¢'~f¢ on the ++,+-+py ~p~: wi]i jut++ equ+] +++<. when:.* :i iS ~.h++ m.m+}:er of the,,, g~+rage tm::m etmt,+~'mh++g the +ytnb+{l+ M ~ now I~roe~+~ to ~ + a ~ P ~+he fto'~n the Up /eve| of the i~h ~:tor~ge ~+~ onto the marked por~Ao~l 0f tim eoFy tape. Whon d~e marked por~itm of the copy t.aipe i~ titled, the te[~ e'ad of }:he it& al~a wiit hay+ [mea ~'~ached, If thi~ c[~d of ~+he storag++' are++ ba%s ~O~ previot~idy been marked,, ~ ~$~ei~d marking symbol is now pktced ~hem+ The machi~m +;her+. re++mce++s i'Ve 8+<,~,++ ~mt/iI i ts att~g++ }mai has n:+,tumed uT+ the ie¢+++ e+:}d of +:.he { i + i)=+++ at+rage area, +rod peom~+~I+ ~o transfer the copied +ymt~+is into the [+,we+ revels o+ the f i ~ i + 1 mr+ram Wim++ ttm home +'i ,,+ a++.t~++ +8 reaeh<+i them will tm o+m ayrrdml tefg over; +|i+ e)~+~! Jm ir~mfhgmged wBh the wmt~i cu:m+++ntb , in ~}m hOmeL saguaro+ M~ a m ~he eam~en~+ of gb. ~i.~+ i + l +~rage areas (m~o +he copy tape. Of co-urn, iu order h:~r M~ ~o lr~msfer them ~ym~.mie i:a their proper 542 F. C. H E N N I E AND R. E. STEARNS operations, it will from time to time visit states to which output values have been assigned. The (infinite) sequence of these output values is called the sequence that the machine generates. A particular infinite sequence ¢o is called T(n)-computable if and only if there is some sequence generator M that produces the nth member of within T(n) or fewer operations. This maehi~m M is then said to operate within time T(n). THEOREM 2. I f a sequence co can be generated by a k-tape machine within time T(n), and T(n) ~ n, then it can be generated by a two-tape machine within time T(n) log2 T(n). PaOOF. From Theorem 1 we know that the given k-tape machine can be simu- lated by a two-tape machine M2 within time aT(n) log~ T(n), for an appropriately chosen constant a. Machine M2 can then be modified to form a new machine M~' that in each operation performs a or more consecutive operations from the com- putation of M2. Such a speed-up construction is detailed by Hartmanis and Stearns [2], and leads to a computation time T'(n) ~_ max [n, T(n) log T(n)]. But if T(n) >_ n and n > 1, one has T'(n) <: T(n) log T (n ) , which completes the proof. A function U(n) is called real-time countable [4] if and only if it is monotone in- creasing and there exists some sequence generator whose output on the j t h opera- tion is 1 if j = U(i) for some integer i, and whose output is 0 otherwise. In other words, U(n) is real-time countable if its characteristic sequence is n-computable. I t is now possible to state our first tape-independent result. THEOREM 3. [f U(n) is a real-time countable function and if T(n) is a computable function, then inf T(n) log T(n) = 0 U(n) implies that there is a binary sequence ¢o that is U(n)-camputable but not T(n)-com- putable. PROOF. The proof is basically the same as the proof of Theorem 9 in Hartmanis and Stearns [2], except that the "Square Law" used in that theorem is now replaced by our Theorem 2. The basic idea is to generate the desired sequence c0 with a sequence generator that operates within time U(n) and computes enough of each T(n)-computable binary sequence o~' to ensure that at least one symbol of ¢0 differs from the corresponding symbol of cJ. Only the key ideas of the construction are mentioned here. Let M~ denote the i th two-tape, binary-output sequence generator, according to some (computable) method of ordering all such Turing machines. I t is then desired to design a "diagonal" sequence generator D whose operation really comprises three simultaneous computations. One of these computations consists of simulat- ing, one after the other, appropriate initial portions of the computations performed by M~, M : , • .. , and so on. The second computation consists of the generation, in real time, of the characteristic sequence of U(n). The third consists of the genera- tion, not necessarily in real time, of the characteristic sequence of T(n) log T(n). As D simulates any particular machine M~, it keeps track of the numbers of basic TWO-TAPE SIMULATION OF MULTITAPE TURING MACHINES 5 4 3 operations that M¢ needs to generate its various output symbols. These numbers are compared with the computed values of T(n) log T(n) in order to check whether or not M~ has been operating within the time bound T(n) log T(n). The fact that this determination cannot in general keep up with the simulation of M~ is unimpor- tant. The important point is that each Ms that does not operate within the time T(n) log T(n) can eventually be identified and eliminated from further considera- tion. Since the machine D must operate within the time U(n), it will be designed to produce an output symbol coincident with each of the l 's in the characteristic se- quence of U(n). Two situations may arise at the time at which the j th such 1 is generated. First, D may not yet have had time to determine the j th output of the machine that it is currently simulating. In this case, D will produce some arbitrary output symbol, say 0. On the other hand, D may already have determined the j th output symbol of the machine that it is currently simulating. In this case, D will produce as its own output the complement of the symbol produced by the simu- lated machine. The simulation of each machine Mr is continued until one of the following situa- tions arises: (a) D determines that M~ does not operate within the time T(n) log T(n). (b) D is able to determine the j th output of machine M~ at or before time U(j), where U(j) is measured from the very beginning of D's computation. Note that if M~ does operate within the bound T(n) log T(n), then situation (b) must eventually arise. For suppose that the simulation of machine Mr is begun after D has executed a total of B~ basic operations, and that at most C~ operations are required to simulate one of Mi's operations. Then because inf T(n) log T(n) U(n) = o, there must be a finite value of j for which B~ + C~T(j) log T(j) < U(j). Once either of the situations (a) or (b) arises, D stops its simulation of Mr and be- gins to simulate the computation of M~+I. Now let ~' be any binary sequence that can be generated within time T(n). By virtue of Theorem 2, ~' can be generated by some two-tape machine M within time T(n) log T(n). But in the course of its computation, D eventually simulates machine M and produces as its j th output symbol the complement of the j th symbol produced by M. Therefore, the sequence ~ produced by D differs in at least one symbol from the sequence d , and the proof is completed. 5. Application to On-Line Turing Machines Like a sequence generator, an on-line Turing machine is a basic multitape Turing machine with output values assigned to certain of the states of its control unit. In addition, however, an on-line machine is provided with a special terminal at which input symbols can be supplied. Such a machine begins its computation in a designated starting state, with all of its tapes blank. Upon being supplied with an input symbol, it goes through a number of basic operations leading to a state to which an output symbol has been assigned. Once such a state is reached, the ma- 544 F . C . H E N N I E A N D R . E . S T E A R N S chine is ready for a new input symbol, at which point tile process is repeated. Any finite sequence of input symbols that leads the machine to a state with output 1 is said to be accepted by the machine. A set 12 of finite sequences is said to be T(n)- 0 " r . • recognizable (by an on-line machine) if and only if there is an n-hne I urmg machine M that processes any input sequence of length n within T(n) operations and such that R is precisely the set of finite sequences accepted by M. TttEORE~,I 4. I f a set R can be recognized by a k-tape on-line Turing machine within time T(n), then it can be recognized by a two-tape on-line machine within time T(n) log T(n). P~OOF. The proof is substantially the same as that of Theorem 2. THEORE:~I 5. I f U(n) is a real-time countable function and if T(n) is a computable function, then T(n) log T(n) in/ U(n) = 0 n o c ~ implies that there is a set R which is U(n)-reeognizable but not T(n)-reeognizable. PROOF. Let ~o be the infinite sequence of Theorem 3. Then define R to be the set of all input sequences of length n for all n such that the nth bit of w is one. R is obviously U(n) recognizable. I t is easy to see that a T(n)-reeognizer for R could easily be converted into a sequence generator for ~, contrary to Theorem 3. 6. Application to Off-Line Turing Machines An off-line Turing machine is a basic multitape Turing machine that has binary outputs associated with some of its states. In addition, one of the machine's tapes is designated as the input tape. The machine begins its computation in a specified starting state, and with a finite pattern of symbols written on its input tape. This pattern is surrounded by blank squares, and is positioned so that its leftmost sym- bol is under the reading head. For any given input pattern, the ensuing machine operations are guaranteed to lead to a (stopping) state to which an output is assigned. The input pattern is said to be accepted if and only if this output value is 1. A set R of finite patterns is said to be T(n)-recognizable (by an off,line machine) if and only if there exists an off-line Turing machine that processes any input pat- tern of length n within T(n) operations and that accepts precisely the members of R. THEOREM 6. I f a set R can be recognized by a k-tape off-line Turing machine within time T(n), then it can be recognized by a two-tape o~-line machine within time T(n) log T(n). PROOF. Again the proof is substantially the same as that of Theorem 2. THEOREM 7. If U(n) is a real-time countable function, then there is a set of finite sequences R that is U(n)-recognizabIe by an off-line machine and is not T(n)-recogniz- able for any function T(n) such that inf T(n) log T(n) = O. U(n) PROOF. We shall describe the construction of an off-line machine D that has a binary input alphabet {0, 1} and recognizes the desired set R within time U(n). This machine interprets any input pattern with which i t is presented as represent- ing the binary expansion of an integer, i, in the obvious manner. The major portion ~;21!i !!ii!!;i i~i ii~ ,~ i~ ~i~i~ ~i~ii ' i!
Docsity logo


Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved