CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
solver_types.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Solver
4
5Author: Daniel Kroening, dkr@amazon.com
6
7\*******************************************************************/
8
11
12#ifndef CPROVER_CPROVER_SOLVER_TYPES_H
13#define CPROVER_CPROVER_SOLVER_TYPES_H
14
16#include <util/std_expr.h>
17
18#include <chrono>
19#include <unordered_map>
20#include <unordered_set>
21
23{
24public:
26 {
27 }
28 explicit frame_reft(std::size_t __index) : index(__index)
29 {
30 }
31 std::size_t index;
32 friend bool operator==(const frame_reft &a, const frame_reft &b)
33 {
34 return a.index == b.index;
35 }
36};
37
38using frame_mapt = std::unordered_map<symbol_exprt, frame_reft, irep_hash>;
39
40class framet
41{
42public:
52
54
55 // our current hypothesis invariant
56 std::vector<exprt> invariants;
57 std::unordered_set<exprt, irep_hash> invariants_set;
58
59 // inferred obligations
60 std::vector<exprt> obligations;
61 std::unordered_set<exprt, irep_hash> obligations_set;
62
63 // auxiliary facts
64 std::vector<exprt> auxiliaries;
65 std::unordered_set<exprt, irep_hash> auxiliaries_set;
66
67 // formulas where this frame is on the rhs of ⇒
82
83 std::vector<implicationt> implications;
84
85 // tracking source code origin
87
88 void add_auxiliary(exprt);
89 void add_invariant(exprt);
91
101
103};
104
105frame_mapt build_frame_map(const std::vector<framet> &frames);
106
108
110 const std::vector<exprt> &constraints,
111 std::vector<framet> &);
112
113std::vector<framet> setup_frames(const std::vector<exprt> &constraints);
114
116{
117public:
127
129 {
131 }
132
136
137 using statust = enum { UNKNOWN, PASS, REFUTED, ERROR, DROPPED };
139 std::chrono::time_point<std::chrono::steady_clock> start, stop;
140
141 // trace information when REFUTED
150
152 {
154 std::vector<trace_updatet> updates;
155 };
156
157 using tracet = std::vector<trace_statet>;
159};
160
161std::vector<propertyt> find_properties(
162 const std::vector<exprt> &constraints,
163 const std::vector<framet> &);
164
165struct workt
166{
167 using patht = std::vector<frame_reft>;
168
170 : frame(std::move(__frame)),
171 invariant(std::move(__invariant)),
172 path(std::move(__path))
173 {
174 }
175
176 // The frame where the invariant is to be established.
179
181
182 std::size_t nondet_counter = 0;
183};
184
185#endif // CPROVER_CPROVER_SOLVER_TYPES_H
virtual void clear()
Reset the abstract state.
Definition ai.h:265
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition dstring.h:38
Base class for all expressions.
Definition expr.h:56
friend bool operator==(const frame_reft &a, const frame_reft &b)
frame_reft(std::size_t __index)
std::size_t index
Stack frames – these are used for function calls and for exceptions.
std::unordered_set< exprt, irep_hash > invariants_set
std::vector< exprt > obligations
std::unordered_set< exprt, irep_hash > auxiliaries_set
void add_invariant(exprt)
frame_reft ref
void reset()
void add_auxiliary(exprt)
framet(symbol_exprt __symbol, source_locationt __source_location, frame_reft __ref)
std::unordered_set< exprt, irep_hash > obligations_set
symbol_exprt symbol
std::vector< exprt > auxiliaries
source_locationt source_location
void add_obligation(exprt)
std::vector< exprt > invariants
std::vector< implicationt > implications
Application of (mathematical) function.
Boolean implication.
Definition std_expr.h:2225
std::vector< trace_statet > tracet
exprt condition
statust status
frame_reft frame
propertyt(source_locationt __source_location, frame_reft __frame, exprt __condition)
tracet trace
irep_idt property_id() const
std::chrono::time_point< std::chrono::steady_clock > stop
source_locationt source_location
std::chrono::time_point< std::chrono::steady_clock > start
static const source_locationt & nil()
const irep_idt & get_property_id() const
Expression to hold a symbol (variable)
Definition std_expr.h:131
API to expression classes for 'mathematical' expressions.
STL namespace.
@ PASS
The property was not violated.
frame_mapt build_frame_map(const std::vector< framet > &frames)
std::vector< framet > setup_frames(const std::vector< exprt > &constraints)
std::unordered_map< symbol_exprt, frame_reft, irep_hash > frame_mapt
void find_implications(const std::vector< exprt > &constraints, std::vector< framet > &)
frame_reft find_frame(const frame_mapt &, const symbol_exprt &frame_symbol)
std::vector< propertyt > find_properties(const std::vector< exprt > &constraints, const std::vector< framet > &)
API to expression classes.
implies_exprt as_expr() const
implicationt(exprt __lhs, function_application_exprt __rhs)
function_application_exprt rhs
std::vector< trace_updatet > updates
trace_updatet(exprt __address, exprt __value)
workt(frame_reft __frame, exprt __invariant, patht __path)
exprt invariant
patht path
std::size_t nondet_counter
std::vector< frame_reft > patht
frame_reft frame