Secure Evaluations
Similar to CircleEvaluation
, SecureEvaluation
is a point-value representation of a polynomial whose evaluations over the CircleDomain
are from the SecureField
(an alias for QM31
). This is implemented as follows:
pub struct SecureEvaluation<B: ColumnOps<BaseField>, EvalOrder> {
pub domain: CircleDomain,
pub values: SecureColumnByCoords<B>,
_eval_order: PhantomData<EvalOrder>,
}
As discussed in the previous subsection, each SecureField
element is represented by four base field elements and stored in four consecutive columns. Thus the evaluations are represented as SecureColumnByCoords
, as shown above.
Similar to CircleEvaluation
, we can interpolate a SecureCirclePoly
with coefficients from the SecureField
as shown below:
impl<B: PolyOps> SecureEvaluation<B, BitReversedOrder> {
/// Computes a minimal [`SecureCirclePoly`] that evaluates to the same values as this
/// evaluation, using precomputed twiddles.
pub fn interpolate_with_twiddles(self, twiddles: &TwiddleTree<B>) -> SecureCirclePoly<B> {
let domain = self.domain;
let cols = self.values.columns;
SecureCirclePoly(cols.map(|c| {
CircleEvaluation::<B, BaseField, BitReversedOrder>::new(domain, c)
.interpolate_with_twiddles(twiddles)
}))
}
}
Secure Circle Polynomials
Similar to CirclePoly
, SecureCirclePoly
is a coefficient representation of a polynomial whose coefficients are from the SecureField
. As discussed in the earlier section, we can define a circle polynomial as follows:
Here, are the coefficients from SecureField
(i.e. ). We can represent the coefficient using four elements from the BaseField
(i.e. ) as follows:
where . Substituting the above representation in the equation of we get:
Thus we can represent a SecureCirclePoly
using four CirclePoly
: and as follows:
where is a CirclePoly
with coefficients , similarly for and . This is implemented as follows:
pub struct SecureCirclePoly<B: ColumnOps<BaseField>>(pub [CirclePoly<B>; SECURE_EXTENSION_DEGREE]);
Here, SECURE_EXTENSION_DEGREE
is the degree of extension of the SecureField
, which is 4.
Similar to CirclePoly
, we can evaluate the SecureCirclePoly
at points on the given CircleDomain
which outputs the SecureEvaluation
.
pub fn evaluate_with_twiddles(
&self,
domain: CircleDomain,
twiddles: &TwiddleTree<B>,
) -> SecureEvaluation<B, BitReversedOrder> {
let polys = self.0.each_ref();
let columns = polys.map(|poly| poly.evaluate_with_twiddles(domain, twiddles).values);
SecureEvaluation::new(domain, SecureColumnByCoords { columns })
}
In the next section, we will see how the interpolate
and evaluate
functions convert between the two polynomial representations using Circle FFT. As you may have noticed, the twiddles are precomputed for efficiency, and we will explore this in the next section on Circle FFT.