CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
bv_refinement_loop.cpp
Go to the documentation of this file.
1/*******************************************************************\
2
3Module:
4
5Author: Daniel Kroening, kroening@kroening.com
6
7\*******************************************************************/
8
9#include "bv_refinement.h"
10
11#include <util/xml.h>
12
14 : bv_pointerst(*info.ns, *info.prop, *info.message_handler),
15 progress(false),
16 config_(info)
17{
18 // check features we need
22}
23
25{
26 // do the usual post-processing
27 log.progress() << "BV-Refinement: post-processing" << messaget::eom;
29
30 log.debug() << "Solving with " << prop.solver_text() << messaget::eom;
31
32 unsigned iteration=0;
33
34 // now enter the loop
35 while(true)
36 {
37 iteration++;
38
39 log.progress() << "BV-Refinement: iteration " << iteration << messaget::eom;
40
41 // output the very same information in a structured fashion
43 {
44 xmlt xml("refinement-iteration");
45 xml.data=std::to_string(iteration);
46 log.status() << xml << '\n';
47 }
48
49 switch(prop_solve())
50 {
52 check_SAT();
53 if(!progress)
54 {
55 log.status() << "BV-Refinement: got SAT, and it simulates => SAT"
57 log.statistics() << "Total iterations: " << iteration << messaget::eom;
59 }
60 else
61 log.progress() << "BV-Refinement: got SAT, and it is spurious, refining"
63 break;
64
67 if(!progress)
68 {
69 log.status()
70 << "BV-Refinement: got UNSAT, and the proof passes => UNSAT"
72 log.statistics() << "Total iterations: " << iteration << messaget::eom;
74 }
75 else
77 << "BV-Refinement: got UNSAT, and the proof fails, refining"
79 break;
80
82 return resultt::D_ERROR;
83 }
84 }
85}
86
88{
89 // this puts the underapproximations into effect
90 std::vector<exprt> assumptions;
91
93 {
94 assumptions.insert(
95 assumptions.end(),
96 approximation.over_assumptions.begin(),
97 approximation.over_assumptions.end());
98 assumptions.insert(
99 assumptions.end(),
100 approximation.under_assumptions.begin(),
101 approximation.under_assumptions.end());
102 }
103
104 push(assumptions);
106 pop();
107
108 // clang-format off
109 switch(result)
110 {
114 }
115 // clang-format off
116
118}
119
121{
122 progress=false;
123
125
126 // get values before modifying the formula
129
132}
133
Abstraction Refinement Loop.
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
messaget log
Definition arrays.h:57
void finish_eager_conversion() override
decision_proceduret::resultt dec_solve(const exprt &) override
Implementation of the decision procedure.
bv_refinementt(const infot &info)
void arrays_overapproximated()
check whether counterexample is spurious
void get_values(approximationt &approximation)
std::list< approximationt > approximations
resultt
Result of running the decision procedure.
Base class for all expressions.
Definition expr.h:56
mstreamt & debug() const
Definition message.h:421
mstreamt & statistics() const
Definition message.h:411
mstreamt & progress() const
Definition message.h:416
static eomt eom
Definition message.h:289
mstreamt & status() const
Definition message.h:406
void pop() override
Pop whatever is on top of the stack.
void push() override
Push a new context on the stack This context becomes a child context nested in the current context.
bvt assumption_stack
Assumptions on the stack.
virtual std::string solver_text() const =0
resultt prop_solve()
Definition prop.cpp:39
virtual bool has_assumptions() const
Definition prop.h:88
resultt
Definition prop.h:101
virtual bool has_set_to() const
Definition prop.h:81
virtual bool has_is_in_conflict() const
Definition prop.h:114
Definition xml.h:21
std::string data
Definition xml.h:39
xmlt xml(const irep_idt &property_id, const property_infot &property_info)
#define UNREACHABLE
This should be used to mark dead code.
Definition invariant.h:525
#define PRECONDITION(CONDITION)
Definition invariant.h:463