Permutations with one prime cycle per hash class #
This module formalizes the combinatorial and circuit-complexity structure of permutations on
BitString (m + K) that act as a disjoint union of prime-length cycles indexed by m-bit hash
classes. States of BitString (m + K) are pairs (r, b) of an m-bit class word r and a
K-bit position word b. Given a cycle length ℓ r < 2 ^ K for each class r, the step map
advances b by 1 modulo ℓ r when b < ℓ r and fixes every other state.
PrimeCycles.iterate_stepandPrimeCycles.power_apply_mod: theT-th power addsTmoduloℓ r, so it depends onTonly through the remainder tabler ↦ T % ℓ r.PrimeCycles.iterate_eq_iterate_iff: when the nontrivial lengths (1 < ℓ r) are pairwise coprime, two powers agree if and only if their exponents are congruent moduloorder ℓ, the product of the nontrivial lengths. Henceorder ℓis both the permutation order (PrimeCycles.iterate_eq_id_iff) and the exact number of distinct powers (PrimeCycles.card_range_iterate).PrimeCycles.classPrime: the hash-class construction with candidates2 ^ (m + g) + (r xor f z) * 2 ^ g + zforz < 2 ^ gandK = m + g + 1. Different classes have disjoint candidate sets (PrimeCycles.candidate_injective), so the chosen prime lengths are distinct and pairwise coprime (PrimeCycles.classPrime_coprime).PrimeCycles.near_landau_lower_bound: for any mixing functionfwith values below2 ^ m, the resulting permutation is bijective, has order at least2 ^ ((m + g) * c)wherecis the number of active classes, and has a power below its order requiring more thanqgates whenever the ordered-syntax exponent forqgates is below(m + g) * c.- The bundled
PrimeCycleDatainterface (PrimeCycleData.step_circuit,PrimeCycleData.power_circuit,PrimeCycleData.exists_hard_power).
Main definitions #
Cslib.Circuits.Boolean.Iteration.PrimeCycles.classWord,Cslib.Circuits.Boolean.Iteration.PrimeCycles.posWord,Cslib.Circuits.Boolean.Iteration.PrimeCycles.pack: split and packm-bit class andK-bit position words.Cslib.Circuits.Boolean.Iteration.PrimeCycles.power:T-step map advancing each classrmoduloℓ r.Cslib.Circuits.Boolean.Iteration.PrimeCycles.step: single-step permutationpower ℓ 1.Cslib.Circuits.Boolean.Iteration.PrimeCycles.active,Cslib.Circuits.Boolean.Iteration.PrimeCycles.order,Cslib.Circuits.Boolean.Iteration.PrimeCycles.LengthsCoprime: active classes, common-period product of the nontrivial cycle lengths (which equals the exact permutation order underLengthsCoprime), and pairwise coprimality predicate.Cslib.Circuits.Boolean.Iteration.PrimeCycles.candidate,Cslib.Circuits.Boolean.Iteration.PrimeCycles.classPrime: prime candidates and least-index prime candidate in each hash class, or1if none exists.Cslib.Circuits.Boolean.Iteration.PrimeCycleData,Cslib.Circuits.Boolean.Iteration.PrimeCycleData.activeLength,Cslib.Circuits.Boolean.Iteration.PrimeCycleData.stepNat,Cslib.Circuits.Boolean.Iteration.PrimeCycleData.step,Cslib.Circuits.Boolean.Iteration.PrimeCycleData.perm,Cslib.Circuits.Boolean.Iteration.PrimeCycleData.period,Cslib.Circuits.Boolean.Iteration.PrimeCycleData.lengthBits,Cslib.Circuits.Boolean.Iteration.PrimeCycleData.remainderBits,Cslib.Circuits.Boolean.Iteration.PrimeCycleData.ofHash: bundled cycle-length data with pairwise coprime nontrivial lengths and associated step, period, bit-encoding, and hash constructors.
Main results #
Cslib.Circuits.Boolean.Iteration.PrimeCycles.iterate_eq_iterate_iff: two powers agree iff the exponents are congruent moduloorder ℓ.Cslib.Circuits.Boolean.Iteration.PrimeCycles.card_range_iterate: the number of distinct powers equalsorder ℓ.Cslib.Circuits.Boolean.Iteration.PrimeCycles.near_landau_lower_bound: explicit lower bound for the hash-class prime-cycle permutation.Cslib.Circuits.Boolean.Iteration.PrimeCycleData.step_circuitandCslib.Circuits.Boolean.Iteration.PrimeCycleData.power_circuit: circuit synthesis for the step andT-th power from class-length and remainder tables.
References #
- Adapted from lean/Proofs/PrimeCycles.lean in S. Schlesinger, Square-root circuit bounds for iterated functions.
Disjoint prime-cycle permutations indexed by hash classes #
The common-period product of the nontrivial cycle lengths (which equals the exact permutation
order under LengthsCoprime).
Instances For
Under LengthsCoprime ℓ, two exponents are congruent modulo order ℓ iff they are congruent
modulo every nontrivial cycle length ℓ r.
With pairwise coprime nontrivial lengths, (step ℓ)^[S] = (step ℓ)^[T] iff
S ≡ T [MOD order ℓ].
If the ordered-syntax budget for q gates is below order ℓ, some power below order ℓ
requires more than q gates.
Hash-class prime candidates #
Every classPrime m g f r is below 2 ^ (m + g + 1), and any nontrivial classPrime m g f r
is a prime at least 2 ^ (m + g).
Nontrivial class lengths are distinct primes, hence pairwise coprime.
Lower bound for the hash-class permutation: for any mixing function f with values below
2 ^ m, put K = m + g + 1 and let ℓ r be the least-index prime candidate of class r. The
step is a bijection of BitString (m + K), its order is at least 2 ^ ((m + g) * c) where c is
the number of active classes, and if the ordered-syntax exponent for q gates is below
(m + g) * c, some power F^[T] with T < order requires more than q gates.
Bundled prime-cycle permutation data and circuit synthesis #
Bundled cycle-length specification for m-bit hash classes and K-bit cycle positions, with
pairwise coprime nontrivial cycle lengths.
Cycle length assigned to each
m-bit class.Every cycle length fits in
Kbits.- lengths_coprime : PrimeCycles.LengthsCoprime self.length
Nontrivial cycle lengths (
1 < length r) are pairwise coprime.
Instances For
The effective cycle length of class r, equal to D.length r when 1 < D.length r and 1
otherwise.
Instances For
Natural-number position update for class r in one step.
Instances For
Single-step map on BitString (m + K).
Instances For
The single-step map D.step is a bijection on BitString (m + K).
The permutation of BitString (m + K) induced by D.step.
Instances For
The order of D.step, equal to the product of the nontrivial cycle lengths.
Instances For
Powers D.step^[T] for T < D.period are pairwise distinct.
If the ordered-syntax budget for q gates is strictly below D.period, some power
D.step^[T] with T < D.period requires more than q gates.
The K-bit cycle-length map on BitString m associated with D.
Instances For
Packing D.lengthBits r into a BitVec K gives BitVec.ofNat K (D.length (word r)).
The K-bit remainder map r ↦ T % D.length r (or 0 when D.length r = 0) on
BitString m.
Instances For
Packing D.remainderBits T r into a BitVec K gives T % D.length (word r) (or 0 when
D.length (word r) = 0).
Given a circuit cLen computing the K-bit class length D.lengthBits, the single-step
permutation D.step has a circuit of size at most cLen.size + 50 * K + 20.
Given circuits cLen for D.lengthBits and cRem for D.remainderBits T, the T-th power
D.step^[T] has a circuit of size at most cLen.size + cRem.size + 100 * (K + 1).
Construct PrimeCycleData from the hash-class prime construction PrimeCycles.classPrime.