Struct folding::FoldingScheme
source · pub struct FoldingScheme<'a, CF: FoldingConfig> {
pub expression: IntegratedFoldingExpr<CF>,
pub srs: &'a CF::Srs,
pub domain: Radix2EvaluationDomain<<<CF as FoldingConfig>::Curve as AffineRepr>::ScalarField>,
pub zero_vec: Evaluations<<<CF as FoldingConfig>::Curve as AffineRepr>::ScalarField, Radix2EvaluationDomain<<<CF as FoldingConfig>::Curve as AffineRepr>::ScalarField>>,
pub structure: CF::Structure,
pub extended_witness_generator: ExtendedWitnessGenerator<CF>,
/* private fields */
}
Fields§
§expression: IntegratedFoldingExpr<CF>
§srs: &'a CF::Srs
§domain: Radix2EvaluationDomain<<<CF as FoldingConfig>::Curve as AffineRepr>::ScalarField>
§zero_vec: Evaluations<<<CF as FoldingConfig>::Curve as AffineRepr>::ScalarField, Radix2EvaluationDomain<<<CF as FoldingConfig>::Curve as AffineRepr>::ScalarField>>
§structure: CF::Structure
§extended_witness_generator: ExtendedWitnessGenerator<CF>
Implementations§
source§impl<'a, CF: FoldingConfig> FoldingScheme<'a, CF>
impl<'a, CF: FoldingConfig> FoldingScheme<'a, CF>
pub fn new( constraints: Vec<FoldingCompatibleExpr<CF>>, srs: &'a CF::Srs, domain: Radix2EvaluationDomain<<<CF as FoldingConfig>::Curve as AffineRepr>::ScalarField>, structure: &CF::Structure ) -> (Self, FoldingCompatibleExpr<CF>)
sourcepub fn get_number_of_additional_columns(&self) -> usize
pub fn get_number_of_additional_columns(&self) -> usize
Return the number of additional columns added by quadraticization
sourcepub fn fold_instance_witness_pair<A, B, Sponge>(
&self,
a: A,
b: B,
fq_sponge: &mut Sponge
) -> FoldingOutput<CF>where
A: RelaxablePair<CF::Curve, CF::Instance, CF::Witness>,
B: RelaxablePair<CF::Curve, CF::Instance, CF::Witness>,
Sponge: FqSponge<<<CF as FoldingConfig>::Curve as AffineRepr>::BaseField, CF::Curve, <<CF as FoldingConfig>::Curve as AffineRepr>::ScalarField>,
pub fn fold_instance_witness_pair<A, B, Sponge>( &self, a: A, b: B, fq_sponge: &mut Sponge ) -> FoldingOutput<CF>where A: RelaxablePair<CF::Curve, CF::Instance, CF::Witness>, B: RelaxablePair<CF::Curve, CF::Instance, CF::Witness>, Sponge: FqSponge<<<CF as FoldingConfig>::Curve as AffineRepr>::BaseField, CF::Curve, <<CF as FoldingConfig>::Curve as AffineRepr>::ScalarField>,
This is the main entry point to fold two instances and their witnesses. The process is as follows:
- Both pairs are relaxed.
- Both witnesses and instances are extended, i.e. all polynomials are reduced to degree 2 and additional constraints are added to the expression.
- While computing the commitments to the additional columns, the commitments are added into a list to absorb them into the sponge later.
- The error terms are computed and committed.
- The sponge absorbs the commitments and challenges.
sourcepub fn fold_instance_pair<A, B, Sponge>(
&self,
a: A,
b: B,
error_commitments: [PolyComm<CF::Curve>; 2],
fq_sponge: &mut Sponge
) -> RelaxedInstance<CF::Curve, CF::Instance>where
A: RelaxableInstance<CF::Curve, CF::Instance>,
B: RelaxableInstance<CF::Curve, CF::Instance>,
Sponge: FqSponge<<<CF as FoldingConfig>::Curve as AffineRepr>::BaseField, CF::Curve, <<CF as FoldingConfig>::Curve as AffineRepr>::ScalarField>,
pub fn fold_instance_pair<A, B, Sponge>( &self, a: A, b: B, error_commitments: [PolyComm<CF::Curve>; 2], fq_sponge: &mut Sponge ) -> RelaxedInstance<CF::Curve, CF::Instance>where A: RelaxableInstance<CF::Curve, CF::Instance>, B: RelaxableInstance<CF::Curve, CF::Instance>, Sponge: FqSponge<<<CF as FoldingConfig>::Curve as AffineRepr>::BaseField, CF::Curve, <<CF as FoldingConfig>::Curve as AffineRepr>::ScalarField>,
Fold two relaxable instances into a relaxed instance.
It is parametrized by two different types A
and B
that represent
“relaxable” instances to be able to fold a normal and “already relaxed”
instance.
sourcepub fn verify_fold<Sponge>(
&self,
left_instance: RelaxedInstance<CF::Curve, CF::Instance>,
right_instance: RelaxedInstance<CF::Curve, CF::Instance>,
t_0: PolyComm<CF::Curve>,
t_1: PolyComm<CF::Curve>,
fq_sponge: &mut Sponge
) -> RelaxedInstance<CF::Curve, CF::Instance>where
Sponge: FqSponge<<<CF as FoldingConfig>::Curve as AffineRepr>::BaseField, CF::Curve, <<CF as FoldingConfig>::Curve as AffineRepr>::ScalarField>,
pub fn verify_fold<Sponge>( &self, left_instance: RelaxedInstance<CF::Curve, CF::Instance>, right_instance: RelaxedInstance<CF::Curve, CF::Instance>, t_0: PolyComm<CF::Curve>, t_1: PolyComm<CF::Curve>, fq_sponge: &mut Sponge ) -> RelaxedInstance<CF::Curve, CF::Instance>where Sponge: FqSponge<<<CF as FoldingConfig>::Curve as AffineRepr>::BaseField, CF::Curve, <<CF as FoldingConfig>::Curve as AffineRepr>::ScalarField>,
Verifier of the folding scheme; returns a new folded instance, which can be then compared with the one claimed to be the real one.
Auto Trait Implementations§
impl<'a, CF> RefUnwindSafe for FoldingScheme<'a, CF>where <CF as FoldingConfig>::Challenge: RefUnwindSafe, <CF as FoldingConfig>::Column: RefUnwindSafe, <<CF as FoldingConfig>::Curve as AffineRepr>::ScalarField: RefUnwindSafe, <CF as FoldingConfig>::Selector: RefUnwindSafe, <CF as FoldingConfig>::Srs: RefUnwindSafe, <CF as FoldingConfig>::Structure: RefUnwindSafe,
impl<'a, CF> Send for FoldingScheme<'a, CF>where <CF as FoldingConfig>::Challenge: Send, <CF as FoldingConfig>::Column: Send, <CF as FoldingConfig>::Selector: Send, <CF as FoldingConfig>::Srs: Sync, <CF as FoldingConfig>::Structure: Send,
impl<'a, CF> Sync for FoldingScheme<'a, CF>where <CF as FoldingConfig>::Challenge: Sync, <CF as FoldingConfig>::Column: Sync, <CF as FoldingConfig>::Selector: Sync, <CF as FoldingConfig>::Srs: Sync, <CF as FoldingConfig>::Structure: Sync,
impl<'a, CF> Unpin for FoldingScheme<'a, CF>where <CF as FoldingConfig>::Challenge: Unpin, <CF as FoldingConfig>::Column: Unpin, <<CF as FoldingConfig>::Curve as AffineRepr>::ScalarField: Unpin, <CF as FoldingConfig>::Selector: Unpin, <CF as FoldingConfig>::Structure: Unpin,
impl<'a, CF> UnwindSafe for FoldingScheme<'a, CF>where <CF as FoldingConfig>::Challenge: UnwindSafe, <CF as FoldingConfig>::Column: UnwindSafe, <<CF as FoldingConfig>::Curve as AffineRepr>::ScalarField: UnwindSafe, <CF as FoldingConfig>::Selector: UnwindSafe, <CF as FoldingConfig>::Srs: RefUnwindSafe, <CF as FoldingConfig>::Structure: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more