VIEWS: 9 PAGES: 26 POSTED ON: 10/13/2011
Time & Tape Complexity of Turing Machines Space Complexity • Consider the offline Turing Machine M. M has a read only input tape with n markers and k infinite storage tapes. If for every input word of length n, M scans at most S(n) cells on any storage tape, then M is said to be an S(n) space bounded Turing machine, or of space complexity S(n). The language recognised by M is also said to be of space complexity S(n). Time Complexity • Consider the Multi tape Turing Machine M which has k two way infinite tapes, one of which contains the input. If for every input word of length n, M makes at most T(n) moves before halting, then M is said to be a T(n) time bounded Turing machine, or of time complexity T(n). The language recognized by M is said to be of time complexity T(n). Special Assumptions about time and space complexity • Every TM uses at least one cell on all inputs, so if S(n) is a space complexity measure, we may assume S(n) >= 1 for all n. We make the useful assumption that when we talk of space complexity S(n), we really mean max (1, ⌈S(n)⌉). • Similarly, it is reasonable to assume that any time complexity function T(n) is at least n+1, for this is the time needed just to read the input and verify that the end has been reached by reading the first blank. We thus make the convention that time complexity T(n) means max (n+1,⌈T(n)⌉). Nondeterministic Time and Space Complexity • The concepts of time and space complexity apply equally well to nondeterministic machines. A nondeterministic TM is of time complexity T(n) if no sequence of choices of moves causes the machine to make more than T(n) moves. It is of space complexity S(n) if no sequence of choices enables it to scan more than S(n) cells on any storage tape. Complexity Classes • The family of languages of space complexity S(n) is denoted by DSPACE(S(n)); the languages of nondeterministic space complexity S(n) are collectively called NSPACE(S(n)). The family of languages of time complexity T(n) is denoted DTIME(T(n)) and that of nondeterministic time complexity T(n) is denoted NTIME(T(n)). All these families of languages are called complexity classes. • Theorem : If L is accepted by an S(n) space- bounded Turing machine with k storage tapes, then for any c > 0, L is accepted by a cS(n) space bounded TM. • Theorem : If a language L is accepted by an S(n) space bounded TM with k storage tapes, it is accepted by an S(n) space bounded TM with a single storage tape. • A function S(n) is said to be space constructible, if there is some Turing machine M that is S(n) space bounded, and for each n, there is some input of length n on which M actually uses S(n) tape cells. The set of space constructible functions includes log n, nk , 2n and n!. If S1(n) and S2(n) are space constructible, then so are S1(n) S2(n), 2 S1(n). • Note that M above need not use S(n) space on all inputs of length n, just on some one input of that length. If for all n, M in fact uses exactly S(n) cells on any input of length n, then we say S(n) is fully space constructible. • If S2(n) is a space constructible function, S1(n) inf ------ =0 n ∞ S2(n) and S1(n) and S2(n) are each at least log2(n), then there is a language DSPACE(S2(n)) not in DSPACE(S1(n)). • If T2(n) is a fully time constructible function and T1(n) log T1(n) inf ------------------ = 0 n ∞ T2(n) then there is a language in DTIME(T2(n) ) but not DTIME(T1(n) ). • Savitch’s Theorem : If L is in NSPACE(S(n)), then L is in DSPACE(S2(n)) provided S(n) is fully space constructible and S(n) ≥ log2(n) ⋃ i≥1 DTIME(ni) = ℘ ⋃ i≥1 NTIME(ni) = N℘ ⋃ i≥1 DSPACE(ni) = PSPACE ⋃ i≥1 NSPACE(ni) = NSPACE • DSPACE (log n) ⋤ DSPACE(log2n) ⋤ DSPACE (log3n) ⋤… and • NSPACE (log n) ⋤ NSPACE(log2n) ⋤ NSPACE (log3n) ⋤… • Clearly, DSPACE (logkn) ⋤ NSPACE (logkn) and thus by Savitch’s theorem, • ⋃ k≥1 NSPACE(logkn) = ⋃ k≥1 DSPACE(logkn) • Although one can show that ℘ ≠ ⋃k≥=1DSPACE(logkn) containment of either class in the other is unknown. • DSPACE(log n) ⊑ ℘ ⊑ N℘ ⊑ PSPACE, and at least one of the containments is proper, since DSPACE(log n) ⋤ PSPACE by the space hierarchy theorem. • We say that L’ is polynomial time reducible to L if there is a polynomial time bounded TM that for each input x produces an output y that is in L if and only if x is in L’ • Let L’ be polynomial time reducible to L. Then • L’ is in N℘ if L is in N℘ • L’ is in ℘ if L is in ℘. • Let C be a class of languages. We say language L is complete for C with respect to polynomial time reductions if L is in C, and every language in C is polynomial time reducible to L. • We say L is hard for C with respect to polynomial time reductions if every language in C is polynomial time reducible to L, but not necessarily in C. • Theorem : the satisfiability problem is NP complete. The problem of determining whether a Boolean expression is satisfiable is NP complete • Proof : The satisfiability problem is in NP. Thus we need to show that every language L in NP is polynomially transformable to the satisfiability problem. Let M be a nondeterministic Turing machine of polynomial time complexity that accepts L, and let w be an input to M. From M and w we can construct a Boolean expression w0 such that w0 is satisfiable if and only if M accepts w. The crux of the proof is in showing that for each M there is a polynomial time bounded algorithm to construct the Boolean experssion w0 from w. The polynomial depends on machine M. • Every language in N℘ is accepted by a nondeterministic single tape Turing machine of polynomial time complexity. Thus we may assume M has a single tape. • Suppose M has states q1,q2,…,qs and tape symbols X1,X2,…,Xm. Let p(n) be the time complexity of M. We shall construct a Boolean expression w0 that “simulates” a sequence of IDs entered by M. • C<i,j,t> is 1 if and only if the ith cell on M’s input tape contains the tape symbol Xj at time t. Here 1 ≤i ≤ p(n), 1 ≤j ≤m, and 0 ≤t ≤ p(n). • S<k,t> is 1 if and only if M is in state qk at time t. Here 1 ≤k ≤ s and 0 ≤t ≤ p(n) • H<i,t> is true if and only if at time t the tape head is scanning tape cell i. Here 1 ≤i ≤ p(n) and 0 ≤t ≤ p(n). • U(x1 , …, xr ) = (x1 + …+ xr ) (Π (¬xi +¬xj )) i,j, i ≠ j • The tape head is scanning exactly one cell in each ID • Each ID has exactly one tape symbol in each tape cell • Each ID has exactly one state • At most one tape cell, the cell scanned by the tape head, is modified from one ID to the next • The change in state, head location and tape cell contents between successive ID’s is allowed by the move function of M, • The first ID is an initial ID, and • The state in the last ID is the final state.