Trait BoolHelpers

Source
pub trait BoolHelpers<F: One + Debug + Zero>
where Self: Interpreter<F>,
{ // Provided methods fn is_boolean(x: Self::Variable) -> Self::Variable { ... } fn not(x: Self::Variable) -> Self::Variable { ... } fn is_one(x: Self::Variable) -> Self::Variable { ... } fn is_nonzero(x: Self::Variable, x_inv: Self::Variable) -> Self::Variable { ... } fn is_zero( x: Self::Variable, x_inv: Self::Variable, z: Self::Variable, ) -> (Self::Variable, Self::Variable) { ... } fn xor(x: Self::Variable, y: Self::Variable) -> Self::Variable { ... } fn or(x: Self::Variable, y: Self::Variable) -> Self::Variable { ... } fn either_zero(x: Self::Variable, y: Self::Variable) -> Self::Variable { ... } }
Expand description

This trait contains helper functions for boolean operations used in the Keccak circuit

Provided Methods§

Source

fn is_boolean(x: Self::Variable) -> Self::Variable

Degree-2 variable encoding whether the input is a boolean value (0 = yes)

Source

fn not(x: Self::Variable) -> Self::Variable

Degree-1 variable encoding the negation of the input Note: it only works as expected if the input is a boolean value

Source

fn is_one(x: Self::Variable) -> Self::Variable

Degree-1 variable encoding whether the input is the value one (0 = yes)

Source

fn is_nonzero(x: Self::Variable, x_inv: Self::Variable) -> Self::Variable

Degree-2 variable encoding whether the first input is nonzero (0 = yes). It requires the second input to be the multiplicative inverse of the first. Note: if the first input is zero, there is no multiplicative inverse.

Source

fn is_zero( x: Self::Variable, x_inv: Self::Variable, z: Self::Variable, ) -> (Self::Variable, Self::Variable)

Source

fn xor(x: Self::Variable, y: Self::Variable) -> Self::Variable

Degree-2 variable encoding the XOR of two variables which should be boolean (1 = true)

Source

fn or(x: Self::Variable, y: Self::Variable) -> Self::Variable

Degree-2 variable encoding the OR of two variables, which should be boolean (1 = true)

Source

fn either_zero(x: Self::Variable, y: Self::Variable) -> Self::Variable

Degree-2 variable encoding whether at least one of the two inputs is zero (0 = yes)

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

Source§

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