Skip to main content

PermutationInstance

Struct PermutationInstance 

Source
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>

Source

pub fn to_bytes(&self) -> Vec<u8>

The canonical byte encoding of this instance.

Source

pub fn from_bytes(bytes: &[u8]) -> Result<Self, InvalidRelation>

Parses Self::to_bytes, running the same checks as PermutationRelation::compile.

Source

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>

Source

pub fn label(&self) -> &str

The permutation’s label; see PermutationRelation::labeled.

Source

pub const fn vars_count(&self) -> usize

The number of wires, FieldVar::ZERO included.

Source

pub fn public_vars(&self) -> &[(FieldVar, T)]

The assigned wires and their values, in index order.

Source

pub fn queries(&self) -> &[QueryAnswerPair<FieldVar, WIDTH>]

The queries to prove, in the order they were made.

Source

pub fn equations(&self) -> &[LinearEquation<T>]

The linear equations to prove.

Source

pub fn value(&self, var: FieldVar) -> Option<&T>

The value assigned to var, if it is public.

Source

pub fn is_witness_valid<P>( &self, permutation: &P, witness: &PermutationWitness<T, WIDTH>, ) -> bool
where 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>

Source§

fn clone(&self) -> PermutationInstance<T, WIDTH>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T: Debug, const WIDTH: usize> Debug for PermutationInstance<T, WIDTH>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Unit + Encoding + FromNarg + PartialEq, const WIDTH: usize> Encoding for PermutationInstance<T, WIDTH>

Source§

fn encode(&self) -> impl AsRef<[u8]>

The function encoding prover messages into inputs to be absorbed by the duplex sponge. Read more
Source§

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>

Source§

fn from_narg(reader: &mut NargReader<'_>) -> Result<Self, VerificationError>

This map must compute the inverse of Encoding::encode, or return an error if a pre-image does not exist. Read more
Source§

fn from_narg_array<const N: usize>( reader: &mut NargReader<'_>, ) -> Result<[Self; N], VerificationError>

Reads N consecutive values: the body of [Self; N]’s implementation. Read more
Source§

impl<T: PartialEq, const WIDTH: usize> PartialEq for PermutationInstance<T, WIDTH>

Source§

fn eq(&self, other: &PermutationInstance<T, WIDTH>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<T: PartialEq, const WIDTH: usize> StructuralPartialEq for PermutationInstance<T, WIDTH>

Auto Trait Implementations§

§

impl<T, const WIDTH: usize> Freeze for PermutationInstance<T, WIDTH>

§

impl<T, const WIDTH: usize> RefUnwindSafe for PermutationInstance<T, WIDTH>

§

impl<T, const WIDTH: usize> Send for PermutationInstance<T, WIDTH>

§

impl<T, const WIDTH: usize> Sync for PermutationInstance<T, WIDTH>

§

impl<T, const WIDTH: usize> Unpin for PermutationInstance<T, WIDTH>

§

impl<T, const WIDTH: usize> UnsafeUnpin for PermutationInstance<T, WIDTH>

§

impl<T, const WIDTH: usize> UnwindSafe for PermutationInstance<T, WIDTH>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where 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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more