1 / 25

Reducibility

Reducibility. Chuck Cusack Based on M. Sipser, “Introduction to the Theory of Computation,” Second Edition, Thomson/Course Technology, 2006, Chapter 5. Review. Recall the halting problem : HALT TM = {  M, w  | M is a TM that halts on input w }

cicely
Download Presentation

Reducibility

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Reducibility Chuck Cusack Based on • M. Sipser, “Introduction to the Theory of Computation,” Second Edition, Thomson/Course Technology, 2006, Chapter 5.

  2. Review • Recall the halting problem: HALTTM = { M, w | M is a TM that halts on input w } • We will prove that HALTTM is not decidable. • Recall the language: ATM= { M, w | M is a TM that accepts w } • Also recall that we proved the following theorem: Thm 4.11: ATM= { M, w | M is an TM that accepts w } is not decidable. • We will prove that HALTTM is not decidable by using this theorem.

  3. HALTTM is not Decidable Thm 5.1: HALTTM = { M, w | M is a TM that halts on input w } is not decidable. Proof: • Assume HALTTM is decidable. • Then some TM R decides HALTTM. • Using R, we construct a TM S that will decide ATM as follows: S = “On input M, w, where M is a TM and w a string, • Run TM R on input M, w. // Determine if M halts with input w. • Reject if R rejects. // If the machine doesn’t halt, M, w ATM. (Why?) • If R accepts, simulate M on w until it halts. // If it halts, then just run it. • Accept if M accepts, reject if M rejects.” // Return the answer • Clearly S decides ATM. • But ATM is not decidable, so we have a contradiction. • Therefore, HALTTM is not decidable.

  4. ETM is not Decidable Thm 5.2: ETM= { M | M is a TM and L(M) =  } is not decidable. Proof: • Assume ETM is decidable. Then some TM R decides ETM. • Using R, we will construct a TM S that will decide ATM. • Given input M, w, we first construct a TM M1 as follows: M1 = “On input x: • If x≠ w, reject. • If x = w, run M on input w and accept if M accepts.” • Notice that • if M accepts w, M1 accepts w and no other string. • if M does not accept w, M1 accepts no strings. • Therefore, M accepts w iff L(M1) ≠.

  5. ETM is not Decidable Proof continued: • We constructed TM M1 s.t. M accepts w iff L(M1) ≠. • Thus, if we can determine whether or not L(M1) ≠, we can decide whether or not M accepts w. • That is, ATM reduces to ETM. • Thus we construct a TM S that will decide ATM as follows: S = “On input M, w, where M is a TM and w a string, • Construct TM M1 based on description of M and w. • Run R on input M1. • Accept if R rejects, reject if R accepts.” • Clearly S decides ATM. • But ATM is not decidable, so we have a contradiction. • Therefore, ETM is not decidable.

  6. Reductions • Problem Areduces to problem B if a solution to B can be used to solve A. • If I can reduce problem A to problem B and I can solve problem B, then I can solve problem A. • Example • Let A = “Given a list of names, find the alphabetically first one” • Let B = “Given a list of words, rearrange them so they are in alphabetical order” • Notice that if the names on my list were in alphabetic order, the first name on the list would be the one I want. • That is, I can reduce problem A to problem B. • Thus, a solution to problem B helps me solve problem A. • Bad joke: When a certain mathematician wakes up every morning, he sits at the table reading his favorite mathematics journal as his wife makes coffee for him. One week she goes on vacation, and when he wakes up, he realizes he has to make his own coffee. Fortunately, he remembers how she did it—she opens the cupboard, takes out the coffee and a mug, puts a few scoops of coffee it in the mug, adds water, and puts it in the microwave. So he does it, and all is well. Unfortunately, when he wakes up the next day, he again realizes he has to make his own coffee. To his horror, he discovers that the coffee and the mug are not in the cupboard—they are on the counter. Thinking for a minute, he realizes he can reduce the problem to one he has previously solved. He puts the coffee and the mug into the cupboard and shuts the door. He proceeds to make the coffee as he did the previous day.

  7. Reductions and Decidability • We have seen that if I can solve problem B and I can reduce problem A to problem B, then I can solve problem A. • We can apply this to decidability • Notice that if A reduces to B and B is decidable, then A is decidable. • Thus, to prove a problem is decidable, you can show it can be reduced to a decidable problem. • On the other hand, if I cannot solve problem A and I can reduce problem A to problem B, then I cannot solve problem B. • This is because if I could solve problem B and I could reduce problem A to problem B, this would lead to a solution to problem A.

  8. Reductions and Undecidability • We have seen that if I cannot solve problem A and I can reduce problem A to problem B, then I cannot solve problem B. • We can apply this to undecidability • Notice that if A reduces to B and A is undecidable, then B is undecidable. • Thus, to prove a problem is undecidable, you can show some undecidable problem can be reduced to it. • This is the technique we have used for the last two proofs. • We will now prove a few more results using this technique.

  9. Turing Machines and Regular Languages • Given a TM M, can we determine whether or not L(M) is regular? • The language related to this problem is REGULARTM = { M | M is a TM and L(M) is a regular language } • The question we want to answer is Is REGULARTM decidable? • It should not surprise you to know that the answer is “no.” • We will prove this.

  10. REGULARTM is not Decidable Thm 5.3:REGULARTM = { M | M is a TM and L(M) is a regular language }is not decidable. Proof idea: • We will show that we can reduce ATM to REGULARTM. • That is, given an instance of ATM, we will show how to solve it using a TM that solves REGULARTM. • But ATM is undecidable, so this is impossible. • Thus, REGULARTMis undecidable. • In order to do this, we will first create a TM M2that will accept a regular language iff M accepts w.

  11. REGULARTM is not Decidable Proof idea continued: • We want a TM M2that will accept a regular language iff M accepts w. • Given input M, w, TM M2 will operate as follows: M2 = “On input x: • If xhas the form 0n1n, accept. • If x does not have this form, run M on input w and accept if M accepts w.” • Notice that • If M accepts w, L(M2) = ∑*, a regular language, and • If M does not accept w, L(M2) = {0n1n| n ≥ 0}, a non-regular language. • That is, L(M2) is a regular language iff M accepts w.

  12. REGULARTM is not Decidable Proof: • Assume REGULARTM is decidable. Then some TM R decides REGULARTM. • Using R, we will construct a TM S that will decide ATM. S = “On input M, w, where M is a TM and w a string, • Construct TM M2 as follows M2 = “On input x: • If xhas the form 0n1n, accept. • If x does not have this form, run M on input w and accept if M accepts w. • Run R on input M2. // R accepts iff M accepts w. • Accept if R accepts, reject if R rejects.” • Since S accepts iff M accepts w, we can decide ATM. • This is a contradiction, since ATM is undecidable. • Therefore, REGULARTM is undecidable.

  13. Rice’s Theorem • We have seen that we cannot tell whether or not the language accepted by a TM is regular. • We can also prove that languages CFLTM , FINITETM , ODDLENGTHTM , (where each is defined similarly to REGULARTM) etc. are not decidable. • In fact, it can be shown that deciding any nontrivial property (one that some but not all TMs have) of a TM language is undecidable: Thm 5.π:For any given nontrivial property P of TMs, PTM = { M | M is a TM and L(M) has property P }is not decidable. • See Problem 5.28 and solution in Sipser for more details.

  14. EQTM is not Decidable Thm 5.4:EQTM= { M, N | M and N are TMs with L(M) = L(N) }is not decidable. Proof: • We will show that we can reduce ETM to EQTM. • Assume EQTM is decidable. Then some TM R decides EQTM. • Using R, we construct TM S that will decide ETM as follows S = “On input M, where M is a TM: • Run R on input M, N, where TM N rejects all inputs. • Accept if R accepts, reject if R rejects.” • Since S accepts input M iff L(M) = L(N) = , we can decide ETM. • This is a contradiction, since ETM is undecidable (Thm 5.2). • Therefore, EQTM is undecidable.

  15. Formalizing Reducibility • So far we have talked about reducing one problem to another rather informally. • Now we formalize the notion by discussing mapping reducibility (or many-one reducibility). • Before we can do that, we need to realize that a TM can compute a function by replacing the input on the tape with the desired output. • That is, instead of merely accepting or rejecting an input, we can use a TM to perform computations. • Thus, if a TM implements function f, then given input w, TM will output f(w).

  16. Computable Functions • Definition: A function f: ∑*→ ∑* is a computable function if some TM M, on every input w, halts with just f(w) on its tape. • As we have discussed previously, any function that can be computed by any reasonable model of computation can be computed by a TM. • For instance, we know that we can implement addition, multiplication, polynomial evaluation, etc. on a computer. • Therefore, we can construct a TM to compute these functions. • Therefore, these functions are computable.

  17. Mapping Reducible • Definition: A language A is mapping reducible to language B if there is a computable function f: ∑*→ ∑*, where for every string w, w A f(w) B • If A is mapping reducible to B, we write A≤mB. • The function f is called the reduction of A to B. • In words, a function f is a reduction from A to B if every string in A maps to a string in B, and every string not in A maps to a string not in B. • A reduction from A to B allows us to answer a question about membership in A by converting it to a question about membership in B. • If A reduces to B, to test if w A, we can instead test if f(w) B.

  18. Mapping Reducibility and Decidability Thm 5.22:If A≤mB and B is decidable, then A is decidable. Proof: • Let TM M be a decider for B. • Since A≤mB, there is some computable function f that maps A to B. • We construct a decider N for A as follows: N = “On input w: • Compute f(w). • Run M on input f(w) and output whatever M outputs.” • Since A≤mB, w A f(w) B. • Thus, N accepts w M accepts f(w)  w A. • Thus, N decides A.

  19. Mapping Reducibility and Undecidability • The following corollary should be easy to see: Corollary 5.23:If A≤mB and A is undecidable, then B is undecidable. • We essentially used this corollary to prove several of the results in these notes, although we didn’t actually prove anything related to mapping reducibility. • In particular, we proved that HALTTM is undecidable by reducing from ATM. • But in all of these proofs we did not actually use the concept of mapping reducibility in the proof. • Can we actually demonstrate that ATM≤mHALTTM?

  20. Halting Problem Revisited • We want to prove that ATM≤mHALTTM. • To do so, we need to show there is a computable function f that maps an input M, w to output M', w', where M, wATM M', w'HALTTM • That is, we need to construct a TM F which takes input M, w and outputs M', w', where M is a TM. • Notice that if M is not a TM, then M, wATM , so we need to make sure the output is not in HALTTM. • This is easy enough—if the input is not valid, we output “blah”, which certainly isn’t of the correct form.

  21. Proof that ATM≤mHALTTM • To show that ATM≤mHALTTM, we give the following TM that computes the reduction. F = “On input M, w: • If M is not a valid TM, output “blah”. • Otherwise, construct the following TM M': M'= “On input x: • Run M on x. • Accept if M accepts • Loop if M rejects. • Output M', w” • Notice that M' halts iff given an input string that M accepts. • Therefore, we can see that M, wATM iff M', w'HALTTM.

  22. Mapping Reducibility and Undecidability • It should be clear that a language B is decidable if and only if B is decidable. • Thus, a language B is undecidable if and only if B is undecidable. • Given this, we can strengthen Corollary 5.23: Corollary 5.23b:If A≤mB orA≤mB and A is undecidable, then B is undecidable. • In fact, the proof of Theorem 5.2 sort of used a mapping of the form A≤mETM.

  23. Reducibility and Turing-Recognizability • We can prove results about reductions and Turing-recognizable languages that are analogous to the theorems about reductions and decidability. Thm 5.28:If A≤mB and B is Turing-recognizable, then A is Turing-recognizable. Proof: • Replace deciders in proof of Thm 5.22 with recognizers. Corollary 5.29:If A≤mB and A is not Turing-recognizable, then B is not Turing-recognizable.

  24. ATM and Turing-reducibility • Recall that ATM is not Turing-recognizable. • Also observe that A≤mB  A≤mB • This leads to the following useful result: Corollary 5.29b:If ATM≤mB, then B is not Turing-recognizable. Proof: • Since ATM≤mB  ATM≤mB, applying Corollary 5.29 and the fact that ATM is not Turing-recognizable, the result follows. • Thus, one way to show that a language is not Turing-recognizable is to reduce ATM to the complement of the language. • Can we prove a language A is not Turing-recognizable by proving ATM≤mA? Why or why not?

  25. A final Theorem about EQTM Thm 5.4:EQTM= { M, N | M and N are TMs with L(M) = L(N) }is neither Turing-recognizable nor co-Turing-recognizable. Proof: • Time permitting, work it out. • Otherwise, read the proof in Sipser Section 5.3.

More Related