25 else if(expr.
id()==ID_not)
27 else if(expr.
id()==ID_and ||
33 "logical and, or, and xor expressions have at least two operands");
39 return expr.
id() == ID_and
43 else if(expr.
id()==ID_implies)
52 else if(expr.
id() == ID_equal &&
to_equal_expr(expr).lhs().is_boolean())
61 else if(expr.
id()==ID_if)
73 std::pair<expr_mapt::iterator, bool> entry =
79 const unsigned index = (unsigned)
node_map.size() - 1;
83 return entry.first->second;
101 return or_exprt{std::move(a), std::move(b)};
109 std::unordered_map<bdd_nodet::idt, exprt> &cache)
const
113 if(
r.is_complement())
119 auto index = narrow<std::size_t>(
r.index());
124 auto insert_result = cache.emplace(
r.id(),
nil_exprt());
125 if(insert_result.second)
127 auto result_ignoring_complementation = [&]() ->
exprt {
128 if(
r.else_branch().is_constant())
130 if(
r.then_branch().is_constant())
132 if(
r.else_branch().is_complement())
138 if(
r.else_branch().is_complement())
147 else if(
r.then_branch().is_constant())
149 if(
r.then_branch().is_complement())
155 return make_or(n_expr, else_case);
160 return if_exprt(n_expr, then_branch, else_branch);
163 insert_result.first->second =
166 : result_ignoring_complementation;
168 return insert_result.first->second;
173 std::unordered_map<bdd_nodet::idt, exprt> cache;
static exprt make_or(exprt a, exprt b)
Disjunction of two expressions.
Conversion between exprt and miniBDD.
std::vector< exprt > node_map
Mapping from BDD variables to expressions: the expression at index i of node_map corresponds to the i...
exprt as_expr(const bddt &root) const
bddt from_expr_rec(const exprt &expr)
bddt from_expr(const exprt &expr)
bdd_nodet bdd_node(const bddt &bdd) const
bddt bdd_variable(bdd_nodet::indext index)
Low level access to the structure of the BDD, read-only.
Logical operations on BDDs.
bddt bdd_xor(const bddt &other) const
static bddt bdd_ite(const bddt &i, const bddt &t, const bddt &e)
bddt bdd_or(const bddt &other) const
bddt bdd_and(const bddt &other) const
Base class for all expressions.
bool is_boolean() const
Return whether the expression represents a Boolean.
bool is_false() const
Return whether the expression is a constant representing false.
bool is_constant() const
Return whether the expression is a constant.
void add_to_operands(const exprt &expr)
Add the given argument to the end of exprt's operands.
The Boolean constant false.
The trinary if-then-else operator.
const irep_idt & id() const
The Boolean constant true.
exprt make_binary(const exprt &expr)
splits an expression with >=3 operands into nested binary expressions
exprt make_and(exprt a, exprt b)
Conjunction of two expressions.
exprt boolean_negate(const exprt &src)
negate a Boolean expression, possibly removing a not_exprt, and swapping false and true
Deprecated expression utility functions.
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
#define PRECONDITION(CONDITION)
API to expression classes.
const if_exprt & to_if_expr(const exprt &expr)
Cast an exprt to an if_exprt.
const not_exprt & to_not_expr(const exprt &expr)
Cast an exprt to an not_exprt.
const binary_exprt & to_binary_expr(const exprt &expr)
Cast an exprt to a binary_exprt.
const equal_exprt & to_equal_expr(const exprt &expr)
Cast an exprt to an equal_exprt.
const implies_exprt & to_implies_expr(const exprt &expr)
Cast an exprt to a implies_exprt.