ExprLowering

Trait ExprLowering 

Source
pub trait ExprLowering {
    type CellOutput;

Show 23 methods // Required methods fn lower_sum( &self, lhs: &Self::CellOutput, rhs: &Self::CellOutput, ) -> Result<Self::CellOutput>; fn lower_product( &self, lhs: &Self::CellOutput, rhs: &Self::CellOutput, ) -> Result<Self::CellOutput>; fn lower_neg(&self, expr: &Self::CellOutput) -> Result<Self::CellOutput>; fn lower_constant(&self, f: Felt) -> Result<Self::CellOutput>; fn lower_eq( &self, lhs: &Self::CellOutput, rhs: &Self::CellOutput, ) -> Result<Self::CellOutput>; fn lower_lt( &self, lhs: &Self::CellOutput, rhs: &Self::CellOutput, ) -> Result<Self::CellOutput>; fn lower_le( &self, lhs: &Self::CellOutput, rhs: &Self::CellOutput, ) -> Result<Self::CellOutput>; fn lower_gt( &self, lhs: &Self::CellOutput, rhs: &Self::CellOutput, ) -> Result<Self::CellOutput>; fn lower_ge( &self, lhs: &Self::CellOutput, rhs: &Self::CellOutput, ) -> Result<Self::CellOutput>; fn lower_ne( &self, lhs: &Self::CellOutput, rhs: &Self::CellOutput, ) -> Result<Self::CellOutput>; fn lower_and( &self, lhs: &Self::CellOutput, rhs: &Self::CellOutput, ) -> Result<Self::CellOutput>; fn lower_or( &self, lhs: &Self::CellOutput, rhs: &Self::CellOutput, ) -> Result<Self::CellOutput>; fn lower_not(&self, value: &Self::CellOutput) -> Result<Self::CellOutput>; fn lower_true(&self) -> Result<Self::CellOutput>; fn lower_false(&self) -> Result<Self::CellOutput>; fn lower_det(&self, expr: &Self::CellOutput) -> Result<Self::CellOutput>; fn lower_implies( &self, lhs: &Self::CellOutput, rhs: &Self::CellOutput, ) -> Result<Self::CellOutput>; fn lower_iff( &self, lhs: &Self::CellOutput, rhs: &Self::CellOutput, ) -> Result<Self::CellOutput>; fn lower_function_input(&self, i: usize) -> Slot; fn lower_function_output(&self, o: usize) -> Slot; fn lower_funcio<IO>(&self, io: IO) -> Result<Self::CellOutput> where IO: Into<Slot>; // Provided methods fn lower_function_inputs( &self, ins: impl IntoIterator<Item = usize>, ) -> Vec<Slot> { ... } fn lower_function_outputs( &self, outs: impl IntoIterator<Item = usize>, ) -> Vec<Slot> { ... }
}
Expand description

Defines the interface code generators expose for generating expressions in their corresponding IR.

Required Associated Types§

Source

type CellOutput

The type representing a generated expression.

Required Methods§

Source

fn lower_sum( &self, lhs: &Self::CellOutput, rhs: &Self::CellOutput, ) -> Result<Self::CellOutput>

Emits an expression representing addition.

Source

fn lower_product( &self, lhs: &Self::CellOutput, rhs: &Self::CellOutput, ) -> Result<Self::CellOutput>

Emits an expression representing multiplication.

Source

fn lower_neg(&self, expr: &Self::CellOutput) -> Result<Self::CellOutput>

Emits an expression representing negation.

Source

fn lower_constant(&self, f: Felt) -> Result<Self::CellOutput>

Emits a constant value.

Source

fn lower_eq( &self, lhs: &Self::CellOutput, rhs: &Self::CellOutput, ) -> Result<Self::CellOutput>

Emits a boolean expression representing equality between the operands.

Source

fn lower_lt( &self, lhs: &Self::CellOutput, rhs: &Self::CellOutput, ) -> Result<Self::CellOutput>

Emits a boolean expression representing a less-than relation between the operands.

Source

fn lower_le( &self, lhs: &Self::CellOutput, rhs: &Self::CellOutput, ) -> Result<Self::CellOutput>

Emits a boolean expression representing a less-than or equal relation between the operands.

Source

fn lower_gt( &self, lhs: &Self::CellOutput, rhs: &Self::CellOutput, ) -> Result<Self::CellOutput>

Emits a boolean expression representing a greater-than relation between the operands.

Source

fn lower_ge( &self, lhs: &Self::CellOutput, rhs: &Self::CellOutput, ) -> Result<Self::CellOutput>

Emits a boolean expression representing a greater-than or equal relation between the operands.

Source

fn lower_ne( &self, lhs: &Self::CellOutput, rhs: &Self::CellOutput, ) -> Result<Self::CellOutput>

Emits a boolean expression representing the negation of equality between the operands.

Source

fn lower_and( &self, lhs: &Self::CellOutput, rhs: &Self::CellOutput, ) -> Result<Self::CellOutput>

Emits a logical AND between the two operands.

Source

fn lower_or( &self, lhs: &Self::CellOutput, rhs: &Self::CellOutput, ) -> Result<Self::CellOutput>

Emits a logical OR between the two operands.

Source

fn lower_not(&self, value: &Self::CellOutput) -> Result<Self::CellOutput>

Emits a logical NOT between the two operands.

Source

fn lower_true(&self) -> Result<Self::CellOutput>

Emits a literal true value.

Source

fn lower_false(&self) -> Result<Self::CellOutput>

Emits a literal false value.

Source

fn lower_det(&self, expr: &Self::CellOutput) -> Result<Self::CellOutput>

Emits an expression that hints that the given expression must be proven deterministic.

The concrete semantics of this expression are backend dependant but it must return an expression of boolean type.

Source

fn lower_implies( &self, lhs: &Self::CellOutput, rhs: &Self::CellOutput, ) -> Result<Self::CellOutput>

Emits a logical implication between the two operands.

Source

fn lower_iff( &self, lhs: &Self::CellOutput, rhs: &Self::CellOutput, ) -> Result<Self::CellOutput>

Emits a logical double-implication between the two operands.

Source

fn lower_function_input(&self, i: usize) -> Slot

Returns a Slot representing the i-th input.

Source

fn lower_function_output(&self, o: usize) -> Slot

Returns a Slot representing the o-th output.

Source

fn lower_funcio<IO>(&self, io: IO) -> Result<Self::CellOutput>
where IO: Into<Slot>,

Emits an expression representing the given IO.

Provided Methods§

Source

fn lower_function_inputs( &self, ins: impl IntoIterator<Item = usize>, ) -> Vec<Slot>

Returns a list of Slot representing the input indices in the iterator.

Source

fn lower_function_outputs( &self, outs: impl IntoIterator<Item = usize>, ) -> Vec<Slot>

Returns a list of Slot representing the output indices in the iterator.

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§