sp1_recursion_program/
commit.rs

1use p3_commit::{LagrangeSelectors, PolynomialSpace};
2use sp1_recursion_compiler::ir::{Array, Builder, Config, Ext, FromConstant, Usize};
3
4use crate::fri::types::{FriConfigVariable, TwoAdicPcsRoundVariable};
5
6/// Reference: [p3_commit::PolynomialSpace]
7pub trait PolynomialSpaceVariable<C: Config>: Sized + FromConstant<C> {
8    type Constant: PolynomialSpace<Val = C::F>;
9
10    fn next_point(&self, builder: &mut Builder<C>, point: Ext<C::F, C::EF>) -> Ext<C::F, C::EF>;
11
12    fn selectors_at_point(
13        &self,
14        builder: &mut Builder<C>,
15        point: Ext<C::F, C::EF>,
16    ) -> LagrangeSelectors<Ext<C::F, C::EF>>;
17
18    fn zp_at_point(&self, builder: &mut Builder<C>, point: Ext<C::F, C::EF>) -> Ext<C::F, C::EF>;
19
20    fn split_domains(
21        &self,
22        builder: &mut Builder<C>,
23        log_num_chunks: impl Into<Usize<C::N>>,
24        num_chunks: impl Into<Usize<C::N>>,
25    ) -> Array<C, Self>;
26
27    fn split_domains_const(&self, _: &mut Builder<C>, log_num_chunks: usize) -> Vec<Self>;
28
29    fn create_disjoint_domain(
30        &self,
31        builder: &mut Builder<C>,
32        log_degree: Usize<C::N>,
33        config: Option<FriConfigVariable<C>>,
34    ) -> Self;
35}
36
37/// Reference: [p3_commit::Pcs]
38pub trait PcsVariable<C: Config, Challenger> {
39    type Domain: PolynomialSpaceVariable<C>;
40
41    type Commitment;
42
43    type Proof;
44
45    fn natural_domain_for_log_degree(
46        &self,
47        builder: &mut Builder<C>,
48        log_degree: Usize<C::N>,
49    ) -> Self::Domain;
50
51    fn verify(
52        &self,
53        builder: &mut Builder<C>,
54        rounds: Array<C, TwoAdicPcsRoundVariable<C>>,
55        proof: Self::Proof,
56        challenger: &mut Challenger,
57    );
58}