1 / 31

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.

lajos
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. Some more formalities…. Mapping Reductions

  3. Mapping reductions:a second definition • A ≤m B • Second definition: • There is a function f: Σ* -> Σ* • If f(x) = y, then: • y is in B if and only if x is in A. • f is computable by a TM that always halts • We say that f maps strings in A to strings in B • Note that A ≤m B also implies A ≤m B

  4. Thm.: EQTM is not recognizable • ATM = { <M,w> | M accepts w } • EQTM = { <M1,M2> | L(M1) = L(M2) } • f(<M,w>) = <M1,M2> where: • M1 = “On any input, reject” • M2 = “On any input, run M on w. If it accepts, accept.” • Which mapping reduction does this f give? • ATM≤m EQTM • EQTM≤m ATM • ATM≤m EQTM • EQTM≤m ATM 4

  5. We showed: ATM ≤m EQTM • We know: ATM is NOT co-recognizable. • We showed this in a previous lecture • We showed: ATM is mapping reducible to EQTM. • We can “co-recognize” ATM by applying f and “co-recognizing” EQTM • This means: if EQTM is co-recognizable, then ATM is co-recognizable. • We know ATM is not co-recognizable, though. • Contradiction! EQTM is NOT co-recognizable. • The same as: EQTM is NOT recognizable. 5

  6. Thm.: EQTM is not co-recognizable • ATM = { <M,w> | M accepts w } • EQTM = { <M1,M2> | L(M1) = L(M2) } • f(<M,w>) = <M1,M2> where: • M1 = “Accept” • M2 = “On any input, run M on w. If it accepts, accept.” • Which mapping reduction does this f give? • ATM≤m EQTM • EQTM≤m ATM • ATM≤m EQTM • EQTM≤m ATM 6

  7. We showed: ATM ≤m EQTM • We know: ATM is NOT co-recognizable. • We showed this in a previous class • We showed: ATM is mapping reducible to EQTM. • We can “co-recognize” ATM by applying f and “co-recognizing” EQTM • This means: if EQTM is co-recognizable, then ATM is co-recognizable. • We know ATM is not co-recognizable, though. • Contradiction! EQTM is NOT co-recognizable. 7

  8. So, we did TWO mapping reductions • ATM ≤m EQTM • ATM ≤m EQTM • We have shown: There is a language (EQTM) that is not recognizable and also not co-recognizable! • In general: to show that a language L is NOT recognizable • Give a mapping reduction from ATM to L. • Pro tip: Use ATM as the stock “language that’s recognizable but not co-recognizable” x 2 8

  9. Review Measuring Complexity of Decidable ProblemsBig-O

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

  11. 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 are NOT a big-O running time of M(w)? (where n = |w|) • O(n3 + n2) • O(n5) • O(n3) • O(200n2) • More than one of the above

  12. Complexity Classes Measuring Complexity of Decidable ProblemsP AND NP

  13. 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 constant k

  14. 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-deterministic polynomial

  15. Complexity Classes:Where are P and NP? Recognizable Decidable Context-free Co-recognizable Regular

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

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

  18. Polynomial-time Mapping Reducibility • If A B (we can use a decider MB for B to build a decider MA for A), 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 and B is in P means… • A is in P!

  19. 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 !!

  20. “Foo is NP-complete” • What does this mean? • Foo is in NP • Every problem in NP can to Foo • It’s impossible to solve Foo in polynomial time • None or more than one of the above

  21. The first NP-complete problem: SAT • SAT = {<φ> | φ is a Boolean formula with a satisfying assignment} • Boolean formula: n variables x1…xn, m clauses. • Literal: any xi or ~xi • Clause: OR of a bunch of literals • Boolean formula: AND of a bunch of clauses • Is there a way to assign xi = T or F such that φ is TRUE?

  22. SAT is in NP • With a non-deterministic TM: • Non-deterministically “guess” a solution, and plug it in. • With a verifier: • Just plug in the assignment and see if the formula evaluates to TRUE.

  23. Every problem in NP to SAT • How can we possibly make a statement about ALL problems in NP? Any ideas?

  24. Every problem in NP to SAT • T/F Properties of TM’s: • Tape head is at position k after t steps • Tape position k contains symbol a after t steps • State is q after t steps • You can create clauses based on these T/F properties and your TM description! • “If at step t, TM is in state q and reading an a from position k, then at step t + 1, TM is in state r and at position k + 1, and position k contains a b” • “TM is in state qaccept after poly(n) steps” • “TM is in state q0 at step 0” • Etc.

  25. Every problem in NP to SAT • If a problem A is in NP, there is a non-deterministic TM that can decide it in polynomial time • We have made a construction for an arbitrary problem A: • We transformed properties of the nondeterministic TM for A into a Boolean formula for A. • “Non-deterministic TM can decide if w is in A” -> “There’s a satisfying assignment for the Boolean formula” • In other words: a reduction for arbitraryA in NP to SAT. We can solve A by turning it into a Boolean formula and solving SAT.

  26. Every problem in NP to SAT • The complete details of the transformation are quite complex – especially showing that it can be done in polynomial time • Much more detail in text for the curious – details not on the final • This is just to give a flavor of the reduction • The reduction proves the Cook-Levin Theorem: SAT is NP-complete.

  27. Luckily, we don’t have to reduce from ALL problems in NP anymore… • Suppose we want to show that B is NP-complete. How can we do this? • Show that B is in NP • Show that B SAT • Show that SAT B • None or more than one of the above

  28. If P = NP Recognizable Decidable Context-free Co-recognizable Regular

  29. If P ≠ NP Recognizable Decidable Context-free Co-recognizable Regular

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

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