L, NL, and the Immerman-Szelepcsenyi Theorem
Anchor (Master): Arora and Barak 2009 Computational Complexity: A Modern Approach (Cambridge) §4.3 (NL, coNL, the inductive counting argument of Immerman-Szelepcsenyi with full proof, the consequences for the low levels of the space hierarchy, and connections to circuit complexity); Sipser 2013 §8.4; Papadimitriou 1994 Computational Complexity (Addison-Wesley) Ch. 7
Intuition Beginner
Imagine you are a robot walking through a city, trying to get from your hotel to the museum. You have no map, and you can only remember a constant number of street names at any time. Can you navigate? The answer depends on whether you are allowed to make lucky guesses.
If you must plan deterministically, with only a fixed-size memory, you are limited to the class L — problems solvable in logarithmic space. Logarithmic space means you can remember only a handful of numbers about the size of the input, not the input itself. Remarkably, some useful problems still fit in this budget.
If you are allowed to make nondeterministic guesses — "try this street, and if it works, great" — you enter the class NL. The gap between L and NL is the space analogue of the gap between P and NP, but it lives at a much tighter scale.
The biggest surprise in this area is that NL is closed under complement. If a problem can be solved with nondeterministic log-space guesses, then its negation can too. This is nothing like the NP situation, where whether NP equals coNP is a major open question. For logarithmic space, nondeterminism is weak enough that we can prove it adds no power when you flip the answer.
Visual Beginner
The space complexity hierarchy at the logarithmic level and its relationship to the polynomial levels.
PSPACE
/ \
P ----- NP
| |
L ----- NLThe key relationships. L sits inside NL, just as P sits inside NP. But unlike the P-vs-NP question, we know NL = coNL (Immerman-Szelepcsenyi, 1987). The inclusion NL within P follows from the fact that a log-space nondeterministic machine has at most polynomially many configurations.
| class | resource | deterministic version |
|---|---|---|
| L | itself | |
| NL | inside by Savitch | |
| P | itself | |
| NP | unknown |
Worked example Beginner
Take the PATH problem: given a directed graph with nodes and , does a directed path from to exist? This is the canonical NL-complete problem.
A nondeterministic log-space algorithm works as follows. Start at . At each step, nondeterministically pick an outgoing edge and follow it. Store only the current node number, which takes bits for a graph with nodes. After at most steps (since any simple path has at most nodes), either you reach and accept, or you give up and reject.
If a path exists, some sequence of lucky guesses follows it, so the machine accepts. If no path exists, no guessing sequence can reach , so the machine always rejects. This shows PATH is in NL.
The harder direction is that every NL problem reduces to PATH. The idea is that any nondeterministic log-space computation on input has a configuration graph with polynomially many vertices, and the machine accepts if and only if there is a path from the start configuration to an accepting one. Since the configuration graph can be constructed on-the-fly in log space, this gives a log-space reduction.
Check your understanding Beginner
Formal definition Intermediate+
For a function , define and as in 47.02.05. The logarithmic-space classes are
Equivalently, is the class of languages decidable by a deterministic Turing machine that uses cells on its work tape (the read-only input tape is not counted), and is the nondeterministic variant.
A log-space reduction from to is a function computable in space such that . A language is NL-complete if and every log-space reduces to .
The language
is the canonical NL-complete problem. Its complement is -complete.
The key structural facts are: , by Savitch's theorem 47.02.05, and by the Immerman-Szelepcsenyi theorem. Whether remains open [Arora-Barak §4.3].
Counterexamples to common slips Intermediate+
"NL = coNL implies L = NL." It does not. Closure under complement says that the complement of every NL language is also in NL. This does not collapse NL to its deterministic version. The relationship between L and NL is analogous to P versus NP — closure under complement is a weaker statement than derandomisation of nondeterminism.
"Savitch gives the best known simulation of NL in deterministic space." This is correct: is the best known upper bound. Whether is a major open question. No improvement on Savitch's bound is known even for the specific case of graph reachability.
"PATH is NL-complete, so it cannot be in L." NL-completeness means PATH is among the hardest problems in NL, but we do not know whether L = NL. If L = NL, then PATH would be in L. The completeness result only tells us that PATH is in L if and only if every NL problem is in L.
Key theorem with proof Intermediate+
Theorem (Immerman-Szelepcsenyi). For space-constructible , . In particular, .
Proof. The proof uses an inductive counting technique. We show , which suffices since is -complete.
Let be a graph on vertices. For a vertex and integer , define and . Note (only itself). The goal is to decide, given , whether .
Inductive step: Suppose an NL machine knows . It can compute in NL as follows. Initialize a counter . For each vertex (loop over all vertices): nondeterministically verify that by guessing a path of length from to . If verification succeeds, check if any neighbour of is the current vertex . If so, is reachable in steps.
To compute : iterate over all vertices . For each , use the above procedure to check membership in . But there is a subtlety: the nondeterministic verification might reject a reachable vertex. The fix is to use the count as a certificate of completeness: after scanning all , if we have found exactly vertices in , then we know we have found all of them. This ensures no reachable vertex is missed.
Starting from , compute inductively. After computing , we know exactly how many vertices are reachable from . Now check whether is among them: guess paths to distinct vertices, and if none equals , then is unreachable — accept. If is found among them, reject.
The machine uses space: it stores counters (each bits), the current vertex (also ), and the nondeterministic path guesses reuse the same space.
Bridge. This theorem is the foundational reason the space complexity landscape is more tractable at the logarithmic level than the time complexity landscape at the polynomial level: nondeterminism in log space is so constrained that even its complement fits within the same class, and this is exactly the kind of structural collapse that has no known time analogue (NP versus coNP remains wide open). The inductive counting technique builds toward the circuit complexity results in 47.03.02 where similar counting arguments appear, and it appears again in the derandomisation programme 47.05.05 where explicit constructions of pseudorandom generators for space-bounded computation rely on counting reachability sets. The central insight is that knowing certifies completeness of a nondeterministic search — putting these together, the inductive chain turns a "there exists" question into a sequence of verified counts, and the bridge is that this counting trick works in NL precisely because log-space machines can count to polynomial quantities while storing only logarithmically many bits.
Exercises Intermediate+
Advanced results Master
The Immerman-Szelepcsenyi theorem opened the door to a detailed understanding of space-bounded computation. The results below explore the consequences and generalisations.
Theorem 1 (NL = coNL, full detail). The proof has two key components: (a) computing from in NL, and (b) using to decide . For (a), the machine maintains two counters: (given) and (being computed). For each vertex , it determines whether by scanning all vertices and guessing paths of length from to . When a path to is found, check if is an edge. The count ensures completeness: after scanning all , if exactly of them were verified as reachable, the scan was exhaustive. For (b), with known, guess distinct reachable vertices and verify that is not among them [Arora-Barak §4.3].
Theorem 2 (Savitch at the logarithmic level). The bound from Savitch's theorem 47.02.05 is the best known deterministic upper bound for NL. No improvement is known, and the question remains one of the fundamental open problems in complexity theory. The Reingold theorem (2005) showed that undirected graph reachability is in L, giving , but the directed case remains open.
Theorem 3 (NL and circuit complexity). The inclusion follows from the Savitch recursion translated into circuits. This places NL problems in the realm of efficient parallel computation. The converse relationship — whether — involves the complexity of formula evaluation and is related to the question of whether Boolean formula value is complete for [Arora-Barak §6.2].
Theorem 4 (downward self-reducibility and NL). Many NL-complete problems exhibit downward self-reducibility: the answer for input size can be obtained from answers for inputs of size . For PATH, removing a vertex and asking about reachability in the smaller graph is a form of self-reducibility. This property connects to the randomised algorithms for space-bounded computation in 47.05.01, where random walks on graphs approximate reachability probabilities.
Theorem 5 (space-bounded hierarchies). The space hierarchy theorem gives , so the logarithmic landscape has genuine structure. Whether the intermediate classes form a strict hierarchy depends on unresolved questions. The Immerman-Szelepcsenyi theorem implies that the nondeterministic space hierarchy at the log level has no "gap" at the complement: , , and so on [Arora-Barak §4.3].
Synthesis. The foundational reason NL = coNL is that nondeterministic log-space machines are constrained enough that their computation graphs can be analysed inductively, and this is exactly the structural property that distinguishes space from time at every level of the hierarchy. The inductive counting technique builds toward the more general result that for all space-constructible , and it appears again in the derandomisation of space-bounded computation 47.05.05 where explicit constructions for pseudorandom generators rely on counting reachable configurations. The central insight is that a count serves as a compact certificate of exhaustive search — putting these together, knowing lets you verify that every reachable vertex has been found, and this certificate propagates through the inductive chain. The bridge is that this self-certifying property of space-bounded nondeterminism generalises to give at every level, which is dual to the collapse from 47.02.05, and the generalises connection from NL to NC circuits shows that space-bounded nondeterminism sits naturally within the parallel computation framework.
Full proof set Master
Proposition 1 (PATH is NL-complete). and every log-space reduces to PATH.
Proof. Membership: a nondeterministic log-space machine starts at and repeatedly guesses a successor vertex. Store only the current vertex ( bits) and a step counter ( bits). If is reached within steps, accept.
Hardness: let decide in . The configuration graph has vertices, each described in bits. The reduction maps to where is the start configuration and is the accepting configuration. The graph is described implicitly: given two configuration descriptions, the edge relation is computed by simulating one step of , using space. Then iff there is a path from to in .
Proposition 2 (Immerman-Szelepcsenyi). .
Proof. We show . Let have vertex set and let . Compute . Inductively compute from : for each vertex , determine whether by scanning all vertices . For each , nondeterministically guess a path of length from to . If a path is found and is an edge, mark as reachable. Keep a count of how many 's were verified. After scanning all , if the count equals , the search was complete (every reachable was found). Increment if was marked. This uses space for counters and vertex labels.
After rounds, is known. To decide whether : nondeterministically guess paths to distinct vertices. If is not among them and exactly vertices are found, accept ( is unreachable). Otherwise reject.
Proposition 3 (NL within P). .
Proof. An NL machine on input uses space, giving configurations. Construct the configuration graph with vertices. Reachability in a directed graph with vertices is decidable in time by BFS/DFS. The accepting configuration is reachable from the start configuration iff . Total time: , hence .
Proposition 4 (generalisation to all space bounds). For space-constructible , .
Proof. The identical inductive counting argument works. The machine has configurations. The machine stores counters of size bits and vertex labels of bits, using total space . The induction runs for rounds, each requiring space.
Connections Master
Space complexity and PSPACE
47.02.05provides the framework that this unit specialises to the logarithmic level. Savitch's theorem gives , and the Immerman-Szelepcsenyi theorem complements this by showing that nondeterministic and co-nondeterministic log space coincide.Time complexity P and NP
47.02.01is the polynomial-time analogue of this unit's topic. The relationship mirrors , but the Immerman-Szelepcsenyi theorem shows that NL = coNL, whereas NP versus coNP remains open.Interactive proofs
47.03.04use the counting technique from this unit in the arithmetisation of quantifier predicates. The NL = coNL proof is a miniature version of the IP = PSPACE argument, where counting certifiable sets replaces probabilistic verification.Circuit complexity
47.03.02connects to NL through the inclusion , which translates the Savitch recursion into a bounded-depth circuit family.
Historical & philosophical context Master
The Immerman-Szelepcsenyi theorem was proved independently by Neil Immerman and R ostislav Szelepcsenyi in 1987, resolving a question that had been open since the early 1970s. Immerman's paper, "Nondeterministic Space is Closed Under Complementation" (1988), and Szelepcsenyi's paper, "The Method of Forced Estimation for Proving Nondeterministic Space is Closed Under Complementation" (1988), both appeared in the SIAM Journal on Computing. The result was surprising because the analogous question for time (NP versus coNP) remains wide open, and most researchers had expected the space version to be equally hard [Arora-Barak §4.3].
The technique of inductive counting introduced in these proofs has become a standard tool in complexity theory. It demonstrates that counting and verification can be interleaved in a way that preserves space bounds, a principle that reappears in the IP = PSPACE proof and in the theory of pseudorandom generators for space-bounded computation.
The Reingold theorem of 2005, showing that undirected graph reachability is in L (and hence ), extended the structural understanding of space-bounded classes. Directed reachability remains in NL but not known to be in L, making it the canonical candidate for separating L from NL.
Bibliography Master
@article{immerman1988nondeterministic,
author = {Immerman, Neil},
title = {Nondeterministic space is closed under complementation},
journal = {SIAM Journal on Computing},
volume = {17},
number = {5},
year = {1988},
pages = {935--938}
}
@article{szelepcsenyi1988method,
author = {Szelepcsenyi, Rostislav},
title = {The method of forced estimation for proving nondeterministic space is closed under complementation},
journal = {Slovo a Slovesnost},
year = {1988}
}
@article{reingold2005undirected,
author = {Reingold, Omer},
title = {Undirected connectivity in log-space},
journal = {Journal of the ACM},
volume = {55},
number = {4},
year = {2008},
pages = {1--24}
}
@book{sipser2013introduction,
author = {Sipser, Michael},
title = {Introduction to the Theory of Computation},
publisher = {Cengage Learning},
edition = {3rd},
year = {2013}
}
@book{arora2009computational,
author = {Arora, Sanjeev and Barak, Boaz},
title = {Computational Complexity: A Modern Approach},
publisher = {Cambridge University Press},
year = {2009}
}
@book{papadimitriou1994computational,
author = {Papadimitriou, Christos H.},
title = {Computational Complexity},
publisher = {Addison-Wesley},
year = {1994}
}