Skip to content

Commit 541383f

Browse files
author
Daniel Kroening
committed
add the decision_proceduret::handle API
1 parent eed359b commit 541383f

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

src/solvers/prop/decision_procedure.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,14 @@ class decision_proceduret
3434
void set_to_false(const exprt &expr);
3535

3636
/// Convert a Boolean expression and return the corresponding literal
37+
/// This will go away, use handle(expr) instead
3738
virtual literalt convert(const exprt &expr) = 0;
3839

40+
/// Generate a handle for an expression; this offers an efficient way
41+
/// to refer to the expression in subsequent calls to \ref get or
42+
/// \ref set_to
43+
virtual exprt handle(const exprt &expr) = 0;
44+
3945
/// Result of running the decision procedure
4046
enum class resultt
4147
{
@@ -54,6 +60,7 @@ class decision_proceduret
5460

5561
/// Return value of literal \p l from satisfying assignment.
5662
/// Return tvt::UNKNOWN if not available
63+
/// This will go away, use get instead.
5764
virtual tvt l_get(literalt l) const = 0;
5865

5966
/// Print satisfying assignment to \p out

src/solvers/prop/prop_conv.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,15 @@ Author: Daniel Kroening, [email protected]
77
\*******************************************************************/
88

99
#include "prop_conv.h"
10+
#include "literal_expr.h"
11+
1012
#include <algorithm>
1113

14+
exprt prop_convt::handle(const exprt &expr)
15+
{
16+
return literal_exprt(convert(expr));
17+
}
18+
1219
/// determine whether a variable is in the final conflict
1320
bool prop_convt::is_in_conflict(literalt) const
1421
{

src/solvers/prop/prop_conv.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ class prop_convt:public decision_proceduret
2222

2323
using decision_proceduret::operator();
2424

25+
// handle
26+
exprt handle(const exprt &expr) override;
27+
2528
// incremental solving
2629
virtual void set_frozen(literalt a);
2730
virtual void set_frozen(const bvt &);

0 commit comments

Comments
 (0)