1 / 25

CSE 105 Theory of Computation

CSE 105 Theory of Computation. Alexander Tsiatas Spring 2012. Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons Attribution- NonCommercial - ShareAlike 3.0 Unported License. Based on a work at http://peerinstruction4cs.org.

kyne
Download Presentation

CSE 105 Theory of Computation

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. CSE 105Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. Based on a work at http://peerinstruction4cs.org. Permissions beyond the scope of this license may be available at http://peerinstruction4cs.org.

  2. What we did last time ATMis UNDECIDABLE

  3. ATM is undecidable • Proof by contradiction • Assume ATM is decidable • There’s a TM MATM that decides it • Use MATM to create another TM D in a clever way: • Running D(<D>) creates a paradox • D accepts <D> if and only if D rejects <D>

  4. Proof: • Thm: ATM = {<M,w> | M is a TM, M accepts w} is undecidable • Assume (towards contradiction) that ATM is decidable, so some TM MATM decides ATM. • Construct a TM D as follows: • D(<M>): //input is a string description of a TM • MATM(<M,<M>>)– MATM is a decider, so it will either accept or reject (no infinite looping) • If MATM accepts, we reject • If MATM rejects, we accept // we do the opposite of MATM • Run D(<D>). Observe that D(<D>) should accept when D(<D>) rejects, and D(<D>) should reject when D(<D>) accepts, a contradiction. Therefore the assumption is false, and ATM is undecidable.

  5. Proving it is undecidable The Halting ProblemHALTTM

  6. The Halting Problem • HALTTM = {<M,w> | M is a TM and M halts on input w} • Doesn’t say if M accepts or rejects w, just that it halts • Imagine we have a hypothetical TM Mhalt that decides HALTTM. • Could we use Mhaltto build a decider for ATM? • recall ATM = {<M,w> | M is a TM and M accepts w} Showing HALT is undecidable by reduction from ATM

  7. Thm. HALTTM is undecidable. • Proof by contradiction. • Assume that HALTTM is decidable, and some TM Mhaltdecides it. • Construct a TM MATM that decides ATM: • But is ATM is undecidable, a contradiction. So the assumption is false and HALTTM is undecidable.

  8. We just did a reduction! • We showed that *if* we have a solution to HALTTM, then we have a solution to ATM. • What did we show exactly? • ATM reduces to HALTTM. • HALTTM reduces to ATM. • HALTTM and ATM reduce to each other. • None of the above or more than one of the above.

  9. We showed some languages are not decidable… …Are there Languages That Are NotTuring-recognizable?

  10. Are there languages that areNOT recognizable? • YES, based on diagonalization and comparing infinite sets • |Languages| > |TM’s|, so there must be a language not recognized by a TM

  11. Could ATMbe not recognizable?{<M,w> | M is a TM, M accepts w} • No. We proved it was recognizable on Thurs. • B(<M,w>): • Run M(w) and accept if it accepts, reject if it rejects • (If it loops that’s ok) • Thought experiment: • What about the complement of ATM? • Lets just guess that it is also recognizable, and has a TM C that recognizes it • Could we use B and C to build a decider(!) for ATM?

  12. Thm.: ATM is not recognizable Proof by contradiction • Assume ATM is recognizable, so some TM C recognizes it. • We know that ATM is recognizable, so let Bbe a TM that recognizes it. • MATM-Decider (<M,w>): • But ATM is undecidable, a contradiction. So the assumption is false and ATM is not recognizable

  13. Recognizable and co-recognizable • Same method for arbitrary L: • L is recognizable but not decidable => L is not recognizable • Class of recognizable languages is not closed under complement • Same construction for arbitrary L: • L is recognizable AND co-recognizable => L is decidable

  14. EQTM, SubsetTM So, what does the Venn Diagram look like? Co-recognizable A B Co-recognizable Decidable Recognizable Decidable Recognizable C D Recognizable Recognizable Co-recognizable Co-recognizable Decidable Decidable

  15. Changing one problem into another Reductions More examples 15

  16. ETM = { <M> | M is a TM, and L(M) = {} } • Undecidable! Proven in textbook

  17. EQTM= { <M1,M2> | M1, M2 are TMs and L(M1) = L(M2) } • Thm. EQTMis undecidable. • Proof by contradiction. • Assume that EQTM is decidable, and some TM MEQ decides it. • Construct a TM METM that decides ETM: • METM(<M,w>): • Run MEQ(<M,Mx>) • If MEQ accepts, then accept. If it rejects, then reject. • But is ETM is undecidable, a contradiction. So the assumption is false and EQTM is undecidable. What Mx makes this proof work? • (a) L(Mx) = { w | w is in Σ* } (b) L(Mx) = EQTM • (c) L(Mx) = {} (d) L(MX) = ETM

  18. ETM reduces to EQTM (a) “If A reduces to B, we can use a solution to B to solve A.” We just did a reduction! • We showed that *if* we have a solution to EQTM, then we have a solution to ETM. • What did we show exactly? • ETM reduces to EQTM. • EQTM reduces to ETM. • EQTM and ETM reduce to each other. • None of the above or more than one of the above.

  19. Changing one problem into another Reductions Using ATMMore examples 19

  20. Thm.: TWO = {<M> |  for all w in L(M), w has exactly two 1s} is undecidable • Proof by contradiction: • Assume TWO is decidable by TM DTWO. Use DTWOto construct TM DATM that decides ATM. • DATM (<M, w>): • Construct M'(x): • Count the number of 1s in x.  If it is 2, accept. • Simulate M(w). If M(w) accepts, accept. If it rejects, reject. (might loop) • Call DTWO(<M'>)  //DTWOis a decider for TWO • If DTWO(<M'>) accepts, reject, else accept. • But ATM is undecidable, a contradiction. So the assumption is false and T is undecidable. QED. What is L(M’)? (a) Σ* (b) {x | x has exactly two 1s}(c) Σ * if M(w) accepts, and {x|x has exactly two 1s} if M(w) does not accept(d) Σ * if M(w) accepts, and the empty set if M(w) rejects. 20

  21. We just did a reduction! • We showed that if we have a solution to TWO, then we have a solution to ATM. • What did we show exactly? • ATM reduces to TWO. • TWO reduces to ATM. • TWO and ATM reduce to each other. • None of the above or more than one of the above.

  22. Thm. T = {<M> | M is a TM and both “101” and “111” are in L(M)} is undecidable • Proof by contradiction: (Reduce from ATM.) • Assume T is decidable by TM MT. Use MT to construct TM X that decides ATM. • X(<M,w>): • Construct Z(m): • If m != “111” and m != “101” then reject. • Else: Run M(w), if it accepts then accept. If it rejects then reject (might loop in which case obviously Z loops). • Run MT(<Z>). If it accepts then accept, otherwise reject. • But ATM is undecidable, a contradiction. So the assumption is false and T is undecidable. QED. What is L(Z)? (a) Σ * (b) {“101”, “111”}(c) empty set if M(w) rejects, and {“101”,”111”} if M(w) accepts.(d) Σ * if M(w) accepts, and {“101”,”111”} if M(w) does not accept 22

  23. We just did a reduction! • We showed that if we have a solution to T, then we have a solution to ATM. • What did we show exactly? • ATM reduces to T. • T reduces to ATM. • T and ATM reduce to each other. • None of the above or more than one of the above.

  24. Thm. T = {<M> | M is a TM that accepts wR whenever it accepts w} is undecidable • Proof by contradiction: (Reduce from ATM.) • Assume T is decidable by TM MT. Use MT to construct TM X that decides ATM. • X(<M,w>): • Construct Z(m): • If m != “01” and m!= “10” then reject • If m == “01” accept • ??? • Run MT(<Z>). If it accepts then accept, otherwise reject. • But ATM is undecidable, a contradiction. So the assumption is false and T is undecidable. QED. How do we finish Z? • Run M(w), if it accepts then accept. If it rejects then reject (might loop in which case obviously Z loops). • Run M(w), if it accepts then reject. If it rejects then accept (might loop in which case obviously Z loops). 24

  25. We just did a reduction! • We showed that if we have a solution to T, then we have a solution to ATM. • What did we show exactly? • ATM reduces to T. • T reduces to ATM. • T and ATM reduce to each other. • None of the above or more than one of the above.

More Related