Documentation

Complexity.Computability.Circuit.Boolean.Iteration.Label

Canonical cycle labels as bit strings #

Order n-bit states lexicographically, coordinate zero first (lexOrder). The canonical label of a state x under f lists the least state of its eventual cycle, the cycle length and the phase of x on the cycle, the last two in n + 3 bits (canonicalLabel). Labels along an orbit differ only in the phase, so the label of x is recovered from the label of f^[j] x by subtracting j modulo the cycle length (correctLabel_canonicalLabel).

On a cycle of length at most K, the first K + 1 states of the orbit of a periodic state contain the whole cycle. A scan for the least of them, the first return to x and the first visit to the least state give its label directly (shortLabel_eq_canonicalLabel), in O(K * n + n ^ 2) gates once the orbit prefix is available (synthesis_shortLabel).

Main definitions #

Main results #

References #

Label words #

def Cslib.Circuits.Boolean.Iteration.labelBits {n w : ℕ} (c : BitString n) (ell phi : BitVec w) :
BitString (n + (w + w))

A state followed by two words.

Instances For

    The state of a label.

    Instances For

      The first word of a label: the cycle length.

      Instances For

        The second word of a label: the phase.

        Instances For
          @[simp]
          @[simp]
          theorem Cslib.Circuits.Boolean.Iteration.labelPhase_labelBits {n w : ℕ} (c : BitString n) (ell phi : BitVec w) :
          labelPhase (labelBits c ell phi) = phi
          @[reducible, inline]

          The width of a canonical label: a state, then two words of n + 3 bits.

          Instances For

            Canonical labels. The lexicographically least state of the eventual cycle of x, the cycle length, and the phase of x on the cycle, the last two in n + 3 bits.

            Instances For

              Correcting labels along an orbit #

              def Cslib.Circuits.Boolean.Iteration.correctLabel {n w : ℕ} (r : BitString (n + (w + w))) (j : ℕ) :
              BitString (n + (w + w))

              Shift a label back by j steps: subtract j from its phase modulo its cycle length.

              Instances For

                The label of x is the label of f^[j] x shifted back by j, for j < 2 ^ (n + 3).

                theorem Cslib.Circuits.Boolean.Iteration.labelBits_wires_subset {n a w : ℕ} (s : Set (BooleanFunction a)) (c : BitString a → BitString n) (ell phi : BitString a → BitVec w) (hc : wires c ⊆ s) (he : wordWires ell ⊆ s) (hp : wordWires phi ⊆ s) :
                (wires fun (x : BitString a) => labelBits (c x) (ell x) (phi x)) ⊆ s

                The bits of a label of available parts are available.

                theorem Cslib.Circuits.Boolean.Iteration.synthesis_correctLabel {n a w : ℕ} (s : Set (BooleanFunction a)) (r : BitString a → BitString (n + (w + w))) (hr : wires r ⊆ s) (hc : ∀ (b : Bool), (fun (x : BitString a) => b) ∈ s) (j : ℕ) :
                Synthesis interpretation s (wires fun (x : BitString a) => correctLabel (r x) j) (50 * (w + 1) ^ 2)

                Correcting an available label costs one modular difference.

                Short cycles #

                The least of the first K + 1 states of the orbit of x.

                Instances For

                  The first positive time up to K at which the orbit of x returns to x.

                  Instances For
                    noncomputable def Cslib.Circuits.Boolean.Iteration.shortTime {n w : ℕ} (f : BitString n → BitString n) (K : ℕ) (x : BitString n) :

                    The first time up to K at which the orbit of x visits its short representative.

                    Instances For
                      noncomputable def Cslib.Circuits.Boolean.Iteration.shortLabel {n : ℕ} (f : BitString n → BitString n) (K : ℕ) (x : BitString n) :

                      The label read from the first K + 1 states of the orbit of x.

                      Instances For

                        Short cycles. On a periodic state whose cycle has length at most K, the label read from the first K + 1 states of its orbit is its canonical label.

                        theorem Cslib.Circuits.Boolean.Iteration.synthesis_shortLabel {n a : ℕ} (s : Set (BooleanFunction a)) (f : BitString n → BitString n) (init : BitString a → BitString n) (K : ℕ) (hp : ∀ (j : Fin (K + 1)) (bit : Fin n), (fun (x : BitString a) => f^[↑j] (init x) bit) ∈ s) (hc : ∀ (b : Bool), (fun (x : BitString a) => b) ∈ s) :
                        Synthesis interpretation s (wires fun (x : BitString a) => shortLabel f K (init x)) ((K + 1) * (30 * n + 27) + 50 * (n + 4) ^ 2)

                        Short-cycle labels. Once the first K + 1 states of an orbit are available, its short label costs one minimum scan, two first-position scans, their equality tests and one modular difference.