binius_core/poly_commit/
pcs.rsuse crate::{
challenger::{CanObserve, CanSample, CanSampleBits},
transcript::{AdviceReader, AdviceWriter, CanRead, CanWrite},
};
use binius_field::{ExtensionField, PackedField, TowerField};
use binius_hal::ComputationBackend;
use binius_math::MultilinearExtension;
use std::ops::Deref;
pub trait PolyCommitScheme<P, FE>
where
P: PackedField,
FE: ExtensionField<P::Scalar> + TowerField,
{
type Commitment: Clone;
type Committed;
type Error: std::error::Error + Send + Sync + 'static;
fn n_vars(&self) -> usize;
fn commit<Data>(
&self,
polys: &[MultilinearExtension<P, Data>],
) -> Result<(Self::Commitment, Self::Committed), Self::Error>
where
Data: Deref<Target = [P]> + Send + Sync;
fn prove_evaluation<Data, Transcript, Backend>(
&self,
advice: &mut AdviceWriter,
transcript: &mut Transcript,
committed: &Self::Committed,
polys: &[MultilinearExtension<P, Data>],
query: &[FE],
backend: &Backend,
) -> Result<(), Self::Error>
where
Data: Deref<Target = [P]> + Send + Sync,
Transcript: CanObserve<FE>
+ CanObserve<Self::Commitment>
+ CanSample<FE>
+ CanSampleBits<usize>
+ CanWrite,
Backend: ComputationBackend;
fn verify_evaluation<Transcript, Backend>(
&self,
advice: &mut AdviceReader,
transcript: &mut Transcript,
commitment: &Self::Commitment,
query: &[FE],
values: &[FE],
backend: &Backend,
) -> Result<(), Self::Error>
where
Transcript: CanObserve<FE>
+ CanObserve<Self::Commitment>
+ CanSample<FE>
+ CanSampleBits<usize>
+ CanRead,
Backend: ComputationBackend;
fn proof_size(&self, n_polys: usize) -> usize;
}