CBMC
Loading...
Searching...
No Matches
bmc_util.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Bounded Model Checking Utilities
4
5Author: Daniel Kroening, Peter Schrammel
6
7\*******************************************************************/
8
11
12#ifndef CPROVER_GOTO_CHECKER_BMC_UTIL_H
13#define CPROVER_GOTO_CHECKER_BMC_UTIL_H
14
16
18
20#include "properties.h"
21
22#include <chrono> // IWYU pragma: keep
23#include <memory>
24
27class goto_tracet;
30class namespacet;
31class optionst;
32class symex_bmct;
34struct trace_optionst;
36
38 symex_target_equationt &equation,
39 decision_proceduret &decision_procedure,
41
46
49
52 const namespacet &,
54 const decision_proceduret &,
56
58 const goto_tracet &,
59 const namespacet &,
60 const trace_optionst &,
62
63void output_graphml(const goto_tracet &, const namespacet &, const optionst &);
66 const namespacet &,
67 const optionst &);
68
69std::unique_ptr<memory_model_baset>
70get_memory_model(const optionst &options, const namespacet &);
71
72void slice(
73 symex_bmct &,
75 const namespacet &,
76 const optionst &,
78
84 symex_bmct &symex,
85 symex_target_equationt &equation,
86 const optionst &options,
87 const namespacet &ns,
88 ui_message_handlert &ui_message_handler);
89
98 const std::string &cov_out,
99 const abstract_goto_modelt &goto_model,
100 const symex_bmct &symex,
101 ui_message_handlert &ui_message_handler);
102
110 propertiest &properties,
111 std::unordered_set<irep_idt> &updated_properties,
112 const symex_target_equationt &equation);
113
121 propertiest &properties,
122 std::unordered_set<irep_idt> &updated_properties);
123
131 propertiest &properties,
132 std::unordered_set<irep_idt> &updated_properties);
133
143std::chrono::duration<double> prepare_property_decider(
144 propertiest &properties,
145 symex_target_equationt &equation,
146 goto_symex_property_decidert &property_decider,
147 ui_message_handlert &ui_message_handler);
148
161 propertiest &properties,
162 goto_symex_property_decidert &property_decider,
163 ui_message_handlert &ui_message_handler,
164 std::chrono::duration<double> solver_runtime,
165 bool set_pass = true);
166
167#define OPT_BMC \
168 "(program-only)" \
169 "(show-byte-ops)" \
170 "(show-vcc)" \
171 "(show-goto-symex-steps)" \
172 "(show-points-to-sets)" \
173 "(slice-formula)" \
174 "(unwinding-assertions)" \
175 "(no-unwinding-assertions)" \
176 "(no-self-loops-to-assumptions)" \
177 "(partial-loops)" \
178 "(paths):" \
179 "(show-symex-strategies)" \
180 "(depth):" \
181 "(max-field-sensitivity-array-size):" \
182 "(no-array-field-sensitivity)" \
183 "(graphml-witness):" \
184 "(symex-complexity-limit):" \
185 "(symex-complexity-failed-child-loops-limit):" \
186 "(incremental-loop):" \
187 "(unwind-min):" \
188 "(unwind-max):" \
189 "(ignore-properties-before-unwind-min)" \
190 "(symex-cache-dereferences)" OPT_UNWINDSET
191
192#define HELP_BMC \
193 " {y--paths} [strategy] \t explore paths one at a time\n" \
194 " {y--show-symex-strategies} \t list strategies for use with {y--paths}\n" \
195 " {y--show-goto-symex-steps} \t show which steps symex travels, includes " \
196 "diagnostic information\n" \
197 " {y--show-points-to-sets} \t show points-to sets for pointer dereference. " \
198 "Requires {y--json-ui}.\n" \
199 " {y--program-only} \t only show program expression\n" \
200 " {y--show-byte-ops} \t show all byte extracts and updates\n" \
201 " {y--depth} {unr} \t limit search depth\n" \
202 " {y--max-field-sensitivity-array-size} {uM} \t " \
203 "maximum size {uM} of arrays for which field sensitivity will be " \
204 "applied to array, the default is 64\n" \
205 " {y--no-array-field-sensitivity} \t " \
206 "deactivate field sensitivity for arrays, this is equivalent to setting " \
207 "the maximum field sensitivity size for arrays to 0\n" HELP_UNWINDSET \
208 " {y--incremental-loop} {uL} \t " \
209 "check properties after each unwinding of loop {uL} (use {y--show-loops} " \
210 "to get the loop IDs)\n" \
211 " {y--unwind-min} {unr} \t " \
212 "start incremental-loop after {unr} unwindings but before solving that " \
213 "iteration. If for example it is 1, then the loop will be unwound once, " \
214 "and immediately checked. Note: this means for {y--unwind-min} 1 or 0 all " \
215 "properties are checked.\n" \
216 " {y--unwind-max} {unr} \t stop incremental-loop after {unr} unwindings\n" \
217 " {y--ignore-properties-before-unwind-min} \t " \
218 "do not check properties before unwind-min when using " \
219 "{y--incremental-loop}\n" \
220 " {y--show-vcc} \t show the verification conditions\n" \
221 " {y--slice-formula} \t remove assignments unrelated to property\n" \
222 " {y--unwinding-assertions} \t generate unwinding assertions (cannot be " \
223 "used with {y--cover})\n" \
224 " {y--partial-loops} \t permit paths with partial loops\n" \
225 " {y--no-self-loops-to-assumptions} \t do not simplify while(1){ {}} to " \
226 "assume(0)\n" \
227 " {y--symex-complexity-limit} {uN} \t " \
228 "how complex ({uN}) a path can become before symex abandons it. Currently " \
229 "uses guard size to calculate complexity.\n" \
230 " {y--symex-complexity-failed-child-loops-limit} {uN} \t " \
231 "how many child branches ({uN}) in an iteration are allowed to fail due to " \
232 "complexity violations before the loop gets blacklisted\n" \
233 " {y--graphml-witness} {ufilename} \t write the witness in GraphML format " \
234 "to {ufilename}\n" \
235 " {y--symex-cache-dereferences} \t enable caching of repeated " \
236 "dereferences\n"
237
238#endif // CPROVER_GOTO_CHECKER_BMC_UTIL_H
void run_property_decider(incremental_goto_checkert::resultt &result, propertiest &properties, goto_symex_property_decidert &property_decider, ui_message_handlert &ui_message_handler, std::chrono::duration< double > solver_runtime, bool set_pass=true)
Runs the property decider to solve the equation.
Definition bmc_util.cpp:359
void slice(symex_bmct &, symex_target_equationt &symex_target_equation, const namespacet &, const optionst &, ui_message_handlert &)
Definition bmc_util.cpp:175
void output_coverage_report(const std::string &cov_out, const abstract_goto_modelt &goto_model, const symex_bmct &symex, ui_message_handlert &ui_message_handler)
Output a coverage report as generated by symex_coveraget if cov_out is non-empty.
Definition bmc_util.cpp:283
std::chrono::duration< double > prepare_property_decider(propertiest &properties, symex_target_equationt &equation, goto_symex_property_decidert &property_decider, ui_message_handlert &ui_message_handler)
Converts the equation and sets up the property decider, but does not call solve.
Definition bmc_util.cpp:335
void update_status_of_unknown_properties(propertiest &properties, std::unordered_set< irep_idt > &updated_properties)
Sets the property status of UNKNOWN properties to PASS.
Definition bmc_util.cpp:267
void output_graphml(const goto_tracet &, const namespacet &, const optionst &)
outputs an error witness in graphml format
Definition bmc_util.cpp:104
void update_properties_status_from_symex_target_equation(propertiest &properties, std::unordered_set< irep_idt > &updated_properties, const symex_target_equationt &equation)
Sets property status to PASS for properties whose conditions are constant true in the equation.
Definition bmc_util.cpp:215
void output_error_trace(const goto_tracet &, const namespacet &, const trace_optionst &, ui_message_handlert &)
Definition bmc_util.cpp:61
void message_building_error_trace(messaget &)
Outputs a message that an error trace is being built.
Definition bmc_util.cpp:32
void update_status_of_not_checked_properties(propertiest &properties, std::unordered_set< irep_idt > &updated_properties)
Sets the property status of NOT_CHECKED properties to PASS.
Definition bmc_util.cpp:251
ssa_step_predicatet ssa_step_matches_failing_property(const irep_idt &property_id)
Returns a function that checks whether an SSA step is an assertion with property_id.
Definition bmc_util.cpp:51
std::unique_ptr< memory_model_baset > get_memory_model(const optionst &options, const namespacet &)
Definition bmc_util.cpp:159
void convert_symex_target_equation(symex_target_equationt &equation, decision_proceduret &decision_procedure, message_handlert &message_handler)
Definition bmc_util.cpp:147
void postprocess_equation(symex_bmct &symex, symex_target_equationt &equation, const optionst &options, const namespacet &ns, ui_message_handlert &ui_message_handler)
Post process the equation.
Definition bmc_util.cpp:299
void build_error_trace(goto_tracet &, const namespacet &, const symex_target_equationt &, const decision_proceduret &, ui_message_handlert &)
Definition bmc_util.cpp:37
Traces of GOTO Programs.
std::function< bool(symex_target_equationt::SSA_stepst::const_iterator, const decision_proceduret &)> ssa_step_predicatet
Abstract interface to eager or lazy GOTO models.
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
An interface for a decision procedure for satisfiability problems.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition dstring.h:38
Provides management of goal variables that encode properties.
Trace of a GOTO program.
Definition goto_trace.h:177
Class that provides messages with a built-in verbosity 'level'.
Definition message.h:154
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition namespace.h:91
Inheriting the interface of symex_targett this class represents the SSA form of the input program as ...
message_handlert * message_handler
Definition ui_message.h:49
Incremental Goto Checker Interface.
Properties.
std::map< irep_idt, property_infot > propertiest
A map of property IDs to property infos.
Definition properties.h:76
Options for printing the trace using show_goto_trace.
Definition goto_trace.h:221
Loop unwinding.