23 for(
const auto &
bit : bv)
24 if(!
bit.is_constant())
66 return result.first->second;
91 symbolst::const_iterator result =
99 return prop.
l_get(result->second).is_true();
123 for(
const auto &op : expr.
operands())
184 std::cout <<
literal <<
"=" << expr <<
'\n';
204 "constant expression of type bool should be either true or false");
238 "constraint_select_one should have at least two operands");
240 std::vector<literalt>
op_bv;
241 op_bv.reserve(op.size());
243 for(
const auto &op : expr.
operands())
249 b.reserve(
op_bv.size() - 1);
251 for(
unsigned i = 1; i <
op_bv.size(); i++)
264 "operator '" + expr.
id_string() +
"' takes at least one operand");
288 INVARIANT(op.size() == 1,
"not takes one operand");
293 INVARIANT(op.size() == 2,
"equality takes two operands");
296 if(op[0].is_boolean() && op[1].is_boolean())
335 std::pair<symbolst::iterator, bool> result =
336 symbols.insert(std::pair<irep_idt, literalt>(identifier,
tmp));
353 return expr.is_boolean();
371 for(
const auto &op : expr.
operands())
386 for(
const auto &op : expr.
operands())
420 for(
const auto &op : expr.
operands())
492 if(value.has_value())
502 for(
auto &op :
tmp.operands())
512 for(
const auto &symbol :
symbols)
513 out << symbol.first <<
" = " <<
prop.
l_get(symbol.second) <<
'\n';
542 for(
const auto &assumption : assumptions)
576 return "propositional reduction";
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
resultt
Result of running the decision procedure.
void set_to_true(const exprt &)
For a Boolean expression expr, add the constraint 'expr'.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
std::vector< exprt > operandst
bool is_true() const
Return whether the expression is a constant representing true.
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.
The Boolean constant false.
The trinary if-then-else operator.
std::string pretty(unsigned indent=0, unsigned max_indent=0) const
const std::string & id_string() const
const irep_idt & id() const
mstreamt & statistics() const
mstreamt & warning() const
mstreamt & progress() const
void pop() override
Pop whatever is on top of the stack.
virtual bool set_equality_to_true(const equal_exprt &expr)
virtual literalt convert_bool(const exprt &expr)
decision_proceduret::resultt dec_solve(const exprt &) override
Implementation of the decision procedure.
void set_frozen(literalt)
std::vector< size_t > context_size_stack
assumption_stack is segmented in contexts; Number of assumptions in each context on the stack
std::size_t context_literal_counter
To generate unique literal names for contexts.
std::size_t get_number_of_solver_calls() const override
Return the number of incremental solver calls.
bool equality_propagation
bool post_processing_done
virtual void finish_eager_conversion()
virtual literalt get_literal(const irep_idt &symbol)
std::string decision_procedure_text() const override
Return a textual description of the decision procedure.
virtual void ignoring(const exprt &expr)
void add_constraints_to_prop(const exprt &expr, bool value)
Helper method used by set_to for adding the constraints to prop.
void push() override
Push a new context on the stack This context becomes a child context nested in the current context.
virtual std::optional< bool > get_bool(const exprt &expr) const
Get a boolean value from the model if the formula is satisfiable.
literalt convert(const exprt &expr) override
Convert a Boolean expression and return the corresponding literal.
exprt get(const exprt &expr) const override
Return expr with variables replaced by values from satisfying assignment if available.
bvt assumption_stack
Assumptions on the stack.
virtual literalt convert_rest(const exprt &expr)
void set_to(const exprt &expr, bool value) override
For a Boolean expression expr, add the constraint 'current_context => expr' if value is true,...
exprt handle(const exprt &expr) override
Generate a handle, which is an expression that has the same value as the argument in any model that i...
static const char * context_prefix
bool is_in_conflict(const exprt &expr) const override
Returns true if an expression is in the final conflict leading to UNSAT.
void print_assignment(std::ostream &out) const override
Print satisfying assignment to out.
void l_set_to_true(literalt a)
virtual literalt land(literalt a, literalt b)=0
std::size_t get_number_of_solver_calls() const
virtual void set_variable_name(literalt, const irep_idt &)
virtual literalt limplies(literalt a, literalt b)=0
virtual literalt lselect(literalt a, literalt b, literalt c)=0
virtual void set_frozen(literalt)
virtual void l_set_to(literalt a, bool value)
virtual literalt lxor(literalt a, literalt b)=0
virtual std::string solver_text() const =0
void lcnf(literalt l0, literalt l1)
virtual literalt new_variable()=0
virtual literalt lequal(literalt a, literalt b)=0
virtual literalt lor(literalt a, literalt b)=0
virtual bool is_in_conflict(literalt l) const =0
Returns true if an assumption is in the final conflict.
virtual tvt l_get(literalt a) const =0
Expression to hold a symbol (variable)
The Boolean constant true.
std::vector< literalt > bvt
literalt const_literal(bool value)
const literal_exprt & to_literal_expr(const exprt &expr)
Cast a generic exprt to a literal_exprt.
#define CHECK_RETURN(CONDITION)
#define UNREACHABLE
This should be used to mark dead code.
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
#define PRECONDITION(CONDITION)
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.
const named_term_exprt & to_named_term_expr(const exprt &expr)
Cast an exprt to a named_term_exprt.
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 symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
const implies_exprt & to_implies_expr(const exprt &expr)
Cast an exprt to a implies_exprt.
const equal_exprt & to_equal_expr(const exprt &expr)
Cast an exprt to an equal_exprt.