Skip to content

Commit 24b8f5d

Browse files
Add stop-on-fail verifier
Stops verification when the first property violation is found.
1 parent 81f6c6b commit 24b8f5d

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*******************************************************************\
2+
3+
Module: Goto Verifier for stopping at the first failing property
4+
5+
Author: Daniel Kroening, Peter Schrammel
6+
7+
\*******************************************************************/
8+
9+
/// \file
10+
/// Goto Verifier for stopping at the first failing property
11+
12+
#ifndef CPROVER_GOTO_CHECKER_STOP_ON_FAIL_VERIFIER_H
13+
#define CPROVER_GOTO_CHECKER_STOP_ON_FAIL_VERIFIER_H
14+
15+
#include "bmc_util.h"
16+
#include "goto_verifier.h"
17+
18+
/// Stops when the first failing property is found.
19+
/// Requires an incremental goto checker that is a
20+
/// `goto_trace_providert` and `witness_providert`.
21+
template <class incremental_goto_checkerT>
22+
class stop_on_fail_verifiert : public goto_verifiert
23+
{
24+
public:
25+
stop_on_fail_verifiert(
26+
const optionst &options,
27+
ui_message_handlert &ui_message_handler,
28+
abstract_goto_modelt &goto_model)
29+
: goto_verifiert(options, ui_message_handler),
30+
goto_model(goto_model),
31+
incremental_goto_checker(options, ui_message_handler, goto_model)
32+
{
33+
properties = std::move(initialize_properties(goto_model));
34+
}
35+
36+
resultt operator()() override
37+
{
38+
(void)incremental_goto_checker(properties);
39+
return determine_result(properties);
40+
}
41+
42+
void report() override
43+
{
44+
switch(determine_result(properties))
45+
{
46+
case resultt::PASS:
47+
report_success(ui_message_handler);
48+
incremental_goto_checker.output_proof();
49+
break;
50+
51+
case resultt::FAIL:
52+
{
53+
goto_tracet goto_trace = incremental_goto_checker.build_trace();
54+
output_error_trace(
55+
goto_trace,
56+
incremental_goto_checker.get_namespace(),
57+
trace_optionst(options),
58+
ui_message_handler);
59+
report_failure(ui_message_handler);
60+
incremental_goto_checker.output_error_witness(goto_trace);
61+
break;
62+
}
63+
64+
case resultt::UNKNOWN:
65+
report_inconclusive(ui_message_handler);
66+
break;
67+
68+
case resultt::ERROR:
69+
report_error(ui_message_handler);
70+
break;
71+
}
72+
}
73+
74+
protected:
75+
abstract_goto_modelt &goto_model;
76+
incremental_goto_checkerT incremental_goto_checker;
77+
};
78+
79+
#endif // CPROVER_GOTO_CHECKER_STOP_ON_FAIL_VERIFIER_H

0 commit comments

Comments
 (0)