The determinant is in VP #
The generic matrix genericMatrix K n is the n × n matrix whose entries are the n * n
variables, in row-major order, and the determinant family detFamily K consists of its
determinants. Over every commutative ring K the determinant family is in VP K
[Val79a]: exists_circuit_det gives, for every n, an arithmetic circuit with at most
3 * n ^ 4 + 4 gates computing the generic determinant as a formal polynomial.
The circuit runs Bird's division-free algorithm [Bir11], whose correctness is Mathlib's
BirdDet development; Cslib.Circuits.Rational.DeterminantAlgorithm executes the same
algorithm on integer matrices. Bird's algorithm, like Berkowitz's [Ber84], uses only
additions, multiplications and integer constants, so no field or characteristic hypothesis is
needed. It runs n - 1 stages. Each stage multiplies the previous matrix, with its diagonal
replaced by negated suffix sums and its lower triangle cleared, by the input matrix; each of its
n ^ 2 entries costs at most 3 * n + 3 gates. Common subexpressions are not shared across
entries, which a sharper count would exploit. Only the gate count is certified; the circuits are
obtained from a synthesis bound, not constructed by a certified uniform procedure.
The permanent family permFamily K of generic permanents is also a p-family
(isPFamily_permFamily). The separate Arithmetic/Permanent module proves membership in VNP.
Nothing here places it in VP or proves Valiant's VNP-completeness of the permanent.
Main definitions #
Cslib.Circuits.Arithmetic.genericMatrix: the matrix of variables.Cslib.Circuits.Arithmetic.detFamily: the family of generic determinants.Cslib.Circuits.Arithmetic.permFamily: the family of generic permanents.
Main results #
Cslib.Circuits.Arithmetic.genericMatrix_eq_map_rename: the generic matrix is Mathlib's matrix of variables renamed to row-major order.Cslib.Circuits.Arithmetic.map_genericMatrix,map_permanent_genericMatrix: change of coefficients.Cslib.Circuits.Arithmetic.totalDegree_det_genericMatrix_le: the generic determinant has degree at mostn.Cslib.Circuits.Arithmetic.exists_circuit_det: a circuit with at most3 * n ^ 4 + 4gates;exists_circuit_det_eval: the same circuit evaluates the determinant over every commutativeK-algebra.Cslib.Circuits.Arithmetic.detFamily_mem_VP: the determinant family is inVP.Cslib.Circuits.Arithmetic.isPFamily_permFamily: the permanent family is a p-family.
References #
- L. G. Valiant, Completeness classes in algebra
- R. S. Bird, A simple division-free algorithm for computing determinants
- S. J. Berkowitz, On computing the determinant in small parallel time using a small number of processors
- The shared bridges in
CslibFrontier/Computability/Circuit/Bird.leanrestate Paul Cadman's private Mathlib correctness proofs, preserving the earlier integer and generic-ring source credit there.
The generic matrix and the determinant family #
The generic n × n matrix over K: entry (i, j) is the variable n * i + j of
MvPolynomial (Fin (n * n)) K.
The generic matrix of Cslib.Circuits.Arithmetic.genericMatrix renames the variables of
Matrix.mvPolynomialX to row-major order.
Mapping the coefficients of the generic matrix over R along f gives the generic matrix
over S.
The determinant family over K: its n-th member is the determinant of the generic
n × n matrix, a polynomial in n * n variables.
The generic determinant has total degree at most n.
The permanent family #
The permanent family over K: its n-th member is the permanent of the generic n × n
matrix, a polynomial in n * n variables.
The generic permanent has total degree at most n.
The permanent family over K is a p-family (vars n = n ^ 2 and totalDegree ≤ n).
Mapping the coefficients of the generic permanent along f gives the generic permanent.
Bird's algorithm as an arithmetic circuit #
The determinant has small circuits [Bir11]: the generic n × n determinant is computed
by an arithmetic circuit with at most 3 * n ^ 4 + 4 gates, over every commutative ring K.
The circuits of exists_circuit_det are universal: the same circuit evaluates the determinant
of every n × n matrix over every commutative K-algebra, its entries supplied in row-major
order.