@@ -70,13 +70,21 @@ class smt2_incremental_decision_proceduret final
70
70
// / Sends the solver the definitions of the object sizes.
71
71
void define_object_sizes ();
72
72
73
+ // / Namespace for looking up the expressions which symbol_exprts relate to.
74
+ // / This includes the symbols defined outside of the decision procedure but
75
+ // / does not include any additional SMT function identifiers introduced by the
76
+ // / decision procedure.
73
77
const namespacet &ns;
74
-
78
+ // / The number of times `dec_solve()` has been called.
75
79
size_t number_of_solver_calls;
76
-
80
+ // / \brief For handling the lifetime of and communication with the separate
81
+ // / SMT solver process.
82
+ // / \note This may be mocked for unit testing purposes.
77
83
std::unique_ptr<smt_base_solver_processt> solver_process;
84
+ // / For reporting errors, warnings and debugging information back to the user.
78
85
messaget log;
79
-
86
+ // / Generators of sequences of uniquely identifying numbers used for naming
87
+ // / SMT functions introduced by the decision procedure.
80
88
class sequencet
81
89
{
82
90
size_t next_id = 0 ;
@@ -87,14 +95,38 @@ class smt2_incremental_decision_proceduret final
87
95
return next_id++;
88
96
}
89
97
} handle_sequence, array_sequence;
90
-
98
+ // / When the `handle(exprt)` member function is called, the decision procedure
99
+ // / commands the SMT solver to define a new function corresponding to the
100
+ // / given expression. The mapping of the expressions to the function
101
+ // / identifiers is stored in this map so that when there is as subsequent
102
+ // / `get(exprt)` call for the same expression, the function identifier can be
103
+ // / requested from the solver, rather than reconverting the expression.
91
104
std::unordered_map<exprt, smt_identifier_termt, irep_hash>
92
105
expression_handle_identifiers;
106
+ // / As part of the decision procedure's overall translation of CBMCs `exprt`s
107
+ // / into SMT terms, some subexpressions are substituted for separate SMT
108
+ // / functions. This map associates these sub-expressions to the identifiers of
109
+ // / the separated functions. This applies to `symbol_exprt` where it is fairly
110
+ // / natural to define the value of the symbol using a separate function, but
111
+ // / also to the expressions which define entire arrays. This includes
112
+ // / `array_exprt` for example and will additionally include other similar
113
+ // / array expressions when support for them is implemented.
93
114
std::unordered_map<exprt, smt_identifier_termt, irep_hash>
94
115
expression_identifiers;
116
+ // / This map is used to track object related state. See documentation in
117
+ // / object_tracking.h for details.
95
118
smt_object_mapt object_map;
119
+ // / The size of each object is separately defined as a pre-solving step.
120
+ // / `object_size_defined[object ID]` is set to true for objects where the size
121
+ // / has been defined. This is used to avoid defining the size of the same
122
+ // / object multiple times in the case where multiple rounds of solving are
123
+ // / carried out.
96
124
std::vector<bool > object_size_defined;
125
+ // / Implementation of the SMT formula for the object size function. This is
126
+ // / stateful because it depends on the configuration of the number of object
127
+ // / bits and how many bits wide the size type is configured to be.
97
128
smt_object_sizet object_size_function;
129
+ // / Precalculated type sizes used for pointer arithmetic.
98
130
type_size_mapt pointer_sizes_map;
99
131
};
100
132
0 commit comments