Space Complexity
Space-bounded computation, reachability in configuration graphs, and Savitch's theorem.
Goals
- Define deterministic and nondeterministic space with read-only input.
- Use configuration graphs to prove membership and completeness.
- Compose log-space reductions without storing their output.
- Derive Savitch's recursion and its full space bound.
- Explain and without overstating their proofs.
1. The model and what is counted
A space-bounded multitape Turing machine has a read-only input tape and one or more read/write work tapes. Input-head position is not charged as work space; work-tape cells ever visited are. Output for a transducer is write-only, so it cannot be used as free memory.
A nondeterministic decider must halt on every branch and use the bound on every branch. Space differs from time because cells can be reused: a polynomial-space computation may run for exponential time. For conventional machines with , repeated configurations can be removed from any shortest accepting path, so a halting search need not exceed the number of configurations.
2. Configuration graphs
A configuration records the finite control state, input-head position, work-tape contents in the used region, and work-head positions. For fixed alphabet and state set, an -space machine has
configurations when . Its directed configuration graph has one vertex per legal configuration and an edge for one valid transition. The machine accepts exactly when an accepting configuration is reachable from the start configuration.
This graph is normally implicit. A simulator generates a requested configuration or checks adjacency using space; writing all exponentially many vertices would destroy the bound.
3. STCON is the canonical NL problem
STCON (directed - connectivity) asks whether a directed graph has a path from designated to .
Membership in NL. Store the current vertex and a counter up to . Nondeterministically guess a next vertex, verify that the edge exists, and accept on reaching . A simple path has length at most , so the counter prevents endless branches. Both vertex and counter use bits.
NL-hardness. Let be decided by machine . Map input to the configuration graph with its start and accepting configurations. Acceptance is reachability. The reduction cannot print the whole graph from memory, but a log-space transducer can enumerate configuration names and edge pairs using counters, recomputing each local transition. Since configurations of a log-space machine have bits, this is a log-space many-one reduction. Therefore STCON is NL-complete.
4. Log-space reductions and composition
means a deterministic log-space transducer computes such that
with polynomially bounded output length. Such a transducer runs in polynomial time: once its work configuration and output position repeat without progress, it loops, which a total transducer cannot do.
The subtle point in composing and is that may be polynomially long and cannot be stored. To compute an output bit of , simulate . Whenever it asks for the th input symbol, rerun the transducer for from the start with an counter until symbol is produced. Store only 's work configuration, , and 's current work configuration. Polynomial output lengths imply . Thus log-space reductions compose by recomputation.
Consequently, to prove NL-complete, show and reduce a known NL-complete problem—usually STCON—to . A polynomial-time reduction is not enough for NL-completeness.
5. Savitch's theorem: full recursion
Savitch's theorem. For space-constructible ,
Let use nondeterministic space and have at most configurations. Define
Base case : accept iff or is one transition. For , enumerate every configuration and accept if both
accept. Correctness follows by splitting a path of length at most at its midpoint; conversely, concatenating the two recursive paths gives a path of the allowed length.
Call with . At one recursion level store , , and an enumeration counter: bits. The two recursive calls are made sequentially, and midpoint work space is reused. Therefore
Time is enormous: roughly . That is acceptable because the theorem claims space, not time. Multiplying by the recursion's branching factor is a time analysis, not a space analysis.
For , Savitch gives
The reverse inclusion is immediate because deterministic choice is a special case of nondeterminism. Hence
This equality is a direct corollary of Savitch; it is not known whether the analogous logarithmic inclusion collapses to , because Savitch only yields .
6. The complement theorem
Immerman–Szelepcsényi theorem. ; more generally, is closed under complement for .
The statement is examinable; the full inductive-counting proof is longer than Savitch's proof. Its key idea is to certify nonreachability without listing all reached vertices. Let be vertices reachable from in at most steps. Nondeterministically verify the count from by scanning all vertices and using reachability witnesses of length . Once the exact count of reachable vertices is certified, verify that is not among them. Counters and one vertex name require only logarithmic space.
The surprising point is that nondeterminism can certify a universal-looking negative fact by first certifying an exact count. A mere statement “guess that no path exists” proves nothing.
Worked example
Consider vertices and edges , , . The NL STCON machine may guess to accept . It stores only the current name and a counter, not the path. For Savitch on the same graph with length bound four, try midpoint : recursively establish a path of length at most two and of length at most two. Failed midpoint attempts are discarded before trying the next.
For a reduction-composition example, suppose outputs an adjacency matrix and reads its entries in arbitrary order. The composition does not cache that matrix. Each request for entry reruns until its th output symbol. Time increases, but work space stays logarithmic.
Common mistakes
- Charging the read-only input tape as work space, or using write-only output as memory.
- Omitting the step counter in the NL algorithm, leaving nonhalting branches.
- Materializing the configuration graph.
- Using a polynomial-time reduction where log-space completeness is required.
- Storing while claiming closure of log-space reductions.
- Multiplying Savitch's recursive branches into a space bound.
- Claiming Savitch proves .
- Treating as obvious from swapping accepting states.
Visualizations
Savitch recursion
Draw two views of the same computation: an implicit configuration graph and the depth-first Savitch recursion. Show only one active recursive path in memory. A second panel can depict composition as an on-demand wire: requests position , and is replayed to regenerate it.
Exercises
Exercise 1 — Short accepting path
Prove that a simple accepting path of a space- machine uses fewer than configurations, where is the configuration count.
Solution
If a configuration repeats on a path, the segment between repeats is a cycle that can be deleted without losing reachability to accept (along that chosen path). Hence a simple path of length exists.
Exercise 2 — What an NL STCON machine stores
Describe the work state of a standard NL machine for STCON and bound space by .
Solution
Store the current vertex ( bits), a step counter up to (to avoid loops), and temporary space to test an edge. Total .
Exercise 3 — Composing log-space reductions
Why is essential in composition? What is recomputed instead of stored?
Solution
A log-space transducer's output is polynomial length, so an output index is . Composition does not store all of — it recomputes symbol-by-symbol in log space, trading space for time.
Exercise 4 — Savitch to
Solve at depth , and deduce Savitch's space bound.
Solution
for . Hence .
Exercise 5 — and NL=coNL
Deduce from Savitch. Does imply ?
Solution
For : ; the union yields . The reverse is immediate. does not collapse determinism vs nondeterminism: complement closure .
Summary
Space is understood via implicit reachability. STCON captures NL; Savitch squares space; NPSPACE=PSPACE; Immerman–Szelepcsényi yields NL=coNL.
Guided practice
Task 1 — Configuration count in log space
Prove that an -space machine has polynomially many configurations.
Solution
Work contents: . Head positions and state contribute polynomial factors. Hence , and the configuration graph is an implicit polynomial-size object.
Task 2 — Complete versus hard
Distinguish NL-hard from NL-complete. When does a reduction to STCON prove completeness?
Solution
Hard: every NL language reduces to . Complete: also . Reductions from all NL languages to STCON prove hardness; with STCON one obtains completeness.
Task 3 — Immerman–Szelepcsényi sketch
Outline at idea level why undirected-style non-reachability for STCON lies in NL (no full proof).
Solution
Count vertices reachable from in layers, verifying the count nondeterministically. If is not among them, accept non-reachability. Verified counting replaces the illegal “I found no path” guess in NL.
Source trail and authority
- Student/course evidence:
סיכומי שיעור/סיכום ממוזג.pdf, pp. 101–130 and p. 142 (L/NL, reachability, reductions, Savitch, and complement material). This is a merged student summary used for course alignment, not theorem authority. - Textbook authority: Sipser, 3rd ed., Ch. 8: §8.1 pp. 333–336 (Savitch), §§8.4–8.5 pp. 348–354 (L/NL and NL-completeness), §8.6 pp. 354–356 (NL=coNL); Arora–Barak draft, Ch. 4, §§4.1–4.4, book pp. 75–87; Papadimitriou, Ch. 7, especially §7.3 pp. 146–154, and Ch. 16 §16.1 pp. 395–399.
- Editorial status: all stated class equalities and the Savitch recurrence were checked against these sections. The NL=coNL proof is explicitly a proof sketch. Reviewed; high confidence.
The pages this was written from
3 pages
These pages were chosen by word overlap between the text here and the page's transcription — nobody has verified them. Treat them as a lead to check, not a citation.
Lecture 23 · page 4רדוקציות מקום לוגריתמיShared wordsשומרת · להרכבה · שפת · בעזרת · coNL · אימרמן
Lecture 24 · page 1סיכום + תרגיליםShared wordsגבוה · חייב · סה״כ · לולאות · coNL · מאימרמן
Lecture 24 · page 2סיכום + תרגיליםShared wordsסגורות · coNL · NPSPACE · למשלים · סיכום · סגורה