Documentation

Complexity.Computability.USTCON.Reader.Defs

A read machine for undirected connectivity #

Cslib.USTCON.Reader.machine decides undirected s–t connectivity (Cslib.Complexity.USTCON) on the encodings Cslib.Complexity.encUSTCON, reading its input by address (Turing.ReadMachine), following Reingold's algorithm Reingold, Theorem 4.1 Arora and Barak, Section 21.4:

  1. it counts the unary header 1^n 0 1^s 0 1^t 0 (hdrN, hdrS, hdrT) and halves n until it vanishes, adding 16 to the depth and 4168 to the walk length at each halving (size), so that the depth and the walk length are Cslib.Reachability.Reingold.depth a and Cslib.Reachability.Reingold.walkLength a for a = Nat.size n, with n ≤ 2 ^ a;
  2. for each counter c = 0, 1, … it walks in Reingold's graph from the vertex (⋯ ((s, s), 0) ⋯, 0) (start, fill) along the labels given by the digits of c in base |B| = 257 ^ 8 (next), each step evaluating the rotation map in place (eval, by Cslib.RotationMap.reingoldEvalStep) and reading the adjacency matrix at a step of the slot graph;
  3. it accepts when a walk ends over a slot of t, and rejects when the counter has more digits than the walk length, all counters having been tried (check).

Its memory is a constant number of numbers bounded by a polynomial in n or by |B| to the power of the walk length, and two lists of O(log n) labels and program counters, so O(log n) bits.

Main definitions #

References #

The number of labels, 257 ^ 8.

Instances For

    The number of labels is the cardinality of the label type.

    The labels numbered by the residues modulo their number.

    Instances For

      The label of the digit x % numLabels.

      Instances For

        The rotation map of the regular rotation map of the input graph, on slots written as pairs of numbers below n, given the entry bit of the adjacency matrix at the slot: the edge of the graph exchanges the ends of an edge if bit is set, the edges of the cycle of the slots move to the next or the previous slot, and every other label is a self-loop.

        Instances For

          The control state of the machine.

          • hdrN : Ctl

            Counting the ones of the number of vertices.

          • hdrS : Ctl

            Counting the ones of the source.

          • hdrT : Ctl

            Counting the ones of the target.

          • size : Ctl

            Halving the number of vertices, to compute the depth and the walk length.

          • start : Ctl

            Starting the walk of the counter.

          • fill : Ctl

            Filling the labels of the start vertex with zeros.

          • next : Ctl

            Taking the next step of the walk, or ending it.

          • eval : Ctl

            Evaluating the rotation map of Reingold's graph.

          • check : Ctl

            Checking the end of the walk.

          • done : Ctl

            Halted.

          Instances For

            The memory of the machine.

            • ctl : Ctl

              The control state.

            • cnt : ℕ

              The ones counted in the header, or the number of vertices being halved.

            • n : ℕ

              The number of vertices.

            • s : ℕ

              The source.

            • t : ℕ

              The target.

            • depth : ℕ

              The depth of Reingold's graph.

            • len : ℕ

              The length of the walks.

            • c : ℕ

              The counter of the walks.

            • w : ℕ

              The digits of the counter not yet used.

            • j : ℕ

              The steps of the walk not yet taken.

            • The state of the evaluation of the rotation map: the slot, the labels and the frames.

            Instances For

              The step of the evaluation with the entry bit of the adjacency matrix.

              Instances For
                noncomputable def Cslib.USTCON.Reader.step (q : State) (b : Bool) :

                A step, given the bit read.

                Instances For

                  The address read by a step: the next bit of the header while counting it, and the entry of the adjacency matrix at the slot at a step of the slot graph.

                  Instances For

                    The initial state: counting the header.

                    Instances For

                      The read machine for undirected connectivity.

                      Instances For