You are on page 1of 3

CS 810: Introduction to Computational Complexity Theory 02/04/2003

Lecture 5: Savitch’s Theorem and Immerman-Szelepcsényi’s Theorem


Instructor: Jin-Yi Cai Scribe: Vinod Ganapathy and Michael DeCoster

In today’s lecture, we will discuss two theorems related to non-deterministic space bounded com-
putation – Savitch’s theorem and Immerman-Szelepcsényi’s theorem.

1 Savitch’s Theorem
Theorem 1. If s(i) is space constructible, and s(n) ≥ log n, then N SP ACE[s(n)] ⊆ DSP ACE[(s(n)) 2 ]
Proof. Let us consider the directed graph correspondoing to the state configurations of a turing
machine. If you have s(n) space, then you are essentially talking about a directed graph with
2c.s(n) states for some constant c. Since we want to show containment of N SP ACE[s(n)] in
DSP ACE[(s(n))2 ], we can without loss of generatlity consider the graph accessibility problem on
a graph with 2c.s(n) vertices in it, and 2 identified vertices s and t.

The key idea behind the proof can be captured in one line: If you want to go from a vertex v to a
vertex u in ≤ k steps, then there must exist a vertex w such that it takes ≤ k2 steps to go from v to
w, and it takes ≤ k2 steps to go from w to u. In fact, we have not been very precise when making
the above statement since we have omitted small details – like what happens if k is odd etc. To be
very precise, we must word it as saying that: you can go from a vertex v to a vertex u in ≤ k steps
if and only if there exists a vertex w such that it takes ≤ d k2 e steps to go from v to w and it takes
≤ b k2 c steps to go from w to u.

Consider now the predicate Reach(v, u, k) where v and u are vertices of the directed graph, and k is
an integer such that Reach(v, u, k) is true if and only if you can reach u by starting at v in ≤ k steps.
Formally, Reach(v, u, k) iff v = v0 , v1 , . . . , vl = u, l ≤ k and (vi , vi+1 ) ∈ Edges, for i ∈ [0, i − 1]
The key idea is: Reach(v, u, k) = ∃w[Reach(v, w, d k2 e) ∧ Reach(w, u, b k2 c)]

If k is 0, then v and u must be the same if the predicate is to be true, and this can easily be checked
in Logspace by just writing down u and v, which clearly takes only O(s(n)) space. (Note: Since
we are taking about a graph with 2c.s(n) space, s(n) is Logspace for us.) Again, if k is 1, then v
and u are either the same vertex, or (v, u) is an edge in the graph. Checking if (v, u) is an edge
only takes O(s(n)) space.

Now, let us consider a deterministic machine. How does it determine the value of the predicate
Reach(v, u, k)? It just cycles through all the vertices to see if there is apath from v to some vertex
w in d k2 e steps, and similarly checks to see if there is a path from w to u in b k2 c steps, resuing the
space at each step. That is, the combined space requirement for computing Reach(v, w, d k2 e) and
Reach(w, u, b k2 c) is the maximum of the two quantities.

Hence, we have,
Space usage for Reach(v, u, 2l )
≤ Space usage for max(Reach(v, w, 2l−1 ), Reach(w, u, 2l−1 ) + O(log 2c.s(n) )

1
≤ maxα,β Space usage for Reach(α, β, 2l−1 ) + O(log 2c.s(n) ))
In other words,
maxα,β Space usage for Reach(α, β, 2l )
≤ maxα,β Space usage for Reach(α, β, 2l−1 ) + O(log 2c.s(n) )
Clearly, if there is a path from v to u, then there must be one that is shorter than 2 c.s(n) (without any
cycles in it). Hence l ≤ c.s(n). So we have that the space requirement to compute Reach(v, u, k)
using a deterministic turing machine is c.s(n) 2 , and hence we simulated a Non-deterministic turing
machine operating in space s(n), with a deterministic turing machine opearting in space c.s(n) 2
for some constant c, hence showing the theorem.

2 Immerman-Szelepcsényi’s Theorem
Theorem 2. Let s(i) be a space constructible function and s(n) ≥ log(n). Then N SP ACE[s(n)] =
co − N SP ACE[s(n)]
Proof. We will only prove a specific case of this theorem that states that N L = co − N L by
considering the graph accesibility problem for an n-vertex graph, which we know can be done in
log n space (in fact we know that the s-t connectivity problem is N L-complete under logspace re-
ductions). The complement of this problem (graph non-accessibility) – that is the problem whose
”yes” instances are such that s and t are two vertices in a graph G and s is not connected to t in
G – is hence co-NL complete. Hence, to show that N L = co − N L, we will try to construct a NL
algorithm to the co-NL problem.

To find such an algorithm, we will construct an algorithm to find c i where ci =# of vertices reach-
able from s in ≤ i steps. To find this value, we first note that c 0 = 1 is trivial as the only vertex
possible is itself. To find c1 we can simply cycle through all the vertices v and add 1 to the count
if (s, v) ∈ E. Next we will use induction to find the rest of the c i ’s. Assume ci is already written
on the tape. We will now cycle through all vertices v, and try to decide Reach(s, v, i + 1). Follow
the following nondeterministic algorithm to decide this: Cycle through all vertices u. Nondeter-
ministically guess if u is reachable in i steps. If the guess is yes, then nondeterministically guess a
path. If the path is valid add 1 to the number of yes’s, and then set a bit if u = v, or if (u, v) ∈ E
otherwise abort. After all the u’s have been looped through make sure that the number of yes’s
equals ci . If they don’t, abort, otherwise add 1 to c i if the bit was ever set during the loop. Repeat
this process until cn has been computed. Now repeat the previous process using t instead of v. If
the bit is never set for t, t is never reachable from s. Algorithm 1 has the details.

This algorithm shows that Graph Nonaccessibility can be done in logn space because when com-
puting ci+1 for i ≥ 0, the algorithm will only need to store the value for c i which is at most logn,
the value for the recount of ci which is also at most logn, the running total for c i+1 which is also
at most logn, the value of i which is at most logn size.the vertices v, u, s, and t which again are
at most logn each, and the two intermediate vertices used to guess the path, again only logn. In
the final part of the algorithm, cn−1 , s, t, u, the running recount of cn−1 , and the two intermediate
vertices used for guessing the paths are used, each of which are at most logn size. Therefore dur-
ing the first half of the algorithm 10 log n bits are needed, and in the second half, 7 log n bits are
needed. Because of this, Graph nonaccessibility is in NL, and hence NL = co-NL. This proof can
be generalized to show that for any s(n), N SP ACE[s(n)] = co − N SP ACE[s(n)].

2
Algorithm 1: Graph Nonaccessibility
Input: Edges E; Set of Vertices V = {1, 2, · · · , n}; vertex s; vertex t
Output: Accept if there is no path from s to t, decline otherwise
(1) c0 = 1
(2) i=0
(3) repeat
(4) ci+1 = 0
(5) for v = 1 to n
(6) bv =F
(7) c=0
(8) for u = 1 to n
(9) guess yes or no
(10) if guessed yes
(11) guess a path from s to u of length ≤ i
(12) if path is valid
(13) if u = v or (u, v) ∈ E
(14) bv =T
(15) c=c+1
(16) else
(17) abort
(18) if c 6= ci
(19) abort
(20) if bv =T
(21) ci+1 = ci+1 + 1
(22) i=i+1
(23) until i = n − 1
(24) b = F
(25) c = 0
(26) for u = 1 to n
(27) guess yes or no
(28) if guessed yes
(29) guess a path from s to u of length ≤ n − 1
(30) if the path was valid
(31) if u = t
(32) b=T
(33) c=c+1
(34) else
(35) abort
(36) if c 6= cn−1
(37) abort
(38) if b 6= T
(39) accept

You might also like