Title: Computer Science 500 Theory of Computation Spring, 2000, March 27
1Computer Science 500Theory of ComputationSpring,
2000, March 27 1. Complexity Theory 2. HW 6
due next Wednesday
2Time complexity
TIME(T) L ? T.M. M s.t. 1) L(M) L
and 2) ? inputs w, M halts on w
in O(T) steps
3Polynomial Time
8
P Uk1 TIME(nk)
4A language known to be in P
example
Ldiv k,N N 0 mod k
5A language not known to be in P
example
SAT f f is a boolean formula s.t. ? x1, x2
xn s.t. f(x1, x2 xn) true. f f has a
satisfying assignment
6A language not known to be in P
example
Lfactor (k,N) N has a prime
factor less than k
7A language not known to be in P
example
Liso (G1, G2) G1and G2 are isomorphic
graphs
8Running Time for Non-deterministic Machines
steps
accept
reject
Non-deterministic
Deterministic
9Time classes NTIME(f)
NTIME(T) L ? Non-deterministic T.M. M such
that 1) L(M) L and 2) ? inputs w, ?
computation branches b, M halts on w in O(T)
steps
10Theorem
NTIMEf(n) ? TIME2O(f(n))
11To prove ? L, L ? NTIMEf(n) ?L ?
TIME2O(f(n))
Assume L ? NTIMEf(n), accepted by N.T.M. N in
time O(f(n)). Construct D.T.M. D simulate
N on all non-deterministic choices
(witnesses), accept iff an accepting path is found
12Claim ? w, N acc w ?D acc w
13Definition of NP
8
NP Uk1 NTIME(nk)
14Note
NP ? EXP-Time where EXP-Time Uk1
TIME2O(nk)
8
15Polynomial Time Verifiabledefinition
L is Polynomial Time Verifiable iff There is k, a
language L2 in P L x ? w, w O(xk),
such that (w,x) is in L2
Sp1
16Theorem
L is Polynomial Time Verifiable ? L ? NP
17Proof
( ) If L is p-time verifiable, define NTM N
that guesses witness w and runs DTM for L2 (
) If L is in NP with NTM N, DTM simulates N on
non-deterministic choices w
18Languages in NPexamples
Ldiv, Lconn , SAT, Lfactor, Liso
Known to be in P, hence in NP
Known to be in NP
19A language known to be in NP
example
SAT f f is a boolean formula that has a
satisfying assignment
Polynomial verifier guess assignment to
variables, plug into f, verify
20A language known to be in NP
example
Lfactor (k,N) N has a non- trivial factor
less than k
- Polynomial verifier
- guess 1ltdltk
- divide d into N
- determine whether the remainder is 0
21A language known to be in NP
example
Liso (G1, G2) G1and G2 are isomorphic
graphs
Polynomial verifier guess p verify that G2
p(G1)
22co-NPdefinition
co-NP L L is in NP There is k, a language
L in P L x w, w O(xk),
such that (w,x) is in L
A
Pp1
23Polynomial-time Reductions
- A function f is a polynomial-time reduction from
language L1 to language L2 iff - f is computable in polynomial time
- for all x, x ? L1 f(x) ? L2
- L1 ltp L2
24NP-harddefinition
A language L is NP-hard iff ? L in NP, L
ltp L
25NP-completedefinition
A language L is NP-complete iff 1) L ? NP
2) L is NP-hard
26Theorem (Cook-Levin)SAT is NP-complete
Proof We already know SAT is in NP. So, we
only need to show that SAT is NP-hard. Let L be
any language in NP. We demonstrate a p-time
reduction from L to SAT
27Proof SAT is NP-hard
Suppose NTM N decides L is time nk-3 Goal
Given (N,w), efficiently construct a boolean
formula ? such that ? has a satisfying
N has an accepting assignment
path on w
28 Idea Given (N,w), build a table (tableau)
Ns configuration
v1,1 v1,2 v1,2v1,2 v1,nk v2,1
v2,2 v2,2 v2,2
v2,nk . . . Vnk,,1 vnk,2 vnk,2 vnk,2
vnk,nk
1 2 nk
time
29Proof SAT is NP-hard
If N accepts w, then there is a legal tableau
that looks like this
Ns configuration
q0 w1 w2 wn U U v2,2 v2,2 v2,2
v2,nk1 v3,2 v3,2 v3,2
v3,nk1 any accept
configuration
1 2 nk
time
30Proof SAT is NP-hard
Constructing ?
? ?cell AND ?move AND ?start AND ?accept
Each cell contains exactly one