Documentation

Complexity.Computability.Circuit.Boolean.Iteration.CounterChart.Encode

Sparse orbit coordinates from interval labels #

Each interval stores its cycle representative, cycle length, and the phase of its first state. One modular addition encodes its other states. Decoding tests the phase distance from each interval start. This proves a chart without an enumeration of payload states or an assumed constant-time table primitive.

Main definitions #

Main results #

References #

@[instance_reducible]

Numeric order chooses canonical representatives of word cycles. Kept local to charts.

Instances For
    @[reducible, inline]

    Two spare bits hold cycle lengths and sums even for a cycle of length 2^n.

    Instances For

      Every cycle length of a map on BitVec n is at most 2 ^ n.

      Any natural number a ≤ 2 ^ n fits without wraparound in BitVec (chartWidth n).

      noncomputable def Cslib.Circuits.Boolean.Iteration.wordCycleLabel {n : ℕ} (f : BitVec n → BitVec n) (x : BitVec n) :

      Canonical coordinates of a cyclic word.

      Instances For

        The first word of an interval.

        Instances For

          Cycle length of the interval, in the widened coordinate width.

          Instances For

            Canonical phase of the interval start.

            Instances For

              Number of words in an interval.

              Instances For
                @[simp]

                The natural-number value of chart.period j is the cycle length of chart.first j.

                @[simp]

                The natural-number value of chart.initialPhase j is the phase of chart.first j.

                @[simp]
                theorem Cslib.Circuits.Boolean.Iteration.CounterIntervalChart.length_toNat {n R : ℕ} {f : BitVec n → BitVec n} (chart : CounterIntervalChart f R) (j : Fin R) :
                (chart.length j).toNat = chart.stop j - chart.start j

                The natural-number value of chart.length j is chart.stop j - chart.start j.

                Test membership in the half-open numerical interval.

                Instances For
                  @[simp]
                  theorem Cslib.Circuits.Boolean.Iteration.CounterIntervalChart.contains_iff {n R : ℕ} {f : BitVec n → BitVec n} (chart : CounterIntervalChart f R) (j : Fin R) (x : BitVec n) :
                  chart.contains j x = true ↔ chart.start j ≤ x.toNat ∧ x.toNat < chart.stop j

                  chart.contains j x is true iff x.toNat lies in [chart.start j, chart.stop j).

                  Numerical distance from the interval start.

                  Instances For

                    Canonical coordinates predicted by one interval.

                    Instances For

                      Encode by selecting any interval containing the input.

                      Instances For

                        Encoding a word x under an injective map f produces its canonical cycle coordinates wordCycleLabel f x.