Skip to content

Commit 6f06664

Browse files
Merge pull request #3860 from peterschrammel/goto-checker-interface-fixes
Goto checker interface enhancements [blocks: 3794]
2 parents 24c0ccc + be514e3 commit 6f06664

5 files changed

+95
-19
lines changed

src/goto-checker/all_properties_verifier.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class all_properties_verifiert : public goto_verifiert
3939
if(!has_properties_to_check(properties))
4040
return resultt::PASS;
4141

42-
while(incremental_goto_checker(properties) !=
43-
incremental_goto_checkert::resultt::DONE)
42+
while(incremental_goto_checker(properties).progress !=
43+
incremental_goto_checkert::resultt::progresst::DONE)
4444
{
4545
// loop until we are done
4646
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*******************************************************************\
2+
3+
Module: Interface for returning Goto Traces from Goto Checkers
4+
5+
Author: Daniel Kroening, Peter Schrammel
6+
7+
\*******************************************************************/
8+
9+
/// \file
10+
/// Interface for returning Goto Traces from Goto Checkers
11+
12+
#ifndef CPROVER_GOTO_CHECKER_GOTO_TRACE_PROVIDER_H
13+
#define CPROVER_GOTO_CHECKER_GOTO_TRACE_PROVIDER_H
14+
15+
class goto_tracet;
16+
class namespacet;
17+
18+
/// An implementation of `incremental_goto_checkert`
19+
/// may implement this interface to provide goto traces.
20+
class goto_trace_providert
21+
{
22+
public:
23+
/// Builds and returns a trace
24+
virtual goto_tracet build_trace() const = 0;
25+
26+
/// Returns the namespace associated with the traces
27+
virtual const namespacet &get_namespace() const = 0;
28+
29+
virtual ~goto_trace_providert() = default;
30+
};
31+
32+
#endif // CPROVER_GOTO_CHECKER_GOTO_TRACE_PROVIDER_H

src/goto-checker/incremental_goto_checker.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,10 @@ incremental_goto_checkert::incremental_goto_checkert(
1919
log(ui_message_handler)
2020
{
2121
}
22+
23+
incremental_goto_checkert::resultt::resultt(
24+
progresst progress,
25+
const std::vector<irep_idt> &updated_properties)
26+
: progress(progress), updated_properties(updated_properties)
27+
{
28+
}

src/goto-checker/incremental_goto_checker.h

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,37 @@ class incremental_goto_checkert
3737
incremental_goto_checkert(const incremental_goto_checkert &) = delete;
3838
virtual ~incremental_goto_checkert() = default;
3939

40-
enum class resultt
40+
struct resultt
4141
{
42-
/// The goto checker may be able to find another FAILed property
43-
/// if operator() is called again.
44-
FOUND_FAIL,
45-
/// The goto checker has returned all results for the given set
46-
/// of properties.
47-
DONE
42+
enum class progresst
43+
{
44+
/// The goto checker may be able to find another FAILed property
45+
/// if operator() is called again.
46+
FOUND_FAIL,
47+
/// The goto checker has returned all results for the given set
48+
/// of properties.
49+
DONE
50+
};
51+
52+
progresst progress = progresst::DONE;
53+
54+
/// Changed properties since the last call to
55+
/// `incremental_goto_checkert::operator()`
56+
std::vector<irep_idt> updated_properties;
57+
58+
resultt() = default;
59+
resultt(
60+
progresst progress,
61+
const std::vector<irep_idt> &updated_properties);
4862
};
4963

5064
/// Check whether the given properties with status NOT_CHECKED, UNKNOWN or
5165
/// properties newly discovered by `goto_checkert` hold.
5266
/// \param [out] properties: Properties updated to whether their status
5367
/// have been determined. Newly discovered properties are added.
5468
/// \return whether the goto checker found a violated property (FOUND_FAIL) or
55-
/// whether it is DONE with the given properties.
69+
/// whether it is DONE with the given properties, together with
70+
/// the properties whose status changed since the last call to operator().
5671
/// After returning DONE, another call to operator() with the same
5772
/// properties will return DONE and leave the properties' status unchanged.
5873
/// If there is a property with status FAIL then its counterexample
@@ -64,15 +79,6 @@ class incremental_goto_checkert
6479
/// failing properties any more.
6580
virtual resultt operator()(propertiest &properties) = 0;
6681

67-
/// Builds and returns the counterexample
68-
virtual goto_tracet build_error_trace() const = 0;
69-
70-
// Outputs an error witness in GraphML format (see `graphml_witnesst`)
71-
virtual void output_error_witness(const goto_tracet &) = 0;
72-
73-
// Outputs a proof in GraphML format (see `graphml_witnesst`)
74-
virtual void output_proof() = 0;
75-
7682
protected:
7783
incremental_goto_checkert(const optionst &, ui_message_handlert &);
7884

src/goto-checker/witness_provider.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*******************************************************************\
2+
3+
Module: Interface for outputting GraphML Witnesses for Goto Checkers
4+
5+
Author: Daniel Kroening, Peter Schrammel
6+
7+
\*******************************************************************/
8+
9+
/// \file
10+
/// Interface for outputting GraphML Witnesses for Goto Checkers
11+
12+
#ifndef CPROVER_GOTO_CHECKER_WITNESS_PROVIDER_H
13+
#define CPROVER_GOTO_CHECKER_WITNESS_PROVIDER_H
14+
15+
class goto_tracet;
16+
17+
/// An implementation of `incremental_goto_checkert`
18+
/// may implement this interface to provide GraphML witnesses.
19+
class witness_providert
20+
{
21+
public:
22+
virtual ~witness_providert() = default;
23+
24+
// Outputs an error witness in GraphML format (see `graphml_witnesst`)
25+
virtual void output_error_witness(const goto_tracet &) = 0;
26+
27+
// Outputs a proof in GraphML format (see `graphml_witnesst`)
28+
virtual void output_proof() = 0;
29+
};
30+
31+
#endif // CPROVER_GOTO_CHECKER_WITNESS_PROVIDER_H

0 commit comments

Comments
 (0)