Struct winter_prover::ConstraintDivisor [−][src]
pub struct ConstraintDivisor<B> where
B: StarkField, { /* fields omitted */ }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 exclusion 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 exclusion 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)], exclude: [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}{x - g^{n-1}} $$
where, $n$ is the length of the execution trace, and $g$ is the generator of the trace domain.
The above divisor specifies that transition constraints must hold on all steps of the execution trace except for the last one.
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 exclusion points (the denominator portion) of this constraints divisor.
Evaluates the divisor polynomial at the provided x coordinate.
Trait Implementations
impl<B> PartialEq<ConstraintDivisor<B>> for ConstraintDivisor<B> where
B: PartialEq<B> + StarkField,
impl<B> PartialEq<ConstraintDivisor<B>> for ConstraintDivisor<B> where
B: PartialEq<B> + StarkField,
This method tests for self and other values to be equal, and is used
by ==. Read more
This method tests for !=.
Auto Trait Implementations
impl<B> RefUnwindSafe for ConstraintDivisor<B> where
B: RefUnwindSafe,
impl<B> Send for ConstraintDivisor<B>
impl<B> Sync for ConstraintDivisor<B>
impl<B> Unpin for ConstraintDivisor<B> where
B: Unpin,
impl<B> UnwindSafe for ConstraintDivisor<B> where
B: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self