Download presentation
Presentation is loading. Please wait.
Published bySybil Jones Modified over 9 years ago
1
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. Permissions beyond the scope of this license may be available at http://peerinstruction4cs.org.
2
MAPPING REDUCTIONS Some more formalities….
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 3
4
Thm.: EQ TM is not recognizable A TM = { | M accepts w } EQ TM = { | L(M 1 ) = L(M 2 ) } f( ) = where: – M 1 = “On any input, reject” – M 2 = “On any input, run M on w. If it accepts, accept.” Which mapping reduction does this f give? a)A TM ≤ m EQ TM b)EQ TM ≤ m A TM c)A TM ≤ m EQ TM d)EQ TM ≤ m A TM 4
5
We showed: A TM ≤ m EQ TM We know: A TM is NOT co-recognizable. – We showed this in a previous lecture We showed: A TM is mapping reducible to EQ TM. – We can “co-recognize” A TM by applying f and “co- recognizing” EQ TM – This means: if EQ TM is co-recognizable, then A TM is co-recognizable. – We know A TM is not co-recognizable, though. – Contradiction! EQ TM is NOT co-recognizable. – The same as: EQ TM is NOT recognizable. 5
6
Thm.: EQ TM is not co-recognizable A TM = { | M accepts w } EQ TM = { | L(M 1 ) = L(M 2 ) } f( ) = where: – M 1 = “Accept” – M 2 = “On any input, run M on w. If it accepts, accept.” Which mapping reduction does this f give? a)A TM ≤ m EQ TM b)EQ TM ≤ m A TM c)A TM ≤ m EQ TM d)EQ TM ≤ m A TM 6
7
We showed: A TM ≤ m EQ TM We know: A TM is NOT co-recognizable. – We showed this in a previous class We showed: A TM is mapping reducible to EQ TM. – We can “co-recognize” A TM by applying f and “co- recognizing” EQ TM – This means: if EQ TM is co-recognizable, then A TM is co-recognizable. – We know A TM is not co-recognizable, though. – Contradiction! EQ TM is NOT co-recognizable. 7
8
So, we did TWO mapping reductions A TM ≤ m EQ TM We have shown: There is a language ( EQ TM ) 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 A TM to L. Pro tip: Use A TM as the stock “language that’s recognizable but not co-recognizable” 8 x 2
9
MEASURING COMPLEXITY OF DECIDABLE PROBLEMS BIG-O Review 9
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) = 10n 3 + 200n 2 + 5 Which best represents a tight bound on the big-O running time of M(w)? (where n = |w|) a)O(n 3 + n 2 ) b)O(n 5 ) c)O(n 3 ) d)O(200n 2 ) 10
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) = 10n 3 + 200n 2 + 5 Which are NOT a big-O running time of M(w)? (where n = |w|) a)O(n 3 + n 2 ) b)O(n 5 ) c)O(n 3 ) d)O(200n 2 ) e)More than one of the above 11
12
MEASURING COMPLEXITY OF DECIDABLE PROBLEMS P AND NP Complexity Classes 12
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(n k ) steps in the worst case, for some constant k 13
14
P and NP P is the class of languages that can be decided in polynomial time on a deterministic, single- tape TM NP is 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 14
15
Complexity Classes: Where are P and NP? Regular Context-free Decidable Recognizable Co-recognizable
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 16
17
A CLUE IN THE P ≠/= NP PUZZLE? THE CLASS NP-COMPLETE Complexity Classes 17
18
Polynomial-time Mapping Reducibility If A B (we can use a decider M B for B to build a decider M A for A), and M B 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! 18
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 !! 19
20
“Foo is NP-complete” What does this mean? a)Foo is in NP b)Every problem in NP can to Foo c)It’s impossible to solve Foo in polynomial time d)None or more than one of the above 20
21
The first NP-complete problem: SAT SAT = { | φ is a Boolean formula with a satisfying assignment} Boolean formula: n variables x 1 …x n, m clauses. – Literal: any x i or ~x i – Clause: OR of a bunch of literals – Boolean formula: AND of a bunch of clauses Is there a way to assign x i = T or F such that φ is TRUE? 21
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. 22
23
Every problem in NP to SAT How can we possibly make a statement about ALL problems in NP? Any ideas? 23
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 q accept after poly(n) steps” – “TM is in state q 0 at step 0” – Etc. 24
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 arbitrary A in NP to SAT. We can solve A by turning it into a Boolean formula and solving SAT. 25
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. 26
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? a)Show that B is in NP b)Show that B SAT c)Show that SAT B d)None or more than one of the above 27
28
If P = NP Regular Context-free Decidable Recognizable Co-recognizable
29
If P ≠ NP Regular Context-free Decidable Recognizable Co-recognizable
30
CONSEQUENCES OF P ≠/= NP WHAT’S AT STAKE? Wonderful!!! Doom!!! 30
31
If P = NP, what would the consequences be? a)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 b)Many important optimizations may now be computationally practical, improving our lives and efficiency in many things c)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 d)Other/None/More than one 31
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.