Upload
lynne-barber
View
218
Download
0
Embed Size (px)
Citation preview
2005 SDU
Lecture13 Reducibility—A methodology for proving un-
decidability
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.
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.)
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 P1. For each instance IQ of Q, construct an instance IP of P
2. Solve IP by using Mp
3. From the answer of 2 to get the answer for corresponding IQ
4. Since Q is known to be un-decidable, MP cannot exist.
2005 SDU 5
Application
Problem P: HALTTM, is the problem of determining whether a Turing machine M halts on an input w: HALTTM = {<M, w>| M is a TM and M halts on w}
We use the un-decidability of ATM to show that HALTTM is un-decidable by reducing ATM to HALTTM.
Proof idea: by construction:
Assume that HALTTM is decidable and use this assumption to show that ATM is decidable, which contradicts the un-decidability of ATM.
2005 SDU 6
Example --continued
S = “On input <M, w>, where M is a TM and w is a string:1. Run TM R on input <M, w> (R is an assumed decider of
HALTTM)
2. If R rejects, reject; (note: <M, w>ATM 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 HALTTM, S decides ATM, a contradiction. Hence, such a decider R for HALTTM
cannot exist.
2005 SDU 7
Language emptiness
ETM = {<M>| M is a TM and L(M) = }
Theorem 5.2 ETM is un-decidable.
Proof idea:
1. Assume that ETM is decidable and let TM R decides ETM.
2. Show that ATM is decidable by constructing TM S that uses R to decide ATM.
2005 SDU 8
Reduction from ATM to ETM
A good idea: Run R on a modification <M1> of <M>, where M1 guarantees that M1 rejects all strings except w. On w it works as usual, i.e., M1(w) is the same as M(w).
Then use R to test whether M1 recognizes the empty language.
The only string M1 can recognize is w, hence, L(M1) iff M accepts w.
If R accepts when it is fed with <M1>, it means that L(M1)=. Since M1 is identical with M on w, we know that M does not accept w.
2005 SDU 9
Reduction from ATM to ETM
The modified machine, M1 is defined by:
M1 = “On input x;
1. If x w, reject
2. If x = w, run M on input w and accept if M does.”
Note: M1 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.
2005 SDU 10
Reduction from ATM to ETM
Assume that ETM is decided by TM R and construct TM S that decides ATM as follows:S = “On input <M, w>, where M is a TM and w is a string:
1. Use the description of M and w to construct M1
2. Run R on input <M1>3. If R accepts, reject; if R rejects, accept.”
But a decider of ATM cannot exist, hence, R can not exist and ETM is un-decidable.
2005 SDU 11
TM and Regular languages
Test whether a TM has an equivalent DFA.
REGULARTM = {<M>| M is a TM and L(M) is regular}
REGULARTM is un-decidable.
Proof idea: Reduce ATM to REGULARTM: Assume REGULARTM is decided by a TM R, use R to construct a decider S of ATM.
Idea for S: Take input <M, w>, and construct a new TM M1 such that L(M1) is regular iff M accepts w.
2005 SDU 12
From ATM to REGULAR TM
Let R be a TM that decides REGULARTM. We construct TM S that decides ATM as follows:
S = “On input <M, w>, where M is a TM and w is a string:1. Construct TM M1 by the procedure:
M2 = “On input x:– If x = 0n1n for some n 0, accept.– If x 0n1n, run M on w and accept if M accepts w”
2. Run R on <M1>3. If R accepts, accept; if R rejects, reject.”
Since ATM is un-decidable, S cannot exist, hence, R cannot exist. REGULARTM is un-decidable.
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).
2005 SDU 14
Using other reductions
Sometimes reducing from other (different from ATM) un-decidable languages, such as ETM, is more convenient.
Example: Testing the equivalence of two TM:
EQTM = {<M, N>| M and N are TMs and L(M)=L(N)} can be proven un-decidable by reduction fro ETM.
2005 SDU 15
Using other reductions
Let TM R decides EQTM. Construct TM S to decide ETM as follows:
S = “On input <M>, where M is a TM:1. Run R on input <M, N>, where N is a TM that rejects
all inputs
2. If R accepts, accept; if R rejects, reject.”
Note: If R decides EQTM, then S decides ETM. But ETM is un-decidable. Hence, R cannot exist, and EQTM is un-decidable.
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 C1, C2, …, Ck, where1. C1 is the start configuration of M on w2. Ck is an accepting configuration of M3. Ci+1 legally follows from Ci according to the
transition function of M• Rejecting computation history can be defined similarly.
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.
2005 SDU 18
Linear bounded automaton
Lemma. Let M be an LBA with q states and with a tape alphabetof size s. For every n 1, for every input of length n, there are precisely qnsn 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.
2005 SDU 19
Decide ALBA
Language ALBA ={<M, w>| M is an LBA that accepts string w}is decidable.
The algorithm that decides ALBA is:L = “On input <M, w>, where M is an LBA and w is a string:
1. Simulate M on w for qngn 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.”
2005 SDU 20
ELBA is un-decidable
Lx if and only if M accepts w.
For a string x = <M, w> such that M is a Turing machine and w is an input to M, let Lx be the set of all strings of the form #C1#C2#...#Cm# such that 1. C1, …, Cm are configurations of M, 2. C1 is the initial configuration of M on w, 3. Cm is the accepting configuration of M on w, 4. Each Ci+1 legally follows from Ci.then Lx can be recognized by an LBA.
2005 SDU 21
Un-decidability concerning LBA
ELBA = {<M>| M is an LBA and L(M)=} is un-decidable.
Proof. Suppose that on the contrary TM R decides ELBA. Construct TM S that decides ATM as follows:
S = “On input <M, w>, 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 <B>;3. If R rejects, accept; if R accepts, reject.”
2005 SDU 22
Un-decidability of ALLCFG
The language ALLCFG = {<G> | G is a CFG and L(G) = *} is un-decidable.
Proof. Using the decidability of ALLCFG, one can devise the following decision procedure for ATM:
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.
2005 SDU 23
Concerning ALLCFG
Notice that when a string s is popped off the stack, it is in reverseorder. So, to compare Ci and Ci+1, we write the sequence of configurations in a different way: #C1#C2
R#C3#C4R#...Cm#.
Hence, G generates all strings that:1. Do not start with C1,2. Do not end with an accepting configuration3. For some i, Ci does not properly yield Ci+1 under the rules of M.
Construct the equivalent PDAG and then convert it to G.
2005 SDU 24
Concerning ALLCFG
Suppose that TM R decides ALLCFG, construct a TM S that decides ATM as follows:
S=“On input <M, w>, 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 <G>.
3.If R accepts, reject; if R rejects, accept.”
2005 SDU 25
Application
EQCFG = {<G, H>| G and H are CFGs and L(G) = L(H)} is un-decidable.
Proof. Assume that EQCFG were decidable. Construct a decider M for ALLCFG by:
M = “On input <G>, where G is a CFG:1. Construct CFG H such that L(H)=*
2. Run the decider for EQCFG on <G, H>
3. If it accepts, accept; if it rejects, reject.”