Documentation

CslibFrontier.Computability.Complexity.RealAlgebraic.CharacteristicCoefficients

Indexed characteristic coefficients from uniform power traces #

traceExponentialCoefficient is a total modular evaluator: it forms the divided negative trace coefficients by powering, evaluates their finite exponential, extracts one coefficient, and returns zero for addresses above the matrix dimension. Given uniform F_a trace residues, its certificate is F_(max (a + 1) 3 + 2); the modulus, dimension and address are binary polynomial-time functions. No matrix or trace evaluator is constructed by this generic step.

At a prime with D * D < p - 1, the output is the canonical characteristic coefficient of a D-dimensional matrix when the supplied residues give its traces for powers 1, …, D. The zero trace slot is ignored, so the empty matrix is included.

Adapted from the trace-to-coefficient construction in lean-canny and its matrix correctness proof.

The zero logarithm slot is masked before Fermat inversion, including at p=2.

theorem Cslib.Complexity.RealAlgebraic.traceLogarithmResidue_cast {p : ℕ} [Fact (Nat.Prime p)] {k : ℕ} (hk : k < p) (t : ℕ) :
↑(traceLogarithmResidue p k t) = -↑t / ↑k

The addressed reversed coefficient, with a total zero default above the dimension.

theorem Cslib.Complexity.RealAlgebraic.traceExponentialCoefficient_eq {p : ℕ} [Fact (Nat.Prime p)] {D d : ℕ} (hdegree : D * D < p - 1) (hd : d ≤ D) (t : ℕ → ℕ) :
traceExponentialCoefficient p D d t = ((Polynomial.finiteExponential D ((Polynomial.ofFn (D + 1)) fun (k : Fin (D + 1)) => -↑(t ↑k) / ↑↑k)).coeff (D - d)).val

The reconstructed expression is exactly the one with coefficients -t_k/k.

Forming the divided negative trace costs no additional counting level.

theorem Cslib.Complexity.RealAlgebraic.traceExponentialCoefficient_eq_charpoly {p : ℕ} [Fact (Nat.Prime p)] {ι : Type u_1} [Fintype ι] [DecidableEq ι] (M : Matrix ι ι (ZMod p)) (hdegree : Fintype.card ι * Fintype.card ι < p - 1) (d : ℕ) (t : ℕ → ℕ) (ht : ∀ (k : ℕ), 1 ≤ k → k ≤ Fintype.card ι → ↑(t k) = (M ^ k).trace) :

From the positive power traces through the dimension, the evaluator returns the actual characteristic coefficient, including the zero default above the dimension. The prime cutoff also ensures that every required factorial denominator is invertible.