pub struct FracAddCircuit<'a, A: Allocator, P: PackedField> { /* private fields */ }Expand description
The materialized layers of a fractional addition circuit.
Each layer holds the numerator and denominator of one fractional term per node. A layer is half the width of the one below it, each node adding its two children: $$\frac{a_0}{b_0} + \frac{a_1}{b_1} = \frac{a_0b_1 + a_1b_0}{b_0b_1}$$
Implementations§
Source§impl<'a, A, F, P> FracAddCircuit<'a, A, P>
impl<'a, A, F, P> FracAddCircuit<'a, A, P>
Sourcepub fn build(
k: usize,
alloc: &'a A,
witness: Fraction<FieldVec<P, A>>,
) -> (Self, Fraction<FieldVec<P, A>>)
pub fn build( k: usize, alloc: &'a A, witness: Fraction<FieldVec<P, A>>, ) -> (Self, Fraction<FieldVec<P, A>>)
Materializes every layer of the circuit from witness.
Returns the circuit beside sums, its root layer.
sums holds the fractional addition over all k reduced variables.
§Arguments
k- How many variables to reduce, one sibling fractional addition per step.witness- The witness numerator/denominator layers
§Preconditions
witness.num.log_len() >= k
Sourcepub fn pop_layer(
&mut self,
claim: FracAddEvalClaim<F>,
) -> LayerProver<'a, A, F, P>
pub fn pop_layer( &mut self, claim: FracAddEvalClaim<F>, ) -> LayerProver<'a, A, F, P>
Pops the widest remaining layer as the MLE-check prover that reduces it.
The returned prover owns the popped buffers and borrows only the allocator. So it outlives this borrow, and the circuit stays in place while a caller drives it.
§Preconditions
self.n_layers() >= 1
Sourcepub fn prove(
self,
claim: FracAddEvalClaim<F>,
channel: &mut impl IPProverChannel<F>,
) -> FracAddEvalClaim<F>
pub fn prove( self, claim: FracAddEvalClaim<F>, channel: &mut impl IPProverChannel<F>, ) -> FracAddEvalClaim<F>
Runs the fractional addition check protocol and returns the final evaluation claims.
This consumes the circuit, reducing from the smallest layer back to the largest.
§Arguments
claim- The numerator and denominator claims at their shared evaluation point.channel- The channel for sending prover messages and sampling challenges.
§Preconditions
claim.point.len() == witness.log_len() - k, forkthe number of reduction layers.
Trait Implementations§
Auto Trait Implementations§
impl<'a, A, P> Freeze for FracAddCircuit<'a, A, P>
impl<'a, A, P> RefUnwindSafe for FracAddCircuit<'a, A, P>
impl<'a, A, P> Send for FracAddCircuit<'a, A, P>
impl<'a, A, P> Sync for FracAddCircuit<'a, A, P>
impl<'a, A, P> Unpin for FracAddCircuit<'a, A, P>
impl<'a, A, P> UnsafeUnpin for FracAddCircuit<'a, A, P>
impl<'a, A, P> UnwindSafe for FracAddCircuit<'a, 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