Struct Air

Source
pub struct Air {
    pub name: Identifier,
    pub trace_segment_widths: Vec<u16>,
    pub periodic_columns: BTreeMap<QualifiedIdentifier, PeriodicColumn>,
    pub public_inputs: BTreeMap<Identifier, PublicInput>,
    pub num_random_values: u16,
    pub constraints: Constraints,
}
Expand description

The intermediate representation of a complete AirScript program

This structure is produced from an air_parser::ast::Program that has been through semantic analysis, constant propagation, and inlining. It is equivalent to an air_parser::ast::Program, except that it has been translated into an algebraic graph representation, on which further analysis, optimization, and code generation are performed.

Fields§

§name: Identifier

The name of the air_parser::ast::Program from which this IR was derived

§trace_segment_widths: Vec<u16>

The widths (number of columns) of each segment of the trace, in segment order (i.e. the index in this vector matches the index of the segment in the program).

§periodic_columns: BTreeMap<QualifiedIdentifier, PeriodicColumn>

The periodic columns referenced by this program.

These are taken straight from the air_parser::ast::Program without modification.

§public_inputs: BTreeMap<Identifier, PublicInput>

The public inputs referenced by this program.

These are taken straight from the air_parser::ast::Program without modification.

§num_random_values: u16

The total number of elements in the random values array

§constraints: Constraints

The constraints enforced by this program, in their algebraic graph representation.

Implementations§

Source§

impl Air

Source

pub fn new(name: Identifier) -> Air

Create a new, empty Air container

An empty Air is meaningless until it has been populated with constraints and associated metadata. This is typically done by converting an air_parser::ast::Program to this struct using the crate::passes::AstToAir translation pass.

Source

pub fn name(&self) -> &str

Returns the name of the air_parser::ast::Program this Air was derived from, as a str

Source

pub fn public_inputs(&self) -> impl Iterator<Item = &PublicInput>

Source

pub fn periodic_columns(&self) -> impl Iterator<Item = &PeriodicColumn>

Source

pub fn num_boundary_constraints(&self, trace_segment: usize) -> usize

Return the number of boundary constraints

Source

pub fn boundary_constraints(&self, trace_segment: usize) -> &[ConstraintRoot]

Return the set of ConstraintRoot corresponding to the boundary constraints

Source

pub fn integrity_constraints(&self, trace_segment: usize) -> &[ConstraintRoot]

Return the set of ConstraintRoot corresponding to the integrity constraints

Source

pub fn integrity_constraint_degrees( &self, trace_segment: usize, ) -> Vec<IntegrityConstraintDegree>

Return the set of IntegrityConstraintDegree corresponding to each integrity constraint

Source

pub fn validity_constraints( &self, trace_segment: usize, ) -> impl Iterator<Item = &ConstraintRoot>

Return an Iterator over the validity constraints for the given trace segment

Source

pub fn transition_constraints( &self, trace_segment: usize, ) -> impl Iterator<Item = &ConstraintRoot>

Return an Iterator over the transition constraints for the given trace segment

Source

pub fn constraint_graph(&self) -> &AlgebraicGraph

Return a reference to the raw AlgebraicGraph corresponding to the constraints

Source

pub fn constraint_graph_mut(&mut self) -> &mut AlgebraicGraph

Return a mutable reference to the raw AlgebraicGraph corresponding to the constraints

Trait Implementations§

Source§

impl Debug for Air

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Air

Source§

fn default() -> Air

Returns the “default value” for a type. Read more
Source§

impl Spanned for Air

Auto Trait Implementations§

§

impl Freeze for Air

§

impl RefUnwindSafe for Air

§

impl Send for Air

§

impl Sync for Air

§

impl Unpin for Air

§

impl UnwindSafe for Air

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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 for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.