Products in prime fields by averaging generators #
The generators of the multiplicative group of ZMod p, for prime p, form a nonempty set of
cardinality strictly below p. Their cardinality is therefore invertible in the prime field.
Every generator represents each nonzero factor by exactly one exponent below p - 1.
Summing the matching exponents gives a total finite formula for logarithms, without selecting a
generator or an exponent. Averaging the resulting product formula over all generators then
recovers the original product.
These are algebraic statements, without computational complexity certificates. The denominator argument uses the fact that the field is prime: the number of generators in a general finite field can vanish in that field's characteristic.
Main definitions #
ZMod.generatorLogSum: the sum of all exponents whose power equals the supplied element.
Main results #
ZMod.primitiveRoots_nonempty: there is a generator of the prime field.ZMod.primitiveRoots_card_bounds,ZMod.primitiveRoots_card_ne_zero: the generator count is positive and invertible in the prime field.ZMod.generatorLogSum_spec: the sum is the unique bounded logarithm on nonzero elements.ZMod.prod_eq_generator_average: a product equals the average of its logarithm formulas.
Sum all matching exponents below p - 1. This is a total finite formula, including at
composite and zero moduli and for nongenerators. Its logarithm specification requires a prime
modulus, a primitive root and a nonzero element.
The multiplicative group of a prime field has a generator, represented as a field element.
The number of multiplicative generators is positive and strictly below the prime modulus.
This includes p = 2, whose sole generator is one.
The natural generator count is nonzero as an element of the prime field, and hence has a multiplicative inverse.
At a primitive root, a nonzero element has one matching exponent, so the sum of all matching exponents is that exponent. No efficient algorithm is asserted here.
A finite product in a prime field is the average, over every multiplicative generator, of its discrete-logarithm formula. Zero factors are handled by the explicit zero test. The formula also covers empty products. It assumes no efficient logarithm or generator selection algorithm.