39 enum value_t :
repr_t { no_value = -1, maybe_value = 0, yes_value = 1 };
43 constexpr
trival() noexcept
50 : val_(v ? yes_value : no_value)
79 return val_ != maybe_value;
85 return val_ == maybe_value;
91 return val_ == yes_value;
97 return val_ == no_value;
111 explicit operator bool()
const
113 return val_ == yes_value;
119 return trival((val_ == yes_value) ? no_value :
120 (val_ == no_value) ? yes_value :
136 return a.
val() == b.
val();
150 (a.
val() == trival::no_value || b.
val() == trival::no_value)
152 : (a.
val() == trival::maybe_value || b.
val() == trival::maybe_value)
173 (a.
val() == trival::yes_value || b.
val() == trival::yes_value)
175 : (a.
val() == trival::maybe_value || b.
val() == trival::maybe_value)
195 return os << ((v.
val() == trival::no_value) ?
"no"
196 : (v.
val() == trival::maybe_value) ?
"maybe"
A class implementing Kleene's three-valued logic.
Definition: trival.hh:33
value_t
The three possible logical values.
Definition: trival.hh:39
constexpr bool is_known() const
Is true or false, but not maybe.
Definition: trival.hh:77
static constexpr trival maybe() noexcept
Return a trival representing the maybe (unknown) value.
Definition: trival.hh:71
constexpr trival(bool v) noexcept
Construct from a bool: false maps to no, true to yes.
Definition: trival.hh:49
signed char repr_t
Definition: trival.hh:37
static trival from_repr_t(repr_t v)
Construct from a raw repr_t value.
Definition: trival.hh:58
constexpr bool is_maybe() const
Return true iff the value is maybe.
Definition: trival.hh:83
constexpr trival operator!() const
Return the three-valued logical negation.
Definition: trival.hh:117
constexpr bool is_false() const
Return true iff the logical value is no.
Definition: trival.hh:95
constexpr trival(value_t v)
Construct from a value_t enumerator.
Definition: trival.hh:65
constexpr value_t val() const
Return the raw value_t enumerator.
Definition: trival.hh:101
constexpr bool is_true() const
Return true iff the logical value is yes.
Definition: trival.hh:89
Definition: automata.hh:26
constexpr trival operator||(trival a, trival b)
Three-valued Kleene logical OR.
Definition: trival.hh:170
std::ostream & operator<<(std::ostream &os, const mc_algorithm &ma)
Print an mc_algorithm value to a stream.
Definition: mc.hh:74
constexpr trival operator&&(trival a, trival b)
Three-valued Kleene logical AND.
Definition: trival.hh:147
constexpr bool operator==(trival a, trival b)
Equality comparison of two trival values.
Definition: trival.hh:134
constexpr bool operator!=(trival a, trival b)
Inequality comparison of two trival values.
Definition: trival.hh:140