Remainder-power equivalence and batched powers of the modular counter #
Computing the T-th power of the 2 k-bit modular counter (counterStep k) is equivalent up to
linear additive overhead to computing the fixed-integer remainder x ↦ T % x on k-bit moduli
(counterRemainder_of_power, counterPower_of_remainder).
On a batch of r independent 2 k-bit modular counters (counterBatchPower), all r members can
share a single hardwired lookup dictionary a ↦ T % a over the 2 ^ k - 1 positive k-bit moduli
(residueKeys, residueValues). Each member then needs only the linear carry-safe residue addition
(addResidue), giving a circuit of size at most 40000 * (k + 1) ^ 3 * (2 ^ k + r) for every
r ≤ 2 ^ (k + k) (batched_counter_power). Conversely, one block of a batched circuit computes the
single power with no extra gates (counterPower_of_batched), and whenever the power is not the
identity every block requires its own output gate (counterBatch_size_ge_of_ne_id). Together with
the counting lower bound for counterStep k, this yields matching Ω(2 ^ k / k + r) and
O(k ^ 3 * (2 ^ k + r)) bounds for batched modular-counter powers (batched_hard_counter_power).
Main definitions #
Cslib.Circuits.Boolean.Iteration.counterRemainder: fixed-integer remainderx ↦ T % xonk-bit words (zero on modulus zero).Cslib.Circuits.Boolean.Iteration.counterBlock: blockmemberof anr-way batched2 k-bit state.Cslib.Circuits.Boolean.Iteration.counterBatchPower: theT-step modular counter applied independently to each ofrblocks.Cslib.Circuits.Boolean.Iteration.residueKeys,Cslib.Circuits.Boolean.Iteration.residueValues: shared dictionary keys1, …, 2 ^ k - 1and payloadsT % a.
Main results #
Cslib.Circuits.Boolean.Iteration.counterRemainder_of_power,Cslib.Circuits.Boolean.Iteration.counterPower_of_remainder: circuit equivalence between(counterStep k)^[T]andcounterRemainder T.Cslib.Circuits.Boolean.Iteration.batched_counter_power: shared-dictionary upper bound40000 * (k + 1) ^ 3 * (2 ^ k + r)forr ≤ 2 ^ (k + k).Cslib.Circuits.Boolean.Iteration.counterPower_of_batched,Cslib.Circuits.Boolean.Iteration.counterBatch_size_ge_of_ne_id,Cslib.Circuits.Boolean.Iteration.counterBatch_lower_bounds: single-block and per-block output lower bounds.Cslib.Circuits.Boolean.Iteration.batched_hard_counter_power: combined upper and lower bounds for hard exponents atk ≥ 64.
References #
- Adapted from lean/Proofs/{CounterRemainders,CounterBatch}.lean in S. Schlesinger, Square-root circuit bounds for iterated functions.
Remainder-power equivalence for counterStep #
A circuit for (counterStep k)^[T] yields a circuit for counterRemainder T with at most one
extra gate.
A circuit for counterRemainder T yields a circuit for (counterStep k)^[T] with at most
100 * (k + 1) extra gates.
Batched modular-counter states and dictionary #
The batched power is the T-th iterate of the single-step batched update.
States with modulus zero are fixed by ModulusCounter.power T.
Batched modular-counter upper bound. Using one shared residue dictionary, r independent
2 k-bit modular counters can be advanced by T steps in size at most
40000 * (k + 1) ^ 3 * (2 ^ k + r) for every r ≤ 2 ^ (k + k).
One block of a batched circuit computes the single power with no extra gates: feed the same state to every block.
If ModulusCounter.power T is not the identity, every block needs its own output gate.
Both lower bounds: a batched circuit is at least as large as any circuit for the single power,
and, unless the power is the identity, has size at least r.
Batched hard modular-counter powers. For k ≥ 64, there exists an exponent
T < ModulusCounter.period k such that for every 0 < r ≤ 2 ^ (k + k), counterBatchPower T has
a circuit of size at most 40000 * (k + 1) ^ 3 * (2 ^ k + r) and every circuit computing it has
size greater than lowerBudget k and at least r.