use alloc::vec::Vec;
use core::fmt::Debug;
use p3_field::ExtensionField;
use p3_matrix::dense::RowMajorMatrix;
use p3_matrix::Matrix;
use serde::de::DeserializeOwned;
use serde::Serialize;
use crate::PolynomialSpace;
pub type Val<D> = <D as PolynomialSpace>::Val;
pub trait Pcs<Challenge, Challenger>
where
Challenge: ExtensionField<Val<Self::Domain>>,
{
type Domain: PolynomialSpace;
type Commitment: Clone + Serialize + DeserializeOwned;
type ProverData;
type Proof: Clone + Serialize + DeserializeOwned;
type Error: Debug;
fn natural_domain_for_degree(&self, degree: usize) -> Self::Domain;
#[allow(clippy::type_complexity)]
fn commit(
&self,
evaluations: Vec<(Self::Domain, RowMajorMatrix<Val<Self::Domain>>)>,
) -> (Self::Commitment, Self::ProverData);
fn get_evaluations_on_domain<'a>(
&self,
prover_data: &'a Self::ProverData,
idx: usize,
domain: Self::Domain,
) -> impl Matrix<Val<Self::Domain>> + 'a;
fn open(
&self,
rounds: Vec<(
&Self::ProverData,
Vec<
Vec<Challenge>,
>,
)>,
challenger: &mut Challenger,
) -> (OpenedValues<Challenge>, Self::Proof);
#[allow(clippy::type_complexity)]
fn verify(
&self,
rounds: Vec<(
Self::Commitment,
Vec<(
Self::Domain,
Vec<(
Challenge,
Vec<Challenge>,
)>,
)>,
)>,
proof: &Self::Proof,
challenger: &mut Challenger,
) -> Result<(), Self::Error>;
}
pub type OpenedValues<F> = Vec<OpenedValuesForRound<F>>;
pub type OpenedValuesForRound<F> = Vec<OpenedValuesForMatrix<F>>;
pub type OpenedValuesForMatrix<F> = Vec<OpenedValuesForPoint<F>>;
pub type OpenedValuesForPoint<F> = Vec<F>;