Go to the documentation of this file.
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)
53 expr.
id() == ID_equal &&
to_equal_expr(expr).lhs().type().
id() == ID_bool)
62 else if(expr.
id()==ID_if)
74 std::pair<expr_mapt::iterator, bool> entry =
80 const unsigned index = (unsigned)
node_map.size() - 1;
84 return entry.first->second;
102 return or_exprt{std::move(a), std::move(b)};
110 std::unordered_map<bdd_nodet::idt, exprt> &cache)
const
114 if(
r.is_complement())
120 auto index = narrow<std::size_t>(
r.index());
125 auto insert_result = cache.emplace(
r.id(),
nil_exprt());
126 if(insert_result.second)
128 auto result_ignoring_complementation = [&]() ->
exprt {
129 if(
r.else_branch().is_constant())
131 if(
r.then_branch().is_constant())
133 if(
r.else_branch().is_complement())
139 if(
r.else_branch().is_complement())
148 else if(
r.then_branch().is_constant())
150 if(
r.then_branch().is_complement())
156 return make_or(n_expr, else_case);
161 return if_exprt(n_expr, then_branch, else_branch);
164 insert_result.first->second =
167 : result_ignoring_complementation;
169 return insert_result.first->second;
174 std::unordered_map<bdd_nodet::idt, exprt> cache;
exprt make_and(exprt a, exprt b)
Conjunction of two expressions.
bddt from_expr(const exprt &expr)
bddt bdd_or(const bddt &other) const
const if_exprt & to_if_expr(const exprt &expr)
Cast an exprt to an if_exprt.
std::vector< exprt > node_map
Mapping from BDD variables to expressions: the expression at index i of node_map corresponds to the i...
The trinary if-then-else operator.
Base class for all expressions.
Low level access to the structure of the BDD, read-only.
exprt make_binary(const exprt &expr)
splits an expression with >=3 operands into nested binary expressions
bool is_false() const
Return whether the expression is a constant representing false.
const binary_exprt & to_binary_expr(const exprt &expr)
Cast an exprt to a binary_exprt.
typet & type()
Return the type of the expression.
static bddt bdd_ite(const bddt &i, const bddt &t, const bddt &e)
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
bdd_nodet bdd_node(const bddt &bdd) const
bddt bdd_variable(bdd_nodet::indext index)
#define PRECONDITION(CONDITION)
exprt boolean_negate(const exprt &src)
negate a Boolean expression, possibly removing a not_exprt, and swapping false and true
exprt as_expr(const bddt &root) const
const irep_idt & id() const
The Boolean constant false.
Deprecated expression utility functions.
bddt from_expr_rec(const exprt &expr)
bddt bdd_and(const bddt &other) const
const not_exprt & to_not_expr(const exprt &expr)
Cast an exprt to an not_exprt.
const implies_exprt & to_implies_expr(const exprt &expr)
Cast an exprt to a implies_exprt.
bool is_constant() const
Return whether the expression is a constant.
const equal_exprt & to_equal_expr(const exprt &expr)
Cast an exprt to an equal_exprt.
void add_to_operands(const exprt &expr)
Add the given argument to the end of exprt's operands.
Logical operations on BDDs.
The Boolean constant true.
bddt bdd_xor(const bddt &other) const
static exprt make_or(exprt a, exprt b)
Disjunction of two expressions.