Skip to content

Commit 9f63d79

Browse files
author
Daniel Kroening
committed
add the decision_proceduret::handle API
1 parent cb25f82 commit 9f63d79

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,16 @@ Author: Daniel Kroening, [email protected]
77
\*******************************************************************/
88

99
#include "prop_conv.h"
10+
11+
#include "literal_expr.h"
12+
1013
#include <algorithm>
1114

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

src/solvers/prop/prop_conv.h

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

2323
using decision_proceduret::operator();
2424

25+
/// returns a 'handle', which is an expression that
26+
/// has the same value as the argument in any model
27+
/// that is generated.
28+
/// This may be the expression itself or a more compact
29+
/// but solver-specific representation.
30+
exprt handle(const exprt &expr) override;
31+
2532
// incremental solving
2633
virtual void set_frozen(literalt a);
2734
virtual void set_frozen(const bvt &);

0 commit comments

Comments
 (0)