Affine, polynomial and arithmetic bases #
Three ways of computing over a commutative semiring F:
- the affine basis (
Cslib.Circuits.affineSignature), whose operations of aritykare the affine mapsx ↦ a₀ x₀ + ... + a_{k-1} x_{k-1} + b; - polynomial interpretations (
Cslib.Circuits.Interpretation.IsPolynomial), in which every operation of a signature is a polynomial in its arguments, with any coefficients and of any degree; - the arithmetic basis (
Cslib.Circuits.arithSignature): addition and multiplication of arity two, and a constant gate of arity zero for each element ofF.
The affine and arithmetic bases are polynomial. Over a finite field every operation is a
polynomial, so the distinction matters only over infinite fields, where it is essential: an
infinite field admits injections F × F → F, through which a single wire can carry any amount
of information.
In an arithmetic circuit the constants are leaves, and Cslib.Circuits.Circuit.innerSize counts
exactly the additions and multiplications.
Main definitions #
Cslib.Circuits.affineSignature,Cslib.Circuits.affineInterpretation: the affine basis.Cslib.Circuits.ArithOp,Cslib.Circuits.ArithOp.arity,Cslib.Circuits.arithSignature,Cslib.Circuits.arithInterpretation: the arithmetic basis.Cslib.Circuits.arithInterpretationWith: interpret the constant symbols in another carrier.Cslib.Circuits.ArithOp.mulCost: count multiplications, including scalar multiplications.Cslib.Circuits.ArithOp.addCost: count additions.Cslib.Circuits.Interpretation.IsPolynomial: every operation is a polynomial.
Main results #
Cslib.Circuits.isPolynomial_affineInterpretation,Cslib.Circuits.isPolynomial_arithInterpretation: both bases are polynomial.Cslib.Circuits.Circuit.fanInAtMost_two_arith: arithmetic circuits have fan-in two.
References #
The affine basis over F: an operation of arity k is a vector of k coefficients and a
constant.
An affine operation with coefficients a and constant b computes
x ↦ ∑ i, a i * x i + b.
The arity of an arithmetic operation: two for addition and multiplication, zero for a constant.
The arithmetic basis: addition and multiplication of arity two, and constants of arity zero.
Addition and multiplication in R, with constant symbols interpreted by constant.
For example, MvPolynomial.C interprets field constants as constant polynomials.
Instances For
Addition, multiplication and constants.
Evaluating .add under arithInterpretationWith adds the two arguments.
Evaluating .mul under arithInterpretationWith multiplies the two arguments.
Evaluating .const c under arithInterpretationWith applies constant to c.
Multiplications cost one; additions and constants are free. Multiplication by a scalar still costs one.
Additions cost one; multiplications and constants are free.
Evaluating the formal polynomial computed by a circuit, with coefficients in S, along a
ring homomorphism f : S →+* R agrees with evaluating the circuit in R with the constants mapped
by f.
Evaluating the formal polynomial computed by a circuit agrees with evaluating the circuit in the coefficient semiring. The converse need not hold over a finite field.
An interpretation is polynomial when every operation is given by a polynomial in its arguments.
The affine basis is polynomial.
The arithmetic basis is polynomial.
Arithmetic circuits have fan-in at most two.