Documentation

CslibFrontier.Computability.Complexity.Classes.CountingHierarchy.Products

Short-index products in prime fields #

A total evaluator averages the logarithm formula over every multiplicative generator. Each sum uses a uniform short-index evaluator. No generator is selected, and the unreduced product and full powers occur only in correctness proofs. Composite moduli, including zero and one, return zero. The modulus is binary and the index width is polynomial-time unary.

Main definitions #

Main results #

References #

noncomputable def Cslib.Complexity.generatorCount (p : ℕ) :

Count canonical generators by their total Boolean test; nonprime moduli give zero.

noncomputable def Cslib.Complexity.primeFieldProduct (p b : ℕ) (f : List Bool → ℕ) :

Total product evaluator on residue factors. Its inputs contain no unreduced product. For a prime modulus it returns the canonical product residue; for every other modulus it returns zero, even though powMod itself has the fixed value one at modulus zero.

The accepted natural representatives count the algebraic generator set exactly.

The generator count vanishes on every nonprime modulus.

Composite and malformed moduli use the total default zero.

theorem Cslib.Complexity.primeFieldProduct_lt {p : ℕ} (hp : 0 < p) (b : ℕ) (f : List Bool → ℕ) :

The evaluator returns a canonical residue whenever the modulus is positive.

theorem Cslib.Complexity.primeFieldProduct_spec {p : ℕ} [Fact (Nat.Prime p)] (b : ℕ) (f : List Bool → ℕ) :
↑(primeFieldProduct p b f) = ∏ i : Fin b → Bool, ↑(f (List.ofFn i))

The total evaluator agrees with the full mathematical product at a prime modulus. The product is a specification, never an intermediate value of the evaluator.

theorem Cslib.Complexity.primeFieldProduct_eq_val {p : ℕ} [Fact (Nat.Prime p)] (b : ℕ) (f : List Bool → ℕ) :
primeFieldProduct p b f = (∏ i : Fin b → Bool, ↑(f (List.ofFn i))).val

The natural output is the least representative of the full mathematical product.

theorem Cslib.Complexity.primeFieldProduct_restrict_spec {p : ℕ} [Fact (Nat.Prime p)] (b : ℕ) (f : List Bool → ℕ) (V : List Bool → Bool) :
↑(primeFieldProduct p b fun (w : List Bool) => if V w = true then f w else 1) = ∏ i : Fin b → Bool with V (List.ofFn i) = true, ↑(f (List.ofFn i))

A restricted product is the product over exactly the selected bitstrings. Excluded indices contribute one, so selecting no indices gives the empty product.

noncomputable def Cslib.Complexity.primeFieldRangeProduct (p n : ℕ) (value : ℕ → ℕ) :

Evaluate the product of n addressed factors modulo p using binary addresses. Addresses at least n contribute one. On nonprime moduli the evaluator returns zero.

theorem Cslib.Complexity.primeFieldRangeProduct_cast {p : ℕ} [Fact (Nat.Prime p)] (n : ℕ) (value : ℕ → ℕ) :
↑(primeFieldRangeProduct p n value) = ∏ i : Fin n, ↑(value ↑i)

The prime-field result agrees with the product over precisely the genuine indices.

Counting the accepted generator tests costs one level beyond the tests themselves.

The generator-average evaluator is in F_(a+3), including on every nonprime input. The strict certificates of composition and summation bound every query and intermediate output.

A binary factor count and a uniform factor evaluator add three counting function levels.

Short-index prime-field products of F_a factors lie in F_(a+4), with total zero default on every nonprime modulus. The modulus is polynomial-time binary, and width polynomial-time unary; factor, query, intermediate and output lengths follow from strict certificates. The stronger F_(a+3) bound comes from averaging rather than selecting a generator.

A same-level predicate restricts the product by replacing excluded factors with one. This includes an empty allowed domain and does not add a counting level.