CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cover_goals.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Cover a set of goals incrementally
4
5Author: Daniel Kroening, kroening@kroening.com
6
7\*******************************************************************/
8
11
12#ifndef CPROVER_SOLVERS_PROP_COVER_GOALS_H
13#define CPROVER_SOLVERS_PROP_COVER_GOALS_H
14
15#include <list>
16
18
19#include <util/expr.h>
20
22
26{
27public:
34
35 virtual ~cover_goalst();
36
37 // returns result of last run on success
39
40 // the goals
41
42 struct goalt
43 {
46
49 {
50 }
51 };
52
53 typedef std::list<goalt> goalst;
55
56 // statistics
57
58 std::size_t number_covered() const
59 {
60 return _number_covered;
61 }
62
63 unsigned iterations() const
64 {
65 return _iterations;
66 }
67
68 goalst::size_type size() const
69 {
70 return goals.size();
71 }
72
73 // managing the goals
74
75 void add(exprt condition)
76 {
77 goals.emplace_back(std::move(condition));
78 }
79
80 // register an observer if you want to be told
81 // about satisfying assignments
82
84 {
85 public:
86 virtual void goal_covered(const goalt &) { }
87 virtual void satisfying_assignment() { }
88 };
89
91 {
92 observers.push_back(&o);
93 }
94
95protected:
96 std::size_t _number_covered;
97 unsigned _iterations;
99
100 typedef std::vector<observert *> observerst;
102
103private:
104 void mark();
105 void constraint();
106};
107
108#endif // CPROVER_SOLVERS_PROP_COVER_GOALS_H
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
virtual void goal_covered(const goalt &)
Definition cover_goals.h:86
virtual void satisfying_assignment()
Definition cover_goals.h:87
Try to cover some given set of goals incrementally.
Definition cover_goals.h:26
observerst observers
virtual ~cover_goalst()
std::size_t _number_covered
Definition cover_goals.h:96
std::vector< observert * > observerst
unsigned iterations() const
Definition cover_goals.h:63
unsigned _iterations
Definition cover_goals.h:97
std::size_t number_covered() const
Definition cover_goals.h:58
void register_observer(observert &o)
Definition cover_goals.h:90
goalst::size_type size() const
Definition cover_goals.h:68
void add(exprt condition)
Definition cover_goals.h:75
std::list< goalt > goalst
Definition cover_goals.h:53
decision_proceduret::resultt operator()(message_handlert &)
Try to cover all goals.
void constraint()
Build clause.
void mark()
Mark goals that are covered.
cover_goalst(decision_proceduret &_decision_procedure)
Definition cover_goals.h:28
decision_proceduret & decision_procedure
Definition cover_goals.h:98
An interface for a decision procedure for satisfiability problems.
resultt
Result of running the decision procedure.
Base class for all expressions.
Definition expr.h:56
Decision Procedure Interface.
STL namespace.
goalt(exprt _condition)
Definition cover_goals.h:47
enum cover_goalst::goalt::statust status