Directed connectivity by a nondeterministic search in logarithmic space #
A nondeterministic counter program (Cslib.Complexity.STCON.searchProgram) decides directed
s–t connectivity on the adjacency-matrix encoding Cslib.Complexity.encSTCON in logarithmic
space Sipser, Example 8.19. It counts the unary header to learn n, s and t,
then walks from s: at each step it accepts if the current vertex is t, rejects once it has
taken n steps, and otherwise guesses the next vertex v by incrementing a counter from 0 as
long as its choices say so, rejecting when the counter reaches n, and moves to v when the
matrix has an arc from the current vertex to v. It stores only the header values, the current
vertex, the number of steps taken and the counter, all at most the length of the input, and every
branch halts.
The proof uses an invariant of every branch (Cslib.Complexity.STCON.Search.Inv): it records the
values of the registers at every label, and in particular that the current vertex is reachable
from s, which gives soundness at the accepting label. Every step decreases a rank
(Cslib.Complexity.STCON.Search.rank), which bounds the length of every branch. Conversely, a
shortest path from s to t, which has fewer than n arcs, is followed by an accepting branch.
Main definitions #
Cslib.Complexity.STCON.searchProgram: the nondeterministic search.
Main results #
Cslib.Complexity.STCON.accepts_searchProgram_iff: the search accepts exactly the instances inSTCON.Cslib.Complexity.STCON.exists_decidesInLogSpace: one nondeterministic machine decidesSTCONin logarithmic space, every branch halting.
References #
The nondeterministic search for a path. Register 0 holds the choice, registers 1,
2 and 3 the header values n, s and t, register 4 the current vertex, register 5 the
number of steps taken and register 6 the guessed vertex. Label 17 accepts and label 18
rejects.
Instances For
The vertex cur is reachable from the source.
Instances For
The registers of the main loop: the current vertex is reachable, at most n steps were taken
and the guessed vertex is a vertex.
Instances For
The registers 1 to 6 stay below the header values.
Instances For
The invariant of every branch.
Instances For
The total budget of the rank.
Instances For
The progress made by a configuration: it increases with every step.
Instances For
The rank: the budget left.
Instances For
Every branch #
The invariant holds on every branch.
Every branch halts.
An accepting branch is sound: the invariant at the accepting label says that t is
reachable from s.
An accepting branch #
An accepting branch exists when t is reachable from s: a shortest path has fewer
than n arcs.
The search accepts exactly the instances in STCON.
Directed s–t connectivity in nondeterministic logarithmic space
Sipser, Example 8.19: one finite-state nondeterministic machine decides STCON on
the encoding encSTCON within space c * (Nat.log2 n + 1) on encodings of length n, every
branch halting.