Nondeterministic space complexity class Created 2026-10-07 Updated 2026-10-14
Languages accepted by Nondeterministic Turing machines using work space on every computation path, with acceptance defined by existence of an accepting path. Bounded-space loops do not prevent the reachability interpretation in the finite configuration graph.
Use Turing machines with a two-way read-only input tape, bounded by endmarkers, and a fixed finite number of read-write work tapes over a fixed finite alphabet. Work-tape cells count towards space complexity; the read-only input does not. For input length , use to include the small-length cases.
, or L, is the class of formal languages decided by a deterministic such machine using at most work-tape cells for some fixed constant . It must halt on every input and accept exactly the members.
, or NL, is the class of formal languages accepted by a Nondeterministic Turing machine with the same work-space bound on every computation branch. An input is accepted if and only if at least one branch accepts. One may require all branches to halt: the configuration graph has only a polynomial number of vertices, so a logarithmic space counter can stop any branch that has taken more steps than that bound. If an accepting computation exists, one exists with no repeated Turing machine configuration, so this convention does not change the complexity class.
In standard space complexity notation,
Directed reachability is NL-complete under logspace many-one reductions. For membership, let be the number of vertices. Store a current vertex, initially , and a counter initially zero. Accept immediately if the current vertex is . Otherwise guess a next vertex, verify by scanning the input that the appropriate directed edge exists, move there and increment the counter. Reject a branch that has made steps without reaching .
Whenever a directed walk reaches , removing closed portions between repeated vertices produces a path in a graph with at most edges. Thus this bound preserves all yes-instances. The current and guessed vertices and the counter use bits, while adjacency checks only need repeated read-only input scans. All branches halt, so directed reachability belongs to NL.
For hardness, let and fix a Nondeterministic Turing machine accepting in work space. On input , construct its configuration graph . A vertex is a possible Turing machine configuration within the fixed work-space bound. Put a directed edge exactly when one legal transition of on changes into . Take the initial Turing machine configuration as source, and add a fresh target with an incoming edge from every accepting Turing machine configuration. Then
There are only a polynomial number of Turing machine configurations, by the count used in part (c). More importantly, their encodings have length . A logspace transducer can enumerate candidate encodings and pairs of candidate encodings with bits of counters. For each pair, it checks the finite transition rule, the scanned input symbol and the local work-tape change using work space. It emits the corresponding adjacency matrix entry or edge-list record. Invalid candidate encodings may be discarded or represented by isolated vertices.
The configuration graph is thus output by a logspace transducer, rather than stored in its work tapes. This supplies the required logspace many-one reduction from every and proves NL-completeness.
With a read-only input tape, deterministic space complexity class consists of languages decidable by deterministic Turing machines using work-tape cells. The nondeterministic space complexity class uses Nondeterministic Turing machines, with the bound holding on every computation path and acceptance meaning that some path accepts. Input storage is not charged. We use the standard finite-state, fixed-alphabet model.
The Savitch theorem is
First suppose a work-space budget is available. A configuration graph for computations restricted to cells has configurations encoded in bits: work contents, control state and head positions, including bits for the input head. Its size is at most for a machine-dependent constant . Add accept and exit sinks if needed; the size bound merely changes . A reachable configuration has a simple path of length smaller than the number of configurations.
For encoded configurations , define to ask whether a path of length at most exists. At , test equality or one transition. For , enumerate every candidate middle configuration and test
Any path of the given length can be split into two halves of length at most ; conversely concatenation gives a path of length at most . This proves the recursion. Taking suffices. Depth is , and each recursive frame stores only its endpoints, the current middle configuration and counters in bits. The two recursive calls are made sequentially and reuse their space. The total is , even though the time can be very large.
The printed hypothesis does not say that is computable. The space-bound discovery by exit reachability removes that issue. Begin with and use the preceding recursion to test both whether an accepting state is reachable within the budget and whether a reachable state has a transition leaving the budget. Accept in the first case. If acceptance is absent and an exit is reachable, double and repeat. If neither is reachable, reject: all computations remain within this finite configuration graph, and none accepts.
Every path of the original machine uses at most cells. Once reaches that bound there can be no reachable exit, so this procedure terminates. The final budget is by doubling, and all stages reuse the same storage. Hence its deterministic space is without requiring a machine that first computes . This proves the stated general form.
A decision problem is NL-complete when and every language has a deterministic logarithmic space many-one reduction to .
The directed graph reachability problem is the standard example. It lies in NL because a machine stores the current vertex and a counter, nondeterministically guesses at most successive edges, and accepts upon reaching ; this uses space. For hardness, given an NL machine and input , construct its configuration graph. Its configurations have logarithmic length, adjacency can be computed in logarithmic space, and
Adding one target joined from every accepting configuration gives the required logarithmic-space reduction.
ST-connectivity Created 2026-09-24 Updated 2026-10-07
The directed graph reachability problem asks whether a directed graph contains a directed path from a specified vertex to a specified vertex . It is NL-complete.