Documentation

CslibFrontier.Computability.Complexity.Problems.StronglyConnected.Search

Strong connectivity by a nondeterministic search in logarithmic space #

A nondeterministic counter program (Cslib.Complexity.StronglyConnected.searchProgram) decides strong connectivity on the adjacency-matrix encoding Cslib.Complexity.encDigraph in logarithmic space. It counts the unary header to learn n, then runs through the pairs of vertices (p / n, p % n) for p < n * n: for each pair it walks from p / n as the search for directed connectivity does (Cslib.Complexity.STCON.searchProgram), passing to the next pair once the current vertex is p % n, rejecting once it has taken n steps, and guessing the next vertex v by incrementing a counter from 0 as long as its choices say so. It accepts after the last pair. It stores only n, the pair, the current vertex, the number of steps and the counter, all at most the length of the input, and every branch halts.

The proof follows that of Cslib.Complexity.STCON.searchProgram, from which this module adapts its step tactics, per-label invariant and termination argument: a private invariant of every branch records the values of the registers at every label, in particular that every pair before the current one is connected and that the current vertex is reachable from the first vertex of the current pair, and a private rank decreases with every step. Conversely, for each pair a shortest path, with fewer than n arcs, is followed.

Main definitions #

Main results #

References #

The nondeterministic search for paths between all pairs. Register 0 holds the choice, register 1 the number n of vertices, register 2 the index p of the pair (p / n, p % n), register 3 the current vertex, register 4 the number of steps taken and register 5 the guessed vertex. Label 16 accepts and label 17 rejects.

Every branch #

An accepting branch is sound: the invariant at the accepting label says that the digraph is strongly connected.

An accepting branch #

Strong connectivity in nondeterministic logarithmic space: one finite-state nondeterministic machine decides StronglyConnected on the encoding encDigraph within space c * (Nat.log2 n + 1) on encodings of length n, every branch halting.