CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.

Slides:



Advertisements
Similar presentations
1 P, NP, and NP-Complete Dr. Ying Lu RAIK 283 Data Structures & Algorithms.
Advertisements

Complexity Classes: P and NP
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
NP-Completeness Lecture for CS 302. Traveling Salesperson Problem You have to visit n cities You want to make the shortest trip How could you do this?
Great Theoretical Ideas in Computer Science for Some.
Umans Complexity Theory Lectures Lecture 2a: Reductions & Completeness.
Computability and Complexity 14-1 Computability and Complexity Andrei Bulatov Cook’s Theorem.
Computability and Complexity 13-1 Computability and Complexity Andrei Bulatov The Class NP.
NP-completeness Sipser 7.4 (pages 271 – 283). CS 311 Mount Holyoke College 2 The classes P and NP NP = ∪ k NTIME(n k ) P = ∪ k TIME(n k )
NP-completeness Sipser 7.4 (pages 271 – 283). CS 311 Fall The classes P and NP NP = ∪ k NTIME(n k ) P = ∪ k TIME(n k )
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Read sections 7.1 – 7.3 of the book for next time.
1 Polynomial Time Reductions Polynomial Computable function : For any computes in polynomial time.
NP-Complete Problems Problems in Computer Science are classified into
Analysis of Algorithms CS 477/677
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture NP-Completeness Jan Maluszynski, IDA, 2007
Chapter 11: Limitations of Algorithmic Power
February 20, 2015CS21 Lecture 191 CS21 Decidability and Tractability Lecture 19 February 20, 2015.
Halting Problem. Background - Halting Problem Common error: Program goes into an infinite loop. Wouldn’t it be nice to have a tool that would warn us.
Final Exam Review Cummulative Chapters 0, 1, 2, 3, 4, 5 and 7.
Complexity Theory: The P vs NP question Lecture 28 (Dec 4, 2007)
Theory of Computation 1 Theory of Computation Peer Instruction Lecture Slides by Dr. Cynthia Lee, UCSD are licensed under a Creative Commons Attribution-NonCommercial-ShareAlike.
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
Theory of Computation 1 Theory of Computation Peer Instruction Lecture Slides by Dr. Cynthia Lee, UCSD are licensed under a Creative Commons Attribution-NonCommercial-ShareAlike.
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 8: Complexity Theory.
February 18, 2015CS21 Lecture 181 CS21 Decidability and Tractability Lecture 18 February 18, 2015.
Computational Complexity Theory Lecture 2: Reductions, NP-completeness, Cook-Levin theorem Indian Institute of Science.
Theory of Computing Lecture 17 MAS 714 Hartmut Klauck.
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
Cs3102: Theory of Computation Class 24: NP-Completeness Spring 2010 University of Virginia David Evans.
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
CSC 413/513: Intro to Algorithms NP Completeness.
CSCI 2670 Introduction to Theory of Computing November 29, 2005.
CSCI 2670 Introduction to Theory of Computing December 1, 2004.
CSCI 3160 Design and Analysis of Algorithms Tutorial 10 Chengyu Lin.
COMPSCI 102 Introduction to Discrete Mathematics.
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
1 Chapter 34: NP-Completeness. 2 About this Tutorial What is NP ? How to check if a problem is in NP ? Cook-Levin Theorem Showing one of the most difficult.
ATM, Halting Problem, P vs. NP Chapter 4, 5 & 7. Russel’s Paradox An Index is a book that lists other books in.
P Vs NP Turing Machine. Definitions - Turing Machine Turing Machine M has a tape of squares Each Square is capable of storing a symbol from set Γ (including.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
CSCI 3130: Formal languages and automata theory Andrej Bogdanov The Chinese University of Hong Kong The Cook-Levin.
CSE 589 Part V One of the symptoms of an approaching nervous breakdown is the belief that one’s work is terribly important. Bertrand Russell.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
NPC.
NP-complete Languages
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
Given this 3-SAT problem: (x1 or x2 or x3) AND (¬x1 or ¬x2 or ¬x2) AND (¬x3 or ¬x1 or x2) 1. Draw the graph that you would use if you want to solve this.
CSE 105 Theory of Computation Alexander Tsiatas Spring 2012 Theory of Computation Lecture Slides by Alexander Tsiatas is licensed under a Creative Commons.
Complexity ©D.Moshkovitz 1 Our First NP-Complete Problem The Cook-Levin theorem A B C.
Prof. Busch - LSU1 Time Complexity. Prof. Busch - LSU2 Consider a deterministic Turing Machine which decides a language.
Theory of Computational Complexity Yuji Ishikawa Avis lab. M1.
Computability Examples. Reducibility. NP completeness. Homework: Find other examples of NP complete problems.
CS 154 Formal Languages and Computability May 10 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
Theory of Computational Complexity TA : Junichi Teruyama Iwama lab. D3
 2005 SDU Lecture14 Mapping Reducibility, Complexity.
NP-Completeness A problem is NP-complete if: It is in NP
P & NP.
Busch Complexity Lectures: Reductions
Reductions Costas Busch - LSU.
CS154, Lecture 13: P vs NP.
NP-completeness The Chinese University of Hong Kong Fall 2008
Our First NP-Complete Problem
CSE 589 Applied Algorithms Spring 1999
Instructor: Aaron Roth
Presentation transcript:

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 Permissions beyond the scope of this license may be available at

MAPPING REDUCTIONS Some more formalities….

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

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

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

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

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

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

MEASURING COMPLEXITY OF DECIDABLE PROBLEMS BIG-O Review 9

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 n 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

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 n 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

MEASURING COMPLEXITY OF DECIDABLE PROBLEMS P AND NP Complexity Classes 12

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

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

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

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

A CLUE IN THE P ≠/= NP PUZZLE? THE CLASS NP-COMPLETE Complexity Classes 17

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

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

“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

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

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

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

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

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

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

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

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

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

CONSEQUENCES OF P ≠/= NP WHAT’S AT STAKE? Wonderful!!! Doom!!! 30

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