Modular-counter remainders, short-exponent circuits, and variable-time equivalence #
Computing ModulusCounter.power T on 2 k bits is equivalent up to O(k) gates to computing the
fixed-integer remainder x ↦ T % x on k-bit moduli (ModulusCounter.remainder_of_power,
ModulusCounter.power_of_remainder, counter_powers_compute_remainders). Likewise, variable-time
iteration of counterStep k for an m-bit input time is equivalent up to O(k) gates to m-bit
division remainder (variable_time_counter_iff_remainder).
Hardwiring m numerator bits into the streaming remainder circuit of Remainder.lean shows that
any exponent T < 2 ^ m has a power circuit of size at most 110 * (m + 1) * (k + 1)
(ModulusCounter.short_power_circuit). Consequently, every hard power requires an exponent of
binary length m = Ω(2 ^ k / k ^ 2) (ModulusCounter.hard_power_requires_long_exponent,
ModulusCounter.hard_power_exponent_capacity).
Main definitions #
Cslib.Circuits.Boolean.Iteration.ModulusCounter.remainder: fixed-integer remainder onk-bit words.Cslib.Circuits.Boolean.Iteration.counterInput,Cslib.Circuits.Boolean.Iteration.counterOutput: input packing and state extraction for remainder reductions.Cslib.Circuits.Boolean.Iteration.inputTimeRemainder: two-input remainder onmnumerator bits andkmodulus bits.
Main results #
Cslib.Circuits.Boolean.Iteration.ModulusCounter.remainder_of_power,Cslib.Circuits.Boolean.Iteration.ModulusCounter.power_of_remainder,Cslib.Circuits.Boolean.Iteration.counter_powers_compute_remainders: equivalence between fixed-exponent counter powers and fixed-integer remainders.Cslib.Circuits.Boolean.Iteration.ModulusCounter.short_remainder_circuit,Cslib.Circuits.Boolean.Iteration.ModulusCounter.short_power_circuit: linear-in-m * kcircuits for exponentsT < 2 ^ m.Cslib.Circuits.Boolean.Iteration.ModulusCounter.hard_power_requires_long_exponent,Cslib.Circuits.Boolean.Iteration.ModulusCounter.hard_power_exponent_capacity: exponential lower bound on the binary length of hard exponents.Cslib.Circuits.Boolean.Iteration.variable_time_counter_iff_remainder: equivalence between variable-time counter iteration and two-input remainder.
References #
- Adapted from lean/Proofs/{CounterRemainders,ExponentLength}.lean in S. Schlesinger, Square-root circuit bounds for iterated functions.
Fixed-integer remainders and equivalence with counter powers #
A circuit for remainder T yields a circuit for power T with at most 100 * (k + 1) extra
gates.
Short-exponent upper bounds and exponent-length lower bounds #
Hardwiring m numerator bits into bounded_modulus_remainder and masking modulus zero gives a
circuit for remainder T of size linear in m * (k + 1).
A fixed exponent T < 2 ^ m gives a circuit for power T of size at most
110 * (m + 1) * (k + 1).
Any exponent whose counter power requires more than lowerBudget k gates needs
lowerBudget k < 110 * (m + 1) * (k + 1).
Explicit exponential lower bound on the binary length m of any hard exponent T < 2 ^ m.
Remainder helpers and variable-time equivalence #
Computing ModulusCounter.power T and computing ModulusCounter.remainder T are equivalent up
to linear additive overhead.
Variable-time iteration of counterStep k for an m-bit input time is equivalent up to
O(k) gates to computing the m-bit remainder inputTimeRemainder m k.