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>

source

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>)

source

pub fn get_number_of_additional_columns(&self) -> usize

Return the number of additional columns added by quadraticization

source

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.
source

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.

source

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V