Trait Interpreter

Source
pub trait Interpreter<F: One + Debug + Zero> {
    type Variable: Mul<Self::Variable, Output = Self::Variable> + Add<Self::Variable, Output = Self::Variable> + Sub<Self::Variable, Output = Self::Variable> + Clone + Debug + One + Zero;

    // Required methods
    fn constant(x: u64) -> Self::Variable;
    fn constant_field(x: F) -> Self::Variable;
    fn variable(&self, column: KeccakColumn) -> Self::Variable;
    fn constrain(
        &mut self,
        tag: Constraint,
        if_true: Self::Variable,
        x: Self::Variable,
    );
    fn add_lookup(
        &mut self,
        if_true: Self::Variable,
        lookup: RAMLookup<Self::Variable, LookupTableIDs>,
    );
}
Expand description

This trait includes functionalities needed to obtain the variables of the Keccak circuit needed for constraints and witness

Required Associated Types§

Source

type Variable: Mul<Self::Variable, Output = Self::Variable> + Add<Self::Variable, Output = Self::Variable> + Sub<Self::Variable, Output = Self::Variable> + Clone + Debug + One + Zero

Required Methods§

Source

fn constant(x: u64) -> Self::Variable

Creates a variable from a constant integer

Source

fn constant_field(x: F) -> Self::Variable

Creates a variable from a constant field element

Source

fn variable(&self, column: KeccakColumn) -> Self::Variable

Returns the variable corresponding to a given column alias.

Source

fn constrain( &mut self, tag: Constraint, if_true: Self::Variable, x: Self::Variable, )

Adds one KeccakConstraint to the environment if the selector holds

Source

fn add_lookup( &mut self, if_true: Self::Variable, lookup: RAMLookup<Self::Variable, LookupTableIDs>, )

Adds a given Lookup to the environment if the condition holds

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<F: Field> Interpreter<F> for o1vm::interpreters::keccak::constraints::Env<F>

Source§

impl<F: Field> Interpreter<F> for o1vm::interpreters::keccak::witness::Env<F>