Download presentation
Presentation is loading. Please wait.
Published bySpencer Andrews Modified over 8 years ago
1
1 8.4 Extensions to the Basic TM Extended TM’s to be studied: Multitape Turing machine Nondeterministic Turing machine The above extensions make no increase of the original TM’s power, but make TM’s easier to use: Multitape TM --- useful for simulating real computers Nondeterministic TM --- making TM programming easier.
2
2 8.4 Extensions to the Basic TM 8.4.1 Multitape TM’s Finite control Tape 1 Tape 2 Tape 3 Figure 8.16. A multitape TM.
3
3 8.4 Extensions to the Basic TM 8.4.1 Multitape TM’s Initially, the input string is placed on the 1 st tape; the other tapes hold all blanks; the finite control is in its initial state; the head of the 1 st tape is at the left end of the input; the tape heads of all other tapes are at arbitrary positions. A move consists of the following steps: the finite control enters a new state; on each tape, a symbol is written; each tape head moves left or right, or stationary.
4
4 8.4 Extensions to the Basic TM 8.4.2 Equivalence of One –tape & Multitape TM’s Theorem 8.9 Every language accepted by a multitape TM is recursive enumerable. (That is, the one-tape TM and the multitape one are equivalent) Proof: see the textbook.
5
5 8.4 Extensions to the Basic TM 8.4.3 Running Time and the Many-Tapes-to- One Construction Theorem 8.10 The time taken by the one-tape TM of Theorem 8.9 to simulate n moves of the k-tape TM is O(n 2 ). Proof: see the textbook. Meaning: the equivalence of the two types of TM’s is good in the sense that their running times are roughly the same within polynomial complexity.
6
6 8.4 Extensions to the Basic TM 8.4.4 Nondeterministic TM’s A nondeterministic TM (NTM) has multiple choices of next moves, i.e., (q, X) = {(q 1, Y 1, D 1 ), (q 2, Y 2, D 2 ), …, (q k, Y k, D k )}. The NTM is not any ‘powerful’ than a deterministic TM (DTM), as said by the following theorem. Theorem 8.11 If M N is NTM, then there is a DTM M D such that L(M N ) = L(M D ). (for proof, see the textbook)
7
7 8.4 Extensions to the Basic TM 8.4.4 Nondeterministic TM’s The equivalent DTM constructed for a NTM in the last theorem may take exponentially more time than the DTM. It is unknown whether or not this exponential slowdown is necessary! More investigation will be done in Chapter 10.
8
8 8.5 Restricted TM’s Restricted TM’s to be studied: the tape is infinite only to the right, and the blank cannot be used as a replacement symbol; the tapes are only used as stacks (“stack machines”); the stacks are used as counters only (“counter machines”). The above restrictions make no decrease of the original TM’s power, but are useful for theorem proving. Undecidability of the TM also applies to these restricted TM’s.
9
9 8.5 Restricted TM’s 8.5.1 TM’s with Semi-infinite Tapes Theorem 8.12 Every language accepted by a TM M 2 is also accepted by a TM M 1 with the following restrictions: M 1 ’s head never moves left of its initial position (so the tape is semi-infinite essential); M 1 never writes a blank. (i.e., M 1 and M 2 are equivalent) Proof. See the textbook.
10
10 8.5 Restricted TM’s 8.5.2 Multistack Machines Multistack machines, which are restricted versions of TM’s, may be regarded as extensions of pushdown automata (PDA’s). Actually, a PDA with two stacks has the same computation power as the TM. See Fig.8.20 for a figure of a multistack TM. Theorem 8.13 If a language is accepted by a TM, then it is accepted by a two-stack machine. Proof. See the textbook.
11
11 8.5 Restricted TM’s 8.5.3 Counter Machines There are two ways to think of a counter machine. Way 1: as a multistack machine with each stack replaced by a counter regarded to be on a tape of a TM. A counter holds any nonnegative integer. The machine can only distinguish zero and nonzero counters. A move conducts the following operations: changing the state; add or subtract 1 from a counter which cannot becomes negative.
12
12 8.5 Restricted TM’s 8.5.3 Counter Machines Way 2: as a restricted multistack machine with each stack replaced by a counter implemented on a stack of a PDA. There are only two stack symbols Z 0 and X. Z 0 is the initial stack symbol, like that of a PDA. Can replace Z 0 only by X i Z 0 for some i 0. Can replace X only by X i for some i 0. For an example of a counter machine of the 2 nd type, do the exercise (part a) of this chapter.
13
13 8.5 Restricted TM’s 8.5.4 The Power of Counter Machines Every language accepted by a one-counter machine is a CFL. Every language accepted by a counter machine (of any number of counters) is recursive enumerable. Theorem 8.14 Every recursive enumerable language is accepted by a three-counter machine. Proof. See the textbook.
14
14 8.5 Restricted TM’s 8.5.4 The Power of Counter Machines Theorem 8.15 Every recursive enumerable language is accepted by a two-counter machine. Proof. See the textbook.
15
15 8.6 Turing Machines and Computers In this section, it is shown informally that: a computer can simulate a TM; and that a TM can simulate a computer. That means: the real computer we use every day is nearly an implementation of the maximal computational model. under the assumptions that the memory space (including registers, RAM, hard disks, …) is infinite in size. the address space is infinite (not only that defined by 32 bits used in most computers today).
16
16 8.7 Turing Machines and Computers 8.7.1 Simulating a TM by Computer If the previous two assumptions are not satisfied, then a real computer is actually a finite automaton! We can simulate an infinite memory space by “storage swapping.” Also, simulating the infinite tape of the TM by two stacks of disks, respectively for the left portion and the right portion of the tape, with the head as the middle.
17
17 8.6 Turing Machines and Computers 8.6.1 Simulating a TM by a Computer Write a program on the computer to simulate the states and the symbols of the TM in the following way: encode the states as character strings; encode the tape symbols with fixed-length character strings, too; use a table of transitions to determine each move. By the above way, a TM may be said to be simulatable by a program of a real computer (informally)!
18
18 8.6 Turing Machines and Computers 8.6.2 Simulating a Computer by a TM Meaning of this section: The TM is as powerful as a modern-day computer though it seems so simple! Sketch of the simulation using a Multitape TM (see Fig. 8.22) use a TM tape as the computer memory; use a TM tape to simulate the instruction counter; use a TM tape for the memory address; use a TM tape as scratch to perform computation operations on it.
19
19 8.6 Turing Machines and Computers 8.6.2 Simulating a Computer by a TM Meaning of this section: the TM is as powerful as a modern-day computer though it seems so simple! Sketch of using a Multitape TM (see Fig. 8.22) to simulate the sequence of instructions (described by an assembly-language program usually) of the computer: use a TM tape as the computer memory; use a TM tape to simulate the instruction counter; use a TM tape for the memory address; use a TM tape as scratch to perform computation operations on it.
20
20 8.6 Turing Machines and Computers 8.6.2 Simulating a Computer by a TM The TM simulates the instruction cycle of the computer using the above tapes. For more details, see pp. 366-367 of the textbook. Assume that the computer has an “accept” instruction. The TM simulate it and enters an accepting state. Essence of simulation above: the TM has many tapes of different purposes to use; the TM can do any computation on the tapes.
21
21 8.6 Turing Machines and Computers 8.6.3 Comparing the Running Times of Computers and Turing Machines If the simulation discussed in the previous section take exponential times, then it is less meaningful. What is the fact? We hope the two types of machines are polynomially equivalent, i.e., the computer is simulatable by the TM in polynomial time. The answer is yes! (cont’d)
22
22 8.6 Turing Machines and Computers 8.6.3 Comparing the Running Times of Computers and Turing Machines Theorem 8.17 If a computer: (1) has only instructions that increase the maximum word length by at most 1 and; (2) has only instructions that a multitape TM can perform on words of length k in (k 2 ) steps or less, then the TM described in Section 8.6.2 can simulate n steps of the computer in O(n 3 ) of its own steps. (see the textbook for a proof)
23
23 8.6 Turing Machines and Computers 8.6.3 Comparing the Running Times of Computers and Turing Machines Theorem 8.18 A computer of the type described in Theorem 8.17 can be simulated for n steps by a one-tape TM, using at most O(n 6 ) steps for the TM. Conclusion: the TM is as “powerful” as a real computer seen today!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.