pub struct ConstraintDivisor<B> where
    B: StarkField, 
{ /* private fields */ }
Expand description

The denominator portion of boundary and transition constraints.

A divisor is described by a combination of a sparse polynomial, which describes the numerator of the divisor and a set of exemption points, which describe the denominator of the divisor. The numerator polynomial is described as multiplication of tuples where each tuple encodes an expression $(x^a - b)$. The exemption points encode expressions $(x - a)$.

For example divisor $(x^a - 1) \cdot (x^b - 2) / (x - 3)$ can be represented as: numerator: [(a, 1), (b, 2)], exemptions: [3].

A divisor cannot be instantiated directly, and instead must be created either for an Assertion or for a transition constraint.

Implementations

Builds a divisor for transition constraints.

For transition constraints, the divisor polynomial $z(x)$ is always the same:

$$ z(x) = \frac{x^n - 1}{ \prod_{i=1}^k (x - g^{n-i})} $$

where, $n$ is the length of the execution trace, $g$ is the generator of the trace domain, and $k$ is the number of exemption points. The default value for $k$ is $1$.

The above divisor specifies that transition constraints must hold on all steps of the execution trace except for the last $k$ steps.

Builds a divisor for a boundary constraint described by the assertion.

For boundary constraints, the divisor polynomial is defined as:

$$ z(x) = x^k - g^{a \cdot k} $$

where $g$ is the generator of the trace domain, $k$ is the number of asserted steps, and $a$ is the step offset in the trace domain. Specifically:

  • For an assertion against a single step, the polynomial is $(x - g^a)$, where $a$ is the step on which the assertion should hold.
  • For an assertion against a sequence of steps which fall on powers of two, it is $(x^k - 1)$ where $k$ is the number of asserted steps.
  • For assertions against a sequence of steps which repeat with a period that is a power of two but don’t fall exactly on steps which are powers of two (e.g. 1, 9, 17, … ) it is $(x^k - g^{a \cdot k})$, where $a$ is the number of steps by which the assertion steps deviate from a power of two, and $k$ is the number of asserted steps. This is equivalent to $(x - g^a) \cdot (x - g^{a + j}) \cdot (x - g^{a + 2 \cdot j}) … (x - g^{a + (k - 1) \cdot j})$, where $j$ is the length of interval between asserted steps (e.g. 8).
Panics

Panics of the specified trace_length is inconsistent with the specified assertion.

Returns the numerator portion of this constraint divisor.

Returns exemption points (the denominator portion) of this constraints divisor.

Returns the degree of the divisor polynomial

Evaluates the divisor polynomial at the provided x coordinate.

Evaluates the denominator of this divisor (the exemption points) at the provided x coordinate.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.