Top Banner
CSCI 2670 Introduction to Theory of Computing November 29, 2005
23

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

Jan 03, 2016

Download

Documents

Reynold Tate
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CSCI 2670 Introduction to Theory of Computing November 29, 2005.

CSCI 2670Introduction to Theory of

Computing

November 29, 2005

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

November 29, 2005

Agenda

• Today– More on the class NP

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

November 29, 2005

The class NP

Definition: A verifier for a language A is an algorithm V, whereA={w|V accepts <w,c> 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.

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

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

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

November 29, 2005

What we know

NPP coNP

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

November 29, 2005

What we don’t know

NPP coNP

Are there any problems here?

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

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

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

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, and2. Every A in NP is polynomial time

reducible to B

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

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

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

November 29, 2005

Examples

• (x y) ( x y)– Satisfiable – e.g., x = y = 1

• ((xy) (xz)) ((xy) (yz))– Satisfiable – e.g., x = 0, y = z = 1

• ((xy) (xz)) ((xy) (yz))– Unsatisfiable

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

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!

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

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

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

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.

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

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) Bf

f

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

November 29, 2005

Reductions & NP-completeness

Theorem: If A ≤P B and BP, then AP.

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 w1. Compute f(w)2. Run M on f(w) and output M’s result”

Then N decides A in polynomial time.

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

November 29, 2005

Implications of NP-completeness

Theorem: If B is NP-complete and BP, then P = NP.

Theorem: If B is NP-complete and B≤PC for some C in NP, then C is NP-complete

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

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

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

November 29, 2005

NP-completeness proof

• LPATH = {<G, a, b, k> | 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,a,b> | G is a graph

with a Hamiltonian path from a to b}• A Hamiltonian path visits each node

exactly once

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

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

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

November 29, 2005

Reduction from UHAMPATH

R = “On input <G,a,b>, where G = <V,E> is a graph with nodes a and b

1. If |V| ≤ 1 reject2. Check if <G,a,b,|V|-1> is in

LPATH”

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

November 29, 2005

Two questions

• Need to demonstrate that <Ga,b> is in UHAMPATH iff <G,a,b,|V|-1> 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|

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

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

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

November 29, 2005

Summary

• To show a language L is NP-complete

1. Demonstrate L is in NP2. Find a language C that is known to

be NP-complete3. Create a function f from C to L4. Demonstrate that if x is in C then

f(x) is in L5. Demonstrate that if f(x) is in L then

x is in C6. Demonstrate f is computable in

polynomial time