You are on page 1of 4

Assignment 7

CMPUT 474
Max Uhlich 1171907

CMPUT 474 - Assignment 7

Max Uhlich

5.13
UT M = { T |T is a TM with at least one useless state.} Suppose UT M is decidable and let a TM H be its decider. Let U be the Universal Turing Machine as described in the book. The following TM S decides AT M : S = On input M, w : 1. Construct the following TM. F = On input x: 1. If x = w, accept. 2. If x = w, run U on M, w and accept or reject as U does. 2. Run H on F . If H accepts, accept. If H rejects, reject. The comparison step of F is naturally implemented without any useless states as well. It would be a string of states, between which would be transitions corresponding to successive symbols in w. From each state there would be a transition to the accept state for any symbol not matching with the current symbol of w. The Universal Turing Machine is designed in such a way as to use every state on any input. If U were not designed to use every state on any input, we could modify it to that end by adding a loop state right before the accept state. Using special tape symbols, it would transition back and forth in some predetermined sequence from the loop state to every state of the machine not equal to qaccept or qreject and then it would accept. I wont go further into detail because I am convinced from what I have read on the internet that there exists a Universal Turing Machine which has been designed in such a way as to use every state (not necessarily qaccept or qreject ) on any input. The machine F will thus have a useless state if and only if M accepts w for a given M and w. That useless state will be the reject state. The machine S contradicts the fact that AT M is undecidable, therefore UT M is undecidable.

5.23
A is decidable if and only if A m 0 1 . Suppose A m 0 1 . If 0 1 is decidable then A is decidable by theorem 5.22 on page 208 of the text. 0 1 is a regular expression so it describes a regular language, therefore it is decidable. This implies that A is decidable. Suppose A is decidable. Let M decide A. The following machine computes a reduction from A to 0 1 . F = On input x: 1. Run M on input x. 2. If M accepts, output 01. 3. If M rejects, output 10. The above computes the function f : where for every x, x A f (x) 0 1 , therefore A m 0 1 .

CMPUT 474 - Assignment 7

Max Uhlich

5.34
Z = {ww|w {0, 1} } H = { P |P is a PDA which accepts some string s Z} Suppose this language is decidable and let D be its decider. We can now build a decider for AT M which uses D. For a given TM M and a string x we construct a PDA P which accepts a string in Z if and only if M accepts x. That is to say, P accepts a string in Z if and only if there exists an accepting computation history for M on x. We can do this by constructing P using the description of M to accept exactly that computation history (actually a special encoding of it) for M on x, of which there is only one (if it exists). Once we have our PDA P which accepts a computation history for M on x, we can connect two copies of P in series to create a larger machine which accepts a string in Z, namely s = ww where w is a computation history for M on x. We simply remove the accept state from the rst copy of P , call it P1 , and those transitions which entered it we direct into the start state of the second copy, P2 . We create P to accept a special encoding of a computation history for a given M = (Q, , , , q0 , qa , qr ) on x. This encoding is depicted below: D Sb1 b2 . . . bk DD b2 . . . b2 b2 S 2 DD S 2 b2 b2 . . . b2 DD b3 . . . b3 b3 S 3 DD . . . . . . . . . DD bn . . . bn bn S n D k 2 1 1 2 k k 2 1 k 2 1
C1
R C2

C2

R C3

R Cn

S i = Fixed width binary number representing M s state in conguration i. Number of bits in this eld are chosen on inspection of Q so as to be able to express uniquely each possible state. For example, if there are 7 states in Q this eld must be able to represent binary numbers 0 to 6, so it is xed at length 3. bi = Fixed width binary number indicating the jth symbol on the tape in conguration i. Number of bits j in this eld are chosen to be able to express uniquely each symbol in plus a special delimiter symbol and another special symbol for the tape head, which by design do not appear in . One of bi . . . bi for each i is 1 k the special tape head symbol indicating its position on the tape in conguration i. D = The special delimiter symbol of the same width as any bi . j Notice that every individual eld is of xed width, but the string of tape symbols including the position of the tape head b1 . . . bk is of variable size, i.e. bi may not equal bj . The delimiter symbol will allow the k k PDA to recognize the end of a particular conguration, and the fact that each individual eld is xed gives the string a structure easily followed by a PDA. As you can see, the above encoding would represent a computation history for M on x if C1 is the start conguration for M on x, each Ci+1 follows legally from Ci , and Cn is an accepting conguration for M . The PDA P will be constructed to accept any string of this form which is a valid computation history for M on x. P will check all three of those conditions and reject if at any point they are not satised or the string is invalid (i.e. if the value of S i did not correspond to any state in Q). P will rst check C1 to make sure it is the starting conguration for M on x. It will push C1 to the stack while doing so. Since the congurations R are in the form Ci DDCi+1 DDCi+1 , P will be able to push conguration i and check it against conguration i + 1 in reverse order while popping. It can then push conguration i + 1 and repeat. So for every pair of congurations, P will check to make sure that the second follows legally from the rst according to . If any of these does not follow, it will reject. If P comes to a conguration in which the state of the machine corresponds to qa , it will nish verifying that the current conguration follows legally from the last and then accept. Notice that when it accepts it will have an empty stack, since the accepting conguration would have been compared to the previous conguration while popping it. Thus P accepts an accepting computation history for M on x. We can now join two copies of P in series as was mentioned above to create a machine which accepts a string in Z if and only if there exists a computation history for M on x in the described form. We join P1 with P2 as described above and call the larger machine P P . Now P P accepts a string if and only if M accepts x. The following TM decides AT M . 2

CMPUT 474 - Assignment 7

Max Uhlich

S = On input M, x , where M is a TM and x is a string: 1. Construct the PDA P P using M and x as described above. 2. Run D on input P P . 3. If D accepts, accept, otherwise reject. This is a contradiction of the fact that AT M is undecidable, therefore H is undecidable.

You might also like