Documentation

Complexity.Algorithms.Reachability.InductiveCounting

A binary-choice inductive-counting controller #

The controller scans vertex identifiers in increasing order. It guesses whether to include each identifier, certifies each included identifier by a padded walk, and checks the selected count against the previous round's count. Only a fixed number of natural-number registers and Boolean flags are stored. An edge or bad-vertex oracle is consulted only in an explicit query phase.

Main definitions #

References #

The finite control. Neither a walk nor a set of selected vertices is stored.

Instances For

    A request for one bit of the graph or of the bad-vertex predicate.

    Instances For
      Instances For

        Ten registers and two flags suffice, independently of the number of vertices. remaining is the number of padded walk steps still to check; bits counts unguessed bits of guess.

        • phase : Phase

          Current instruction.

        • round : ℕ

          Current round.

        • count : ℕ

          Certified size of the current round.

        • target : ℕ

          Target currently being tested.

        • nextCount : ℕ

          Accumulated size of the next round.

        • candidate : ℕ

          Candidate currently being scanned.

        • selected : ℕ

          Number of selected candidates.

        • remaining : ℕ

          Number of walk steps left.

        • current : ℕ

          Current walk vertex.

        • guess : ℕ

          Partially guessed next vertex.

        • bits : ℕ

          Number of vertex bits left.

        • hit : Bool

          Has a selected candidate satisfied the scan's predicate?

        • finalScan : Bool

          Is this the last scan, which tests the bad-vertex predicate?

        Instances For
          Instances For

            Canonical rejecting state.

            Instances For

              Canonical accepting state.

              Instances For

                A state has halted when it is accepting or rejecting.

                Instances For

                  Oracle calls occur only at these two instructions.

                  Instances For
                    def Cslib.InductiveCounting.instruction (N width source : ℕ) (s : State) (answer choice : Bool) :

                    The underlying instruction, before the uniform storage and termination checks. answer is consulted only at edge and observe; choice only at candidate and guess. Vertex identifiers are guessed from most significant to least significant bit.

                    Instances For

                      A uniform bound on each register. It includes the whole range of a width-bit guess, vertex counts (which can equal N), and the width counter.

                      Instances For

                        The bounds checked at each transition, including transitions on dishonest guesses.

                        Instances For
                          @[instance_reducible]

                          Worst-case cost of checking one candidate, with slack for the loop instructions.

                          Instances For

                            Worst-case cost of one target scan, with slack for the loop instructions.

                            Instances For

                              Worst-case cost of one whole round, with slack for the loop instructions.

                              Instances For
                                def Cslib.InductiveCounting.rank (N width : ℕ) (s : State) :

                                A natural-number progress measure. In a legitimate state, each instruction decreases it. The runtime check also rejects malformed states rather than allowing them to cycle.

                                Instances For
                                  def Cslib.InductiveCounting.advance (N width source : ℕ) (s : State) (answer choice : Bool) :

                                  One instruction, checked for bounded storage and progress. These checks are executable and do not consult the edge relation or the bad-vertex predicate.

                                  Instances For
                                    def Cslib.InductiveCounting.answer (edge : ℕ → ℕ → Bool) (bad : ℕ → Bool) (s : State) :

                                    Supply the answer to the unique pending oracle request.

                                    Instances For
                                      def Cslib.InductiveCounting.step (N width source : ℕ) (edge : ℕ → ℕ → Bool) (bad : ℕ → Bool) (s : State) (choice : Bool) :

                                      A graph-backed step of the controller.

                                      Instances For

                                        Initial state; an out-of-range source is rejected.

                                        Instances For
                                          def Cslib.InductiveCounting.replay (N width source : ℕ) (edge : ℕ → ℕ → Bool) (bad : ℕ → Bool) (s : State) :

                                          Replay finite binary choices. Bits at deterministic instructions are ignored.

                                          Instances For
                                            def Cslib.InductiveCounting.Accepts (N width source : ℕ) (edge : ℕ → ℕ → Bool) (bad : ℕ → Bool) :

                                            A finite run from the canonical initial state.

                                            Instances For
                                              theorem Cslib.InductiveCounting.bounded_advance {N width source : ℕ} {s : State} (ans choice : Bool) (h : Bounded N width s) :
                                              Bounded N width (advance N width source s ans choice)

                                              All branches preserve the uniform register bound.

                                              theorem Cslib.InductiveCounting.rank_advance_lt {N width source : ℕ} {s : State} (ans choice : Bool) (h : halted s = false) :
                                              rank N width (advance N width source s ans choice) < rank N width s

                                              Each unhalted transition decreases the progress measure.

                                              @[simp]
                                              theorem Cslib.InductiveCounting.advance_halted {N width source : ℕ} {s : State} (ans choice : Bool) (h : halted s = true) :
                                              advance N width source s ans choice = s
                                              theorem Cslib.InductiveCounting.bounded_replay {N width source : ℕ} {edge : ℕ → ℕ → Bool} {bad : ℕ → Bool} {s : State} (h : Bounded N width s) (bs : List Bool) :
                                              Bounded N width (replay N width source edge bad s bs)

                                              Register bounds hold at every point of every replay.

                                              theorem Cslib.InductiveCounting.replay_append {N width source : ℕ} {edge : ℕ → ℕ → Bool} {bad : ℕ → Bool} {s : State} (xs ys : List Bool) :
                                              replay N width source edge bad s (xs ++ ys) = replay N width source edge bad (replay N width source edge bad s xs) ys

                                              Appending choice sequences composes their executions.

                                              theorem Cslib.InductiveCounting.replay_halted {N width source : ℕ} {edge : ℕ → ℕ → Bool} {bad : ℕ → Bool} {s : State} (h : halted s = true) (bs : List Bool) :
                                              replay N width source edge bad s bs = s

                                              Further choices do not change a halted state.

                                              theorem Cslib.InductiveCounting.halted_replay_of_rank_le {N width source : ℕ} {edge : ℕ → ℕ → Bool} {bad : ℕ → Bool} {s : State} (bs : List Bool) (h : rank N width s ≤ bs.length) :
                                              halted (replay N width source edge bad s bs) = true

                                              Every branch halts within the initial progress measure, including adversarial guesses.