Lecture 12 Time and Space of NTM

Download Report

Transcript Lecture 12 Time and Space of NTM

Part II
Theory of Nondeterministic
Computation
Lecture 5 Time and Space of
NTM
Nondeterministic TM (NTM)
• There are multiple choices for each
transition.
• For each input x, the NTM may have more
than one computation paths.
• An input x is accepted if at least one
computation path leads to the final state.
• L(M) is the set of all accepted inputs.
• A function f(x) is computed by an NTM M if
for every x ε L(M), M gives output f(x)
whenever it reaches the final state.
Theorem. A function can be computed by an
NTM iff it is Turing-computable.
Proof. Idea: Enumerate all possible
computation paths of certain length from
small to large.
Implement: set a tape to do the
enumeration.
• Suppose for each transition, there are at
most c choices. Then on the enumeration
tape, the DTM enumerate all strings on
alphabet {a1, a2, …, ac}: ε, a1, a2, …, ac, a1a2,
a1a3, ….
• When a string ai ai ∙∙∙ai is written on the
enumeration tape, the DTM simulates the
NTM by making the ij –th choice at the j-th
move.
• DTM halts iff it found a computation path of
NTM which halts.
1
2
m
• Question: How many moves does a DMT
needs to simulate t moves of a NTM?
• O(c t )
Time
• For a NDM M and an input x,
TimeM(x) = the minimum # of moves
leading to accepting x
if x ε L(M)
= infinity
if x not in L(M)
Time Bound
A NTM M is said to have a time bound t(n)
if for sufficiently large n and every x ε L(M)
With |x|=n,
TimeM(x) < max {n+1, t(n)} .
Complexity Classes
NTIME(t(n)) = {L(M) | M is a NTM with time
bound t(n)}
c
NP = U c > 0 NTIME(n )
Relationship
• P NP
• NP ≠ EXP
• NP  EXPOLY
NP≠EXP
First,notethat EXP  DTIME(2 )  DTIME(2 ).
For contradiction,suppose NP  EXP.
n2 / 2
Consider any L  DTIME(2 ).
n2
Define L'  {x$
| x|2 | x|
| x  L}.
T henL' DTIME(2 n )  EXP  NP.
So, L' NTIME(n c ) for some c  0.
Hence,L  NTIME((n 2 ) c )  NP  EXP.
T herefore,DTIME(2 )  EXP ().
n2
n2
Theorem
• Speed Up Theorem still holds.
• Hierarchy Theorem may not.
Space
For a NTM M and an input x,
SpaceM(x) = the minimum space, over all
computation paths, on input x
if x ε L(M)
= infinity
otherwise
Space bound
• A NTM M is said to have a space bound
s(n) if sufficiently large n and every input x
with |x|=n,
SpaceM(x) ≤ max{k, s(n)}
k = # of work tapes
Complexity Classes
• NSPACE(s(n)) = {L(M) | M is a NTM with
space bound s(n)}
• NPSPACE = Uc>0 NSPACE(nc )
Relationship
• NP  NPSPACE
• PSPACE = NPSPACE (why?)
Savich’s Theorem
• If s(n) ≥ log n, then
NSPACE (s(n))  DSPACE(s(n) 2)
The proof will be given later!
Theorems
• Compresion Theorem holds.
• Hierarchy Theorem may not.
Translation Lemma
• Let s1(n), s2(n) and f(n) be fully spaceconstructible functions with s2(n) > n and f(n)
> n. Then
NSPACE(s1(n))  NSPACE(s2(n))
implies
NSPACE(s1(f(n)))  NSPACE(s2(f(n)))
Hierarchy
• NSPACE(n 4 )  DSPACE(n8 )
9

DSPACE(n
)
≠
 NSPACE(n9 )
• For r > 1 and a > 0,
r+a
r
NSPACE(n ) ≠ NSPACE (n )
Suppose s and t are two positiveintegerssuch thatr  s / t , ( s  1) / t  r  a.
It suffices to show NSP ACE(n s / t )  NSP ACE(n ( s 1) / t ).
For contradiction,suppose NSP ACE(n ( s 1) / t )  NSP ACE(n s / t ).
By translation lemma with f (n)  n ( s i ) t , we have
NSP ACE(n ( s 1)( s i ) )  NSP ACE(n s ( s i ) )
(A)
for i  0,1,...,s. Note thats ( s  i )  ( s  1)(s  i  1) for i  1.
T hus, NSP ACE(n s ( s i ) )  NSP ACE(n ( s 1)( s i 1) ).
(B)
Now, altenatively using (A) and (B), we have
NSP ACE(n ( s 1)( 2 s ) )  NSP ACE(n s ( 2 s ) )
 NSP ACE(n ( s 1)( 2 s 1) )  NSP ACE(n s ( 2 s 1) )
   NSP ACE(n ).
s2
By Savitch theorem, NSP ACE(n s )  DSP ACE(n 2 s ).
2
2
By Hierarchytheorem,DSP ACE(n 2 s )  DSP ACE(n 2 s
2
T hus, NSP ACE(n
s ( s i )
)  DSP ACE(n
2s2 2s
2
2s
).
)  NSP ACE(n
2s2 2s
). (-  -)
Proof of Savitch’s Theorem
Savich’s Theorem
• If s(n) ≥ log n, then
NSPACE (s(n))  DSPACE(s(n) 2)
Proof.
Consider L  L( M )  NSPACE( s (n))
where M is a NT M with space bound s (n).
Consider an input x with | x | n, x  x1  xn .
We will show that whether M acceptsx or
not can be computedby a DT M with space
bound s (n) 2 .
How many configurations of M exist
within space s(n)?
Input tape
x1 x2
xn
Work tape
c
s ( n)
for someconstantc!
x  L( M )
iff
it takesat most c
s(n)
moves
from theinitialconfiguration I 0 to reach
a finalconfiguration I f .
iff
T hereexist sconfiguration I1 such that
I 0  I1 within at most c
s(n)
/ 2 moves
I1  I f within at most c s ( n ) / 2 moves.
c
I0
I0
I0
c
s (n )
c
/2
s (n )
4
I2
s (n )
If
c
I1
c
s (n )
I1
4
depth  log2 c
c
s (n )
s (n )
I3
c
s (n )
4
s ( n)
/2
  O(s(n))
4
If
If
Depth-first Search
It only needs to rememberall configurations
on a pathfrom theroot toa leaf,i.e.,
space  2  depth space( I i )
 O( s(n) ).
2
P
P

?


NP
?

||

?
EXP

?
? || 

?


PSPACE
PSPACE

EXPOLY