kimchi/circuits/polynomial.rs
1//! This module implements Plonk prover polynomials primitive.
2
3pub use super::wires::COLUMNS;
4use ark_ff::FftField;
5use ark_poly::{univariate::DensePolynomial, Evaluations, Radix2EvaluationDomain as D};
6
7// PLONK
8
9/// Evaluations of the wires and permutation
10#[derive(Clone)]
11pub struct WitnessEvals<F: FftField> {
12 /// wire evaluations
13 pub w: [Evaluations<F, D<F>>; COLUMNS],
14 /// permutation evaluations
15 pub z: Evaluations<F, D<F>>,
16}
17
18/// The witness and the permutation accumulator, evaluated over `d8`.
19///
20/// Only the values the quotient is built from: constraints referring to the
21/// next row are evaluated by shifting the index into these same evaluations,
22/// so no separately shifted copy of the witness is kept.
23#[derive(Clone)]
24pub struct WitnessOverDomains<F: FftField> {
25 /// The wires and the permutation accumulator at each row.
26 pub this: WitnessEvals<F>,
27 /// The permutation accumulator one row on, which the permutation argument
28 /// compares against the accumulator in [`Self::this`].
29 pub z_next: Evaluations<F, D<F>>,
30}
31
32// PLOOKUP
33
34#[derive(Clone)]
35pub struct LookupEvals<F: FftField> {
36 /// aggregation
37 pub l: Evaluations<F, D<F>>,
38 /// lookup witness
39 pub lw: Evaluations<F, D<F>>,
40 /// lookup multiset
41 pub h1: Evaluations<F, D<F>>,
42 /// lookup multiset
43 pub h2: Evaluations<F, D<F>>,
44}
45
46#[derive(Clone)]
47pub struct LookupShifts<F: FftField> {
48 /// this wire evaluations
49 pub this: LookupEvals<F>,
50 /// next wire evaluations
51 pub next: LookupEvals<F>,
52}
53
54#[derive(Clone)]
55pub struct LookupPolys<F: FftField> {
56 /// aggregation
57 pub l: DensePolynomial<F>,
58 /// lookup witness
59 pub lw: DensePolynomial<F>,
60 /// lookup multiset
61 pub h1: DensePolynomial<F>,
62 /// lookup multiset
63 pub h2: DensePolynomial<F>,
64}