04church Turing
04church Turing
http://cis.k.hosei.ac.jp/~yukita/
Example M1
decides the language A = {w# w | w {0,1}*}. M 1 =" On input string w : 1. Scan the input to be sure that it contains a single # symbol. If not, reject. 2. Zig - zag across the tape to correspond ing positions on either side of the # symbol to check on whether these positions contain th e same symbol. If they do not, reject. Cross off symbols as they are checked to keep track of which symbols correspond . 3. When all symbols to the left of the # have been crossed off, check for any remaining symbols to the right of the #. If any symbols remain, reject; otherwise accept."
2
Definition 3.1
A Turing machine is a 7 - tuple, (Q, , , , q0 , qaccept , qreject ), where Q, , are finite sets and 1. Q is the set of states, 2. is the input alphabet not containing the special blank symbol _, 3. is the tape alphabet, where _ and , 4. : Q Q {L, R} is the transitio n function, 5. q0 Q is the start state, 6. qaccept Q is the accept state, and 7. qreject Q is the reject state, where qreject qaccept .
3
Configuration 1011q701111
q7
1 0 1 1 0 1 1 1 1 _ _ _
...
A Turing machine receives its input w = w1 wn * on the left most n squares of the tape and the rest of the tape is filled with blank symbols. Configurat ions are represente d as finite strings in tape alphabet w ith traili ng blank symbols being omitted. Thus, the start configurat ion is represented as q0 w = q0 w1 wn .
4
Computation
Let a, b , u , v * , and qi , q j Q. Let uaqi bv and uq j acv are two configurat ions. We say that uaqi bv yields uq j acv if ( qi , b) = (q j , c, L). Likewise we say that uaqi bv yields uacq j v if (qi , b) = (q j , c, R ). Assumption for convenience : qi bv yields q j cv if the transitio n is left moving.
Definition 3.2 A language is Turing - recognizab le [recursivel y enumerable ] if some Turing machine recognizes it. Remark : The machine may loop on some input. Definition 3.3 A language is Turing - decidable [recursive ] if some Turing machine decides it. Remark : The machine halts on any input.
Example 3.4 M2
decides the language A = {0 | n 0}. M 2 =" On input string w : 1. Sweep left to right across the tape, crossing off every other 0. 2. If in stage 1 the tape contained a single 0, accept. 3. If in stage 1 the tape contained more than a single 0 and the number of 0s was odd, reject. 4. Return the head to the left - hand end of the tape. 5. Go to stage 1."
7
2n
Example 3.6 M3
decides the language C = {a i b j c k | i j = k and i, j , k 1}. M 3 =" On input string w : 1. Scan the input from left to right to be sure that it is a member of a *b*c* and reject if it is not. 2. Return the head to the left - hand end of the tape. 3. Cross off an a and scan to the right until a b occurs. Shuttle between th e b' s and the c' s, crossing off one of each until all b' s are gone. 4. Restore the crossed off b' s and repeat stage 3 if there is another a to cross off. If all a ' s are crossed off, check on whether all c' s also are crossed off. If yes, accept; otherwise, reject."
8
10
Theorem 3.8 Every multitape Turing machine M has an equivalent single tape Turing machine S.
0 1 0 1 0 _
...
M
a a a _
... ...
S
# 0 1 0 1 0 # a a a # b a # _
...
11
Simulation
S =" On input w = w1w2 wn : 1. S puts its tape into the format tha t represents all k tapes of M . The formatted tape contains 1w2 wn # _ # _ # # #w 2. To simulate a single move, S scans its tape from the first # , which marks the left - hand end, to the (k + 1)st # , which marks the right - hand end, in order to determine the symbols under the virtual heads. Then S makes a second pass to update the tapes according to the way that M ' s transitio n function dictates. 3. (omitted)
12
:Q 2
Q{L, R }
13
Theorem 3.10 Every nondeterministic Turing machine has an equivalent deterministic Turing machine.
...
_ _
input tape
D
x x # 0 1 x
...
1 1
simulation tape
...
14
address tape
Proof
Tape 3 keeps track of D' s location in N ' s nondetermi nistic computatio n tree with b - adic representation, where b is the maximum number of children at each node, which is determined by . All the nodes are odered by breadth first and lexicographical manner. 1. Initially tape 1 contains the input w, and tapes 2 and 3 are empty. 2. Copy tape 1 to tape 2. 3. Use tape 2 to simulate N with input w on the branch of its nondetermi nistic computatio n. Before each step of N consult th e next symbol on tape 3 to determine which choice to make among those allowed by N ' s transitio n function. If no more such symbol remain on tape 3 or if this nondetermi nistic choice is invalid, abort this branch by going to stage 4. Also goto stage 4 if a rejecting configurat ion is encountere d. If an accepting configurat ion is encountere d, accept the input. 4. Replace the string on tape 3 with the lexicograp hically next string. Simulate the next branch of N ' s computatio n by going to stage 2.
15
Corollary 3.11 A language is Turing recognizable if and only if some nondeterministic Turing machine recognizes it.
16
Enumerators
An enumerator is a Turing machine with a printer. An enumerator starts with a blank input tape . If the enumerator does not halt, it may print an infinite list of strings. The language enumerated by E is the set of all strings that it eventually prints out. E may generate the strings of the language in any order, possibly w ith repetition s.
17
Theorem 3.13 A language is Turing-recognizable if and only if some enumerator enumerates it.
Proof (1) Let E enumerates A. Construct M that recognizes A. M =" On input w : 1. Run E. Every time that E outputs a string, compare it with w. 2. If w ever appears in the output of E , accept." (2) Let M recognizes A. Construct E that enumerates A. Let {s1 , s2 , s3 , } = * . E =" Ignore the input. 1. Repeat the following for i = 1,2,3, 2. 3. Run M for i steps on each input, s1 , s2 , s3 , , si . If any computatio ns accept, print out the correspond ing s j ."
18
19
Hilberts 10 Problem
th
D = { p | p is a polynomial with an itegral root}. D1 = { p | p is a polynomial over x with an itegral root}. M 1 =" The input is a polynomial p over x. 1. Evaluate p with x set successive ly to the values 0,1,1,2,2, If at any point the polynomial evaluates to 0, accept." M 1 recognizes D1. Likewise, we can construct M that recognizes D. Since M 1 and M loop when p has no integral roots, they are not deciders. We can convert M 1 to be a decider for D1 because we can restrict t he effective search area. For multivariable cases, we can not.
20
Problem 3.18
Let f ( x) = c1 x n + c2 x n 1 + + cn x + cn +1 be a polynomial with integral coefficien ts and has a root at x = x0 . Let cmax be the largest absolute value of a ci . Then we have | x0 |< (n + 1) cmax . | c1 |
Proof. If x0 = 0, we have nothing to prove. Let us assume that x0 0. | c1 x0 |=| c2 c3 1 1 cn +1 n 1 | n cmax < (n + 1)cmax . x0 x0
21