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
impl Air
sourcepub fn new(name: Identifier) -> Self
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.
sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
Returns the name of the air_parser::ast::Program this Air was derived from, as a str
pub fn public_inputs(&self) -> impl Iterator<Item = &PublicInput> + '_
pub fn periodic_columns(&self) -> impl Iterator<Item = &PeriodicColumn> + '_
sourcepub fn num_boundary_constraints(&self, trace_segment: TraceSegmentId) -> usize
pub fn num_boundary_constraints(&self, trace_segment: TraceSegmentId) -> usize
Return the number of boundary constraints
sourcepub fn boundary_constraints(
&self,
trace_segment: TraceSegmentId
) -> &[ConstraintRoot]
pub fn boundary_constraints( &self, trace_segment: TraceSegmentId ) -> &[ConstraintRoot]
Return the set of ConstraintRoot corresponding to the boundary constraints
sourcepub fn integrity_constraints(
&self,
trace_segment: TraceSegmentId
) -> &[ConstraintRoot]
pub fn integrity_constraints( &self, trace_segment: TraceSegmentId ) -> &[ConstraintRoot]
Return the set of ConstraintRoot corresponding to the integrity constraints
sourcepub fn integrity_constraint_degrees(
&self,
trace_segment: TraceSegmentId
) -> Vec<IntegrityConstraintDegree>
pub fn integrity_constraint_degrees( &self, trace_segment: TraceSegmentId ) -> Vec<IntegrityConstraintDegree>
Return the set of IntegrityConstraintDegree corresponding to each integrity constraint
sourcepub fn validity_constraints(
&self,
trace_segment: TraceSegmentId
) -> impl Iterator<Item = &ConstraintRoot> + '_
pub fn validity_constraints( &self, trace_segment: TraceSegmentId ) -> impl Iterator<Item = &ConstraintRoot> + '_
Return an Iterator over the validity constraints for the given trace segment
sourcepub fn transition_constraints(
&self,
trace_segment: TraceSegmentId
) -> impl Iterator<Item = &ConstraintRoot> + '_
pub fn transition_constraints( &self, trace_segment: TraceSegmentId ) -> impl Iterator<Item = &ConstraintRoot> + '_
Return an Iterator over the transition constraints for the given trace segment
sourcepub fn constraint_graph(&self) -> &AlgebraicGraph
pub fn constraint_graph(&self) -> &AlgebraicGraph
Return a reference to the raw AlgebraicGraph corresponding to the constraints
sourcepub fn constraint_graph_mut(&mut self) -> &mut AlgebraicGraph
pub fn constraint_graph_mut(&mut self) -> &mut AlgebraicGraph
Return a mutable reference to the raw AlgebraicGraph corresponding to the constraints