Documentation

CslibFrontier.Computability.Complexity.Problems.UCONN

Undirected connectivity of a whole graph is in logarithmic space #

Goldreich's Theorem 5.6 [Gol07a] (Section 5.2.4, r2 PDF p. 54, printed p. 170): deciding undirected connectivity (UCONN) is in L. Goldreich's UCONN asks whether a given graph is connected (r2 PDF p. 53, printed p. 169), and a graph "is called connected if there exists a path between each pair of vertices in it" [Gol07e] (Appendix G.1, r6 PDF p. 138, printed p. 646). Here graphs are undirected graph instances (Cslib.Complexity.UGraphInstance, a symmetric loopless adjacency matrix on Fin n, encoded by Cslib.Complexity.encUGraph), and Cslib.Complexity.UCONN is the set of instances whose graph is SimpleGraph.Preconnected: every two vertices are joined by a walk. As in Goldreich's definition, the graph without vertices is connected. (Mathlib's SimpleGraph.Connected additionally requires a vertex.)

The proof reduces UCONN to undirected s–t connectivity, which is in L by Reingold's theorem (Cslib.Complexity.USTCON_mem_L). A graph G on n vertices is connected exactly when every vertex v is reachable from the vertex 0. The instance Cslib.Complexity.UCONN.chainInstance G puts these n queries in series: it takes n disjoint copies of G, joins the vertex v of the copy v to the vertex 0 of the copy v + 1, a source to the vertex 0 of the copy 0 and the vertex n - 1 of the copy n - 1 to a target. Every joining edge is a bridge, so the source reaches the target exactly when the vertex 0 reaches v in the copy v for every v (Cslib.Complexity.UCONN.chainInstance_mem_iff); for n = 0, the source and the target are joined directly. The instance is written in logarithmic space by Cslib.Complexity.UGraphInstance.ustconWriter: an entry within a copy reads one entry of the input matrix and every other entry is arithmetic in n and its row and column (Cslib.Complexity.UCONN.computableInLogSpace_chainInstance). This is a logarithmic-space many-one reduction (Cslib.Complexity.UCONN.logSpaceReducible_USTCON), so UCONN is in L (Cslib.Complexity.UCONN_mem_L). Space is that of L: the work-tape cells visited; as for every problem in L, the decider is only required to be correct on encodings of instances.

Goldreich proves Theorem 5.6 directly, by transforming the graph into a collection of expanders while preserving its connected components. The library's proof of Reingold's theorem decides s–t connectivity; the series composition above is the step from s–t connectivity to the whole graph.

The vertices of the instance are numbered so that a counter program can decode them: the source is 0, the target 1, and the vertex x of the copy v is Cslib.Complexity.UCONN.copyVertex n v x = 2 + v n + x.

Main definitions #

Main results #

References #

Undirected connectivity (UCONN) [Gol07a]: the undirected graphs in which every two vertices are joined by a path, including the graph without vertices.

The numbering of the copies #

The number of vertices: the n vertices of each of the n copies, a source and a target.

The vertex x of the copy v.

The copy of a vertex numbered at least 2.

The vertex of the graph that a vertex numbered at least 2 stands for.

theorem Cslib.Complexity.UCONN.copy_copyVertex {n v x : ℕ} (hx : x < n) :
copy n (copyVertex n v x) = v
theorem Cslib.Complexity.UCONN.vert_copyVertex {n : ℕ} (v : ℕ) {x : ℕ} (hx : x < n) :
vert n (copyVertex n v x) = x
theorem Cslib.Complexity.UCONN.copyVertex_lt {n v x : ℕ} (hv : v < n) (hx : x < n) :
theorem Cslib.Complexity.UCONN.eq_copyVertex {n r : ℕ} (h₂ : 2 ≤ r) (hr : r < numVertices n) :
copy n r < n ∧ vert n r < n ∧ r = copyVertex n (copy n r) (vert n r)

Every vertex numbered at least 2 is a vertex of a copy.

The instance #

The edges of the copies in series, on natural numbers: within a copy, x and y are joined when they are in G; between steps, the edges Link.

The copies of the graph in series, with the source 0 and the target 1, as an instance of undirected s–t connectivity.

def Cslib.Complexity.UCONN.cv (G : UGraphInstance) {v : ℕ} (hv : v < G.n) (x : Fin G.n) :

The vertex x of the copy v, as a vertex of the instance.

theorem Cslib.Complexity.UCONN.adj_cv (G : UGraphInstance) {v : ℕ} (hv : v < G.n) {x y : Fin G.n} (h : G.graph.Adj x y) :
(chainInstance G).graph.Adj (cv G hv x) (cv G hv y)

An edge {x, y} of the graph joins x and y in every copy.

Every copy of the graph embeds in the instance.

The source reaches the target exactly when the graph is connected.

The writer #

The copies in series are computed in logarithmic space from the encoded graph, by UGraphInstance.ustconWriter.

Undirected connectivity reduces to undirected s–t connectivity in logarithmic space, by the copies of the graph in series.

Goldreich's Theorem 5.6 [Gol07a]: deciding undirected connectivity is in L. A graph is connected when every two of its vertices are joined by a path, so the graph without vertices is connected. The proof reduces to undirected s–t connectivity, which is in L by Reingold's theorem (USTCON_mem_L).