CBMC
bv_refinement.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Abstraction Refinement Loop
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
11 
12 #ifndef CPROVER_SOLVERS_REFINEMENT_BV_REFINEMENT_H
13 #define CPROVER_SOLVERS_REFINEMENT_BV_REFINEMENT_H
14 
16 
17 #define MAX_STATE 10000
18 
20 {
21 private:
22  struct configt
23  {
24  bool output_xml = false;
26  unsigned max_node_refinement=5;
28  bool refine_arrays=true;
30  bool refine_arithmetic=true;
31  };
32 public:
33  struct infot:public configt
34  {
35  const namespacet *ns=nullptr;
36  propt *prop=nullptr;
38  };
39 
40  explicit bv_refinementt(const infot &info);
41 
43 
44  std::string decision_procedure_text() const override
45  {
46  return "refinement loop with "+prop.solver_text();
47  }
48 
49 protected:
50 
51  // Refine array
52  void finish_eager_conversion_arrays() override;
53 
54  // Refine arithmetic
55  bvt convert_mult(const mult_exprt &expr) override;
56  bvt convert_div(const div_exprt &expr) override;
57  bvt convert_mod(const mod_exprt &expr) override;
58  bvt convert_floatbv_op(const ieee_float_op_exprt &) override;
59 
60 private:
61  // the list of operator approximations
62  struct approximationt final
63  {
64  public:
65  explicit approximationt(std::size_t _id_nr):
66  no_operands(0),
67  under_state(0),
68  over_state(0),
69  id_nr(_id_nr)
70  {
71  }
72 
74  std::size_t no_operands;
75 
78 
79  std::vector<exprt> under_assumptions;
80  std::vector<exprt> over_assumptions;
81 
82  // the kind of under- or over-approximation
84 
85  std::string as_string() const;
86 
89 
90  std::size_t id_nr;
91  };
92 
94  approximationt &add_approximation(const exprt &expr, bvt &bv);
95  bool conflicts_with(approximationt &approximation);
96  void check_SAT(approximationt &approximation);
97  void check_UNSAT(approximationt &approximation);
98  void initialize(approximationt &approximation);
99  void get_values(approximationt &approximation);
100  void check_SAT();
101  void check_UNSAT();
104 
105  // MEMBERS
106 
107  bool progress;
108  std::list<approximationt> approximations;
109 
110 protected:
111  // use gui format
113 };
114 
115 #endif // CPROVER_SOLVERS_REFINEMENT_BV_REFINEMENT_H
bvt convert_mult(const mult_exprt &expr) override
decision_proceduret::resultt dec_solve(const exprt &) override
Implementation of the decision procedure.
bvt convert_div(const div_exprt &expr) override
std::string decision_procedure_text() const override
Return a textual description of the decision procedure.
Definition: bv_refinement.h:44
bv_refinementt(const infot &info)
bool conflicts_with(approximationt &approximation)
check if an under-approximation is part of the conflict
approximationt & add_approximation(const exprt &expr, bvt &bv)
void freeze_lazy_constraints()
freeze symbols for incremental solving
void arrays_overapproximated()
check whether counterexample is spurious
void get_values(approximationt &approximation)
void finish_eager_conversion_arrays() override
generate array constraints
bvt convert_mod(const mod_exprt &expr) override
bvt convert_floatbv_op(const ieee_float_op_exprt &) override
void initialize(approximationt &approximation)
std::list< approximationt > approximations
resultt
Result of running the decision procedure.
Division.
Definition: std_expr.h:1152
Base class for all expressions.
Definition: expr.h:56
IEEE floating-point operations These have two data operands (op0 and op1) and one rounding mode (op2)...
Definition: floatbv_expr.h:364
Modulo defined as lhs-(rhs * truncate(lhs/rhs)).
Definition: std_expr.h:1223
Binary multiplication Associativity is not specified.
Definition: std_expr.h:1107
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:94
TO_BE_DOCUMENTED.
Definition: prop.h:25
virtual std::string solver_text() const =0
std::vector< literalt > bvt
Definition: literal.h:201
BigInt mp_integer
Definition: smt_terms.h:17
std::vector< exprt > over_assumptions
Definition: bv_refinement.h:80
std::vector< exprt > under_assumptions
Definition: bv_refinement.h:79
approximationt(std::size_t _id_nr)
Definition: bv_refinement.h:65
unsigned max_node_refinement
Max number of times we refine a formula node.
Definition: bv_refinement.h:26
bool refine_arrays
Enable array refinement.
Definition: bv_refinement.h:28
bool refine_arithmetic
Enable arithmetic refinement.
Definition: bv_refinement.h:30
const namespacet * ns
Definition: bv_refinement.h:35
message_handlert * message_handler
Definition: bv_refinement.h:37