Documentation

CslibFrontier.Computability.Complexity.Problems.USTCON

Undirected s–t connectivity #

An instance of undirected s–t connectivity (Cslib.Complexity.USTCONInstance) is a simple graph on Fin n, given by its adjacency matrix, symmetric and with zero diagonal, together with two vertices s and t; it belongs to Cslib.Complexity.USTCON when t is reachable from s Arora and Barak, Section 21.4 Reingold, Section 4.

Instances are encoded (Cslib.Complexity.encUSTCON) as their directed graphs (Cslib.Complexity.USTCONInstance.toSTCONInstance, encoded by Cslib.Complexity.encSTCON): the unary header 1^n 0 1^s 0 1^t 0 followed by the adjacency matrix, row by row, so that the bit at n + s + t + 3 + a * n + b is the entry of the row a and the column b. The matrix has n ^ 2 bits, so the header is no longer than the matrix plus three bits and every number a machine reads from it has logarithmically many binary digits; this is the adjacency matrix representation of Reingold's algorithm, with a header that a machine reading its input by address can parse by counting.

Main definitions #

Main results #

References #

An instance of undirected s–t connectivity: a simple graph on Fin n, given by its adjacency matrix, symmetric and with zero diagonal, and two vertices s and t.

  • n : ℕ

    The number of vertices.

  • adj : Fin self.n → Fin self.n → Bool

    The adjacency matrix.

  • symm (a b : Fin self.n) : self.adj a b = self.adj b a

    The adjacency matrix is symmetric.

  • loopless (a : Fin self.n) : self.adj a a = false

    No vertex is adjacent to itself.

  • s : Fin self.n

    The source.

  • t : Fin self.n

    The target.

Instances For

    An instance has a vertex, its source.

    The simple graph of an instance: a and b are adjacent when the entry of the row a and the column b of the adjacency matrix is set.

    Instances For
      @[instance_reducible]

      Adjacency in the graph of an instance is decidable.

      @[simp]

      Adjacency in the graph of an instance is the entry of the adjacency matrix.

      The directed graph of an instance, with its source and target: an arc in each direction for every edge.

      Instances For

        Distinct instances have distinct directed graphs, since the adjacency matrix determines the proofs of symmetry and looplessness.

        The encoding of an instance, that of its directed graph (Cslib.Complexity.encSTCON): the unary header 1^n 0 1^s 0 1^t 0, then the adjacency matrix row by row.

        Instances For

          The number of binary digits of n is logarithmic in the length of the encoding.

          The header of the number of vertices: the bit at i ≤ n is set exactly when i < n.

          theorem Cslib.Complexity.USTCONInstance.getD_encode_s (I : USTCONInstance) {i : ℕ} (h : i ≤ ↑I.s) :
          I.encode.getD (I.n + 1 + i) false = decide (i < ↑I.s)

          The header of the source: the bit at n + 1 + i, for i ≤ s, is set exactly when i < s.

          theorem Cslib.Complexity.USTCONInstance.getD_encode_t (I : USTCONInstance) {i : ℕ} (h : i ≤ ↑I.t) :
          I.encode.getD (I.n + 1 + ↑I.s + 1 + i) false = decide (i < ↑I.t)

          The header of the target: the bit at n + 1 + s + 1 + i, for i ≤ t, is set exactly when i < t.

          theorem Cslib.Complexity.USTCONInstance.getD_encode_matrix (I : USTCONInstance) (a b : Fin I.n) :
          I.encode.getD (I.n + ↑I.s + ↑I.t + 3 + (↑a * I.n + ↑b)) false = I.adj a b

          The bits of the matrix: the bit at n + s + t + 3 + a * n + b of the encoding is the entry of the row a and the column b.

          The encoding of instances of undirected s–t connectivity: the unary header 1^n 0 1^s 0 1^t 0, then the adjacency matrix row by row.

          Instances For

            Undirected s–t connectivity: the instances in which t is reachable from s Arora and Barak, Section 21.4, Reingold.

            Instances For

              The single edge on two vertices 0 and 1, with source 0 and target 1.

              Instances For

                The edgeless graph on two vertices 0 and 1, with source 0 and target 1.

                Instances For

                  Canonical two-vertex USTCON instance encoding a Boolean truth value: edgeTwo for true and emptyTwo for false.

                  Instances For

                    The single edge on two vertices belongs to USTCON.

                    The edgeless graph on two vertices does not belong to USTCON.