Records for detecting checkpoint hits and repeats #
The fixed-power circuit sorts one array of records. Stored records carry a checkpoint state and
a payload, queries carry a state of the orbit prefix and its time, and padding fills the array.
Records are sorted by a padding flag followed by their state, so that padding comes last. Both
a checkpoint hit and a repeated state appear as two different records with equal keys, and
sorting makes such a pair adjacent; a linear scan finds one (detect). The detected pair
certifies one of the two situations exactly (detect_sorted_witness), even when complete
records repeat. Sorting uses the native Batcher circuit bitonicSortCircuit.
Main definitions #
Cslib.Circuits.Boolean.Iteration.Record: a complete record and its bit encoding.Cslib.Circuits.Boolean.Iteration.Record.initial: checkpoints, then the orbit prefix, then padding.Cslib.Circuits.Boolean.Iteration.Record.Witness: what a detected collision certifies.Cslib.Circuits.Boolean.Iteration.Record.sorted,Record.detect: sort and scan.
Main results #
Cslib.Circuits.Boolean.Iteration.Record.detect_sorted_witness: if the orbit prefix reaches a checkpoint or repeats, the detected pair is a witness.
References #
- Adapted from lean/Proofs/{Records,Detector}.lean in S. Schlesinger, Square-root circuit bounds for iterated functions.
A complete record carried through the sorting network.
- padding : Bool
Padding records sort after all others and never collide.
- state : BitString n
The state compared by the sort.
- checkpoint : Bool
Whether this is a stored checkpoint rather than a query.
- index : BitVec w
The time of a query in the orbit prefix.
- payload : BitString n
The shifted state stored with a checkpoint.
Instances For
The number of bits of a record: its key, then its remaining fields.
Instances For
A stored checkpoint with its payload.
Instances For
A padding record.
Instances For
Two records collide when neither is padding, their states agree, and they differ.
Instances For
The initial array: stored checkpoints, then the orbit prefix up to time K, then padding.
Checkpoint h stores the state T - K steps later.
Instances For
What a collision certifies: the prefix reaches a checkpoint, or it repeats.
- hitLeft {n w M : ℕ} {f : BitString n → BitString n} {T K : ℕ} {checkpoints : Fin M → BitString n} {x : BitString n} (h : Fin M) (d : ℕ) (hd : d ≤ K) (heq : f^[d] x = checkpoints h) : Witness f T K checkpoints x (stored (checkpoints h) (f^[T - K] (checkpoints h))) (query (f^[d] x) d)
A stored checkpoint followed by the prefix state at time
dthat equals it. - hitRight {n w M : ℕ} {f : BitString n → BitString n} {T K : ℕ} {checkpoints : Fin M → BitString n} {x : BitString n} (h : Fin M) (d : ℕ) (hd : d ≤ K) (heq : f^[d] x = checkpoints h) : Witness f T K checkpoints x (query (f^[d] x) d) (stored (checkpoints h) (f^[T - K] (checkpoints h)))
The prefix state at time
dfollowed by the checkpoint it equals. - repeated {n w M : ℕ} {f : BitString n → BitString n} {T K : ℕ} {checkpoints : Fin M → BitString n} {x : BitString n} (i j : ℕ) (hi : i ≤ K) (hj : j ≤ K) (hne : i ≠ j) (heq : f^[i] x = f^[j] x) : Witness f T K checkpoints x (query (f^[i] x) i) (query (f^[j] x) j)
Two different times of the prefix with equal states.
Instances For
A collision between valid records is a witness, without requiring unique records.
Sorting and detection #
Sort records by padding flag and state with the native Batcher circuit.
Instances For
A checkpoint hit or a repeat of the prefix gives two different initial records with equal keys, the first of which is not padding.
Sorting turns such a pair into a flagged adjacent pair.
If the prefix up to time K reaches a checkpoint or repeats, the detected pair of the
sorted initial array is a witness.