|
|
@ -9,7 +9,7 @@ use r1cs_core::{ConstraintSystem, ConstraintVar, LinearCombination, SynthesisErr |
|
|
|
#[derive(Copy, Clone, Debug)]
|
|
|
|
pub struct AllocatedBit {
|
|
|
|
variable: Variable,
|
|
|
|
value: Option<bool>,
|
|
|
|
value: Option<bool>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl AllocatedBit {
|
|
|
@ -69,7 +69,7 @@ impl AllocatedBit { |
|
|
|
|
|
|
|
Ok(AllocatedBit {
|
|
|
|
variable: result_var,
|
|
|
|
value: result_value,
|
|
|
|
value: result_value,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
@ -108,7 +108,7 @@ impl AllocatedBit { |
|
|
|
|
|
|
|
Ok(AllocatedBit {
|
|
|
|
variable: result_var,
|
|
|
|
value: result_value,
|
|
|
|
value: result_value,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
@ -145,7 +145,7 @@ impl AllocatedBit { |
|
|
|
|
|
|
|
Ok(AllocatedBit {
|
|
|
|
variable: result_var,
|
|
|
|
value: result_value,
|
|
|
|
value: result_value,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
@ -183,7 +183,7 @@ impl AllocatedBit { |
|
|
|
|
|
|
|
Ok(AllocatedBit {
|
|
|
|
variable: result_var,
|
|
|
|
value: result_value,
|
|
|
|
value: result_value,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
@ -221,7 +221,7 @@ impl AllocatedBit { |
|
|
|
|
|
|
|
Ok(AllocatedBit {
|
|
|
|
variable: result_var,
|
|
|
|
value: result_value,
|
|
|
|
value: result_value,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -362,7 +362,7 @@ fn cond_select_helper>( |
|
|
|
);
|
|
|
|
|
|
|
|
Ok(AllocatedBit {
|
|
|
|
value: result_val,
|
|
|
|
value: result_val,
|
|
|
|
variable: result_var,
|
|
|
|
})
|
|
|
|
}
|
|
|
@ -400,11 +400,11 @@ impl Boolean { |
|
|
|
} else {
|
|
|
|
LinearCombination::<ConstraintF>::zero()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
Boolean::Is(ref v) => (coeff, v.get_variable()).into(),
|
|
|
|
Boolean::Not(ref v) => {
|
|
|
|
LinearCombination::<ConstraintF>::zero() + (coeff, one) - (coeff, v.get_variable())
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
@ -458,12 +458,12 @@ impl Boolean { |
|
|
|
(is @ &Boolean::Is(_), not @ &Boolean::Not(_))
|
|
|
|
| (not @ &Boolean::Not(_), is @ &Boolean::Is(_)) => {
|
|
|
|
Ok(Boolean::xor(cs, is, ¬.not())?.not())
|
|
|
|
},
|
|
|
|
}
|
|
|
|
// a XOR b = (NOT a) XOR (NOT b)
|
|
|
|
(&Boolean::Is(ref a), &Boolean::Is(ref b))
|
|
|
|
| (&Boolean::Not(ref a), &Boolean::Not(ref b)) => {
|
|
|
|
Ok(Boolean::Is(AllocatedBit::xor(cs, a, b)?))
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
@ -477,16 +477,16 @@ impl Boolean { |
|
|
|
(&Boolean::Constant(false), x) | (x, &Boolean::Constant(false)) => Ok(*x),
|
|
|
|
(&Boolean::Constant(true), _) | (_, &Boolean::Constant(true)) => {
|
|
|
|
Ok(Boolean::Constant(true))
|
|
|
|
},
|
|
|
|
}
|
|
|
|
// a OR b = NOT ((NOT a) AND b)
|
|
|
|
(a @ &Boolean::Is(_), b @ &Boolean::Not(_))
|
|
|
|
| (b @ &Boolean::Not(_), a @ &Boolean::Is(_))
|
|
|
|
| (b @ &Boolean::Not(_), a @ &Boolean::Not(_)) => {
|
|
|
|
Ok(Boolean::and(cs, &a.not(), &b.not())?.not())
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(&Boolean::Is(ref a), &Boolean::Is(ref b)) => {
|
|
|
|
AllocatedBit::or(cs, a, b).map(Boolean::from)
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
@ -504,22 +504,22 @@ impl Boolean { |
|
|
|
// false AND x is always false
|
|
|
|
(&Boolean::Constant(false), _) | (_, &Boolean::Constant(false)) => {
|
|
|
|
Ok(Boolean::Constant(false))
|
|
|
|
},
|
|
|
|
}
|
|
|
|
// true AND x is always x
|
|
|
|
(&Boolean::Constant(true), x) | (x, &Boolean::Constant(true)) => Ok(*x),
|
|
|
|
// a AND (NOT b)
|
|
|
|
(&Boolean::Is(ref is), &Boolean::Not(ref not))
|
|
|
|
| (&Boolean::Not(ref not), &Boolean::Is(ref is)) => {
|
|
|
|
Ok(Boolean::Is(AllocatedBit::and_not(cs, is, not)?))
|
|
|
|
},
|
|
|
|
}
|
|
|
|
// (NOT a) AND (NOT b) = a NOR b
|
|
|
|
(&Boolean::Not(ref a), &Boolean::Not(ref b)) => {
|
|
|
|
Ok(Boolean::Is(AllocatedBit::nor(cs, a, b)?))
|
|
|
|
},
|
|
|
|
}
|
|
|
|
// a AND b
|
|
|
|
(&Boolean::Is(ref a), &Boolean::Is(ref b)) => {
|
|
|
|
Ok(Boolean::Is(AllocatedBit::and(cs, a, b)?))
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
@ -559,7 +559,7 @@ impl Boolean { |
|
|
|
);
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
},
|
|
|
|
}
|
|
|
|
Boolean::Not(ref res) => {
|
|
|
|
cs.enforce(
|
|
|
|
|| "enforce nand",
|
|
|
@ -569,7 +569,7 @@ impl Boolean { |
|
|
|
);
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
@ -760,25 +760,25 @@ impl ConditionalEqGadget for Boolean { |
|
|
|
// 1 - a
|
|
|
|
(Constant(true), Is(a)) | (Is(a), Constant(true)) => {
|
|
|
|
LinearCombination::zero() + one - a.get_variable()
|
|
|
|
},
|
|
|
|
}
|
|
|
|
// a - 0 = a
|
|
|
|
(Constant(false), Is(a)) | (Is(a), Constant(false)) => {
|
|
|
|
LinearCombination::zero() + a.get_variable()
|
|
|
|
},
|
|
|
|
}
|
|
|
|
// 1 - !a = 1 - (1 - a) = a
|
|
|
|
(Constant(true), Not(a)) | (Not(a), Constant(true)) => {
|
|
|
|
LinearCombination::zero() + a.get_variable()
|
|
|
|
},
|
|
|
|
}
|
|
|
|
// !a - 0 = !a = 1 - a
|
|
|
|
(Constant(false), Not(a)) | (Not(a), Constant(false)) => {
|
|
|
|
LinearCombination::zero() + one - a.get_variable()
|
|
|
|
},
|
|
|
|
}
|
|
|
|
// b - a,
|
|
|
|
(Is(a), Is(b)) => LinearCombination::zero() + b.get_variable() - a.get_variable(),
|
|
|
|
// !b - a = (1 - b) - a
|
|
|
|
(Is(a), Not(b)) | (Not(b), Is(a)) => {
|
|
|
|
LinearCombination::zero() + one - b.get_variable() - a.get_variable()
|
|
|
|
},
|
|
|
|
}
|
|
|
|
// !b - !a = (1 - b) - (1 - a) = a - b,
|
|
|
|
(Not(a), Not(b)) => LinearCombination::zero() + a.get_variable() - b.get_variable(),
|
|
|
|
};
|
|
|
@ -831,7 +831,7 @@ impl CondSelectGadget for Boolean { |
|
|
|
Boolean::Constant(false) => Ok(false_value.clone()),
|
|
|
|
cond @ Boolean::Not(_) => {
|
|
|
|
Self::conditionally_select(cs, &cond.not(), false_value, true_value)
|
|
|
|
},
|
|
|
|
}
|
|
|
|
cond @ Boolean::Is(_) => match (true_value, false_value) {
|
|
|
|
(x, &Boolean::Constant(false)) => Boolean::and(cs.ns(|| "and"), cond, x).into(),
|
|
|
|
(&Boolean::Constant(false), x) => Boolean::and(cs.ns(|| "and"), &cond.not(), x),
|
|
|
@ -847,7 +847,7 @@ impl CondSelectGadget for Boolean { |
|
|
|
cond_select_helper(cs, cond, (a.get_value(), a_lc), (b.get_value(), b_lc))?
|
|
|
|
.into(),
|
|
|
|
)
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1138,42 +1138,42 @@ mod test { |
|
|
|
let mut b = Boolean::from(AllocatedBit::alloc(&mut cs, || Ok(true)).unwrap());
|
|
|
|
|
|
|
|
match b {
|
|
|
|
Boolean::Is(_) => {},
|
|
|
|
Boolean::Is(_) => {}
|
|
|
|
_ => panic!("unexpected value"),
|
|
|
|
}
|
|
|
|
|
|
|
|
b = b.not();
|
|
|
|
|
|
|
|
match b {
|
|
|
|
Boolean::Not(_) => {},
|
|
|
|
Boolean::Not(_) => {}
|
|
|
|
_ => panic!("unexpected value"),
|
|
|
|
}
|
|
|
|
|
|
|
|
b = b.not();
|
|
|
|
|
|
|
|
match b {
|
|
|
|
Boolean::Is(_) => {},
|
|
|
|
Boolean::Is(_) => {}
|
|
|
|
_ => panic!("unexpected value"),
|
|
|
|
}
|
|
|
|
|
|
|
|
b = Boolean::constant(true);
|
|
|
|
|
|
|
|
match b {
|
|
|
|
Boolean::Constant(true) => {},
|
|
|
|
Boolean::Constant(true) => {}
|
|
|
|
_ => panic!("unexpected value"),
|
|
|
|
}
|
|
|
|
|
|
|
|
b = b.not();
|
|
|
|
|
|
|
|
match b {
|
|
|
|
Boolean::Constant(false) => {},
|
|
|
|
Boolean::Constant(false) => {}
|
|
|
|
_ => panic!("unexpected value"),
|
|
|
|
}
|
|
|
|
|
|
|
|
b = b.not();
|
|
|
|
|
|
|
|
match b {
|
|
|
|
Boolean::Constant(true) => {},
|
|
|
|
Boolean::Constant(true) => {}
|
|
|
|
_ => panic!("unexpected value"),
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1215,16 +1215,16 @@ mod test { |
|
|
|
OperandType::False => Boolean::constant(false),
|
|
|
|
OperandType::AllocatedTrue => {
|
|
|
|
Boolean::from(AllocatedBit::alloc(cs, || Ok(true)).unwrap())
|
|
|
|
},
|
|
|
|
}
|
|
|
|
OperandType::AllocatedFalse => {
|
|
|
|
Boolean::from(AllocatedBit::alloc(cs, || Ok(false)).unwrap())
|
|
|
|
},
|
|
|
|
}
|
|
|
|
OperandType::NegatedAllocatedTrue => {
|
|
|
|
Boolean::from(AllocatedBit::alloc(cs, || Ok(true)).unwrap()).not()
|
|
|
|
},
|
|
|
|
}
|
|
|
|
OperandType::NegatedAllocatedFalse => {
|
|
|
|
Boolean::from(AllocatedBit::alloc(cs, || Ok(false)).unwrap()).not()
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
@ -1237,22 +1237,22 @@ mod test { |
|
|
|
assert!(cs.is_satisfied());
|
|
|
|
|
|
|
|
match (first_operand, second_operand, c) {
|
|
|
|
(OperandType::True, OperandType::True, Boolean::Constant(false)) => {},
|
|
|
|
(OperandType::True, OperandType::False, Boolean::Constant(true)) => {},
|
|
|
|
(OperandType::True, OperandType::AllocatedTrue, Boolean::Not(_)) => {},
|
|
|
|
(OperandType::True, OperandType::AllocatedFalse, Boolean::Not(_)) => {},
|
|
|
|
(OperandType::True, OperandType::NegatedAllocatedTrue, Boolean::Is(_)) => {},
|
|
|
|
(OperandType::True, OperandType::NegatedAllocatedFalse, Boolean::Is(_)) => {},
|
|
|
|
|
|
|
|
(OperandType::False, OperandType::True, Boolean::Constant(true)) => {},
|
|
|
|
(OperandType::False, OperandType::False, Boolean::Constant(false)) => {},
|
|
|
|
(OperandType::False, OperandType::AllocatedTrue, Boolean::Is(_)) => {},
|
|
|
|
(OperandType::False, OperandType::AllocatedFalse, Boolean::Is(_)) => {},
|
|
|
|
(OperandType::False, OperandType::NegatedAllocatedTrue, Boolean::Not(_)) => {},
|
|
|
|
(OperandType::False, OperandType::NegatedAllocatedFalse, Boolean::Not(_)) => {},
|
|
|
|
|
|
|
|
(OperandType::AllocatedTrue, OperandType::True, Boolean::Not(_)) => {},
|
|
|
|
(OperandType::AllocatedTrue, OperandType::False, Boolean::Is(_)) => {},
|
|
|
|
(OperandType::True, OperandType::True, Boolean::Constant(false)) => {}
|
|
|
|
(OperandType::True, OperandType::False, Boolean::Constant(true)) => {}
|
|
|
|
(OperandType::True, OperandType::AllocatedTrue, Boolean::Not(_)) => {}
|
|
|
|
(OperandType::True, OperandType::AllocatedFalse, Boolean::Not(_)) => {}
|
|
|
|
(OperandType::True, OperandType::NegatedAllocatedTrue, Boolean::Is(_)) => {}
|
|
|
|
(OperandType::True, OperandType::NegatedAllocatedFalse, Boolean::Is(_)) => {}
|
|
|
|
|
|
|
|
(OperandType::False, OperandType::True, Boolean::Constant(true)) => {}
|
|
|
|
(OperandType::False, OperandType::False, Boolean::Constant(false)) => {}
|
|
|
|
(OperandType::False, OperandType::AllocatedTrue, Boolean::Is(_)) => {}
|
|
|
|
(OperandType::False, OperandType::AllocatedFalse, Boolean::Is(_)) => {}
|
|
|
|
(OperandType::False, OperandType::NegatedAllocatedTrue, Boolean::Not(_)) => {}
|
|
|
|
(OperandType::False, OperandType::NegatedAllocatedFalse, Boolean::Not(_)) => {}
|
|
|
|
|
|
|
|
(OperandType::AllocatedTrue, OperandType::True, Boolean::Not(_)) => {}
|
|
|
|
(OperandType::AllocatedTrue, OperandType::False, Boolean::Is(_)) => {}
|
|
|
|
(
|
|
|
|
OperandType::AllocatedTrue,
|
|
|
|
OperandType::AllocatedTrue,
|
|
|
@ -1260,7 +1260,7 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("xor result") == Fr::zero());
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::AllocatedTrue,
|
|
|
|
OperandType::AllocatedFalse,
|
|
|
@ -1268,7 +1268,7 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("xor result") == Fr::one());
|
|
|
|
assert_eq!(v.value, Some(true));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::AllocatedTrue,
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
@ -1276,7 +1276,7 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("xor result") == Fr::zero());
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::AllocatedTrue,
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
@ -1284,10 +1284,10 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("xor result") == Fr::one());
|
|
|
|
assert_eq!(v.value, Some(true));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
(OperandType::AllocatedFalse, OperandType::True, Boolean::Not(_)) => {},
|
|
|
|
(OperandType::AllocatedFalse, OperandType::False, Boolean::Is(_)) => {},
|
|
|
|
(OperandType::AllocatedFalse, OperandType::True, Boolean::Not(_)) => {}
|
|
|
|
(OperandType::AllocatedFalse, OperandType::False, Boolean::Is(_)) => {}
|
|
|
|
(
|
|
|
|
OperandType::AllocatedFalse,
|
|
|
|
OperandType::AllocatedTrue,
|
|
|
@ -1295,7 +1295,7 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("xor result") == Fr::one());
|
|
|
|
assert_eq!(v.value, Some(true));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::AllocatedFalse,
|
|
|
|
OperandType::AllocatedFalse,
|
|
|
@ -1303,7 +1303,7 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("xor result") == Fr::zero());
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::AllocatedFalse,
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
@ -1311,7 +1311,7 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("xor result") == Fr::one());
|
|
|
|
assert_eq!(v.value, Some(true));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::AllocatedFalse,
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
@ -1319,10 +1319,10 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("xor result") == Fr::zero());
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
(OperandType::NegatedAllocatedTrue, OperandType::True, Boolean::Is(_)) => {},
|
|
|
|
(OperandType::NegatedAllocatedTrue, OperandType::False, Boolean::Not(_)) => {},
|
|
|
|
(OperandType::NegatedAllocatedTrue, OperandType::True, Boolean::Is(_)) => {}
|
|
|
|
(OperandType::NegatedAllocatedTrue, OperandType::False, Boolean::Not(_)) => {}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
|
OperandType::AllocatedTrue,
|
|
|
@ -1330,7 +1330,7 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("xor result") == Fr::zero());
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
|
OperandType::AllocatedFalse,
|
|
|
@ -1338,7 +1338,7 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("xor result") == Fr::one());
|
|
|
|
assert_eq!(v.value, Some(true));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
@ -1346,7 +1346,7 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("xor result") == Fr::zero());
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
@ -1354,10 +1354,10 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("xor result") == Fr::one());
|
|
|
|
assert_eq!(v.value, Some(true));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
(OperandType::NegatedAllocatedFalse, OperandType::True, Boolean::Is(_)) => {},
|
|
|
|
(OperandType::NegatedAllocatedFalse, OperandType::False, Boolean::Not(_)) => {},
|
|
|
|
(OperandType::NegatedAllocatedFalse, OperandType::True, Boolean::Is(_)) => {}
|
|
|
|
(OperandType::NegatedAllocatedFalse, OperandType::False, Boolean::Not(_)) => {}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
|
OperandType::AllocatedTrue,
|
|
|
@ -1365,7 +1365,7 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("xor result") == Fr::one());
|
|
|
|
assert_eq!(v.value, Some(true));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
|
OperandType::AllocatedFalse,
|
|
|
@ -1373,7 +1373,7 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("xor result") == Fr::zero());
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
@ -1381,7 +1381,7 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("xor result") == Fr::one());
|
|
|
|
assert_eq!(v.value, Some(true));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
@ -1389,7 +1389,7 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("xor result") == Fr::zero());
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
_ => panic!("this should never be encountered"),
|
|
|
|
}
|
|
|
@ -1426,18 +1426,18 @@ mod test { |
|
|
|
OperandType::False => Boolean::constant(false),
|
|
|
|
OperandType::AllocatedTrue => {
|
|
|
|
Boolean::from(AllocatedBit::alloc(cs, || Ok(true)).unwrap())
|
|
|
|
},
|
|
|
|
}
|
|
|
|
OperandType::AllocatedFalse => {
|
|
|
|
Boolean::from(AllocatedBit::alloc(cs, || Ok(false)).unwrap())
|
|
|
|
},
|
|
|
|
}
|
|
|
|
OperandType::NegatedAllocatedTrue => {
|
|
|
|
Boolean::from(AllocatedBit::alloc(cs, || Ok(true)).unwrap())
|
|
|
|
.not()
|
|
|
|
},
|
|
|
|
}
|
|
|
|
OperandType::NegatedAllocatedFalse => {
|
|
|
|
Boolean::from(AllocatedBit::alloc(cs, || Ok(false)).unwrap())
|
|
|
|
.not()
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
@ -1498,16 +1498,16 @@ mod test { |
|
|
|
OperandType::False => Boolean::constant(false),
|
|
|
|
OperandType::AllocatedTrue => {
|
|
|
|
Boolean::from(AllocatedBit::alloc(cs, || Ok(true)).unwrap())
|
|
|
|
},
|
|
|
|
}
|
|
|
|
OperandType::AllocatedFalse => {
|
|
|
|
Boolean::from(AllocatedBit::alloc(cs, || Ok(false)).unwrap())
|
|
|
|
},
|
|
|
|
}
|
|
|
|
OperandType::NegatedAllocatedTrue => {
|
|
|
|
Boolean::from(AllocatedBit::alloc(cs, || Ok(true)).unwrap()).not()
|
|
|
|
},
|
|
|
|
}
|
|
|
|
OperandType::NegatedAllocatedFalse => {
|
|
|
|
Boolean::from(AllocatedBit::alloc(cs, || Ok(false)).unwrap()).not()
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
@ -1520,159 +1520,159 @@ mod test { |
|
|
|
assert!(cs.is_satisfied());
|
|
|
|
|
|
|
|
match (first_operand, second_operand, c) {
|
|
|
|
(OperandType::True, OperandType::True, Boolean::Constant(true)) => {},
|
|
|
|
(OperandType::True, OperandType::False, Boolean::Constant(true)) => {},
|
|
|
|
(OperandType::True, OperandType::AllocatedTrue, Boolean::Constant(true)) => {},
|
|
|
|
(OperandType::True, OperandType::AllocatedFalse, Boolean::Constant(true)) => {},
|
|
|
|
(OperandType::True, OperandType::True, Boolean::Constant(true)) => {}
|
|
|
|
(OperandType::True, OperandType::False, Boolean::Constant(true)) => {}
|
|
|
|
(OperandType::True, OperandType::AllocatedTrue, Boolean::Constant(true)) => {}
|
|
|
|
(OperandType::True, OperandType::AllocatedFalse, Boolean::Constant(true)) => {}
|
|
|
|
(
|
|
|
|
OperandType::True,
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
|
Boolean::Constant(true),
|
|
|
|
) => {},
|
|
|
|
) => {}
|
|
|
|
(
|
|
|
|
OperandType::True,
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
|
Boolean::Constant(true),
|
|
|
|
) => {},
|
|
|
|
) => {}
|
|
|
|
|
|
|
|
(OperandType::False, OperandType::True, Boolean::Constant(true)) => {},
|
|
|
|
(OperandType::False, OperandType::False, Boolean::Constant(false)) => {},
|
|
|
|
(OperandType::False, OperandType::AllocatedTrue, Boolean::Is(_)) => {},
|
|
|
|
(OperandType::False, OperandType::AllocatedFalse, Boolean::Is(_)) => {},
|
|
|
|
(OperandType::False, OperandType::NegatedAllocatedTrue, Boolean::Not(_)) => {},
|
|
|
|
(OperandType::False, OperandType::NegatedAllocatedFalse, Boolean::Not(_)) => {},
|
|
|
|
(OperandType::False, OperandType::True, Boolean::Constant(true)) => {}
|
|
|
|
(OperandType::False, OperandType::False, Boolean::Constant(false)) => {}
|
|
|
|
(OperandType::False, OperandType::AllocatedTrue, Boolean::Is(_)) => {}
|
|
|
|
(OperandType::False, OperandType::AllocatedFalse, Boolean::Is(_)) => {}
|
|
|
|
(OperandType::False, OperandType::NegatedAllocatedTrue, Boolean::Not(_)) => {}
|
|
|
|
(OperandType::False, OperandType::NegatedAllocatedFalse, Boolean::Not(_)) => {}
|
|
|
|
|
|
|
|
(OperandType::AllocatedTrue, OperandType::True, Boolean::Constant(true)) => {},
|
|
|
|
(OperandType::AllocatedTrue, OperandType::False, Boolean::Is(_)) => {},
|
|
|
|
(OperandType::AllocatedTrue, OperandType::True, Boolean::Constant(true)) => {}
|
|
|
|
(OperandType::AllocatedTrue, OperandType::False, Boolean::Is(_)) => {}
|
|
|
|
(
|
|
|
|
OperandType::AllocatedTrue,
|
|
|
|
OperandType::AllocatedTrue,
|
|
|
|
Boolean::Is(ref v),
|
|
|
|
) => {
|
|
|
|
assert_eq!(v.value, Some(true));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::AllocatedTrue,
|
|
|
|
OperandType::AllocatedFalse,
|
|
|
|
Boolean::Is(ref v),
|
|
|
|
) => {
|
|
|
|
assert_eq!(v.value, Some(true));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::AllocatedTrue,
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
|
Boolean::Not(ref v),
|
|
|
|
) => {
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::AllocatedTrue,
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
|
Boolean::Not(ref v),
|
|
|
|
) => {
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
(OperandType::AllocatedFalse, OperandType::True, Boolean::Constant(true)) => {},
|
|
|
|
(OperandType::AllocatedFalse, OperandType::False, Boolean::Is(_)) => {},
|
|
|
|
(OperandType::AllocatedFalse, OperandType::True, Boolean::Constant(true)) => {}
|
|
|
|
(OperandType::AllocatedFalse, OperandType::False, Boolean::Is(_)) => {}
|
|
|
|
(
|
|
|
|
OperandType::AllocatedFalse,
|
|
|
|
OperandType::AllocatedTrue,
|
|
|
|
Boolean::Is(ref v),
|
|
|
|
) => {
|
|
|
|
assert_eq!(v.value, Some(true));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::AllocatedFalse,
|
|
|
|
OperandType::AllocatedFalse,
|
|
|
|
Boolean::Is(ref v),
|
|
|
|
) => {
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::AllocatedFalse,
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
|
Boolean::Not(ref v),
|
|
|
|
) => {
|
|
|
|
assert_eq!(v.value, Some(true));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::AllocatedFalse,
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
|
Boolean::Not(ref v),
|
|
|
|
) => {
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
|
OperandType::True,
|
|
|
|
Boolean::Constant(true),
|
|
|
|
) => {},
|
|
|
|
(OperandType::NegatedAllocatedTrue, OperandType::False, Boolean::Not(_)) => {},
|
|
|
|
) => {}
|
|
|
|
(OperandType::NegatedAllocatedTrue, OperandType::False, Boolean::Not(_)) => {}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
|
OperandType::AllocatedTrue,
|
|
|
|
Boolean::Not(ref v),
|
|
|
|
) => {
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
|
OperandType::AllocatedFalse,
|
|
|
|
Boolean::Not(ref v),
|
|
|
|
) => {
|
|
|
|
assert_eq!(v.value, Some(true));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
|
Boolean::Not(ref v),
|
|
|
|
) => {
|
|
|
|
assert_eq!(v.value, Some(true));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
|
Boolean::Not(ref v),
|
|
|
|
) => {
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
|
OperandType::True,
|
|
|
|
Boolean::Constant(true),
|
|
|
|
) => {},
|
|
|
|
(OperandType::NegatedAllocatedFalse, OperandType::False, Boolean::Not(_)) => {},
|
|
|
|
) => {}
|
|
|
|
(OperandType::NegatedAllocatedFalse, OperandType::False, Boolean::Not(_)) => {}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
|
OperandType::AllocatedTrue,
|
|
|
|
Boolean::Not(ref v),
|
|
|
|
) => {
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
|
OperandType::AllocatedFalse,
|
|
|
|
Boolean::Not(ref v),
|
|
|
|
) => {
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
|
Boolean::Not(ref v),
|
|
|
|
) => {
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
|
Boolean::Not(ref v),
|
|
|
|
) => {
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
_ => panic!(
|
|
|
|
"this should never be encountered, in case: (a = {:?}, b = {:?}, c = {:?})",
|
|
|
@ -1710,16 +1710,16 @@ mod test { |
|
|
|
OperandType::False => Boolean::constant(false),
|
|
|
|
OperandType::AllocatedTrue => {
|
|
|
|
Boolean::from(AllocatedBit::alloc(cs, || Ok(true)).unwrap())
|
|
|
|
},
|
|
|
|
}
|
|
|
|
OperandType::AllocatedFalse => {
|
|
|
|
Boolean::from(AllocatedBit::alloc(cs, || Ok(false)).unwrap())
|
|
|
|
},
|
|
|
|
}
|
|
|
|
OperandType::NegatedAllocatedTrue => {
|
|
|
|
Boolean::from(AllocatedBit::alloc(cs, || Ok(true)).unwrap()).not()
|
|
|
|
},
|
|
|
|
}
|
|
|
|
OperandType::NegatedAllocatedFalse => {
|
|
|
|
Boolean::from(AllocatedBit::alloc(cs, || Ok(false)).unwrap()).not()
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
@ -1732,33 +1732,31 @@ mod test { |
|
|
|
assert!(cs.is_satisfied());
|
|
|
|
|
|
|
|
match (first_operand, second_operand, c) {
|
|
|
|
(OperandType::True, OperandType::True, Boolean::Constant(true)) => {},
|
|
|
|
(OperandType::True, OperandType::False, Boolean::Constant(false)) => {},
|
|
|
|
(OperandType::True, OperandType::AllocatedTrue, Boolean::Is(_)) => {},
|
|
|
|
(OperandType::True, OperandType::AllocatedFalse, Boolean::Is(_)) => {},
|
|
|
|
(OperandType::True, OperandType::NegatedAllocatedTrue, Boolean::Not(_)) => {},
|
|
|
|
(OperandType::True, OperandType::NegatedAllocatedFalse, Boolean::Not(_)) => {},
|
|
|
|
|
|
|
|
(OperandType::False, OperandType::True, Boolean::Constant(false)) => {},
|
|
|
|
(OperandType::False, OperandType::False, Boolean::Constant(false)) => {},
|
|
|
|
(OperandType::False, OperandType::AllocatedTrue, Boolean::Constant(false)) => {
|
|
|
|
},
|
|
|
|
(OperandType::True, OperandType::True, Boolean::Constant(true)) => {}
|
|
|
|
(OperandType::True, OperandType::False, Boolean::Constant(false)) => {}
|
|
|
|
(OperandType::True, OperandType::AllocatedTrue, Boolean::Is(_)) => {}
|
|
|
|
(OperandType::True, OperandType::AllocatedFalse, Boolean::Is(_)) => {}
|
|
|
|
(OperandType::True, OperandType::NegatedAllocatedTrue, Boolean::Not(_)) => {}
|
|
|
|
(OperandType::True, OperandType::NegatedAllocatedFalse, Boolean::Not(_)) => {}
|
|
|
|
|
|
|
|
(OperandType::False, OperandType::True, Boolean::Constant(false)) => {}
|
|
|
|
(OperandType::False, OperandType::False, Boolean::Constant(false)) => {}
|
|
|
|
(OperandType::False, OperandType::AllocatedTrue, Boolean::Constant(false)) => {}
|
|
|
|
(OperandType::False, OperandType::AllocatedFalse, Boolean::Constant(false)) => {
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::False,
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
|
Boolean::Constant(false),
|
|
|
|
) => {},
|
|
|
|
) => {}
|
|
|
|
(
|
|
|
|
OperandType::False,
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
|
Boolean::Constant(false),
|
|
|
|
) => {},
|
|
|
|
) => {}
|
|
|
|
|
|
|
|
(OperandType::AllocatedTrue, OperandType::True, Boolean::Is(_)) => {},
|
|
|
|
(OperandType::AllocatedTrue, OperandType::False, Boolean::Constant(false)) => {
|
|
|
|
},
|
|
|
|
(OperandType::AllocatedTrue, OperandType::True, Boolean::Is(_)) => {}
|
|
|
|
(OperandType::AllocatedTrue, OperandType::False, Boolean::Constant(false)) => {}
|
|
|
|
(
|
|
|
|
OperandType::AllocatedTrue,
|
|
|
|
OperandType::AllocatedTrue,
|
|
|
@ -1766,7 +1764,7 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("and result") == Fr::one());
|
|
|
|
assert_eq!(v.value, Some(true));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::AllocatedTrue,
|
|
|
|
OperandType::AllocatedFalse,
|
|
|
@ -1774,7 +1772,7 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("and result") == Fr::zero());
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::AllocatedTrue,
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
@ -1782,7 +1780,7 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("and not result") == Fr::zero());
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::AllocatedTrue,
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
@ -1790,11 +1788,11 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("and not result") == Fr::one());
|
|
|
|
assert_eq!(v.value, Some(true));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
(OperandType::AllocatedFalse, OperandType::True, Boolean::Is(_)) => {},
|
|
|
|
(OperandType::AllocatedFalse, OperandType::True, Boolean::Is(_)) => {}
|
|
|
|
(OperandType::AllocatedFalse, OperandType::False, Boolean::Constant(false)) => {
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::AllocatedFalse,
|
|
|
|
OperandType::AllocatedTrue,
|
|
|
@ -1802,7 +1800,7 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("and result") == Fr::zero());
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::AllocatedFalse,
|
|
|
|
OperandType::AllocatedFalse,
|
|
|
@ -1810,7 +1808,7 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("and result") == Fr::zero());
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::AllocatedFalse,
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
@ -1818,7 +1816,7 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("and not result") == Fr::zero());
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::AllocatedFalse,
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
@ -1826,14 +1824,14 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("and not result") == Fr::zero());
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
(OperandType::NegatedAllocatedTrue, OperandType::True, Boolean::Not(_)) => {},
|
|
|
|
(OperandType::NegatedAllocatedTrue, OperandType::True, Boolean::Not(_)) => {}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
|
OperandType::False,
|
|
|
|
Boolean::Constant(false),
|
|
|
|
) => {},
|
|
|
|
) => {}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
|
OperandType::AllocatedTrue,
|
|
|
@ -1841,7 +1839,7 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("and not result") == Fr::zero());
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
|
OperandType::AllocatedFalse,
|
|
|
@ -1849,7 +1847,7 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("and not result") == Fr::zero());
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
@ -1857,7 +1855,7 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("nor result") == Fr::zero());
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
@ -1865,14 +1863,14 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("nor result") == Fr::zero());
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
(OperandType::NegatedAllocatedFalse, OperandType::True, Boolean::Not(_)) => {},
|
|
|
|
(OperandType::NegatedAllocatedFalse, OperandType::True, Boolean::Not(_)) => {}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
|
OperandType::False,
|
|
|
|
Boolean::Constant(false),
|
|
|
|
) => {},
|
|
|
|
) => {}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
|
OperandType::AllocatedTrue,
|
|
|
@ -1880,7 +1878,7 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("and not result") == Fr::one());
|
|
|
|
assert_eq!(v.value, Some(true));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
|
OperandType::AllocatedFalse,
|
|
|
@ -1888,7 +1886,7 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("and not result") == Fr::zero());
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
|
OperandType::NegatedAllocatedTrue,
|
|
|
@ -1896,7 +1894,7 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("nor result") == Fr::zero());
|
|
|
|
assert_eq!(v.value, Some(false));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
(
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
|
OperandType::NegatedAllocatedFalse,
|
|
|
@ -1904,14 +1902,14 @@ mod test { |
|
|
|
) => {
|
|
|
|
assert!(cs.get("nor result") == Fr::one());
|
|
|
|
assert_eq!(v.value, Some(true));
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
_ => {
|
|
|
|
panic!(
|
|
|
|
"unexpected behavior at {:?} AND {:?}",
|
|
|
|
first_operand, second_operand
|
|
|
|
);
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2072,7 +2070,7 @@ mod test { |
|
|
|
match r {
|
|
|
|
Boolean::Is(ref r) => {
|
|
|
|
assert_eq!(r.value.unwrap(), expected);
|
|
|
|
},
|
|
|
|
}
|
|
|
|
_ => unreachable!(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|