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)

Implementors§

source§

impl<F: Field> BoolHelpers<F> for o1vm::keccak::constraints::Env<F>

source§

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