Documentation

CslibFrontier.Computability.Complexity.Classes.CountingHierarchy.Generator

Testing generators of prime fields at the first counting function level #

generatorTest (p, g) accepts exactly a prime modulus p and a positive canonical representative g < p of a primitive root. It is total on every pair of binary naturals. Primality is checked by universally testing possible divisors, and generator status by universally testing the smaller positive exponents. One bitstring of width Nat.size p supplies either candidate. Thus the evaluator is polynomial-time, though its domain can be exponential, and one application of short-index universal quantification places the test in F_1. No primality or discrete-log oracle is assumed. Modular exponentiation uses the existing certified square-and-multiply API.

noncomputable def Cslib.Complexity.generatorTest (x : ℕ × ℕ) :

Test prime-field primitive roots on binary modulus/base pairs. Every malformed pair, including modulus zero or one and noncanonical representatives, is rejected.

A single universal short-index check puts the complete generator test in F_1. All arithmetic and prime-divisor tests are performed by its one polynomial-time evaluator.

The total binary test recognizes precisely canonical primitive roots of prime fields. In particular the two-element field accepts its generator one, while all malformed moduli are rejected. This characterization has no computational assumptions.

On canonical representatives of a prime field, the total test is exactly membership in the finite set of multiplicative generators.

Composite and malformed moduli reject every proposed generator.