Circle Evaluations and Polynomials
A polynomial can be represented in two main ways:- Point-value representation: as evaluations over a domain
- Coefficient representation: as coefficients with respect to some basis
Point-value representation
In S-two, the evaluations of a polynomial over aCircleDomain are stored using the struct CircleEvaluation, implemented as follows:
CircleDomain) and the evaluations (i.e. values) have the same ordering (i.e. EvalOrder) which can either be NaturalOrder or BitReversedOrder.
Now given the evaluations over a domain as CircleEvaluation we can interpolate a circle polynomial using the following functions:
PolyOps is a trait that defines operations on BaseField polynomials, such as interpolation and evaluation. Now before looking into the representation of the circle polynomial (i.e. CirclePoly), let us first look into some theory on polynomials over the circle.
Polynomials over the circle
Let be an extension of the Mersenne prime field . Then represents the ring of bivariate polynomials with coefficients in . The circle polynomials are bivariate polynomials over quotient by the ideal . The space of these bivariate polynomials over the circle curve of total degree is denoted by . For any polynomial , we can substitute all the higher degree terms of with the equation of circle and reduce to the form: The above form is called the canonical representation of any polynomial . Since is of total degree , has degree and has degree . Thus an alternate representation of the space is as follows: From the above representation we can see that the space is spanned by the following monomial basis: The dimension of is the number of monomial basis elements, which is . As a developer, you can usually ignore most of these details, since concepts like polynomial space and basis do not explicitly appear in the S-two implementation. However, they do arise implicitly in the Circle FFT algorithm, as we will see in the next section. Now let us describe the coefficient representation and how the circle polynomials are implemented in S-two.Coefficient representation
Given the evaluations over a domain (i.e.CircleEvaluation) we can compute the coefficients of a polynomial (i.e. CirclePoly) with respect to some basis using the interpolate function. The coefficients are stored as follows:
interpolate function computes the coefficients with respect to the following basis:
where
- is the squaring map on the -coordinate i.e. and is applying the squaring map times, for example
- is log of the size of the
CircleDomain - and is the binary representation of , i.e.,
interpolate function computes coefficients for polynomials of the form:
This polynomial form and its underlying basis are implicit in the Circle FFT construction, as we will see in the next section. However, as discussed earlier, you can largely ignore these details and simply view a polynomial as a set of evaluations over a domain, with its coefficients computed via the FFT algorithm.
Now given the coefficient representation as CirclePoly, we can evaluate the polynomial over a given domain (i.e. compute the CircleEvaluation) using the following functions:
SecureField.