@@ -23,54 +23,59 @@ class tvt;
23
23
class decision_proceduret
24
24
{
25
25
public:
26
- virtual ~decision_proceduret ();
26
+ // / For a Boolean expression \p expr, add the constraint 'expr' if \p value
27
+ // / is `true`, otherwise add 'not expr'
28
+ virtual void set_to (const exprt &expr, bool value) = 0;
27
29
28
- // get a value from satisfying instance if satisfiable
29
- // returns nil if not available
30
- virtual exprt get (const exprt &expr) const =0;
30
+ // / For a Boolean expression \p expr, add the constraint 'expr'
31
+ void set_to_true (const exprt &expr);
31
32
32
- // specialized variant of get
33
- virtual tvt l_get (literalt) const = 0 ;
33
+ // / For a Boolean expression \p expr, add the constraint 'not expr'
34
+ void set_to_false ( const exprt &expr) ;
34
35
35
- // print satisfying assignment
36
- virtual void print_assignment (std::ostream &out) const = 0;
36
+ // / Convert a Boolean expression and return the corresponding literal
37
+ virtual literalt convert ( const exprt &expr) = 0;
37
38
38
- // add constraints
39
- // the expression must be of Boolean type
40
- virtual void set_to (const exprt &expr, bool value)=0;
39
+ // / Convert a Boolean expression and return the corresponding literal
40
+ literalt operator ()(const exprt &);
41
41
42
- void set_to_true (const exprt &expr)
43
- { set_to (expr, true ); }
42
+ // / Result of running the decision procedure
43
+ enum class resultt
44
+ {
45
+ D_SATISFIABLE,
46
+ D_UNSATISFIABLE,
47
+ D_ERROR
48
+ };
44
49
45
- void set_to_false ( const exprt &expr)
46
- { set_to (expr, false ); }
50
+ // / Run the decision procedure to solve the problem
51
+ resultt operator ()();
47
52
48
- // conversion to handle
49
- virtual literalt convert (const exprt &expr) = 0;
53
+ // / Return \p expr with variables replaced by values from satisfying
54
+ // / assignment if available.
55
+ // / Return `nil` if not available
56
+ virtual exprt get (const exprt &expr) const = 0;
50
57
51
- literalt operator ()(const exprt &expr)
52
- {
53
- return convert (expr);
54
- }
58
+ // / Return value of literal \p l from satisfying assignment.
59
+ // / Return tvt::UNKNOWN if not available
60
+ virtual tvt l_get (literalt l) const = 0;
55
61
56
- // solve the problem
57
- enum class resultt { D_SATISFIABLE, D_UNSATISFIABLE, D_ERROR } ;
62
+ // / Print satisfying assignment to \p out
63
+ virtual void print_assignment (std::ostream &out) const = 0 ;
58
64
59
- resultt operator ()()
60
- {
61
- return dec_solve ();
62
- }
63
-
64
- // return a textual description of the decision procedure
65
- virtual std::string decision_procedure_text () const =0;
65
+ // / Return a textual description of the decision procedure
66
+ virtual std::string decision_procedure_text () const = 0;
66
67
67
- // / Returns the number of incremental solver calls
68
+ // / Return the number of incremental solver calls
68
69
virtual std::size_t get_number_of_solver_calls () const = 0;
69
70
71
+ virtual ~decision_proceduret ();
72
+
70
73
protected:
74
+ // / Run the decision procedure to solve the problem
71
75
virtual resultt dec_solve () = 0;
72
76
};
73
77
78
+ // / Push Boolean constraint \p src into decision procedure \p dest
74
79
inline decision_proceduret &operator <<(
75
80
decision_proceduret &dest,
76
81
const exprt &src)
0 commit comments