Title: Nondeterminism
1Non-determinism
? Multiple possible moves at each step.
? As long as one path (sequence of moves) says
yes, answer yes.
(imagine always guessing the right choice each
step.)
In other words, answer no only when no path
answers yes.
time taken by the algorithm
N Y N Y
2Non-deterministic Solution to HC
certificate
Step 2 in deterministic polynomial
time check if
3Components of a Non-deterministic Polynomial-time
Algorithm
? Non-deterministic guess (create certificate)
Polynomial time
? Deterministic check (verify certificate)
Polynomial time
4Class NP
Set of all problems solvable in non-deterministic
polynomial time.
Subset-Sum ? NP
A non-deterministic algorithm
5Polynomial Reduction
Problem A is polynomial-time reducible to problem
B if there exists
function f all inputs of A ? all inputs
of B
input of A
input of B
such that
? f is computable in polynomial time.
6NP-complete
If A B, then A is no harder than B.
P
Proof Suppose g is a polynomial time algorithm
for B.
To solve an instance of A. We first reduce it to
an instance of B, which is then solved using g.
Since the reduction f and g both take polynomial
time,
f g is a polynomial time algorithm for A.
A problem B is NP-complete if
? B ? NP
Class NPC includes all NP-complete problems.
7Sufficient Condition for NPC
Theorem 2 B ? NPC if
? B ? NP
? C B for some C ? NPC
P
8Satisfiability Problem (SAT)
The first NP-complete problem!
9Conjunctive Normal Form (CNF)
Conjunction of disjunctions of variables or their
negations.
clause disjunction of literals
CNF conjunction of clauses
Every ? has an equivalent CNF ?'.
3CNF each clause has exactly 3 literals.
10Converting to CNF
a?b ? ?a ? b
a ? (b ? c) ? (a ? b) ? (a ? c)
T
(a ? b) ? c ? (a ? c) ? (b ? c)
11SAT Is NP-complete
Input a boolean formula ? in CNF.
Q Is ? satisfiable?
Cooks Theorem SAT ? NPC.
Proof (1) SAT ? NP.
Very complicated! Omitted. // single abstract
transformation //
involving the simulation of a non-deterministic
// Turing Machine with
CNFs.
12How to Prove NP-completeness?
To prove a problem B is NP-complete
? Show that B ? NP.
? Select some A ? NPC.
? Construct a transformation f from A to B.
? Prove that f can be carried out in polynomial
time.
133SAT is NPC
3SAT
Input a boolean formula ? in 3CNF.
Q Is ? satisfiable?
Proof (1) 3SAT ? NP (same as the proof for SAT
? NP).
14SAT 3SAT
P
15Proof (contd)