pub struct PermutationInstance<T, const WIDTH: usize> { /* private fields */ }Expand description
A validated relation, ready for a proof system.
Produced by PermutationRelation::compile; see there for what is
checked.
Implementations§
Source§impl<T: Unit + Encoding + FromNarg + PartialEq, const WIDTH: usize> PermutationInstance<T, WIDTH>
impl<T: Unit + Encoding + FromNarg + PartialEq, const WIDTH: usize> PermutationInstance<T, WIDTH>
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, InvalidRelation>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, InvalidRelation>
Parses Self::to_bytes, running the same checks as
PermutationRelation::compile.
Sourcepub fn digest(&self) -> [u8; 32]
pub fn digest(&self) -> [u8; 32]
The 32-byte digest of Self::to_bytes, for binding the statement
into a transcript.
Source§impl<T, const WIDTH: usize> PermutationInstance<T, WIDTH>
impl<T, const WIDTH: usize> PermutationInstance<T, WIDTH>
Sourcepub fn label(&self) -> &str
pub fn label(&self) -> &str
The permutation’s label; see PermutationRelation::labeled.
Sourcepub const fn vars_count(&self) -> usize
pub const fn vars_count(&self) -> usize
The number of wires, FieldVar::ZERO included.
Sourcepub fn public_vars(&self) -> &[(FieldVar, T)]
pub fn public_vars(&self) -> &[(FieldVar, T)]
The assigned wires and their values, in index order.
Sourcepub fn queries(&self) -> &[QueryAnswerPair<FieldVar, WIDTH>]
pub fn queries(&self) -> &[QueryAnswerPair<FieldVar, WIDTH>]
The queries to prove, in the order they were made.
Sourcepub fn equations(&self) -> &[LinearEquation<T>]
pub fn equations(&self) -> &[LinearEquation<T>]
The linear equations to prove.
Sourcepub fn is_witness_valid<P>(
&self,
permutation: &P,
witness: &PermutationWitness<T, WIDTH>,
) -> boolwhere
T: Ring,
P: Permutation<WIDTH, U = T>,
pub fn is_witness_valid<P>(
&self,
permutation: &P,
witness: &PermutationWitness<T, WIDTH>,
) -> boolwhere
T: Ring,
P: Permutation<WIDTH, U = T>,
Whether witness satisfies this instance under permutation.
The trace must have one step per query, each step must be an
evaluation of permutation, every wire must carry one value wherever
it appears, public wires must carry their assigned value, and every
equation must hold on those values.
This is a plain comparison, not a constant-time one: it is meant for the prover checking its own witness, and for tests.
Trait Implementations§
Source§impl<T: Clone, const WIDTH: usize> Clone for PermutationInstance<T, WIDTH>
impl<T: Clone, const WIDTH: usize> Clone for PermutationInstance<T, WIDTH>
Source§fn clone(&self) -> PermutationInstance<T, WIDTH>
fn clone(&self) -> PermutationInstance<T, WIDTH>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T: Unit + Encoding + FromNarg + PartialEq, const WIDTH: usize> Encoding for PermutationInstance<T, WIDTH>
impl<T: Unit + Encoding + FromNarg + PartialEq, const WIDTH: usize> Encoding for PermutationInstance<T, WIDTH>
impl<T: Eq, const WIDTH: usize> Eq for PermutationInstance<T, WIDTH>
Source§impl<T: Unit + Encoding + FromNarg + PartialEq, const WIDTH: usize> FromNarg for PermutationInstance<T, WIDTH>
impl<T: Unit + Encoding + FromNarg + PartialEq, const WIDTH: usize> FromNarg for PermutationInstance<T, WIDTH>
Source§fn from_narg(reader: &mut NargReader<'_>) -> Result<Self, VerificationError>
fn from_narg(reader: &mut NargReader<'_>) -> Result<Self, VerificationError>
Encoding::encode,
or return an error if a pre-image does not exist. Read moreSource§fn from_narg_array<const N: usize>(
reader: &mut NargReader<'_>,
) -> Result<[Self; N], VerificationError>
fn from_narg_array<const N: usize>( reader: &mut NargReader<'_>, ) -> Result<[Self; N], VerificationError>
impl<T: PartialEq, const WIDTH: usize> StructuralPartialEq for PermutationInstance<T, WIDTH>
Auto Trait Implementations§
impl<T, const WIDTH: usize> Freeze for PermutationInstance<T, WIDTH>where
Vec<(FieldVar, T)>: Freeze,
Vec<QueryAnswerPair<FieldVar, WIDTH>>: Freeze,
Vec<LinearEquation<T>>: Freeze,
impl<T, const WIDTH: usize> RefUnwindSafe for PermutationInstance<T, WIDTH>where
Vec<(FieldVar, T)>: RefUnwindSafe,
Vec<QueryAnswerPair<FieldVar, WIDTH>>: RefUnwindSafe,
Vec<LinearEquation<T>>: RefUnwindSafe,
impl<T, const WIDTH: usize> Send for PermutationInstance<T, WIDTH>where
Vec<(FieldVar, T)>: Send,
Vec<QueryAnswerPair<FieldVar, WIDTH>>: Send,
Vec<LinearEquation<T>>: Send,
impl<T, const WIDTH: usize> Sync for PermutationInstance<T, WIDTH>where
Vec<(FieldVar, T)>: Sync,
Vec<QueryAnswerPair<FieldVar, WIDTH>>: Sync,
Vec<LinearEquation<T>>: Sync,
impl<T, const WIDTH: usize> Unpin for PermutationInstance<T, WIDTH>where
Vec<(FieldVar, T)>: Unpin,
Vec<QueryAnswerPair<FieldVar, WIDTH>>: Unpin,
Vec<LinearEquation<T>>: Unpin,
impl<T, const WIDTH: usize> UnsafeUnpin for PermutationInstance<T, WIDTH>where
Vec<(FieldVar, T)>: UnsafeUnpin,
Vec<QueryAnswerPair<FieldVar, WIDTH>>: UnsafeUnpin,
Vec<LinearEquation<T>>: UnsafeUnpin,
impl<T, const WIDTH: usize> UnwindSafe for PermutationInstance<T, WIDTH>where
Vec<(FieldVar, T)>: UnwindSafe,
Vec<QueryAnswerPair<FieldVar, WIDTH>>: UnwindSafe,
Vec<LinearEquation<T>>: UnwindSafe,
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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