Nondeterministic Space is Closed Under

Complementation

Neil Immerman

Computer Science Department

Yale University

New Haven CT

SIAM Journal of Computing

Intro duction

In this pap er we show that nondeterministic space sn is closed under com

plementation for sn greater than or equal to log n It immediately follows

that the contextsensitive languages are closed under complementation thus

settling a question raised by Kuro da in See Hartmanis and Hunt

for a discussion of the history and imp ortance of this problem and Hop croft

and Ullman for relevantbackground material and denitions

The history b ehind the pro of is as follows In we showed that

the set of rstorder inductive denitions over nite structures is closed

under complementation This holds with or without an ordering relation

on the structure If an ordering is present the resulting class is PMany

p eople exp ected that the result was false in the absence of an ordering In

we studied rstorder logic with ordering with a transitive closure

op erator We showed that NSPACElog n is equal to FO p os TC ie

rstorder logic with ordering plus a transitive closure op eration in which

the transitive closure op erator do es not app ear within any negation symbols

Nowwehave returned to the issue of complementation in the lightof

recent results on the collapse of the log space hierarchies Wehave

shown that the class FO p os TC is closed under complementation Our

Research supp orted by NSF Grant DCR

main result follows In this pap er wegive the pro of in terms of machines and

then state the result for transitive closure as Corollary The question of

whether FO posTCwithout ordering is closed under complementation

remains op en

Our work in rstorder expressibility led to our pro of that nondetermin

istic space is closed under complementation However b ecause rstorder

expressibility classes are not directly relevant to the pro ofs in this pap er

we omit those denitions here The interested reader should refer to

for all these denitions Note that the pro of of Theorem in is more

complicated than the pro of of Theorem but quite similar to it The same

is true of the pro of in that the rstorder inductive formulas are closed

under complementation

Results

Theorem For any sn log n

NSPACEsn coNSPACEsn

Pro of We do this bytwo lemmas We will show that counting the exact

numb er of reachable congurations of an NSPACEsn machine can b e

done in NSPACEsn Lemma Lemma says that once this number

has b een calculated we can detect rejection as well as acceptance Note the

similaritybetween Lemma and a similar result ab out census functions in

Lemma Suppose we are given an NSPACEsn machine M a size sn

initial conguration START and the exact number N of congurations of

size sn reachable by M from START Then we can test in NSPACEsn

if M rejects

Pro of Our NSPACEsn tester do es the following It initializes a counter

to and a target conguration to the lexicographically rst string of length

sn For each such target either we guess a computation path of M from

START to target and increment b oth counter and target or we simply

The conguration ofaTuring machine is the contents of its work tap es the p ositions of

its heads and its state Note that for sn log nthenumb er of p ossible congurations

sn

is less than c for some constant candthus can b e written in O sn space

increment target For each target that wehave found a path to if it is

an accept conguration of M then we reject Finally if when we are done

with the last target the counter is equal to N we accept otherwise we

reject Note that we accept i wehave found N reachable congurations

none of which is accepting Supp ose that M accepts In this case there

can b e at most N  reachable congurations that are not accepting and

our machine will reject On the other hand if M rejects then there are N

nonaccepting reachable congurations Thus our nondeterministic machine

can guess paths to each of them in turn and accept That is we accept i

M rejects

Lemma Given START as in Lemma we can calculate N the total

number of congurations of size sn reachable by M from STARTin

NSPACEsn

Pro of Let N b e the numb er of congurations reachable from START

d

in at most d steps The computation pro ceeds by calculating N N and

so on By induction on d weshow that each N may b e calculated in

d

NSPACEsn The base case d is obvious

Inductive step Given N weshowhow to calculate N AsinLemma

d d

wekeep a counter of the number of d reachable congurations and we

cycle through all the target congurations in lexicographical order For each

target we do the following Cycle through all N congurations reachable in

d

at most d steps again we nd a path of length at most d for eachreachable

one and if we dont nd all N of them then we will reject For eachof

d

these N congurations check if it is equal to target or if target is reachable

d

from it in one step If so then increment the counter and start on target

If we nish visiting all N congurations without reaching target then just

d

start again on target without incrementing the counter When weve

completed this for all targets our counter contains N Since N

d

sn

is b ounded ab oveby c for some constant c the space needed is Osn

To complete the pro of of the lemma and the theorem note that N is

equaltotherstN suchthatN N

d d d

Remark In our original statement of Theorem we made the assump

tion that sn is space constructible However the standard denition of a

nondeterministic having sn is that

no sequence of choices enables it to scan more than sn cells Thus

the ab ove pro of works even if sn is not space constructible We just let

sn increase as needed

The following corollary is immediate

Corollary The class of context sensitive languages is closed under com

plementation

Pro of Kuro da showed in that CSL NSPACEn

th

The k level of the log space alternating hierarchy ALOG is dened

k

to b e the set of problems accepted by alternating log space Turing machines

that make at most k  alternations and b egin in an existential state Re

cently Lange Jenner and Kirsig showed that this hierarchy collapsed

to the second level ALOG This result was then extended by several

authors who showed that the log space oracle hierarchy collapses to

NL

L Here DSPACElog n and NL NSPACElog n The logspace or

OLOG

k

acle hierarchyisgiven by OLOG NLand OLOG NL

k

In the case of the p olynomial time hierarchy the oracle and alternating hier

archies are identical but they app eared to b e dierent in the log space case

We knew that the logspace oracle hierarchy is equal to FO TC This

together with the ab ove results led us to exp ect Theorem The following

is again immediate

Corollary The LogSpaceAlternating Hierarchy and the LogSpaceOracle

Hierarchy both col lapse to NSPACElog n

In we showed that NL is equal to FO p os TC In Theorem

of wealsoshowed that any problem in NL may b e expressed in the form

max where is a quantier free rstorder formula and and TC

max are constantsymb ols It now follows that the same is true for the class

FOTC

Corollary NSPACElog nFOpos TC FOTC

Any formula in FOTCmaybe expressed in the form TC max

where is a quantier free rstorder formula

Michael Fischer has observed that one can now diagonalize nondeter

ministic space and thus easily proveatight hierarchy theorem for nonde

terministic space Although Corollary is not new our techniques givea

much simpler pro of than was previously known See Chapter in for

the old pro of

Corollary For any tapeconstructible sn log n

tn

lim

n

sn

implies

NSPACE tn  NSPACE sn

Conclusions and Directions for Future Work

Most of the interesting questions concerning the p ower of nondeterminism

remain op en We still do not know whether nondeterministic space is equal

to deterministic space or whether Savitchs Theorem is optimal It is

interesting to consider whether our pro of metho d can b e extended to answer

these questions or to tell us anything new ab out nondeterministic time

So on after weproved Theorem Tompa et al gavetwo extensions

they proved that LOGCFL the set of problems log space reducible to a

context free language is closed under complementation and they showed

that Symmetric Log Space cf is contained in ZPLP the

class of errorless probabilistic Turing machines running in O log n space

and p olynomial exp ected time We suggest the following op en problems

Is FO without  p os TC closed under complementation

Is Symmetric Log Space equivalently FO p os STC closed under

complementation

Is NL equal to a that was previously known to b e

closed under complementation eg L AC or DSPACElog n

In the pro of of Theorem we made use of the linear space compression

theorem Theorem in Our actual construction multiplies the

space b ound by ab out eight It is interesting to ask howmuch this

can b e reduced Note in particular that if we could complementlogn

times while only increasing the space b ound by a constant factor then

it would followthatNLAC

Acknowledgements Thanks to Sam Buss MikeFischer Lane Hemachan

dra Steve Mahaney and Jo el Seiferas who contributed comments and cor

rections to this pap er

References

A Boro din SA Co ok PW Dymond WL Ruzzo and M Tompa

Two Applications of Complementation via Inductive Counting this

volume

S Buss SA Co ok P Dymond and L Hay The Log Space Oracle

Hierarchy Collapses in preparation

SA Co ok A Taxonomy of Problems with Fast Parallel

Information and Control

J Hartmanis and HB Hunt I I I The LBA Problem Complexity of

Computation ed R Karp SIAMAMS Proc

John E Hop croft and Jery D Ullman Introdution to Automata The

ory Languages and Computation AddisonWesley

N Immerman Relational Queries Computable in Polynomial Time

Information and Control A preliminary version of

this pap er app eared in th ACM STOC Symp

N Immerman Languages That Capture Complexity Classes SIAM

J Comput No A preliminary version of this

pap er app eared in th ACM STOC Symp

N Immerman Expressibility as a Complexity Measure Results and

Directions Second Structure in Complexity Theory Conf

SY Kuro da Classes of Languages and LinearBounded Automata

Information and Control

KJ Lange B Jenner and B Kirsig The Logarithmic Hierarchy

L L

Collapses A A th International Col loquium on Automata

Languages and Programming

H Lewis and C H Papadimitriou Symmetric Space Bounded Com

putation ICALP Revised version app eared in Theoret Com

put Sci

S R Mahaney Sparse Complete Sets for NP Solution of a Conjec

ture of Berman and Hartmanis J Comput Systems Sci

J Reif Symmetric Complementation JACM No April

U Schoning and KW Wagner Collapsing Oracles Census Func

tions and Logarithmically Many Queries Rep ort No

Mathematics Institute Univ Augsburg

WJ Savitch Relationships Between Nondeterministic and Deter

ministic Tap e Complexities J Comput System Sci

Rob ert Szelep csenyi The Metho d of Forcing for Nondeterminis

tic Automata Bul l European Association Theor Comp Sci Oct

SeinosukeTo da SPACEn is Closed Under Complement JCSS

No