pub trait AirBuilder: Sized {
type F: PrimeCharacteristicRing + Sync;
type Expr: Algebra<Self::F> + Algebra<Self::Var>;
type Var: Into<Self::Expr> + Clone + Send + Sync + Add<Self::F, Output = Self::Expr> + Add<Self::Var, Output = Self::Expr> + Add<Self::Expr, Output = Self::Expr> + Sub<Self::F, Output = Self::Expr> + Sub<Self::Var, Output = Self::Expr> + Sub<Self::Expr, Output = Self::Expr> + Mul<Self::F, Output = Self::Expr> + Mul<Self::Var, Output = Self::Expr> + Mul<Self::Expr, Output = Self::Expr>;
type M: Matrix<Self::Var>;
Show 17 methods
// Required methods
fn main(&self) -> Self::M;
fn is_first_row(&self) -> Self::Expr;
fn is_last_row(&self) -> Self::Expr;
fn is_transition_window(&self, size: usize) -> Self::Expr;
fn assert_zero<I: Into<Self::Expr>>(&mut self, x: I);
// Provided methods
fn is_transition(&self) -> Self::Expr { ... }
fn when<I: Into<Self::Expr>>(
&mut self,
condition: I,
) -> FilteredAirBuilder<'_, Self> { ... }
fn when_ne<I1: Into<Self::Expr>, I2: Into<Self::Expr>>(
&mut self,
x: I1,
y: I2,
) -> FilteredAirBuilder<'_, Self> { ... }
fn when_first_row(&mut self) -> FilteredAirBuilder<'_, Self> { ... }
fn when_last_row(&mut self) -> FilteredAirBuilder<'_, Self> { ... }
fn when_transition(&mut self) -> FilteredAirBuilder<'_, Self> { ... }
fn when_transition_window(
&mut self,
size: usize,
) -> FilteredAirBuilder<'_, Self> { ... }
fn assert_zeros<const N: usize, I: Into<Self::Expr>>(
&mut self,
array: [I; N],
) { ... }
fn assert_bools<const N: usize, I: Into<Self::Expr>>(
&mut self,
array: [I; N],
) { ... }
fn assert_one<I: Into<Self::Expr>>(&mut self, x: I) { ... }
fn assert_eq<I1: Into<Self::Expr>, I2: Into<Self::Expr>>(
&mut self,
x: I1,
y: I2,
) { ... }
fn assert_bool<I: Into<Self::Expr>>(&mut self, x: I) { ... }
}Expand description
A builder which contains both a trace on which AIR constraints can be evaluated as well as a method of accumulating the AIR constraint evaluations.
Supports both symbolic cases where the constraints are treated as polynomials and collected into a vector as well cases where the constraints are evaluated on an evaluation trace and combined using randomness.
Required Associated Types§
Sourcetype F: PrimeCharacteristicRing + Sync
type F: PrimeCharacteristicRing + Sync
Underlying field type.
This should usually implement Field but there are a few edge cases (mostly involving PackedFields) where
it may only implement PrimeCharacteristicRing.
Sourcetype Expr: Algebra<Self::F> + Algebra<Self::Var>
type Expr: Algebra<Self::F> + Algebra<Self::Var>
Serves as the output type for an AIR constraint evaluation.
Sourcetype Var: Into<Self::Expr> + Clone + Send + Sync + Add<Self::F, Output = Self::Expr> + Add<Self::Var, Output = Self::Expr> + Add<Self::Expr, Output = Self::Expr> + Sub<Self::F, Output = Self::Expr> + Sub<Self::Var, Output = Self::Expr> + Sub<Self::Expr, Output = Self::Expr> + Mul<Self::F, Output = Self::Expr> + Mul<Self::Var, Output = Self::Expr> + Mul<Self::Expr, Output = Self::Expr>
type Var: Into<Self::Expr> + Clone + Send + Sync + Add<Self::F, Output = Self::Expr> + Add<Self::Var, Output = Self::Expr> + Add<Self::Expr, Output = Self::Expr> + Sub<Self::F, Output = Self::Expr> + Sub<Self::Var, Output = Self::Expr> + Sub<Self::Expr, Output = Self::Expr> + Mul<Self::F, Output = Self::Expr> + Mul<Self::Var, Output = Self::Expr> + Mul<Self::Expr, Output = Self::Expr>
The type of the variable appearing in the trace matrix.
Serves as the input type for an AIR constraint evaluation.
Required Methods§
Sourcefn is_first_row(&self) -> Self::Expr
fn is_first_row(&self) -> Self::Expr
Expression evaluating to 1 on the first row, 0 elsewhere.
Sourcefn is_last_row(&self) -> Self::Expr
fn is_last_row(&self) -> Self::Expr
Expression evaluating to 1 on the last row, 0 elsewhere.
Sourcefn is_transition_window(&self, size: usize) -> Self::Expr
fn is_transition_window(&self, size: usize) -> Self::Expr
Expression evaluating to 1 on rows except the last size - 1 rows, 0 otherwise.
Sourcefn assert_zero<I: Into<Self::Expr>>(&mut self, x: I)
fn assert_zero<I: Into<Self::Expr>>(&mut self, x: I)
Assert that the given element is zero.
Where possible, batching multiple assert_zero calls into a single assert_zeros call will improve performance.
Provided Methods§
Sourcefn is_transition(&self) -> Self::Expr
fn is_transition(&self) -> Self::Expr
Expression evaluating to 1 on all transition rows (not last row), 0 on last row.
Sourcefn when<I: Into<Self::Expr>>(
&mut self,
condition: I,
) -> FilteredAirBuilder<'_, Self>
fn when<I: Into<Self::Expr>>( &mut self, condition: I, ) -> FilteredAirBuilder<'_, Self>
Returns a sub-builder whose constraints are enforced only when condition is nonzero.
Sourcefn when_ne<I1: Into<Self::Expr>, I2: Into<Self::Expr>>(
&mut self,
x: I1,
y: I2,
) -> FilteredAirBuilder<'_, Self>
fn when_ne<I1: Into<Self::Expr>, I2: Into<Self::Expr>>( &mut self, x: I1, y: I2, ) -> FilteredAirBuilder<'_, Self>
Returns a sub-builder whose constraints are enforced only when x != y.
Sourcefn when_first_row(&mut self) -> FilteredAirBuilder<'_, Self>
fn when_first_row(&mut self) -> FilteredAirBuilder<'_, Self>
Returns a sub-builder whose constraints are enforced only on the first row.
Sourcefn when_last_row(&mut self) -> FilteredAirBuilder<'_, Self>
fn when_last_row(&mut self) -> FilteredAirBuilder<'_, Self>
Returns a sub-builder whose constraints are enforced only on the last row.
Sourcefn when_transition(&mut self) -> FilteredAirBuilder<'_, Self>
fn when_transition(&mut self) -> FilteredAirBuilder<'_, Self>
Returns a sub-builder whose constraints are enforced on all rows except the last.
Sourcefn when_transition_window(
&mut self,
size: usize,
) -> FilteredAirBuilder<'_, Self>
fn when_transition_window( &mut self, size: usize, ) -> FilteredAirBuilder<'_, Self>
Returns a sub-builder whose constraints are enforced on all rows except the last size - 1.
Sourcefn assert_zeros<const N: usize, I: Into<Self::Expr>>(&mut self, array: [I; N])
fn assert_zeros<const N: usize, I: Into<Self::Expr>>(&mut self, array: [I; N])
Assert that every element of a given array is 0.
This should be preferred over calling assert_zero multiple times.
Sourcefn assert_bools<const N: usize, I: Into<Self::Expr>>(&mut self, array: [I; N])
fn assert_bools<const N: usize, I: Into<Self::Expr>>(&mut self, array: [I; N])
Assert that a given array consists of only boolean values.
Sourcefn assert_one<I: Into<Self::Expr>>(&mut self, x: I)
fn assert_one<I: Into<Self::Expr>>(&mut self, x: I)
Assert that x element is equal to 1.
Sourcefn assert_eq<I1: Into<Self::Expr>, I2: Into<Self::Expr>>(
&mut self,
x: I1,
y: I2,
)
fn assert_eq<I1: Into<Self::Expr>, I2: Into<Self::Expr>>( &mut self, x: I1, y: I2, )
Assert that the given elements are equal.
Sourcefn assert_bool<I: Into<Self::Expr>>(&mut self, x: I)
fn assert_bool<I: Into<Self::Expr>>(&mut self, x: I)
Assert that x is a boolean, i.e. either 0 or 1.
Where possible, batching multiple assert_bool calls into a single assert_bools call will improve performance.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.