Trait o1vm::interpreters::keccak::helpers::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§
sourcefn is_boolean(x: Self::Variable) -> Self::Variable
fn is_boolean(x: Self::Variable) -> Self::Variable
Degree-2 variable encoding whether the input is a boolean value (0 = yes)
sourcefn not(x: Self::Variable) -> Self::Variable
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
sourcefn is_one(x: Self::Variable) -> Self::Variable
fn is_one(x: Self::Variable) -> Self::Variable
Degree-1 variable encoding whether the input is the value one (0 = yes)
sourcefn is_nonzero(x: Self::Variable, x_inv: Self::Variable) -> Self::Variable
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.
fn is_zero( x: Self::Variable, x_inv: Self::Variable, z: Self::Variable ) -> (Self::Variable, Self::Variable)
sourcefn xor(x: Self::Variable, y: Self::Variable) -> Self::Variable
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)
sourcefn or(x: Self::Variable, y: Self::Variable) -> Self::Variable
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)
sourcefn either_zero(x: Self::Variable, y: Self::Variable) -> Self::Variable
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)