Documentation

CslibFrontier.Foundations.NumberTheory.FiniteField.GeneratorProducts

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 #

Main results #

def ZMod.generatorLogSum (p : ℕ) (γ x : ZMod p) :

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.

theorem ZMod.generatorLogSum_spec {p : ℕ} [Fact (Nat.Prime p)] {γ x : ZMod p} (hγ : IsPrimitiveRoot γ (p - 1)) (hx : x ≠ 0) :
generatorLogSum p γ x < p - 1 ∧ γ ^ generatorLogSum p γ x = x

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.

theorem ZMod.prod_eq_generator_average {p : ℕ} [Fact (Nat.Prime p)] {ι : Type u_1} (s : Finset ι) (f : ι → ZMod p) :
∏ i ∈ s, f i = (∑ γ ∈ primitiveRoots (p - 1) (ZMod p), if ∃ i ∈ s, f i = 0 then 0 else γ ^ ((∑ i ∈ s, generatorLogSum p γ (f i)) % (p - 1))) / ↑(primitiveRoots (p - 1) (ZMod p)).card

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.