Documentation

CslibFrontier.Computability.Complexity.RealAlgebraic.ModularMatrixDeterminant

Small modular determinants at the entry evaluator's level #

The matrix dimension is unary and entries are addressed by binary row-major indices. modularMatrixDeterminant collects the polynomially many entries after modular reduction, forms a short table of binary integers, and invokes Rational.detRows_polytime. It never enumerates determinant permutations or forms unreduced exponential products.

modularMatrixDeterminant_mem preserves the entry evaluator's counting-function level. modularMatrixDeterminant_cast computes the determinant of the actual prime-field matrix, including singular matrices and dimension zero. Only the residues at genuine matrix indices are required from the entry evaluator; all numeric inputs have total defaults.

Ported from LeanCanny.CountingHierarchy.ModularMatrixDeterminant at lean-canny commit 970f28a5ecefc1327402ade16c068aa4b1b2c183, as an ingredient of critical Jacobian evaluation.

noncomputable def Cslib.Complexity.RealAlgebraic.modularMatrixDeterminant (p n : ℕ) (entry : ℕ → ℕ) :

Collect polynomially many reduced entries and run the certified integer determinant. The max 1 p collection modulus keeps the storage invariant total at p = 0.

Each entry is reduced before collection. The resulting short integer table is passed to Frontier's certified polynomial-time determinant program.

theorem Cslib.Complexity.RealAlgebraic.modularMatrixDeterminant_cast {p n : ℕ} [Fact (Nat.Prime p)] (A : Matrix (Fin n) (Fin n) (ZMod p)) (entry : ℕ → ℕ) (he : ∀ (i j : Fin n), ↑(entry (↑i * n + ↑j)) = A i j) :
↑(modularMatrixDeterminant p n entry) = A.det

Only the residues of the entries are required, including for singular matrices. The determinant program itself runs on ordinary short integers.