Space Complexity Review

Complexity Theory Space Complexity

Daniel Borchmann, Markus Krötzsch Review

Computational Logic

2015-11-25

cba

cba 2015 Daniel Borchmann, Markus Krötzsch Complexity Theory 2015-11-25 #1 cba 2015 Daniel Borchmann, Markus Krötzsch Complexity Theory 2015-11-25 #2 Space Complexity Space Complexity Space Complexity Space Complexity Review: Space Complexity Classes

Recall our earlier definition of space complexities:

Definition 10.1 Let f : N + be a function. → DSpace(f(n)) is the class of languages for which there is an Space Complexity O(f(n))-space bounded deciding . L NSpace(f(n)) is the class of all languages for which there is an L O(f(n))-space bounded nondeterministic Turing machine deciding . L Being O(f(n))-space bounded requires a (nondeterministic) TM to halt on every input and to use f( w ) tape cells on every computation path. ≤ | |

cba 2015 Daniel Borchmann, Markus Krötzsch Complexity Theory 2015-11-25 #3 cba 2015 Daniel Borchmann, Markus Krötzsch Complexity Theory 2015-11-25 #4 Space Complexity Space Complexity Space Complexity Space Complexity Space Complexity Classes The Power Of Space

Some important space complexity classes: Space seems to be more powerful than time because space can be reused. L = LogSpace = DSpace(log n) logarithmic space

PSpace = DSpace(nd ) polynomial space Example 10.2 d 1 [≥ Sat can be solved in linear space: d ExpSpace = DSpace(2n ) exponential space Just iterate over all possible truth assignments (each linear in size) and d 1 [≥ check if one satisfies the formula.

NL = NLogSpace = NSpace(log n) nondet. logarithmic space Example 10.3

NPSpace = NSpace(nd ) nondet. polynomial space Tautology can be solved in linear space: d 1 Just iterate over all possible truth assignments (each linear in size) and [≥ d check if all satisfy the formula. NExpSpace = NSpace(2n ) nondet. exponential space d 1 [≥ More generally: NP PSpace and coNP PSpace ⊆ ⊆ cba 2015 Daniel Borchmann, Markus Krötzsch Complexity Theory 2015-11-25 #5 cba 2015 Daniel Borchmann, Markus Krötzsch Complexity Theory 2015-11-25 #6 Space Complexity Space Complexity Space Complexity Space Complexity Linear Compression Tape Reduction

Theorem 10.5 Theorem 10.4 + For every functionf : N R allk 1 and Σ∗: For every functionf : N R+, for allc N, and for every f-space → ≥ L ⊆ → ∈ If can be decided by anf-space boundedk-tape Turing-machine, bounded (deterministic/nondeterminsitic) Turing machine : L M it can also be decided by anf-space bounded 1-tape Turing-machine there is a max 1, 1 f(n) -space bounded (deterministic/nondeterminsitic) { c } Turing machine that accepts the same language as . M0 M Proof idea. Proof idea. Combine tapes with a similar reduction as for time. Compress space to avoid linear increase.  Similar to (but much simpler than) linear speed-. 

This justifies using O-notation for defining space classes. Recall that we still use a separate read-only input tape to define some space complexities, such as LogSpace.

cba 2015 Daniel Borchmann, Markus Krötzsch Complexity Theory 2015-11-25 #7 cba 2015 Daniel Borchmann, Markus Krötzsch Complexity Theory 2015-11-25 #8 Space Complexity Space Complexity Space Complexity Space Complexity Time vs. Space Number of Possible Configurations

Theorem 10.6 Let := (Q, Σ, Γ, q0, δ, qstart) be a 2-tape Turing machine M For all functionsf : N R+: (1 read-only input tape + 1 work tape) → DTime(f) DSpace(f) and NTime(f) NSpace(f) Recall: A configuration of is a quadruple (q, p1, p2, x) where ⊆ ⊆ M q Q is the current state, Proof. ∈ pi N is the head position on tape i, and Visiting a cell take