[][src]Enum snarkvm_models::gadgets::utilities::boolean::Boolean

pub enum Boolean {
    Is(AllocatedBit),
    Not(AllocatedBit),
    Constant(bool),
}

This is a boolean value which may be either a constant or an interpretation of an AllocatedBit.

Variants

Existential view of the boolean variable

Negated view of the boolean variable

Constant(bool)

Constant (not an allocated variable)

Implementations

impl Boolean[src]

pub fn get_value(&self) -> Option<bool>[src]

pub fn lc<F: Field>(&self, one: Variable, coeff: F) -> LinearCombination<F>[src]

pub fn constant_u8_vec<F: Field, CS: ConstraintSystem<F>>(
    cs: &mut CS,
    values: &[u8]
) -> Vec<Self>
[src]

Construct a boolean vector from a vector of u8

pub fn constant(b: bool) -> Self[src]

Construct a boolean from a known constant.

pub fn not(&self) -> Self[src]

Return a negated interpretation of this boolean.

pub fn xor<'a, F, CS>(
    cs: CS,
    a: &'a Self,
    b: &'a Self
) -> Result<Self, SynthesisError> where
    F: Field,
    CS: ConstraintSystem<F>, 
[src]

Perform XOR over two boolean operands.

pub fn or<'a, F, CS>(
    cs: CS,
    a: &'a Self,
    b: &'a Self
) -> Result<Self, SynthesisError> where
    F: Field,
    CS: ConstraintSystem<F>, 
[src]

Perform OR over two boolean operands.

pub fn and<'a, F: Field, CS: ConstraintSystem<F>>(
    cs: CS,
    a: &'a Self,
    b: &'a Self
) -> Result<Self, SynthesisError>
[src]

Perform AND over two boolean operands.

pub fn kary_and<F, CS>(cs: CS, bits: &[Self]) -> Result<Self, SynthesisError> where
    F: Field,
    CS: ConstraintSystem<F>, 
[src]

Perform AND over all the given boolean operands.

pub fn enforce_nand<F, CS>(cs: CS, bits: &[Self]) -> Result<(), SynthesisError> where
    F: Field,
    CS: ConstraintSystem<F>, 
[src]

Asserts that at least one operand is false.

pub fn enforce_in_field<F, CS, NativeF: PrimeField>(
    cs: CS,
    bits: &[Self]
) -> Result<(), SynthesisError> where
    F: Field,
    CS: ConstraintSystem<F>, 
[src]

Asserts that this bit_gadget representation is "in the field" when interpreted in big endian.

Trait Implementations

impl<F: Field> AllocGadget<bool, F> for Boolean[src]

impl Clone for Boolean[src]

impl<F: PrimeField> CondSelectGadget<F> for Boolean[src]

impl<F: Field> ConditionalEqGadget<F> for Boolean[src]

impl Copy for Boolean[src]

impl Debug for Boolean[src]

impl Eq for Boolean[src]

impl<F: Field> EqGadget<F> for Boolean[src]

impl<F: PrimeField> EvaluateEqGadget<F> for Boolean[src]

a == b = !(a XOR b)

impl From<AllocatedBit> for Boolean[src]

impl<'a, F: Field> FullAdder<'a, F> for Boolean[src]

impl PartialEq<Boolean> for Boolean[src]

impl<F: Field> ToBitsGadget<F> for Boolean[src]

impl<F: Field> ToBytesGadget<F> for Boolean[src]

pub fn to_bytes_strict<CS: ConstraintSystem<F>>(
    &self,
    cs: CS
) -> Result<Vec<UInt8>, SynthesisError>
[src]

Additionally checks if the produced list of booleans is 'valid'.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<F, T> ConditionalOrEqualsGadget<F> for T where
    F: Field,
    T: ConditionalEqGadget<F> + CondSelectGadget<F>, 
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<F, T> OrEqualsGadget<F> for T where
    F: Field,
    T: ConditionalOrEqualsGadget<F>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,