Linearizing polynomial circuits #
Affine circuits compute affine maps (Cslib.Circuits.Program.exists_affine_trace): in a
circuit over the affine basis, the value of every wire is an affine function of the input.
Linearization (Cslib.Circuits.Circuit.Computes.exists_affine). Over an infinite field, a
circuit with polynomial operations that computes a linear map x ↦ M x can be replaced by a
circuit over the affine basis, with the same wires, that computes the same map: nonlinear
operations do not help to compute linear maps, as in Strassen's theorem on linear complexity
[BurgisserClausenShokrollahi1997, Chapter 13]. Each gate is
replaced by its first-order Taylor expansion at the point that its arguments take on the zero
input (Cslib.Circuits.taylorOp, Cslib.Circuits.Program.linearize).
To see why this works, evaluate the circuit over the dual numbers F[ε], where ε² = 0, at the
input ε x. Because the operations are polynomials, a gate whose arguments are z + ε v takes
the value P(z) + ε ∑_a ∂_a P(z) v_a (MvPolynomial.snd_aeval_dualNumber), where z is the
value of the arguments on the zero input. So where the circuit takes the value a + ε b at
ε x, the linearized circuit takes the value a + b at x
(Cslib.Circuits.Program.trace_linearize). Over an infinite field a polynomial is determined by
its values, so the polynomial computed at an output is the linear form ∑_j M_{ij} X_j, whose
value at ε x is ε (M x)_i.
Main definitions #
Cslib.Circuits.polynomialInterpretation: the operations given by polynomials, over any algebra.Cslib.Circuits.taylorOp: the affine operation of the first-order Taylor expansion.Cslib.Circuits.Program.linearize: the linearization of a program with polynomial operations.
Main results #
Cslib.Circuits.Program.exists_affine_trace: affine circuits compute affine maps.Cslib.Circuits.Program.trace_linearize: the linearized program reads off the dual numbers.Cslib.Circuits.Circuit.Computes.exists_affine: linearization of circuits for linear maps.
References #
Affine circuits compute affine maps. In a program over the affine basis, the value of every wire is a linear map of the input plus a constant.
Polynomial interpretations over algebras #
The interpretation over an F-algebra R in which each operation o substitutes its
arguments into the polynomial P o. Every polynomial interpretation over F is of this form
(Cslib.Circuits.Interpretation.IsPolynomial).
Instances For
An operation of a polynomial interpretation substitutes its arguments into its polynomial.
Evaluation of a program with polynomial operations commutes with algebra homomorphisms.
Linearization #
The affine operation computing the first-order Taylor expansion of P at z,
y ↦ P(z) + ∑_a ∂_a P(z) (y_a - z_a).
Instances For
The value of the first-order Taylor expansion of P at z.
The linearization of a program whose operations are the polynomials P: the program over
the affine basis with the same wires, in which each gate is replaced by its first-order Taylor
expansion at the point that its arguments take on the zero input.
Instances For
Linearization preserves the inner gates.
The real part of the value of a wire at the input ε x is its value at the zero input.
The linearized program. Where the original program takes the value a + ε b at the
input ε x, the linearized program takes the value a + b at the input x.
Over an infinite field, a circuit with polynomial operations that computes x ↦ M x takes
the value ε (M x)_i at its output i on the input ε x.
Linearization. Over an infinite field, a circuit with polynomial operations computing a
linear map x ↦ M x is matched by a circuit over the affine basis computing the same map, with
the same number of gates, the same inner gates, and the same fan-in.