Presentation is loading. Please wait.

Presentation is loading. Please wait.

 2005 SDU Lecture13 Reducibility — A methodology for proving un- decidability.

Similar presentations


Presentation on theme: " 2005 SDU Lecture13 Reducibility — A methodology for proving un- decidability."— Presentation transcript:

1  2005 SDU Lecture13 Reducibility — A methodology for proving un- decidability

2  2005 SDU 2 Reduction Reduction is a method of converting one problem into another in such a way that a solution to the second problem can be used to solve the first problem. Reduction involves always two problems, A and B, if A reduces to B, we can use a solution to B to solve A. Note: Reducibility says nothing about solving A or B. Reducibility is only about solvability of A using a solution to B.

3  2005 SDU 3 Observations When problem A is reducible to problem B, solving A cannot be harder than solving B, because a solution to B gives a solution to A. If A is reducible to B and B is decidable, then A is decidable (because a solution to B solves A) If A is reducible to B and A is un-decidable, then B is un- decidable (Because if B were decidable, then A would be, a contradiction.)

4  2005 SDU 4 Methodology To prove that a problem P is unsolvable by reduction proceeds as follows: 1.Find a problem Q known to be un-decidable 2.Assume that P is solvable by a TM Mp 3.Use Mp to solve Q thus reducing Q to P 1.For each instance I Q of Q, construct an instance I P of P 2.Solve I P by using Mp 3.From the answer of 2 to get the answer for corresponding I Q 4.Since Q is known to be un-decidable, M P cannot exist.

5  2005 SDU 5 Application Problem P: HALT TM, is the problem of determining whether a Turing machine M halts on an input w: HALT TM = { | M is a TM and M halts on w} We use the un-decidability of A TM to show that HALT TM is un-decidable by reducing A TM to HALT TM. Proof idea: by construction: Assume that HALT TM is decidable and use this assumption to show that A TM is decidable, which contradicts the un-decidability of A TM.

6  2005 SDU 6 Example --continued S = “On input, where M is a TM and w is a string: 1.Run TM R on input (R is an assumed decider of HALT TM ) 2.If R rejects, reject; (note:  A TM or M is looping); 3.If R accept, simulate M on w until it halts; 4.If M has accepted, accept; if M has rejected, reject.” Note: If R decides HALT TM, S decides A TM, a contradiction. Hence, such a decider R for HALT TM cannot exist.

7  2005 SDU 7 Language emptiness E TM = { | M is a TM and L(M) =  } Theorem 5.2 E TM is un-decidable. Proof idea: 1.Assume that E TM is decidable and let TM R decides E TM. 2.Show that A TM is decidable by constructing TM S that uses R to decide A TM.

8  2005 SDU 8 Reduction from A TM to E TM A good idea: Run R on a modification of, where M 1 guarantees that M 1 rejects all strings except w. On w it works as usual, i.e., M 1 (w) is the same as M(w). Then use R to test whether M 1 recognizes the empty language. The only string M 1 can recognize is w, hence, L(M 1 )  iff M accepts w. If R accepts when it is fed with, it means that L(M 1 )= . Since M 1 is identical with M on w, we know that M does not accept w.

9  2005 SDU 9 Reduction from A TM to E TM The modified machine, M 1 is defined by: M 1 = “On input x; 1.If x  w, reject 2.If x = w, run M on input w and accept if M does.” Note: M 1 has w as part of its description. It conducts the test x = w by scanning the input and comparing it character by character with w.

10  2005 SDU 10 Reduction from A TM to E TM Assume that E TM is decided by TM R and construct TM S that decides A TM as follows: S = “On input, where M is a TM and w is a string: 1.Use the description of M and w to construct M 1 2.Run R on input 3.If R accepts, reject; if R rejects, accept.” But a decider of A TM cannot exist, hence, R can not exist and E TM is un-decidable.

11  2005 SDU 11 TM and Regular languages Test whether a TM has an equivalent DFA. REGULAR TM = { | M is a TM and L(M) is regular} REGULAR TM is un-decidable. Proof idea: Reduce A TM to REGULAR TM : Assume REGULAR TM is decided by a TM R, use R to construct a decider S of A TM. Idea for S: Take input, and construct a new TM M 1 such that L(M 1 ) is regular iff M accepts w.

12  2005 SDU 12 From A TM to REGULAR TM Let R be a TM that decides REGULAR TM. We construct TM S that decides A TM as follows: S = “On input, where M is a TM and w is a string: 1.Construct TM M 1 by the procedure: M 2 = “On input x: –If x = 0 n 1 n for some n  0, accept. –If x  0 n 1 n, run M on w and accept if M accepts w” 2.Run R on 3.If R accepts, accept; if R rejects, reject.”  Since A TM is un-decidable, S cannot exist, hence, R cannot exist. REGULAR TM is un-decidable.

13  2005 SDU 13 Observation Testing whether the language of a TM is context- free language is un-decidable. Testing whether the language of a TM is decidable is un-decidable. General result: Testing any property of the languages recognized by Turing machines is un- decidable (Rice’s theorem).

14  2005 SDU 14 Using other reductions Sometimes reducing from other (different from A TM ) un-decidable languages, such as E TM, is more convenient. Example: Testing the equivalence of two TM: EQ TM = { | M and N are TMs and L(M)=L(N)} can be proven un-decidable by reduction fro E TM.

15  2005 SDU 15 Using other reductions Let TM R decides EQ TM. Construct TM S to decide E TM as follows: S = “On input, where M is a TM: 1.Run R on input, where N is a TM that rejects all inputs 2.If R accepts, accept; if R rejects, reject.” Note: If R decides EQ TM, then S decides E TM. But E TM is un-decidable. Hence, R cannot exist, and EQ TM is un-decidable.

16  2005 SDU 16 Reductions via computation histories The computation history of a TM on an input is the sequence of configurations that the machine goes through as it processes the input. We distinguish two kinds of histories: Accepting computation history Rejecting computation history. An accepting computation history for M on w is a sequence of configurations C 1, C 2, …, C k, where 1.C 1 is the start configuration of M on w 2.C k is an accepting configuration of M 3.C i+1 legally follows from C i according to the transition function of M Rejecting computation history can be defined similarly.

17  2005 SDU 17 Computation history Computation histories are finite sequences. If M does not halt on w, no accepting or rejecting computation history exists for M on w.

18  2005 SDU 18 Linear bounded automaton Lemma. Let M be an LBA with q states and with a tape alphabet of size s. For every n  1, for every input of length n, there are precisely qns n possible configurations. An LBA is a restricted type of TM wherein the tape head isn’t Permitted to move off the portion of the tape containing the input.

19  2005 SDU 19 Decide A LBA Language A LBA ={ | M is an LBA that accepts string w} is decidable. The algorithm that decides A LBA is: L = “On input, where M is an LBA and w is a string: 1.Simulate M on w for qng n steps or until it halts; 2.If M halted, accept if M has accepted, and reject if M rejected. If M has not halted, reject.”

20  2005 SDU 20 E LBA is un-decidable L x   if and only if M accepts w. For a string x = such that M is a Turing machine and w is an input to M, let L x be the set of all strings of the form #C 1 #C 2 #...#C m # such that 1. C 1, …, C m are configurations of M, 2. C 1 is the initial configuration of M on w, 3. C m is the accepting configuration of M on w, 4. Each C i+1 legally follows from C i. then L x can be recognized by an LBA.

21  2005 SDU 21 Un-decidability concerning LBA E LBA = { | M is an LBA and L(M)=  } is un-decidable. Proof. Suppose that on the contrary TM R decides E LBA. Construct TM S that decides A TM as follows: S = “On input, where M is a TM and w is a string: 1.Construct LBA B from M and w as described above; 2.Run R on input ; 3.If R rejects, accept; if R accepts, reject.”

22  2005 SDU 22 Un-decidability of ALL CFG The language ALL CFG = { | G is a CFG and L(G) =  *} is un-decidable. Proof. Using the decidability of ALL CFG, one can devise the following decision procedure for A TM :  For a TM M and input w construct CFG G that generates all strings over the extended alphabet of M iff M does not accept w.  If M does accept w, G does not generate a particular string which is the accepting computation history for M on w. Note: G is designed such that it generates all strings that are not accepting computation histories for M on w.

23  2005 SDU 23 Concerning ALL CFG Notice that when a string s is popped off the stack, it is in reverse order. So, to compare C i and C i+1, we write the sequence of configurations in a different way: #C 1 #C 2 R #C 3 #C 4 R #...C m #. Hence, G generates all strings that: 1.Do not start with C 1, 2.Do not end with an accepting configuration 3.For some i, C i does not properly yield C i+1 under the rules of M. Construct the equivalent PDA G and then convert it to G.

24  2005 SDU 24 Concerning ALL CFG Suppose that TM R decides ALL CFG, construct a TM S that decides A TM as follows: S=“ On input, where M is a TM and w is a string: 1.Construct CFG G from M and w as described. 2.Run R on input. 3.If R accepts, reject; if R rejects, accept.”

25  2005 SDU 25 Application EQ CFG = { | G and H are CFGs and L(G) = L(H)} is un-decidable. Proof. Assume that EQ CFG were decidable. Construct a decider M for ALL CFG by: M = “On input, where G is a CFG: 1.Construct CFG H such that L(H)=  * 2.Run the decider for EQ CFG on 3.If it accepts, accept; if it rejects, reject.”


Download ppt " 2005 SDU Lecture13 Reducibility — A methodology for proving un- decidability."

Similar presentations


Ads by Google