1 / 33

Theory of Computation

Theory of Computation. Theory of Computation Peer Instruction Lecture Slides by  Dr. Cynthia Lee, UCSD  are licensed under a  Creative Commons Attribution- NonCommercial - ShareAlike 3.0 Unported License . Based on a work at  www.peerinstruction4cs.org.

Download Presentation

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. Theory of Computation Theory of Computation Peer Instruction Lecture Slides by Dr. Cynthia Lee, UCSD are licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.Based on a work at www.peerinstruction4cs.org.

  2. Looking back on diagonalizationproof that ATM is undecidable Why is it calledDiagonalization? 2

  3. Diagonalization to prove that |R| > |N| • z cannot be in f(n) for any n in N, because z differs from f(n) in f(n)’s nth decimal place • Easy to see why we call this “diagonalization”

  4. Why do we call the ATMundecidability proof “diagonalization”? D(<M>): Run MATM(M(<M>)), if acc->rej, if rej->acc What goes in the green region? Acc, Rej, Rej, Rej Rej, Acc, Acc, Acc Not enough information

  5. Why do we call the ATMundecidability proof “diagonalization”? D(<M>): Run MATM(M(<M>)), if acc->rej, if rej->acc What goes in the green region? Rej Acc Not enough information (d) Other! Paradox!

  6. Changing one problem into another Reductions Using ATMexamples 6

  7. 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>): • String Z = “Z(x): \n” + “Count the number of 1s in x.  If it is 2, accept.\n” + “Simulate” + <M> + “ on input “ + w + “. If it accepts, accept. If it rejects, reject. ”; • Call DTWO(Z) //DTWOis a decider for TWO • If DTWO(Z) 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. 7

  8. 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.

  9. 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 DATMthat decides ATM. • DATM(<M,w>): • String Z = “Z(x): \n” + “If x != “111” and x != “101” then reject. \n” + “Simulate” + <M> + “ on input “ + w + “. If it accepts, accept. If it rejects, reject. ”; • 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) {“101”,”111”} if M(w) accepts, otherwise empty set(d) Σ * if M(w) accepts, and {“101”,”111”} if M(w) does not accept 9

  10. 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.

  11. 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 DATMthat decides ATM. • DATM(<M,w>): • String Z = “Z(x): \n” + “If x != “01” and x != “10” then reject \n” + “If x == “01” accept \n” + “ ??? ”; • 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). 11

  12. 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.

  13. Rice’s Theorem • Let P be anynon-trivial property of the language of a Turing machine • The problem of determining whether a given Turing machine’s language has property P is undecidable • It doesn’t matter what the property is! • Non-trivial here means that P is a property of the language of at least one, but not all, Turing machines • Also, P must be a property of the language of the Turing machine, i.e., if L(TM1) = L(TM2), then P is true of L(TM1) iff P is true of L(TM2)

  14. What can we conclude from a reduction? Properties of Reductions

  15. MYSTERY_LANG reduces to ACFG • Which of the following is true (given the above statement is true): • You can reduce from MYSTERY_LANG to ACFG. • MYSTERY_LANG is decidable. • A decider for ACFG (if it exists) could be used to decide MYSTERY_LANG. • All of the above

  16. ATM reduces to MYSTERY_LANG • Which of the following is true (given the above statement is true): • You can reduce to MYSTERY_LANG from ATM. • MYSTERY_LANG is undecidable. • A decider for MYSTERY_LANG (if it exists) could be used to decide ATM. • All of the above

  17. MYSTERY_LANG reduces to ATM • Which of the following is true (given the statement above is true): • You can reduce to ATM from MYSTERY_LANG. • MYSTERY_LANG is undecidable. • A decider for ATM (if it exists) could be used to decide MYSTERY_LANG. • All of the above • Other

  18. Review Measuring Complexity of Decidable ProblemsBig-O

  19. Review: How Big-O Simplifies Analysis • The number of transitions Turing Machine M takes when run on input w can be written as a function of n=|w| like this: f(n) = 10n3 + 200n2 + 5 Which best represents a tight bound on the big-O running time of M(w)? (where n = |w|) • O(n3 + n2) • O(n5) • O(n3) • O(200n2)

  20. Counting Big-O • Let L = { <G> | Grammar G generates at least one string of length |<G>| } (Σ = {0,1}) • TM M decides L: • M(<G>): • For each string x in {0,1}* that is of length |<G>| • Run TM MACFG(<G,x>), if accept, then accept // TM that decides ACFG • (if didn’t accept yet) Reject. Which best represents a tight bound on the big-O running time of M(<G>)? (where n = |<G>|) • O(n2) • O(n4) • O(2n) • O(2n2) • O(4n)

  21. Complexity Classes Measuring Complexity of Decidable ProblemsP AND NP

  22. Polynomial Time • A language L can be decided in polynomial time if there exists a TM recognizing L that, on input n characters long, will accept or reject in O(nk) steps in the worst case, for some constantk • (i.e., n2n doesn’t count)

  23. P and NP • P is the class of languages that can be decided in polynomial time on adeterministic, single-tape TM • NPis the class of languages that can be decided in polynomial time on a non-deterministic TM • Alternate definition of NP: problems where, if somebody gives you a solution, you can check it for correctness in polynomial time on a deterministic, single-tape TM • NP stands for non-determinisiticpolynomial

  24. Complexity Classes • The red part is not actually known!! • P = NP?? • P NP?? • Is it possible that NP P? • Can you prove or disprove it?

  25. P = NP ???????? • Perhaps the greatest theoretical computation question of our time • Most people suspect no, but it has never been proven… • If you can prove it one way or the other, you win $1,000,000 from the Clay Institute Two Possible Venn Diagrams

  26. Complexity Classes A Clue in the P ≠/= NP Puzzle?The Class NP-Complete

  27. Polynomial-time Mapping Reducibility • If A B (we can transform an instance of problem A into something that can be solved with one call to a decider for problem B), and MB uses a polynomial number of steps in the worst case, then as long as the process of reducing A to B takes a polynomial number of steps… • A B • A is in P!

  28. Mapping Reducibility and NP-Completeness • There are a class of problems that are known to be in NP (can be solved in polynomial time using nondeterminism), but no deterministic polynomial time algorithm has ever been discovered to solve any of them • Boolean equation satisfiability • Traveling salesman • Various graph problems (Clique, Independent Set, …) • Various scheduling optimization problems • FreeCell (Windows game), Sudoku • Map coloring • Amazingly, all these problems can be to each other • This means that a polynomial-time solution to ONE is a polynomial time solution to ALL !!

  29. 3-SAT and CLIQUE (p.275)

  30. If P ≠ NP

  31. If P = NP

  32. Wonderful!!! Doom!!! Consequences of P ≠/= NPWhat’s at Stake?

  33. If P = NP, what would the consequences be? • Many cryptographic systems are no longer secure, so all your Facebook, Gmail and online credit card transactions become insecure in a way they weren’t before • Many important optimizations may now be computationally practical, improving our lives and efficiency in many things • It takes as long to verify the correctness of an answer to problems in NP as it does to find the correct answer in the first place • Other/None/More than one

More Related