TransitionConstraints

Struct TransitionConstraints 

Source
pub struct TransitionConstraints<E: FieldElement> { /* private fields */ }
Expand description

Metadata for transition constraints of a computation.

This metadata includes:

  • List of transition constraint degrees for the main trace segment, as well as for auxiliary trace segments (if any).
  • Groupings of random composition constraint coefficients separately for the main trace segment and for auxiliary tace segment.
  • Divisor of transition constraints for a computation.

Implementations§

Source§

impl<E: FieldElement> TransitionConstraints<E>

Source

pub fn new( context: &AirContext<E::BaseField>, composition_coefficients: &[E], ) -> Self

Returns a new instance of TransitionConstraints for a computation described by the specified AIR context.

§Panics

Panics if the number of transition constraints in the context does not match the number of provided composition coefficients.

Source

pub fn main_constraint_degrees(&self) -> &[TransitionConstraintDegree]

Returns a list of transition constraint degree descriptors for the main trace segment of a computation.

This list will be identical to the list passed into the AirContext::new() method as the transition_constraint_degrees parameter, or into AirContext::new_multi_segment() as the main_transition_constraint_degrees parameter.

Source

pub fn num_main_constraints(&self) -> usize

Returns the number of constraints applied against the main trace segment of a computation.

Source

pub fn main_constraint_coef(&self) -> Vec<E>

Returns the random coefficients for constraints applied against main trace segment of a computation.

Source

pub fn aux_constraint_degrees(&self) -> &[TransitionConstraintDegree]

Returns a list of transition constraint degree descriptors for the auxiliary trace segment of a computation.

This list will be identical to the list passed into AirContext::new_multi_segment() as the aux_transition_constraint_degrees parameter.

Source

pub fn num_aux_constraints(&self) -> usize

Returns the number of constraints applied against the auxiliary trace segment of a computation.

Source

pub fn aux_constraint_coef(&self) -> Vec<E>

Returns the random coefficients for constraints applied against the auxiliary trace segment of a computation.

Source

pub fn divisor(&self) -> &ConstraintDivisor<E::BaseField>

Returns a divisor for transition constraints.

All transition constraints have the same divisor which has the form: $$ z(x) = \frac{x^n - 1}{x - g^{n - 1}} $$ where: $n$ is the length of the execution trace and $g$ is the generator of the trace domain.

This divisor specifies that transition constraints must hold on all steps of the execution trace except for the last one.

Source

pub fn combine_evaluations<F>( &self, main_evaluations: &[F], aux_evaluations: &[E], x: F, ) -> E
where F: FieldElement<BaseField = E::BaseField>, E: ExtensionOf<F>,

Computes a linear combination of all transition constraint evaluations and divides the result by transition constraint divisor.

A transition constraint is described by a rational function of the form $\frac{C(x)}{z(x)}$, where:

  • $C(x)$ is the constraint polynomial.
  • $z(x)$ is the constraint divisor polynomial.

Thus, this function computes a linear combination of $C(x)$ evaluations.

Since, the divisor polynomial is the same for all transition constraints (see ConstraintDivisor::from_transition), we can divide the linear combination by the divisor rather than dividing each individual $C(x)$ evaluation. This requires executing only one division at the end.

Auto Trait Implementations§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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