pub struct TransitionConstraintGroup<E>where
    E: FieldElement,{ /* private fields */ }
Expand description

A group of transition constraints all having the same degree.

A transition constraint group does not actually store transition constraints - it stores only their indexes and the info needed to compute their random linear combination. The indexes are assumed to be consistent with the order in which constraint evaluations are written into the evaluation table by the Air::evaluate_transition() or Air::evaluate_aux_transition() function.

Implementations§

source§

impl<E> TransitionConstraintGroup<E>where E: FieldElement,

source

pub fn indexes(&self) -> &[usize]

Returns indexes of all constraints in this group.

source

pub fn degree(&self) -> &TransitionConstraintDegree

Returns degree descriptors for all constraints in this group.

source

pub fn degree_adjustment(&self) -> u64

Returns degree adjustment factor for this constraint group.

source

pub fn domain_offset_exp(&self) -> <E as FieldElement>::BaseField

Returns c^degree_adjustment where c is the coset offset.

source

pub fn add(&mut self, constraint_idx: usize, coefficients: (E, E))

Adds a new constraint to the group. The constraint is identified by an index in the evaluation table.

source

pub fn merge_evaluations<B, F>(&self, evaluations: &[F], xp: B) -> Ewhere B: FieldElement, F: FieldElement<BaseField = <B as FieldElement>::BaseField> + ExtensionOf<B>, E: FieldElement<BaseField = <B as FieldElement>::BaseField> + ExtensionOf<B> + ExtensionOf<F>,

Computes a linear combination of evaluations relevant to this constraint group.

The linear combination is computed as follows: $$ \sum_{i=0}^{k-1}{C_i(x) \cdot (\alpha_i + \beta_i \cdot xp)} $$ where:

  • $C_i(x)$ is the evaluation of the $i$th constraint at x (same as evaluations[i]).
  • $xp = x^d$ where $d$ is the degree adjustment factor computed as $D + (n - 1) - deg(C_i(x))$, where $D$ is the degree of the composition polynomial, $n$ is the length of the execution trace, and $deg(C_i(x))$ is the evaluation degree of the $i$th constraint.
  • $\alpha$ and $\beta$ are random field elements. In the interactive version of the protocol, these are provided by the verifier.
  • $d$ is the degree adjustment factor computed as $D + (n - 1) - deg(C_i(x))$, where $D$ is the degree of the composition polynomial, $n$ is the length of the execution trace, and $deg(C_i(x))$ is the evaluation degree of the $i$th constraint.

There are two things to note here. First, the degree adjustment factor $d$ is the same for all constraints in the group (since all constraints have the same degree). Second, the merged evaluations represent a polynomial of degree $D + n - 1$, which is higher then the target degree of the composition polynomial. This is because at this stage, we are merging only the numerators of transition constraints, and we will need to divide them by the divisor later on. The degree of the divisor for transition constraints is always $n - 1$. Thus, once we divide out the divisor, the evaluations will represent a polynomial of degree $D$.

Trait Implementations§

source§

impl<E> Clone for TransitionConstraintGroup<E>where E: Clone + FieldElement, <E as FieldElement>::BaseField: Clone,

source§

fn clone(&self) -> TransitionConstraintGroup<E>

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<E> Debug for TransitionConstraintGroup<E>where E: Debug + FieldElement, <E as FieldElement>::BaseField: Debug,

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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<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.
const: unstable · 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.
const: unstable · source§

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

Performs the conversion.