Docsity

Advanced Computational Complexity-Lecture 10 Slides-Computer Science, Slides of Advanced Computational Complexity

Partial preview of the text

Download Advanced Computational Complexity-Lecture 10 Slides-Computer Science and more Slides Advanced Computational Complexity in PDF only on Docsity!

Lecture 10: Non-Deterministic Space

Matthew Johnson

[email protected]

Nondeterministic Machines

Following the same procedure as for time, we can measure the space taken by a non-deterministic machine by taking the minimum over all computation paths. Definition The space complexity of a non-deterministic Turing Machine NT is the function NSpaceNT such that NSpaceNT (x) is the number of cells visited in the shortest accepting path of NT (x) if there is one, otherwise it is the number of steps in the shortest rejecting path. (If not all paths of NT (x) halt, then NSpaceNT (x) is undefined.)

Savitch’s Theorem

Unlike time, it can easily be shown that non-determinism does not reduce the space requirements very much: Theorem (Savitch) If s(n) ≥ n, then

NSPACE[s] ⊆ SPACE[s^2 ]. NB. Compare this with a similar result for time complexity (see Sipser Theorem 7.10 or Papadimitriou Theorem 2.6): Theorem

NTIME[f ] ⊆

c≥ 1

TIME[cf^ ].

The class NPSPACE

Definition NPSPACE =

k≥ 0

NSPACE[nk^ ]

It follows from Savitch’s Theorem that Corollary PSPACE = NPSPACE Thus, for polynomial space, non-determinism does not add any extra computational power.

Proof

Outline (see Sipser Theorem 8.5 for details) Let L be a language in NSPACE[s] Let NT be a non-deterministic Turing machine that decides L with space complexity s Choose an encoding for the computation NT (x) that uses cs(|x|) symbols for each configuration (c is a constant) Let C 0 be the start configuration, and Ce be the accepting configuration Define a Boolean function reach(C, C′, j) which is TRUE iff configuration C′^ can be reached from configuration C in at most 2j^ steps. To decide whether or not x ∈ L we must determine whether or not reach(C 0 , Ce, cs(|x|)) is TRUE

Proof

Outline (see Sipser Theorem 8.5 for details) Let L be a language in NSPACE[s] Let NT be a non-deterministic Turing machine that decides L with space complexity s Choose an encoding for the computation NT (x) that uses cs(|x|) symbols for each configuration (c is a constant) Let C 0 be the start configuration, and Ce be the accepting configuration Define a Boolean function reach(C, C′, j) which is TRUE iff configuration C′^ can be reached from configuration C in at most 2j^ steps. To decide whether or not x ∈ L we must determine whether or not reach(C 0 , Ce, cs(|x|)) is TRUE

Proof

Outline (see Sipser Theorem 8.5 for details) Let L be a language in NSPACE[s] Let NT be a non-deterministic Turing machine that decides L with space complexity s Choose an encoding for the computation NT (x) that uses cs(|x|) symbols for each configuration (c is a constant) Let C 0 be the start configuration, and Ce be the accepting configuration Define a Boolean function reach(C, C′, j) which is TRUE iff configuration C′^ can be reached from configuration C in at most 2j^ steps. To decide whether or not x ∈ L we must determine whether or not reach(C 0 , Ce, cs(|x|)) is TRUE

Proof

Outline (see Sipser Theorem 8.5 for details) Let L be a language in NSPACE[s] Let NT be a non-deterministic Turing machine that decides L with space complexity s Choose an encoding for the computation NT (x) that uses cs(|x|) symbols for each configuration (c is a constant) Let C 0 be the start configuration, and Ce be the accepting configuration Define a Boolean function reach(C, C′, j) which is TRUE iff configuration C′^ can be reached from configuration C in at most 2j^ steps. To decide whether or not x ∈ L we must determine whether or not reach(C 0 , Ce, cs(|x|)) is TRUE

Logarithmic Space

Since polynomial space is so powerful, it is natural to consider more restricted space complexity classes Even linear space is enough to solve SATISFIABILITY To get sublinear space complexity, we disregard the cells containing the input (which we assume are “read-only”) and count only working space.

Definition L = SPACE[log n] NL = NSPACE[log n]

Problems in L and NL

What sort of problems are in L and NL? In logarithmic space we can store a fixed number of counters (up to length of input) a fixed number of pointers to positions in the input string So, L contains all problems requiring only a fixed number of counters/pointers for solving NL contains all problems requiring only a fixed number of counters/pointers for verifying solutions

Examples

L = { 0 n 1 n^ | n ≥ 0 } Algorithm:

  1. Check that whether 1 is ever followed by 0, and if so reject. This requires no working space.
  2. Count the number of 0’s and the number of 1’s
  3. if the counters coincide at the end then accept, else reject. Palindromes (strings that read the same forward and backward). Algorithm: We need two counters: one for position counting from beginning and the other for position counting from the end of string. At each step, check that symbols in the positions indicated by the counters are the same, and then increment the counters.

Example

The first problem defined in this course was REACHABILITY^1 This can be solved by the following nondeterministic algorithm: Define a counter and initialise it to the number of nodes in the graph Define a pointer to hold the “current node” and initialise to the start node While the counter is non-zero — If the current node equals the target node, return yes — Non-deterministically choose a node which can be reached from the current node — Update the pointer to this node and decrement the counter Return no (^1) Also known as PATH