openvm_native_recursion/
commit.rs

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