=========================================================================== CSC 363H Lecture Summary for Week 12 Fall 2007 =========================================================================== --------- Log-space --------- - L = SPACE(log n) = { languages decided by TM in space O(log n) } NL = NSPACE(log n) = { languages decided by NTM in space O(log n) } coNL = { complements of languages in NL } - Q: How can TM use less than linear space when it needs at least that much to store input? A: Measure "work" space independently of space to store input: use 2-tape TM with read-only "input tape" and read-write "work tape", and count only cells used on work tape. (Similar to working with data on read-only DVD when main memory much smaller.) - Note: Sublinear time not useful (can't even read entire input) but sublinear space useful (we'll see examples). - Example 1: { 0^k 1^k : k >= 0 } . Can't just scan back-and-forth marking 0s and 1s because input tape is read-only and marking would require copying to work tape, using more than log n space. . Idea: count instead! Read over 0s and use work tape to record number of 0s read as a binary counter; when we start reading 1s, decrease counter; accept iff no 0 is encountered following a 1 and counter = 0 when we reach end of input and not before. . Space usage: counting up to k requires O(log_2 k) bits, so space is logarithmic. - Think of L as languages that can be recognized by using a fixed number of counters/pointers (counters can be used to keep track of positions into the input string). - Example 2: A_DFA = { : A is a DFA that accepts input string w } Given , keep track of current state of A and current input symbol of w in order to simulate A on w: this can be done with two counters/pointers. - Example 3: PATH = { : G is a graph that contains a path from s to t} No known deterministic log-space algorithm, but easy nondeterministic log-space algorithm: store index of current node, start at s and nondeterministically select next node, accepting when t is reached (or rejecting after n steps, where n = number of nodes of G). This only requires room to store one node index, O(log n), and there is some computation path that accepts iff there is some path from s to t in G. - L subset of NL but NL subset of L unknown: Savitch's Theorem shows NL subset of SPACE((log n)^2), but that's all. - What about NL and P? PATH is NL-complete (w.r.t. L): . PATH in NL . for all A in NL, A <=L PATH, using "log space reduction" <=L (using 3-tape TM with read-only input tape, write-only output tape, and worktape, and measuring only worktape used) Idea: The question "does w belong to A" is equivalent to "is there a path from the initial configuration to an accepting configuration in the computation tree of the nondeterministic log space TM for A". - Note: If A in L and B <=L A, then B in L. However, must be careful: output of log space reduction could take up more than log space. To get a log space algorithm for B, must use log space algorithm for A and recompute log space reduction each time, keeping at most logarithmic number of output symbol at a time on work tape. - Since PATH in P, and A <=L B implies A <=p B (TM running in space O(log n) has at most n * 2^O(log n) possible configurations = O(n^k) for some constant k), NL subset of P. - L = NL? Unknown! P = NL? Unknown! However: NL = coNL! NL =/= PSPACE! ----------------------------- Provably intractable problems ----------------------------- We've concentrated on P, NP, and PSPACE because they are all based on polynomial resource bounds, and our interest was in efficient computation. More importantly, a vast majority of "real-life" problems that arise naturally from various application domains belong to NP. We have seen how to prove problems are NP-complete (and examples of PSPACE-complete problems) and why this is evidence that these problems have no efficient solution. But are there problems that can be proved to have no efficient solution unconditionally? Definitions: EXP = U TIME(2^{n^k}) = { languages decided by TMs in time O(2^n^k) } NEXP = U NTIME(2^{n^k}) = { languages decided by TMs in nondeterministic time O(2^n^k) } EXPSPACE = U SPACE(2^{n^k}) = { languages decided by TMs in space O(2^n^k) } By Savitch's Theorem, NEXPSPACE = EXPSPACE. Known: L <= NL <= P <= NP <= PSPACE <= EXP <= NEXP <= EXPSPACE (using "<=" to represent "subset of") Unknown: L ?= NL, NL ?= P, P ?= NP, P ?= PSPACE, EXP ?= NEXP, EXP ?= EXPSPACE In other words, we don't know how to prove that nondeterminism makes a difference, and we don't know how to prove that space is more powerful than time. Known: NL != PSPACE, P != EXP, NP != NEXP, PSPACE != EXPSPACE In other words, we can prove that exponential gaps make a difference. How do we know these results? Because of so-called "hierarchy theorems": for most functions f_1, f_2 such that f_1 in o(f_2) (i.e., lim_{n -> oo} f_1(n)/f_2(n) = 0), TIME(f_1) is a proper subset of TIME(f_2) and SPACE(f_1) is a proper subset of SPACE(f_2). Idea: construct a decider D that runs in time (or space) O(f_2(n)) and behaves as follows: on input , D simulates M on input for at most f_1(n) steps (or using at most f_1(n) space), and accepts if M rejects, rejects if M accepts (or exceeds the time or space bound). Then, L(D) in TIME(f_2) (or SPACE(f_2)) but L(D) must be different from every language in TIME(f_1) (or SPACE(f_1)), by construction. (See section 9.1 in textbook for technical details required to make this work.) Problems that are complete for EXP are known to be not in P, e.g., "generalized chess", "generalized checkers". Similarly, problems that are complete for EXPSPACE require more than polynomial space and are highly intractable, e.g., "inequivalence of regular expressions with squaring", "equivalence of regular expressions with exponentiation". But it doesn't stop there! We can define k-EXP, k-NEXP, k-EXPSPACE (deterministic time, nondeterministic time, space) 2^(2^...(2^n^t)...), where there are k exponentiations (so EXP = 1-EXP), and show there are languages in each class that are not contained in smaller classes. Even more, ELEMENTARY = 1-EXP U 2-EXP U ... = 1-EXPSPACE U 2-EXPSPACE U ... (since k-EXPSPACE is a subset of (k+1)-EXP). Problems complete for ELEMENTARY are decidable, but with such astronomical time or space bounds that they are completely intractable. Yet, "inequivalence of regular expressions with union, concatenation, and negation" requires running time 2^(2^(...2^(2^n)...)) where there are at least log n many exponentiations, so it's outside even ELEMENTARY!