Turing Machines
[25/100%]Given a Turing machine with the following program . What will the final configuration of this machine be when running on the input 1100? How many steps will be made?
There are three Turing machines , which share the tape alphabet , the set of states , and the initial state . Their programs are given in the tables in Fig. 38 on the next page. Determine which of these machines transform every input word of the form , , into the output .
Fig. 38: Programs of the machines from problem 585.
Fig. 38: Programs of the machines from problem 585.
Let be an arbitrary alphabet not containing . We need to construct a Turing machine that swaps two arguments, more precisely, that transforms any input of the form ( and are words in the alphabet into the output with a standard final configuration.
Determine which of the following programs can be used for the machine . In the program texts, is the initial state, are arbitrary symbols from , and are arbitrary symbols from , where are new symbols.
.
Construct a Turing machine that, for each input word of the form , produces the result . How the machine behaves on other inputs is irrelevant. Estimate the running time of the constructed machine.
Construct a Turing machine that, for each input word of the form , where , produces the result 0, and for all other words produces the result 1. Estimate the running time of the constructed machine.
Construct a Turing machine that transforms any input word into the output , where is the number of letters and is the number of letters in the word . In other words, the letters of the word are sorted and then separated. Estimate the running time of the constructed machine.
Let the alphabet not contain the symbols and *. Construct a Turing machine program that moves the last word on the tape, in the alphabet , from left to right to the place on the tape marked *. More precisely, from the tape one should obtain , where .
Construct a Turing machine performing the following task: given an input consisting of one or more words in the alphabet (possibly ), construct an output by doubling the last of the words: .
Prove that for any constant one can construct a Turing machine that solves problem 591 in time at most , where is the total length of the input words.
Construct a Turing machine that compares two input words in the alphabet lexicographically. This Turing machine must compute the dictionary function:
Construct Turing machine programs that compute the following dictionary functions in the alphabet :
cyclic permutation of letters: ;
cyclic permutation of words:
"reversal" of the sequence of words:
doubling of each letter: ;
finding the image under the homomorphism : ,
removal of all single letters standing in even positions;
checking whether two words contain the same number of letters (the result equals 1 if the answer is "yes", 0 if "no");
checking whether a word is a palindrome (that is, symmetric);
checking whether the word contains two runs of letters of the same length;
checking whether the counts of letters , , and in the word form an increasing arithmetic progression.
Construct a Turing machine to convert the representation of a number from binary to unary, with input alphabet .
Construct a Turing machine that, given the unary representation of three numbers, that is, an input of the form , produces the result 0 if , and 1 otherwise. Estimate the running time of the constructed machine.
Construct programs of one-way Turing machines that compute the following arithmetic functions in the unary system:
;
;
;
comparison ;
exponentiation: ;
square root: ;
logarithm: ;
integer division: ;
remainder: ;
the function selecting the -th argument: , where is a predetermined constant.
Given Turing machines with standard final configuration , each of which computes a dictionary function in time , . Describe how to construct, and estimate the running time of,
the machine , computing the function
the machine , computing the function
the machine , computing the function
the machine , computing the function , where is the smallest natural number for which is empty, with and . Assume that and .
Given the following Turing machines with standard final configuration: - — copies the input, using the symbol as a separator between the original and the copy: ; - — replaces the leftmost occurrence of the symbol with ; if there is no symbol , the input is unchanged; - — adds two numbers written in the unary number system; - — multiplies two numbers written in the unary number system; - — does not change the input.
Determine which arithmetic functions are computed (in the unary number system) by the following Turing machines, constructed by the methods of problem 598 on the previous page:
, ); ;
, (
, ); \operatorname {replace}$$(*, \Lambda ); .
Given the Turing machines with standard final configuration from problem 599 on the preceding page, as well as the following: - — returns the -th argument, or the empty word if the number of arguments is less than ; - — checks whether the -th argument is positive (numbers are written in unary), returning the empty word if it equals zero, or | if it is positive; - — decreases the argument by one if it is positive, otherwise leaves the input unchanged (numbers are written in unary). Determine which arithmetic functions (in the unary system) are computed by each of the Turing machines whose programs are shown schematically in Fig. 39 on the next page (see problem 598 on the preceding page).
Using the Turing machines from the previous problems, construct programs of Turing machines that compute the following functions:
Show how the execution of the following commands can be organized on an ordinary Turing machine:
, return — the head returns to whichever neighboring cell it came from into the current one;
, zero — the head returns to cell zero;
, mirror — the head moves to cell if it was in the cell numbered ;
, double — the head moves to cell if it was in the cell numbered ;
, next — the head moves to the nearest cell to the right of the current one that contains (if it exists, otherwise the head stays in place);
— the current cell and all cells to its right are shifted one position to the right, and the symbol is written into the freed cell; the head ends up in the new cell;
, restore, — the symbol is replaced by the symbol that was in the cell in the initial configuration.
Construct a Turing machine for problem 591 on p. 185, without enlarging the original alphabet .
Implement the following Turing machines without extending the alphabet:
erase the second half of the word, leaving the central symbol if the length was odd;
add two numbers written in binary.
One of the approaches to simulating a two-way tape on a one-way tape consists in storing the contents of the non-negative half of the tape in the cells with odd numbers, and the contents of the left half in the cells with even numbers. That is, the new tape will have the form and for . Construct a program for a one-way machine implementing this approach.
Prove that every arithmetic function computable on some Turing machine in the unary number system can also be computed on a Turing machine whose tape alphabet contains only two symbols: and . Hint. To simulate one symbol of the alphabet , use a block of several consecutive cells containing the word , where . Replace each command of with a group of commands processing the corresponding block of cells.
A -tape Turing machine has tapes, each with its own head moving along it. A command of a -tape Turing machine has the form
where are states, are the symbols observed by the heads on the corresponding tapes, are the symbols written by the heads on the corresponding tapes, are the directions of the head shifts on the corresponding tapes. The input data is written on the first tape, and the rest are empty in the initial configuration. The result is also placed on the first tape.
Prove that any function computable on a -tape Turing machine can also be computed on an ordinary Turing machine. By how much does the computation time increase in this case?
Show that palindromes (symmetric words) can be recognized on a two-tape Turing machine in time proportional to their length.