Examples of Turing Machines
[17/41%]Show that is Turing-acceptable.
Show that the following function is Turing-computable:
Show that is Turing-decidable.
Show that the function , for , is Turing-computable.
Find a Turing machine that computes the function
For , show that function on natural numbers is Turing-computable.
Show that, for any , the function
on strings over is Turing-computable.
For each of the following DTM's, trace the machine and show the computation on the given inputs:
The DTM of Example 4.3 on inputs 0100 and 01010.
The DTM of Example 4.5 on inputs 0110 and 01010.
The DTM of Example 4.6 on inputs and .
The DTM of Example 4.9, with and , from configuration to ().
Construct DTM's for procedures and of Example 4.9.
Construct DTM's to decide the following languages:
.
.
.
.
, where denotes the number of occurrences of letter in string .
.
Construct DTM's to compute the following functions:
over natural numbers .
over natural numbers , , where is a fixed positive integer.
insert , where and are strings in and is a natural number represented by .
on natural numbers .
on natural numbers and .
on natural number .
For any given DTM , construct a new DTM such that accepts exactly the same set of strings as that of (i.e., ) but when halts its tape is always empty (i.e., the final configuration is always ).
Consider the regular language .
Find a read-only DTM accepting . [Hint: make two passes over the input. In the first pass, it checks that and finds . In the second pass, it checks that .]
Find all possible crossing sequences of on any input.
For any two crossing sequences of , and for any symbol , determine whether . Based on this relation between crossing sequences, construct an NFA that accepts .
Can you find an NFA with a smaller state set than that accepts ?
In the proof of Theorem 4.10, we observe that if the DTM visits, during its computation on input , some blank cells to the right of the input, then the NFA needs to move, after reading all input symbols, to other states by -moves to decide whether it accepts the input. Show that this is not necessary. That is, we can eliminate all -moves in and change the set of the final states to include all crossing sequences which contain as the last pair such that . Explain how to determine the final set .
We consider an extension of read-only DTM's. A one-pebble, read-only DTM (or, simply, one-pebble DTM) is a read-only DTM with the additional capability that it can mark a specific cell of the input tape by putting a pebble on it. The machine has only one pebble, and so at any time the tape can have at most one marked symbol. More precisely, a one-pebble DTM is a DTM , where for some finite set , and satisfies the following properties: For any and ,
-
for some and .
-
is either or for some and .
-
is either or for some and .
-
is undefined. (In the above, the superscript * denotes the pebble. So, a state indicates that is holding the pebble at its finite control, and all tape symbols are unmarked; and a state indicates that the pebble is in an input cell. Note that property (i) indicates that cannot mark a cell if it does not hold the pebble in its finite control now.)
-
Construct a one-pebble DTM such that on each input of length halts in exactly moves.
-
Show that for each read-only DTM , there exist two constants and such that if halts on an input of length , then it must halt within moves.
-
Show that for each one-pebble DTM , there exist two constants and such that if halts on an input of length , then it must halt within moves.
-
Show that if is a regular language, then there is a one-pebble DTM that accepts the language . (Recall that is defined in Example 2.44 as .)
In this exercise, we prove that the language accepted by a one-pebble DTM must be regular. Assume that is a one-pebble DTM with . Also assume that operates on an input and visits cells , with symbol in cell , for (i.e., ). For each , define a partial function as follows: If for some and , then is the next state at which returns to cell . Otherwise, is undefined. That is, the function encodes the states of when it visits cell with the pebble in cell (similar to a crossing sequence of a read-only DTM). Note that depends on both machine and input .
Consider the language over the alphabet , where is the set of all partial functions from to , with if and only if for all , , with respect to machine and string . (Note: If then there are at most symbols in , each encodes one partial function from to .) Show that there is a read-only DTM that accepts ; that is, show that a read-only DTM can check whether each symbol stored at the second track of cell encodes correctly the function . [Hint: cannot simulate step-by-step to check whether the values are correct, because does not have a pebble and so once it leaves cell , it cannot remember where it is. Instead, needs only to check the consistency of the function with its neighbors and , similar to the problem of checking the consistency of neighboring crossing sequences in Theorem 4.10.]
Let be the language over the alphabet such that if (1) defined in part (a) above, and (2) the one-pebble DTM accepts the input , where if and if . Show that there is a read-only DTM accepting . [Hint: uses the information to simulate as follows: If holds the pebble in its state (i.e., if is in a state ), then simulates step-by-step. If puts down the pebble in Cell , then uses at the second track to determine the state it will change to when it returns to cell .]
Show that if is a one-pebble DTM, then is regular. [Hint: Show that the language is the image of a homomorphism on ; see Example 2.35.]
We consider another extension of read-only DTM's. A DTM is called a read/erase-only DTM if it can, at each move, only read an input symbol and/or erase it (i.e., replace the original symbol by ). That is, a DTM is a read/erase-only DTM if , and the transition function satisfies the following property: For any and is either or for some and .
Show that there exists a read/erase-only DTM that accepts the language .
Show that there exists a Turing-decidable language that is not accepted by any read/erase-only DTM.