Skip to main content

sp1_hypercube/logup_gkr/
proof.rs

1use std::collections::BTreeMap;
2
3use serde::{Deserialize, Serialize};
4use slop_alloc::{Backend, CpuBackend};
5use slop_multilinear::{Mle, MleEval, Point};
6use slop_sumcheck::PartialSumcheckProof;
7
8/// The output of the log-up GKR circuit.
9#[derive(Debug, Serialize, Deserialize, Clone)]
10#[serde(bound(serialize = "Mle<EF, B>: Serialize", deserialize = "Mle<EF, B>: Deserialize<'de>"))]
11pub struct LogUpGkrOutput<EF, B: Backend = CpuBackend> {
12    /// Numerator
13    pub numerator: Mle<EF, B>,
14    /// Denominator
15    pub denominator: Mle<EF, B>,
16}
17
18/// The proof for a single round of the log-up GKR circuit.
19#[derive(Debug, Serialize, Deserialize, Clone)]
20pub struct LogupGkrRoundProof<EF> {
21    /// The numerator of the numerator with last coordinate being 0.
22    pub numerator_0: EF,
23    /// The numerator of the numerator with last coordinate being 1.
24    pub numerator_1: EF,
25    /// The denominator of the denominator with last coordinate being 0.
26    pub denominator_0: EF,
27    /// The denominator of the denominator with last coordinate being 1.
28    pub denominator_1: EF,
29    /// The sumcheck proof for the round.
30    pub sumcheck_proof: PartialSumcheckProof<EF>,
31}
32
33/// The proof for the log-up GKR circuit.
34#[derive(Debug, Serialize, Deserialize, Clone)]
35pub struct LogupGkrProof<EF> {
36    /// The output of the circuit.
37    pub circuit_output: LogUpGkrOutput<EF>,
38    /// The proof for each round.
39    pub round_proofs: Vec<LogupGkrRoundProof<EF>>,
40    /// The evaluations for each chip.
41    pub logup_evaluations: LogUpEvaluations<EF>,
42}
43
44/// The evaluations for a chip
45#[derive(Debug, Serialize, Deserialize, Clone)]
46pub struct ChipEvaluation<EF> {
47    /// The evaluations of the main trace.
48    pub main_trace_evaluations: MleEval<EF>,
49    /// The evaluations of the preprocessed trace.
50    pub preprocessed_trace_evaluations: Option<MleEval<EF>>,
51}
52
53#[derive(Debug, Serialize, Deserialize, Clone)]
54/// The data passed from the GKR prover to the zerocheck prover.
55pub struct LogUpEvaluations<EF> {
56    /// The point at which the evaluations are made.
57    pub point: Point<EF>,
58    /// The evaluations for each chip.
59    pub chip_openings: BTreeMap<String, ChipEvaluation<EF>>,
60}