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.lcmBelowand elementary upper bounds (lcmBelow_add_dvd,four_pow_ge_two_mul_lcmBelow,lcmBelow_lt_four_pow), together with the bundledPrimeCycleDatainterface (PrimeCycleData.step_circuit,PrimeCycleData.power_circuit,PrimeCycleData.exists_hard_power).
Main definitions #
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.order: common-period product of the nontrivial cycle lengths (which equals the exact permutation order underLengthsCoprime).Cslib.Circuits.Boolean.Iteration.PrimeCycles.classPrime: least-index prime candidate in each hash class, or1if none exists.Cslib.Circuits.Boolean.Iteration.lcmBelow: least common multiple of{1, …, n}.Cslib.Circuits.Boolean.Iteration.PrimeCycleData: bundled cycle-length data with pairwise coprime nontrivial lengths.
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.lcmBelow_lt_four_pow:lcm(1, …, n) < 4 ^ nfor1 ≤ n.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.
Least common multiples up to n #
The least common multiple lcm(1, …, n).
Instances For
For n ≤ m, lcmBelow (m + n) divides lcmBelow m * (m + n).choose m. Every prime power
p ^ L ≤ m + n exceeding m satisfies m < p ^ L ≤ m + n, which forces a base-p carry at
digit L when adding m and n.
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
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 #
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 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
The K-bit cycle-length map on BitString m associated with D.
Instances For
The K-bit remainder map r ↦ T % D.length r (or 0 when D.length r = 0) on
BitString m.
Instances For
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.