Documentation

CslibFrontier.Computability.Complexity.RealAlgebraic.FormulaGateCoefficientEvaluation

Indexed gate coefficients from modular coordinate values #

Pack the bivariate coefficient indices in a single Kronecker exponent and use the finite-field coefficient sum on the gate's executable modular evaluations. This adapts LeanCanny.ETR.BivariateTermReader.coefficient_eq at lean-canny 970f28a5ecefc1327402ade16c068aa4b1b2c183. A coordinate evaluator at counting-function level a yields a certificate at level a + 1. The source for the critical-point family remains separate. The word length and coordinate degree bounds give a uniform binary radix and prime cutoff for all gates.

Choose a radix one larger than the uniform inner degree bound after substitution. This adapts LeanCanny.ETR.BivariateTermReader.radix at the revision above.

A prime strictly above this cutoff has enough evaluation points to interpolate every packed gate polynomial. Both coordinate degree bounds are given in binary.

The uniform radix is computable in polynomial time from the formula and inner bound.

The uniform prime cutoff is computable in polynomial time from the formula and both bounds.

theorem Cslib.Complexity.RealAlgebraic.formulaWordGateCoefficientPrimeCutoff_bounds (word : List Bool) (gate : ℕ) (coordinates : Fin word.length → Polynomial (Polynomial ℤ)) {inner outer p : ℕ} (hinner : ∀ (k : Fin word.length), (Polynomial.Bivariate.swap (coordinates k)).natDegree ≤ inner) (houter : ∀ (k : Fin word.length), (coordinates k).natDegree ≤ outer) (hp : formulaWordGateCoefficientPrimeCutoff word inner outer < p) :

For any gate, the chosen radix and any modulus above the cutoff meet both degree hypotheses of prime-field coefficient extraction.

noncomputable def Cslib.Complexity.RealAlgebraic.formulaWordGateCoefficientResidue (word : List Bool) (gate p radix i j : ℕ) (point : ℕ → List ℕ) :

The coefficient sum for one gate at inner index i and outer index j. The callback supplies coordinate residues at the packed evaluation point. Indices outside the radix or finite-field interpolation range return zero.

Coordinate queries at level a give coefficient extraction at level a + 1. The gate index, modulus, radix and coefficient indices are binary.

theorem Cslib.Complexity.RealAlgebraic.formulaWordGateCoefficientResidue_eq_val (word : List Bool) (gate : ℕ) (coordinates : Fin word.length → Polynomial (Polynomial ℤ)) {p radix : ℕ} [Fact (Nat.Prime p)] (i j : ℕ) (point : ℕ → List ℕ) (hinner : (Polynomial.Bivariate.swap (Logic.RealArithmetic.formulaWordGatePolynomial word gate coordinates)).natDegree < radix) (hdegree : (Polynomial.eval (Polynomial.X ^ radix) (Logic.RealArithmetic.formulaWordGatePolynomial word gate coordinates)).natDegree < p - 1) (hpoint : ∀ z < p, ∀ (k : Fin word.length), ↑((point z)[↑k]?.getD 0) = (Polynomial.aevalAeval (↑z) (↑z ^ radix)) (coordinates k)) :
formulaWordGateCoefficientResidue word gate p radix i j point = (↑(((Logic.RealArithmetic.formulaWordGatePolynomial word gate coordinates).coeff j).coeff i)).val

Correctness at a prime field whose size exceeds the degree of the packed gate polynomial by at least two. The inner degree bound excludes index collisions. The equation covers every query index, including those beyond either cutoff.