Definitions via SPACE and NSPACE
Space-Bounded Classes
The input tape is read-only and is not counted toward work space.
Named Classes
Why Logarithmic Space Is Tiny
With \(O(\log n)\) space, a machine cannot store the whole input, but it can store a constant number of pointers, counters, or vertex indices of size \(O(\log n)\).
Relationships Among the Classes
Standard Inclusions
and trivially
Savitch's Theorem
For every space-constructible \(s(n) \ge \log n\),
Applying this to polynomial space yields
Immerman-Szelepcsényi Theorem
This is a special feature of space-bounded computation. The proof relies on counting how many vertices are reachable within a bounded number of steps, using only logarithmic space and repeated enumeration.
What Is Known and Unknown
| Statement | Status |
|---|---|
| \(L \subseteq NL\) | known |
| \(NL = coNL\) | known |
| \(L = NL\) | open |
| \(P \stackrel{?}{=} PSPACE\) | open |
Enumeration Technique
General Idea
When the machine has little memory, it can recompute needed information rather than store it. A common method is to enumerate all candidate objects one by one using a logarithmic-space counter.
Typical Pattern
- Store an index \(i\) using \(O(\log n)\) bits.
- Generate the \(i\)-th object on demand.
- Test a local property.
- Increment \(i\) and repeat.
This is enough to scan all vertices, all positions of a string, or all pairs \((i,j)\) without storing the full list.
Reachability Counting Version
For directed reachability, define \(R_i\) to be the set of vertices reachable from \(s\) by a path of length at most \(i\). The key subroutine is to compute \(|R_i|\) from \(|R_{i-1}|\).
- Enumerate all vertices \(v\).
- For each \(v\), check whether \(v\in R_i\) by testing whether \(v\in R_{i-1}\) or some predecessor \(u\in R_{i-1}\) has an edge to \(v\).
- Increase the counter whenever the test succeeds.
Only the loop indices, a few vertex names, and the running count are stored, so the space usage is \(O(\log n)\).
Why Enumeration Is Powerful
Logarithmic space does not mean weak control. It means the algorithm must trade memory for repeated passes over the input. This is exactly what makes the proof of \(NL = coNL\) possible.
Why PATH Belongs to \(NL\)
PATH Problem
Nondeterministic Log-Space Algorithm
- Keep the current vertex \(v\) and a step counter \(c\), each using \(O(\log n)\) bits.
- Start with \(v=s\) and \(c=0\).
- Nondeterministically guess a next vertex \(u\).
- Verify from the input that \((v,u)\) is an edge.
- Replace \(v\) by \(u\), increment \(c\), and accept if \(v=t\).
- Reject if \(c\) exceeds \(n-1\).
If a path exists, one branch guesses it. If no path exists, no branch can reach \(t\) within \(n-1\) steps.
Space Analysis
The machine stores only a constant number of vertex names and counters, each of size \(O(\log n)\). Hence \(PATH \in NL\).
Why Binary Addition Belongs to \(L\)
Problem
Given binary strings \(x\), \(y\), and \(z\), decide whether
Log-Space Method
- Use counters to point to the current bit positions of \(x\), \(y\), and \(z\).
- Maintain one carry bit.
- Scan from right to left, recomputing the current bits from the input as needed.
- Check that each output bit equals the sum of the two input bits plus carry modulo \(2\).
- Update the carry and continue.
Space Bound
The machine stores:
- three position counters, each needing \(O(\log n)\) bits,
- one carry bit,
- a constant number of temporary symbols.
Therefore the total work space is \(O(\log n)\), so binary addition is in \(L\).
Lesson
Sequential arithmetic can often be checked in logarithmic space because we only need a few pointers and a tiny amount of state.