zinc_piop/ideal_check/
structs.rs1use itertools::Itertools;
2use zinc_poly::univariate::dynamic::{DynamicPolyVec, DynamicPolynomial};
3use zinc_transcript::traits::{ConstTranscribable, GenTranscribable, Transcribable};
4
5#[derive(Clone, Debug, PartialEq, Eq)]
6pub struct Proof<F> {
7 pub combined_mle_values: Vec<DynamicPolynomial<F>>,
8}
9
10impl<F> Proof<F> {
11 pub fn try_map<T, E>(&self, f: impl FnMut(&F) -> Result<T, E> + Copy) -> Result<Proof<T>, E> {
15 Ok(Proof {
16 combined_mle_values: self
17 .combined_mle_values
18 .iter()
19 .map(|p| p.try_map(f))
20 .try_collect()?,
21 })
22 }
23}
24
25impl<F> GenTranscribable for Proof<F>
26where
27 F: ConstTranscribable,
28{
29 fn read_transcription_bytes_exact(bytes: &[u8]) -> Self {
30 let combined_mle_values = DynamicPolyVec::read_transcription_bytes_exact(bytes).0;
31 Self {
32 combined_mle_values,
33 }
34 }
35
36 fn write_transcription_bytes_exact(&self, buf: &mut [u8]) {
37 DynamicPolyVec::reinterpret(&self.combined_mle_values).write_transcription_bytes_exact(buf);
38 }
39}
40
41impl<F> Transcribable for Proof<F>
42where
43 F: ConstTranscribable,
44{
45 fn get_num_bytes(&self) -> usize {
46 DynamicPolyVec::reinterpret(&self.combined_mle_values).get_num_bytes()
47 }
48}
49
50#[derive(Clone, Debug)]
51pub struct VerifierSubclaim<F> {
52 pub evaluation_point: Vec<F>,
53 pub values: Vec<DynamicPolynomial<F>>,
54}