pub mod not;
pub mod or;
pub mod and;
pub mod xor;
use crate::{term::{Term, Value, value_eq}, term::{ValueEq, ValueNe}};
term! {
pub const fn ConstBool<const B: bool>() -> unsafe bool {
B
}
}
pub type True = ConstBool<true>;
pub type False = ConstBool<false>;
#[allow(non_upper_case_globals)]
pub const True: Value<True> = ConstBool();
#[allow(non_upper_case_globals)]
pub const False: Value<False> = ConstBool();
pub fn true_ne_false() -> ValueNe<True, False> {
unsafe {ValueNe::axiom()}
}
pub fn ne_ne_implies_eq<A: Term<Type = bool>, B: Term<Type = bool>, C: Term<Type = bool>>(_a_ne: ValueNe<A, C>, _b_ne: ValueNe<B, C>) -> ValueEq<A, B> {
unsafe {ValueEq::axiom()}
}
pub fn ne_true_implies_false<T: Term<Type = bool>>(ne: ValueNe<T, True>) -> ValueEq<T, False> {
ne_ne_implies_eq(ne, -true_ne_false())
}
pub fn ne_false_implies_true<T: Term<Type = bool>>(ne: ValueNe<T, False>) -> ValueEq<T, True> {
ne_ne_implies_eq(ne, true_ne_false())
}
pub fn choose<B: Term<Type = bool>>(b: Value<B>) -> Result<
ValueEq<B, True>,
ValueEq<B, False>
> {
match value_eq(b, True) {
Ok(eq) => Ok(eq),
Err(ne) => Err(ne_true_implies_false(ne))
}
}