Skip to main content

slop_sumcheck/
poly.rs

1use slop_algebra::{Field, UnivariatePolynomial};
2
3/// The basic functionality required of a struct for which a sumcheck proof can be generated.
4pub trait SumcheckPolyBase {
5    fn num_variables(&self) -> u32;
6}
7
8pub trait ComponentPoly<K: Field> {
9    fn get_component_poly_evals(&self) -> Vec<K>;
10}
11
12/// The fix_first_variable function applied to a sumcheck's first round's polynomial.
13pub trait SumcheckPolyFirstRound<K: Field>: SumcheckPolyBase {
14    type NextRoundPoly: SumcheckPoly<K>;
15    fn fix_t_variables(self, alpha: K, t: usize) -> Self::NextRoundPoly;
16
17    fn sum_as_poly_in_last_t_variables(
18        &self,
19        claim: Option<K>,
20        t: usize,
21    ) -> UnivariatePolynomial<K>;
22}
23
24/// The fix_first_variable function applied to a sumcheck's post first rounds' polynomial.
25pub trait SumcheckPoly<K: Field>: SumcheckPolyBase + ComponentPoly<K> + Sized {
26    fn fix_last_variable(self, alpha: K) -> Self;
27
28    fn sum_as_poly_in_last_variable(&self, claim: Option<K>) -> UnivariatePolynomial<K>;
29}