NP Complete

NP-Completeness
A problem is NP-complete if:
•It is in NP
•Every NP problem is reduced to it
(in polynomial time)
1
Observation:
If we can solve any NP-complete problem
in Deterministic Polynomial Time (P time)
then we know:
P  NP
2
Observation:
If we prove that
we cannot solve an NP-complete problem
in Deterministic Polynomial Time (P time)
then we know:
P  NP
3
Cook’s Theorem:
The satisfiability problem is NP-complete
Proof:
Convert a Non-Deterministic Turing Machine
to a Boolean expression
in conjunctive normal form
4
An NP-complete Language
Cook-Levin Theorem:
Language SAT (satisfiability problem)
is NP-complete
Proof:
Part1: SAT is in NP
(we have proven this in previous class)
Part2: reduce all NP languages
to the SAT problem
in polynomial time
Prof. Busch - LSU
5
Other NP-Complete Problems:
•The Traveling Salesperson Problem
•Vertex cover
•Hamiltonian Path
All the above are reduced
to the satisfiability problem
6
Observations:
It is unlikely that NP-complete
problems are in P
The NP-complete problems have
exponential time algorithms
Approximations of these problems
are in P
7
NP-complete Languages
Prof. Busch - LSU
8
Polynomial Time Reductions
Polynomial Computable function f :
There is a deterministic Turing machine M
such that for any string w computes f (w)
k
O
(|
w
|
)
in polynomial time:
Prof. Busch - LSU
9
Definition:
Language A
is polynomial time reducible to
language B
if there is a polynomial computable
function f such that:
w  A  f ( w)  B
Prof. Busch - LSU
10
Theorem:
Suppose that A is polynomial reducible to
If B  P then A P .
B.
Proof:
Let
M
be the machine that decides B
in polynomial time
Machine M  to decide
On input string
w:
A
in polynomial time:
1. Compute f (w)
2. Run M on input f (w)
3. If f (w )  B acccept w
Prof. Busch - LSU
11
Example of a polynomial-time reduction:
We will reduce the
3CNF-satisfiability problem
to the
CLIQUE problem
Prof. Busch - LSU
12
3CNF formula:
literal
( x1  x2  x3 )  ( x3  x5  x6 )  ( x3  x6  x4 )  ( x4  x5  x6 )
clause
Each clause has three literals
Language:
3CNF-SAT ={
w
:
w
Prof. Busch - LSU
is a satisfiable
3CNF formula}
13
A 5-clique in graph
G
Language:
CLIQUE = { G, k  : graph G
contains a
Prof. Busch - LSU
k-clique}
14
Theorem:
Proof:
3CNF-SAT is polynomial time
reducible to CLIQUE
give a polynomial time reduction
of one problem to the other
Transform formula to graph
Prof. Busch - LSU
15
Transform formula to graph.
Example:
(x 1  x 2  x 4 )  (x 1  x 2  x 4 )  (x 1  x 2  x 3 )  (x 2  x 3  x 4 )
Clause 2
Create Nodes:
Clause 1
x1
x2
x4
Clause 3
x1
x1
x2
x2
x4
Clause 4
x2
Prof. Busch - LSU
x3
x3
x4
16
(x 1  x 2  x 4 )  (x 1  x 2  x 4 )  (x 1  x 2  x 3 )  (x 2  x 3  x 4 )
x1
x2
x4
x1
x1
x2
x2
x4
x3
x2
x3
x4
Add link from a literal  to a literal in every
other clause, except the complement 
Prof. Busch - LSU
17
(x 1  x 2  x 4 )  (x 1  x 2  x 4 )  (x 1  x 2  x 3 )  (x 2  x 3  x 4 )
x1
x4
x2
x1
x1
x2
x2
x4
x3
x2
x3
x4
Resulting Graph
Prof. Busch - LSU
18
(x 1  x 2  x 4 )  (x 1  x 2  x 4 )  (x 1  x 2  x 3 )  (x 2  x 3  x 4 )  1
x1  1
x2  0
x3  0
x4  1
x1
x2
x4
x1
x1
x2
x2
x4
x3
x2
x3
x4
The formula is satisfied if and only if
the Graph has a 4-clique
End of Proof
Prof. Busch - LSU
19
NP-complete Languages
We define the class of NP-complete
languages
Decidable
NP
NP-complete
Prof. Busch - LSU
20
A language L is NP-complete if:
• L is in NP, and
• Every language in NP
is reduced to L in polynomial time
Prof. Busch - LSU
21
Observation:
If a NP-complete language
is proven to be in P then:
P  NP
Prof. Busch - LSU
22
Decidable
NP
P
?
NP-complete
Prof. Busch - LSU
23