openvm_circuit_primitives

Trait SubAir

Source
pub trait SubAir<AB: AirBuilder> {
    type AirContext<'a>
       where Self: 'a,
             AB: 'a,
             AB::Var: 'a,
             AB::Expr: 'a;

    // Required method
    fn eval<'a>(&'a self, builder: &'a mut AB, ctx: Self::AirContext<'a>)
       where AB::Var: 'a,
             AB::Expr: 'a;
}
Expand description

Trait with associated types intended to allow re-use of constraint logic inside other AIRs.

A SubAir is not an Air itself. A SubAir is a struct that holds the means to generate a particular set of constraints, meant to be re-usable within other AIRs.

The trait is designed to be maximally flexible, but typical implementations will separate the AirContext into two parts: Io and AuxCols. The Io part will consist of expressions (built using AB::Expr) that the SubAir does not own, while the AuxCols are any internal columns that the SubAir requires to generate its constraints. The AuxCols are columns that the SubAir fully owns and should be internally determined by the SubAir from the Io part. These AuxCols are typically just slices of AB::Var.

This trait only owns the constraints, but it is expected that the TraceSubRowGenerator trait or some analogous functionality is also implemented so that the trace generation of the AuxCols of each row can be done purely in terms of the Io part.

Required Associated Types§

Source

type AirContext<'a> where Self: 'a, AB: 'a, AB::Var: 'a, AB::Expr: 'a

Type to define the context, typically in terms of AB::Expr that are needed to define the SubAir’s constraints.

Required Methods§

Source

fn eval<'a>(&'a self, builder: &'a mut AB, ctx: Self::AirContext<'a>)
where AB::Var: 'a, AB::Expr: 'a,

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.

Implementors§

Source§

impl<AB: InteractionBuilder> SubAir<AB> for AssertLtSubAir

Source§

type AirContext<'a> = (AssertLessThanIo<<AB as AirBuilder>::Expr>, &'a [<AB as AirBuilder>::Var]) where AB::Expr: 'a, AB::Var: 'a, AB: 'a

Source§

impl<AB: InteractionBuilder> SubAir<AB> for AssertLtWhenTransitionAir

Source§

type AirContext<'a> = (AssertLessThanIo<<AB as AirBuilder>::Expr>, &'a [<AB as AirBuilder>::Var]) where AB::Expr: 'a, AB::Var: 'a, AB: 'a

Source§

impl<AB: InteractionBuilder> SubAir<AB> for CheckCarryModToZeroSubAir

Source§

type AirContext<'a> = (OverflowInt<<AB as AirBuilder>::Expr>, CheckCarryModToZeroCols<<AB as AirBuilder>::Var>, <AB as AirBuilder>::Expr) where AB::Var: 'a, AB::Expr: 'a, AB: 'a

Source§

impl<AB: InteractionBuilder> SubAir<AB> for CheckCarryToZeroSubAir

Source§

type AirContext<'a> = (OverflowInt<<AB as AirBuilder>::Expr>, CheckCarryToZeroCols<<AB as AirBuilder>::Var>, <AB as AirBuilder>::Expr) where AB::Var: 'a, AB::Expr: 'a, AB: 'a

Source§

impl<AB: InteractionBuilder> SubAir<AB> for Encoder

Source§

type AirContext<'a> = &'a [<AB as AirBuilder>::Var] where AB: 'a, AB::Var: 'a, AB::Expr: 'a

Source§

impl<AB: InteractionBuilder> SubAir<AB> for IsLtSubAir

Source§

type AirContext<'a> = (IsLessThanIo<<AB as AirBuilder>::Expr>, &'a [<AB as AirBuilder>::Var]) where AB::Expr: 'a, AB::Var: 'a, AB: 'a

Source§

impl<AB: InteractionBuilder> SubAir<AB> for IsLtWhenTransitionAir

Source§

type AirContext<'a> = (IsLessThanIo<<AB as AirBuilder>::Expr>, &'a [<AB as AirBuilder>::Var]) where AB::Expr: 'a, AB::Var: 'a, AB: 'a

Source§

impl<AB: InteractionBuilder, const NUM: usize> SubAir<AB> for IsLtArraySubAir<NUM>

Source§

type AirContext<'a> = (IsLtArrayIo<<AB as AirBuilder>::Expr, NUM>, IsLtArrayAuxColsRef<'a, <AB as AirBuilder>::Var>) where AB::Expr: 'a, AB::Var: 'a, AB: 'a

Source§

impl<AB: InteractionBuilder, const NUM: usize> SubAir<AB> for IsLtArrayWhenTransitionAir<NUM>

Source§

type AirContext<'a> = (IsLtArrayIo<<AB as AirBuilder>::Expr, NUM>, IsLtArrayAuxColsRef<'a, <AB as AirBuilder>::Var>) where AB::Expr: 'a, AB::Var: 'a, AB: 'a

Source§

impl<AB: AirBuilder> SubAir<AB> for IsEqSubAir

Source§

type AirContext<'a> = (IsEqualIo<<AB as AirBuilder>::Expr>, <AB as AirBuilder>::Var) where AB::Expr: 'a, AB::Var: 'a, AB: 'a

Source§

impl<AB: AirBuilder> SubAir<AB> for IsZeroSubAir

Source§

type AirContext<'a> = (IsZeroIo<<AB as AirBuilder>::Expr>, <AB as AirBuilder>::Var) where AB::Expr: 'a, AB::Var: 'a, AB: 'a

Source§

impl<AB: AirBuilder, const NUM: usize> SubAir<AB> for IsEqArraySubAir<NUM>

Source§

type AirContext<'a> = (IsEqArrayIo<<AB as AirBuilder>::Expr, NUM>, [<AB as AirBuilder>::Var; NUM]) where AB::Expr: 'a, AB::Var: 'a, AB: 'a