Documentation

CslibFrontier.Computability.Complexity.Classes.CountingHierarchy.DiscreteLog

Total logarithm sums in prime fields #

Sum every exponent below p - 1 whose power matches the requested residue. At a primitive root and nonzero target, uniqueness makes this sum the discrete logarithm. On all other inputs it still defines a total polynomial-bit output. Short-index summation certifies this operation in F_1 without a generator, factoring, or discrete-logarithm oracle.

Sum matching exponents below p - 1, reducing the target modulo p. This is total for every modulus, base and target; its logarithm specification requires a primitive prime-field base.

The natural matching-exponent sum agrees with its prime-field algebraic counterpart.

Computing a logarithm sum from binary modulus, base and target takes one function level. Its range endpoint is short even when its value is exponential.

theorem Cslib.Complexity.modularLogSum_spec {p : ℕ} [Fact (Nat.Prime p)] {g x : ℕ} (hg : IsPrimitiveRoot (↑g) (p - 1)) (hx : ↑x ≠ 0) :
modularLogSum p g x < p - 1 ∧ ↑g ^ modularLogSum p g x = ↑x

At a primitive root, the computed natural sum is its target's unique bounded logarithm.