Lecture 9 Space Complexity of DTM

Lecture 1-2 Time and Space
of DTM
Time of DTM
• TimeM (x) = # of moves that DTM M takes
on input x.
• TimeM(x) < infinity iff x ε L(M).
Time Bound
M is said to have a time bound t(n) if for
every x with |x| < n,
TimeM(x) < max {n+1, t(n)}
Theorem
• For any multitape DTM M, there exists a
one-tape DTM M’ to simulate M within time
TimeM’(x) < c + (TimeM(x))
c is a constant.
2
Complexity Class
• A language L has a (deterministic) timecomplexity t(n) if there is a multitape DTM
M accepting L, with time bound t(n).
• DTIME(t(n)) = {L | L has a time bound t(n)}
Model
• Multitape TM with write-only output.
Linear Speed Up
Suppose t(n)/n → infinity as n → infinity.
Then for any constant c > 0,
DTIME(t(n)) = DTIME(ct(n))
1--m
Bee dance
3m
t ( n)

8
m
8
(choose m such that
 c)
m
Model Independent Classes
P  c 0 DTIME (n )
c
EXP  c 0 DTIME (2 )
cn
EXPOLY  c 0 DTIME (2 )
nc
Space
• SpaceM(x) = total # of cells that M visits on
all working (storage) tapes during the
computation on input x.
• If M is a multitape DTM, then the working
tapes do not include the input tape and the
write-only output tape.
Space Bound
• A DTM with k work tapes is said to have a
space bound s(n) if for any input x with |x|
< n,
SpaceM(x) < max{k, s(n)}.
Time and Space
• For any DTM with k work tapes,
SpaceM(x) < k (TimeM(x) + 1)
Complexity Classes
• A language L has a space complexity s(n)
if it is accepted by a multitape with writeonly output tape DTM with space bound
s(n).
• DSPACE(s(n)) = {L | L has space
complexity s(n)}
Tape Compression Theorem
• For any function s(n) and any constant c > 0,
DSPACE(s(n)) = DSPACE(c·s(n))
1--m
3m

s ( n)
m
(choose m such that
1
 c)
m
Model Independent Classes
c
• P = U c>0 DTIME(n )
cn
• EXP = U c > 0 DTIME(2 )
n
c
• EXPOLY = U c > 0 DTIME(2 )
c
• PSPACE = U c > 0 DSPACE(n )
Extended Church-Turing Thesis
• A function computable in polynomial time
in any reasonable computational model
using a reasonable time complexity
measure is computable by a DTM in
polynomial time.
P  PSPACE
• SpaceM(x) < k (TimeM(x) + 1)
PSPACE  EXPOLY
Multi-tape DTM
Input tape
(read only)
 s (n)
working
tapes
Output tape
(possibly, write only)
A, B  P imply A U B  P
A, B P imply AB  P
L P implies L*  P
All regular sets belong to P
Space Hierarchy Theorem
Space-constructible function
• s(n) is fully space-constructible if there
exists a DTM M such that for sufficiently
large n and any input x with |x|=n,
SpaceM(x) = s(n).
Space Hierarchy
If
• s2(n) is a fully space-constructible function,
• s1(n)/s2(n) → 0 as n → infinity,
• s1(n) > log n,
then
DSPACE(s2(n)) DSPACE(s1(n)) ≠ Φ
Time Hierarchy
Time-constructible function
• t(n) is fully time-constructible if there exists
a DTM such that for sufficiently large n
and any input x with |x|=n,
TimeM(x) = t(n).
Time Hierarchy
If
• t1(n) > n+1,
• t2(n) is fully time-constructible,
• t1(n) log t1(n) /t2(n) → 0 as n → infinity,
then
DTIME(t2(n)) DTIME(t1(n)) ≠ Φ
P  EXP
For any constant c  0,
for sufficient ly large n, n c  2 n.
Thus, DTIME ( n c )  DTIME (2 n ).
Hence, P  DTIME (2 n )  EXP.
Could you prove P
 EXP ?
PSPACE≠EXP
First, note that EXP  DTIME (2 )  DTIME (2 ).
For contradict ion, suppose PSPACE  EXP.
n2 / 2
Consider any L  DTIME (2 ).
n2
| x|2 | x|
Define L'  {x$
| x  L}.
Then L' DTIME (2 n )  EXP  PSPACE.
So, L' DSPACE (n c ) for some c  0.
Hence, L  DSPACE (( n ) )  PSPACE  EXP.
2 c
Therefore, DTIME (2 )  EXP ().
n2
n2