pub struct DecomposedTrace<const N: usize, C: FoldingConfig> {
    pub domain_size: usize,
    pub trace: BTreeMap<C::Selector, Trace<N, C>>,
}
Expand description

Struct representing a circuit execution trace which is decomposable in individual sub-circuits sharing the same columns. It is parameterized by

  • N: the total number of columns (constant), it must equal N_REL + N_DSEL
  • N_REL: the number of relation columns (constant),
  • N_DSEL: the number of dynamic selector columns (constant),
  • Selector: an enum representing the different gate behaviours,
  • F: the type of the witness data.

Fields§

§domain_size: usize

The domain size of the circuit (should coincide with that of the traces)

§trace: BTreeMap<C::Selector, Trace<N, C>>

The traces are indexed by the selector Inside the witness of the trace for a given selector,

  • the last N_SEL columns represent the selector columns and only the one for Selector should be all ones (the rest of selector columns should be all zeros)

Implementations§

source§

impl<const N: usize, C: FoldingConfig> DecomposedTrace<N, C>where usize: From<<C as FoldingConfig>::Selector>,

source

pub fn number_of_rows(&self, opcode: C::Selector) -> usize

Returns the number of rows that have been instantiated for the given selector. It is important that the column used is a relation column because selector columns are only instantiated at the very end, so their length could be zero most times. That is the reason that relation columns are located first.

source

pub fn in_circuit(&self, opcode: C::Selector) -> bool

Returns a boolean indicating whether the witness for the given selector was ever found in the cirucit or not.

source

pub fn is_full(&self, opcode: C::Selector) -> bool

Returns whether the witness for the given selector has achieved a number of rows that is equal to the domain size.

source

pub fn reset(&mut self, opcode: C::Selector)

Resets the witness after folding

source

pub fn set_selector_column<const N_REL: usize>( &mut self, selector: C::Selector, number_of_rows: usize )

Sets the selector column to all ones, and the rest to all zeros

Trait Implementations§

source§

impl<const N: usize, C: Clone + FoldingConfig> Clone for DecomposedTrace<N, C>where C::Selector: Clone,

source§

fn clone(&self) -> DecomposedTrace<N, C>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<const N: usize, C: FoldingConfig<Column = Column, Curve = Curve>, Sponge> Foldable<N, C, Sponge> for DecomposedTrace<N, C>where C::Selector: Into<usize>, Sponge: FqSponge<<<C as FoldingConfig>::Curve as AffineRepr>::BaseField, C::Curve, <<C as FoldingConfig>::Curve as AffineRepr>::ScalarField>, <C as FoldingConfig>::Challenge: From<BerkeleyChallengeTerm>,

Implement the trait Foldable for the structure DecomposedTrace

source§

fn to_folding_pair( &self, selector: C::Selector, fq_sponge: &mut Sponge, domain: D<<<C as FoldingConfig>::Curve as AffineRepr>::ScalarField>, srs: &PairingSRS<Pairing> ) -> (FoldingInstance<N, C::Curve>, FoldingWitness<N, <<C as FoldingConfig>::Curve as AffineRepr>::ScalarField>)

Returns the witness for the given selector as a folding witness and folding instance pair. Note that this function will also absorb all commitments to the columns to coin challenges appropriately.
source§

fn folding_constraints( &self ) -> BTreeMap<C::Selector, Vec<FoldingCompatibleExpr<C>>>

Returns a map of constraints that are compatible with folding for each selector
source§

impl<const N: usize, C: FoldingConfig> Index<<C as FoldingConfig>::Selector> for DecomposedTrace<N, C>

§

type Output = Trace<N, C>

The returned type after indexing.
source§

fn index(&self, index: C::Selector) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<const N: usize, const N_REL: usize, C: FoldingConfig, Env> Tracer<N_REL, C, Env> for DecomposedTrace<N, C>where DecomposedTrace<N, C>: DecomposableTracer<Env>, Trace<N, C>: Tracer<N_REL, C, Env, Selector = ()>, usize: From<<C as FoldingConfig>::Selector>,

Generic implementation of the Tracer trait for the DecomposedTrace struct. It requires the DecomposedTrace to implement the DecomposableTracer trait, and the Trace struct to implement the Tracer trait with Selector set to (), and usize to implement the From trait with C::Selector.

§

type Selector = <C as FoldingConfig>::Selector

source§

fn init(domain_size: usize, _selector: C::Selector, env: &mut Env) -> Self

Initialize a new trace with the given domain size, selector, and environment.
source§

fn push_row( &mut self, selector: Self::Selector, row: &[<<C as FoldingConfig>::Curve as AffineRepr>::ScalarField; N_REL] )

Add a witness row to the circuit (only for relation columns)
source§

fn pad_with_row( &mut self, selector: Self::Selector, row: &[<<C as FoldingConfig>::Curve as AffineRepr>::ScalarField; N_REL] ) -> usize

Pad the rows of one opcode with the given row until reaching the domain size if needed. Returns the number of rows that were added. It does not add selector columns.
source§

fn pad_with_zeros(&mut self, selector: Self::Selector) -> usize

Pads the rows of one opcode with zero rows until reaching the domain size if needed. Returns the number of rows that were added. It does not add selector columns.
source§

fn pad_dummy(&mut self, selector: Self::Selector) -> usize

Pad the rows of one opcode with the first row until reaching the domain size if needed. It only tries to pad witnesses which are non empty. Returns the number of rows that were added. It does not add selector columns. Read more

Auto Trait Implementations§

§

impl<const N: usize, C> RefUnwindSafe for DecomposedTrace<N, C>where <<C as FoldingConfig>::Curve as AffineRepr>::ScalarField: RefUnwindSafe, <C as FoldingConfig>::Selector: RefUnwindSafe,

§

impl<const N: usize, C> Send for DecomposedTrace<N, C>where <C as FoldingConfig>::Selector: Send,

§

impl<const N: usize, C> Sync for DecomposedTrace<N, C>where <C as FoldingConfig>::Selector: Sync,

§

impl<const N: usize, C> Unpin for DecomposedTrace<N, C>

§

impl<const N: usize, C> UnwindSafe for DecomposedTrace<N, C>where <<C as FoldingConfig>::Curve as AffineRepr>::ScalarField: RefUnwindSafe, <C as FoldingConfig>::Selector: RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V