pub struct Witness<'a, 'alloc, A: Allocator, P: PackedField> {Show 14 fields
pub a_exponents: &'a [Word],
pub a_prodcheck: ProdcheckProver<'alloc, A, P>,
pub a_root: FieldVec<P, A>,
pub b_exponents: &'a [Word],
pub b_leaves: FieldVec<P, A>,
pub b_prodcheck: ProdcheckProver<'alloc, A, P>,
pub b_root: FieldVec<P, A>,
pub c_lo_exponents: &'a [Word],
pub c_lo_prodcheck: ProdcheckProver<'alloc, A, P>,
pub c_lo_root: FieldVec<P, A>,
pub c_hi_exponents: &'a [Word],
pub c_hi_prodcheck: ProdcheckProver<'alloc, A, P>,
pub c_hi_root: FieldVec<P, A>,
pub tables: Vec<FieldVec<P, A>>,
}Expand description
An integer multiplication protocol witness. Created from integer slices, consumed during proving.
The statement being proven is a * b = c, where c is represented as a pair (c_lo, c_hi):
Word::BITS-wide multiplicands with a double-wide product.
For each of a, c_lo, c_hi the exponent words split into N_LIMBS limbs, and the
constant-base exponentiation factors as a product of N_LIMBS limb columns — column l reads
the row limb_l(e) of the power table of the base $G^{2^{wl}}$ (where $w$ is the limb bit
width). The columns are concatenated into one (n_vars + LOG_N_LIMBS)-variate buffer with the
limb index in the high bits, and a ProdcheckProver is constructed over each:
aandc_loexponentiate the multiplicative group generator $G$c_hiexponentiates $G^{2^{2^m}}$bselects a variable base (the root of theatree) per bit, overWord::BITSper-bit leaves as before
The shared power table $T\colon i \mapsto G^i$ over $2^w$ rows is retained for the Phase 5 logup* lookup.
Protocol proves that ${(G^a)}^b = G^{c\_lo} \times (G^{2^{2^m}})^{c\_hi}$, which is equivalent
to $a \times b = c$ modulo $2^{2^{m+1}} - 1$. The special case of 0 * 0 = 1 is handled
separately.
Fields§
§a_exponents: &'a [Word]The exponents for a (needed for the phase 5 lookup indices and parity zerocheck on
a_0).
a_prodcheck: ProdcheckProver<'alloc, A, P>Prodcheck prover for the a exponentiation tree (leaf layer retained).
a_root: FieldVec<P, A>The root of the a tree (product of all leaves element-wise); the b variable base.
b_exponents: &'a [Word]The exponents for b (needed for phase 5).
b_leaves: FieldVec<P, A>Concatenated b leaves for prodcheck: [L_0, L_1, …, L_{2^k-1}]. Has log_len = n_vars + Word::LOG_BITS.
b_prodcheck: ProdcheckProver<'alloc, A, P>The prover for the prodcheck reduction on b_leaves.
b_root: FieldVec<P, A>The root of the b tree (product of all leaves element-wise).
c_lo_exponents: &'a [Word]The exponents for c_lo (needed for the phase 5 lookup indices, parity zerocheck on
c_lo_0, and the raw per-bit output evaluations).
c_lo_prodcheck: ProdcheckProver<'alloc, A, P>Prodcheck prover for the c_lo exponentiation tree (leaf layer retained).
c_lo_root: FieldVec<P, A>The root of the c_lo tree.
c_hi_exponents: &'a [Word]The exponents for c_hi (needed for the phase 5 lookup indices and raw per-bit output
evaluations).
c_hi_prodcheck: ProdcheckProver<'alloc, A, P>Prodcheck prover for the c_hi exponentiation tree (leaf layer retained).
c_hi_root: FieldVec<P, A>The root of the c_hi tree.
tables: Vec<FieldVec<P, A>>The 2·N_LIMBS twisted power tables: tables[s][i] = (G^{2^{ws}})^i. Limb column (t, l)
is a gather from table s(t, l); tables[0] is the shared table read by the Phase 5
logup* lookup.
Implementations§
Source§impl<'a, 'alloc, A: Allocator, P: PackedField> Witness<'a, 'alloc, A, P>
impl<'a, 'alloc, A: Allocator, P: PackedField> Witness<'a, 'alloc, A, P>
Sourcepub fn a_prodcheck(&self) -> &ProdcheckProver<'alloc, A, P>
pub fn a_prodcheck(&self) -> &ProdcheckProver<'alloc, A, P>
Prodcheck prover for the a exponentiation tree (leaf layer retained).
Sourcepub fn a_root(&self) -> &FieldVec<P, A>
pub fn a_root(&self) -> &FieldVec<P, A>
The root of the a tree (product of all leaves element-wise); the b variable base.
Sourcepub fn b_leaves(&self) -> &FieldVec<P, A>
pub fn b_leaves(&self) -> &FieldVec<P, A>
Concatenated b leaves for prodcheck: [L_0, L_1, …, L_{2^k-1}]. Has log_len = n_vars + Word::LOG_BITS.
Sourcepub fn b_prodcheck(&self) -> &ProdcheckProver<'alloc, A, P>
pub fn b_prodcheck(&self) -> &ProdcheckProver<'alloc, A, P>
The prover for the prodcheck reduction on b_leaves.
Sourcepub fn b_root(&self) -> &FieldVec<P, A>
pub fn b_root(&self) -> &FieldVec<P, A>
The root of the b tree (product of all leaves element-wise).
Sourcepub fn c_lo_prodcheck(&self) -> &ProdcheckProver<'alloc, A, P>
pub fn c_lo_prodcheck(&self) -> &ProdcheckProver<'alloc, A, P>
Prodcheck prover for the c_lo exponentiation tree (leaf layer retained).
Sourcepub fn c_hi_prodcheck(&self) -> &ProdcheckProver<'alloc, A, P>
pub fn c_hi_prodcheck(&self) -> &ProdcheckProver<'alloc, A, P>
Prodcheck prover for the c_hi exponentiation tree (leaf layer retained).
Source§impl<'a, 'alloc, A, F, P> Witness<'a, 'alloc, A, P>
impl<'a, 'alloc, A, F, P> Witness<'a, 'alloc, A, P>
Sourcepub fn new(
alloc: &'alloc A,
a: &'a [Word],
b: &'a [Word],
c_lo: &'a [Word],
c_hi: &'a [Word],
) -> Result<Self, Error>
pub fn new( alloc: &'alloc A, a: &'a [Word], b: &'a [Word], c_lo: &'a [Word], c_hi: &'a [Word], ) -> Result<Self, Error>
Constructs a new integer multiplication witness from the statement.
The GKR prodcheck provers draw their layer buffers from alloc.
The four columns must have equal length, but need not have a power-of-two one: the reduction
runs over the constraint axis of 2^ceil(log2(n)) rows, and the rows past the columns’ end
read as Word::ZERO. Every buffer built here still spans that whole axis, and each derives
its own value for a padding row rather than being handed one. In the product-check trees
that value is the multiplicative identity, not zero: a zero exponent word indexes row 0
of a power table, which holds base^0 = 1. So no tree’s product moves.
Trait Implementations§
Auto Trait Implementations§
impl<'a, 'alloc, A, P> Freeze for Witness<'a, 'alloc, A, P>
impl<'a, 'alloc, A, P> RefUnwindSafe for Witness<'a, 'alloc, A, P>
impl<'a, 'alloc, A, P> Send for Witness<'a, 'alloc, A, P>
impl<'a, 'alloc, A, P> Sync for Witness<'a, 'alloc, A, P>
impl<'a, 'alloc, A, P> Unpin for Witness<'a, 'alloc, A, P>
impl<'a, 'alloc, A, P> UnsafeUnpin for Witness<'a, 'alloc, A, P>
impl<'a, 'alloc, A, P> UnwindSafe for Witness<'a, 'alloc, A, P>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more