Moving a residue into a repeated interval #
If an orbit repeats with f^[i] x = f^[j] x for i < j, the state at any time T ≥ i is the
state at the unique time in [i, j) congruent to T modulo j - i. A circuit finds that time
without division: it looks up T % (j - i) in a table indexed by the period, which depends on the
fixed exponent T only through its residues, and then adds the period while the value is below
i. At most K additions suffice when i ≤ K (liftResidue_reconstructs).
Main definitions #
Cslib.Circuits.Boolean.Iteration.liftResidue,Cslib.Circuits.Boolean.Iteration.liftWord: one bounded correction of a residue, on natural numbers and on words.Cslib.Circuits.Boolean.Iteration.residueWord: table lookup of the residue ofTmodulo a period word.Cslib.Circuits.Boolean.Iteration.repeatWordIndex: the word computation of the time in the repeated interval.
Main results #
Cslib.Circuits.Boolean.Iteration.liftResidue_reconstructs: the corrected residue gives the state at timeT.Cslib.Circuits.Boolean.Iteration.repeatWordIndex_spec: the same for the word computation.Cslib.Circuits.Boolean.Iteration.synthesis_repeatWordIndex: its gate count does not depend onT.
References #
- Adapted from lean/Proofs/Residues.lean in S. Schlesinger, Square-root circuit bounds for iterated functions.
One bounded correction of a residue: add the period once if below the interval.
Instances For
The word form of liftResidue.
Instances For
theorem Cslib.Circuits.Boolean.Iteration.repeatWordIndex_spec {α : Type u_1} {f : α → α} {x : α} {w T K : ℕ} (lo hi : BitVec w) (hlt : lo.toNat < hi.toNat) (hhi : hi.toNat ≤ K) (hK : K < 2 ^ w) (hT : K ≤ T) (heq : f^[lo.toNat] x = f^[hi.toNat] x) :
The word computation lies in the repeated interval and selects the state at time T.
theorem Cslib.Circuits.Boolean.Iteration.synthesis_repeatWordIndex {n w : ℕ} (s : Set (BooleanFunction n)) (T K : ℕ) (lo hi : BitString n → BitVec w) (hlo : ∀ (i : Fin w), (fun (x : BitString n) => (lo x).getLsbD ↑i) ∈ s) (hhi : ∀ (i : Fin w), (fun (x : BitString n) => (hi x).getLsbD ↑i) ∈ s) (hconst : ∀ (b : Bool), (fun (x : BitString n) => b) ∈ s) :
Synthesis interpretation s (wordWires fun (x : BitString n) => repeatWordIndex T K (lo x) (hi x))
(100 * (K + 1) * (w + 1) ^ 2)
The repeated-interval index circuit has no dependence on the bit length of T.