Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSCI 2670 Introduction to Theory of Computing November 29, 2005.

Similar presentations


Presentation on theme: "CSCI 2670 Introduction to Theory of Computing November 29, 2005."— Presentation transcript:

1 CSCI 2670 Introduction to Theory of Computing November 29, 2005

2 Agenda Today –More on the class NP

3 November 29, 2005 Announcement

4 November 29, 2005 The class NP Definition: A verifier for a language A is an algorithm V, where A={w|V accepts for some string c} The string c is called a certificate of membership in A. Definition: NP is the class of languages that have polynomial-time verifiers.

5 November 29, 2005 Who wants $1,000,000? In May, 2000, the Clay Mathematics Institute named seven open problems in mathematics the Millennium Problems –Anyone who solves any of these problems will receive $1,000,000 –Proving whether or not P equals NP is one of these problems

6 November 29, 2005 What we know NP PcoNP

7 November 29, 2005 What we don’t know NP PcoNP Are there any problems here?

8 November 29, 2005 Solving NP problems The best-known methods for solving problems in NP that are not known to be in P take exponential time –Brute force search

9 November 29, 2005 NP-completeness A problem C is NP-complete if finding a polynomial-time solution for C would imply P=NP Definition: A language B is NP-complete if it satisfies two conditions: 1.B is in NP, and 2.Every A in NP is polynomial time reducible to B

10 November 29, 2005 An NP-complete problem A formula is Boolean if each of its variables can be assigned the values TRUE (1) or FALSE (0) A Boolean formula is satisfiable if there is some assignment of values that results in the formula evaluating to TRUE SAT: Is a given Boolean formula satisfiable? SAT is NP-complete –We will go over the proof next week

11 November 29, 2005 Examples (x  y)  (  x  y) –Satisfiable – e.g., x = y = 1 ((x  y)  (  x  z))  ((  x  y)  (  y  z)) –Satisfiable – e.g., x = 0, y = z = 1 ((x  y)  (  x  z))  ((x  y)  (  y  z)) –Unsatisfiable

12 November 29, 2005 Proving a problem is NP-complete A problem C is NP-complete if finding a polynomial-time solution for C would imply P=NP If a polynomial-time solution is found for C, then that solution can be used to find a polynomial-time solution for any other problem in NP –What does this remind you of? –Reductions!

13 November 29, 2005 Reductions and NP-completeness If we can prove an NP-complete problem C can be polynomially reduced to a problem A, then we’ve shown A is NP-complete –A polynomial-time solution to A would provide a polynomial-time solution to C, which would imply P=NP

14 November 29, 2005 Polynomial functions Definition: A function f:Σ *  Σ * is a polynomial time computable function if some polynomial time Turing machine M exists that halts with just f(w) on its tape, when started on any input w.

15 November 29, 2005 Polynomial reductions Definition: Language A is polynomial- time reducible to language B, written A ≤ P B, if a polynomial time computable function f:Σ *  Σ * exists, where for every w w  A iff f(w)  B f f

16 November 29, 2005 Reductions & NP-completeness Theorem: If A ≤ P B and B  P, then A  P. Proof: Let M be the polynomial time algorithm that decides B and let f be the polynomial reduction from A to B. Consider the TM N N = “On input w 1.Compute f(w) 2.Run M on f(w) and output M’s result” Then N decides A in polynomial time.

17 November 29, 2005 Implications of NP-completeness Theorem: If B is NP-complete and B  P, then P = NP. Theorem: If B is NP-complete and B≤ P C for some C in NP, then C is NP- complete

18 November 29, 2005 Showing a problem in NP-complete Two steps to proving a problem L is NP-complete –Show the problem is in NP Demonstrate there is a polynomial time verifier for the problem –Show some NP-complete problem can be polynomially reduced to L

19 November 29, 2005 NP-completeness proof LPATH = { | G is a graph with nodes a and b and a simple path of length k from a to b} –A simple path has no repeated nodes We will use the fact that the following language is NP-complete –UHAMPATH = { | G is a graph with a Hamiltonian path from a to b} A Hamiltonian path visits each node exactly once

20 November 29, 2005 LPATH is NP-complete First show LPATH is in NP –Can we verify a solution to LPATH in polynomial time? Yes Check the certificate is a simple length-k path from a to b

21 November 29, 2005 Reduction from UHAMPATH R = “On input, where G = is a graph with nodes a and b 1.If |V| ≤ 1 reject 2.Check if is in LPATH”

22 November 29, 2005 Two questions Need to demonstrate that is in UHAMPATH iff is in LPATH –This is clear from the definitions of UHAMPATH and LPATH Need to demonstrate that the reduction is in polynomial time –The reduction takes O(|V|) time (to evaluate |V|

23 November 29, 2005 Insight We know (because I said so) that UHAMPATH is NP-complete –Therefore, a polynomial time solution to UHAMPATH would imply P = NP We showed that we can convert UHAMPATH to LPATH in polynomial time –Therefore, a polynomial solution to LPATH would provide a polynomial solution to UHAMPATH LPATH must be NP-complete

24 November 29, 2005 Summary To show a language L is NP-complete 1.Demonstrate L is in NP 2.Find a language C that is known to be NP-complete 3.Create a function f from C to L 4.Demonstrate that if x is in C then f(x) is in L 5.Demonstrate that if f(x) is in L then x is in C 6.Demonstrate f is computable in polynomial time


Download ppt "CSCI 2670 Introduction to Theory of Computing November 29, 2005."

Similar presentations


Ads by Google