Prime-window cofactors and weighted CRT residues #
primeCofactor Y L p computes the product of primes L < q ≤ Y, omitting p, modulo p.
Its certificate is uniform F_5 for polynomial-time binary cutoffs and modulus. Weighted CRT
coefficients additionally use a supplied residue and a binary exponent; an F_a residue gives
an F_max(a,5) coefficient. Neither operation constructs a full prime product or represented
integer. Nonprime moduli, including zero and one, return zero.
Main definitions #
Cslib.Complexity.primeWindowTest: the shared total primality/range predicate.Cslib.Complexity.primeCofactor: modular product of the other window primes.Cslib.Complexity.primeWindowCoefficient: weighted natural CRT coefficient.
Main results #
Cslib.Complexity.primeCofactor_cast,Cslib.Complexity.primeCofactor_ne_zero: correctness and invertibility of the cofactor residue.Cslib.Complexity.primeWindowCoefficient_modEq: the local CRT congruence.Cslib.Complexity.CountingFunction.primeCofactor_mem: the uniform F_5 certificate.Cslib.Complexity.CountingFunction.primeWindowCoefficient_mem: the coefficient certificate.
References #
- [OAI26f], Section 2, equation
crt-residues. The cutoffs and exponent are generic parameters; this module does not implement integer reconstruction or sign recovery.
Total test for membership in the prime window L < p ≤ Y, shared by cofactor factors
and weighted-residue summation. All three arguments use their ordinary binary values.
Product modulo p of the primes L < q ≤ Y other than p. Only binary-width indices
are passed to the factor evaluator. Every nonprime modulus has the total default zero.
Weighted CRT coefficient for the supplied natural residue r and doubling exponent k.
All powering is modular. Its inputs contain neither an implicit integer nor a full cofactor.
On a prime modulus, the computed residue casts to the mathematical erased-window product. No order between the cutoffs or membership of the modulus in the window is required.
Cofactor residues are canonical at every positive modulus.
Nonprime and malformed moduli have cofactor default zero.
A cofactor is nonzero in every prime field: all its prime factors differ from the modulus.
Weighted coefficients have the total default zero at every nonprime modulus.
Weighted coefficients are canonical natural residues at every positive modulus.
The weighted coefficient represents the modular power times the supplied residue, divided by the nonzero cofactor residue.
The natural coefficient is the canonical representative of its field formula.
A zero supplied residue gives a zero weighted coefficient at every modulus.
A supplied residue of any integer yields the weighted local CRT congruence.
The integer, the full omitted-prime product and the full power occur only in this statement.
The premise is exactly the shape of IntegerResidueAccess.residue_modEq.
Subtype-indexed local congruence, ready for crt_circle_identity and its sign callers.
Every modulus in the prime window is prime; only the supplied residue's congruence is needed.
Uniform prime-window membership is F_1 for polynomial-time binary parameters. This certificate is shared by cofactor products and the final masked residue sum.
The uniform cofactor algorithm lies in F_5. The primality factor test is F_1 and the conservative product rule adds four levels. All three parameters have binary PT certificates.
An F_a supplied residue and PT binary cutoffs, modulus and exponent give a total weighted coefficient in F_max(a,5). Strict certificates charge intermediate residues, queries and outputs; no implicit integer or large mathematical product is supplied as machine data.