Struct air_ir::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) -> Self

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: TraceSegmentId) -> usize

Return the number of boundary constraints

source

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

Return the set of ConstraintRoot corresponding to the boundary constraints

source

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

Return the set of ConstraintRoot corresponding to the integrity constraints

source

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

Return the set of IntegrityConstraintDegree corresponding to each integrity constraint

source

pub fn validity_constraints( &self, trace_segment: TraceSegmentId ) -> impl Iterator<Item = &ConstraintRoot> + '_

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

source

pub fn transition_constraints( &self, trace_segment: TraceSegmentId ) -> 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

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

impl Default for Air

source§

fn default() -> Self

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

impl Spanned for Air

Auto Trait Implementations§

§

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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.