Proving a problem is NP

CSCI 2670
Introduction to Theory of
Computing
December 1, 2004
Agenda
• Yesterday
– The Class NP
– Value is exponential in length
• Today
– More on the class NP
– Quiz
December 1, 2004
2
The class NP
Definition: A verifier for a language A
is an algorithm V, where
A={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.
December 1, 2004
4
Is NP closed under complementation?
• For example, can we verify in
polynomial time that a graph cannot
be 3-colored?
– Not obviously
– It seems we need to check many 3colorings before we can conclude that
none exist
• The 3-coloring problem is in coNP
December 1, 2004
5
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
December 1, 2004
6
What we know
NP
P
December 1, 2004
coNP
7
What we don’t know
Are there any problems here?
NP
P
December 1, 2004
coNP
8
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
• We don’t know if NP is actually in a
smaller complexity class
December 1, 2004
9
NP-completeness
• A problem C is NP-complete if finding
a polynomial-time solution for C would
imply P=NP
December 1, 2004
10
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
December 1, 2004
11
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
December 1, 2004
12
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!
December 1, 2004
13
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
December 1, 2004
14
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.
December 1, 2004
15
Polynomial reductions
Definition: Language A is polynomialtime 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
December 1, 2004
16