binius_core::protocols::abstract_sumcheck

Struct CommonProversState

source
pub struct CommonProversState<MultilinearId, PW, M, Backend>
where MultilinearId: Hash + Eq + Sync, PW: PackedField, M: MultilinearPoly<PW> + Send + Sync, Backend: ComputationBackend,
{ /* private fields */ }
Expand description

A common provers state for a generalized batched sumcheck protocol.

The family of generalized sumcheck protocols includes regular sumcheck, zerocheck and others. The zerocheck case permits many important optimizations, enumerated in Gruen24. These algorithms are used to prove the interactive multivariate sumcheck protocol in the specific case that the polynomial is a composite of multilinears. This prover state is responsible for updating and evaluating the composed multilinears.

Once initialized, the expected caller behavior is, for a total of n_rounds:

  1. At the beginning of each step, call Self::extend with multilinears introduced in this round
  2. Then call Self::pre_execute_rounds to perform query expansion, folding, and other bookkeeping.
  3. Call Self::calculate_round_coeffs on each multilinear subset with an appropriate evaluator.

We associate with each multilinear a switchover round number, which controls small field optimization and corresponding time/memory tradeoff. In rounds $0, \ldots, switchover-1$ the partial evaluation of a specific multilinear is obtained by doing $2^{n\_vars - round}$ inner products, with total time complexity proportional to the number of polynomial coefficients.

After switchover the inner products are stored in a new MLE in large field, which is halved on each round. There are two tradeoffs at play:

  1. Pre-switchover rounds perform Small * Large field multiplications, but do $2^{round}$ as many of them.
  2. Pre-switchover rounds require no additional memory, but initial folding allocates a new MLE in a large field that is $2^{switchover}$ times smaller - for example for 1-bit polynomial and 128-bit large field a switchover of 7 would require additional memory identical to the polynomial size.

NB. Note that switchover=0 does not make sense, as first round is never folded. Also note that switchover rounds are numbered relative introduction round.

Implementations§

source§

impl<MultilinearId, PW, M, Backend> CommonProversState<MultilinearId, PW, M, Backend>
where MultilinearId: Clone + Hash + Eq + Sync + Debug, PW: PackedField, M: MultilinearPoly<PW> + Sync + Send, Backend: ComputationBackend,

source

pub fn new( n_vars: usize, switchover_fn: impl Fn(usize) -> usize + 'static, backend: Backend, ) -> Self

source

pub fn extend( &mut self, multilinears: impl IntoIterator<Item = (MultilinearId, M)>, ) -> Result<(), Error>

source

pub fn pre_execute_rounds( &mut self, prev_rd_challenge: Option<PW::Scalar>, ) -> Result<(), PolynomialError>

source

pub fn calculate_round_coeffs<VS>( &self, multilinear_ids: &[MultilinearId], evaluator: impl AbstractSumcheckEvaluator<PW, VertexState = VS>, current_round_sum: PW::Scalar, vertex_state_iterator: impl IndexedParallelIterator<Item = VS>, ) -> Result<Vec<PW::Scalar>, Error>

Compute the sum of the partial polynomial evaluations over the hypercube.

Auto Trait Implementations§

§

impl<MultilinearId, PW, M, Backend> Freeze for CommonProversState<MultilinearId, PW, M, Backend>
where Backend: Freeze,

§

impl<MultilinearId, PW, M, Backend> !RefUnwindSafe for CommonProversState<MultilinearId, PW, M, Backend>

§

impl<MultilinearId, PW, M, Backend> !Send for CommonProversState<MultilinearId, PW, M, Backend>

§

impl<MultilinearId, PW, M, Backend> !Sync for CommonProversState<MultilinearId, PW, M, Backend>

§

impl<MultilinearId, PW, M, Backend> Unpin for CommonProversState<MultilinearId, PW, M, Backend>
where Backend: Unpin, MultilinearId: Unpin, <Backend as ComputationBackend>::Vec<PW>: Unpin, M: Unpin, PW: Unpin,

§

impl<MultilinearId, PW, M, Backend> !UnwindSafe for CommonProversState<MultilinearId, PW, M, Backend>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where 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.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = _

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, U> TryFrom<U> for T
where U: Into<T>,

source§

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 T
where U: TryFrom<T>,

source§

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 T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more