Skip to content

decision_proceduret interface #4497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/solvers/prop/decision_procedure.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@ class decision_proceduret
void set_to_false(const exprt &expr);

/// Convert a Boolean expression and return the corresponding literal
/// This will go away, use handle(expr) instead
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mark as deprecated? The sooner we mark it as deprecated, the earlier we can remove it ;-)

virtual literalt convert(const exprt &expr) = 0;

/// Generate a handle for an expression; this offers an efficient way
/// to refer to the expression in subsequent calls to \ref get or
/// \ref set_to
virtual exprt handle(const exprt &expr) = 0;

/// Result of running the decision procedure
enum class resultt
{
Expand All @@ -54,6 +60,7 @@ class decision_proceduret

/// Return value of literal \p l from satisfying assignment.
/// Return tvt::UNKNOWN if not available
/// This will go away, use get instead.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mark as deprecated?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove the usage first (not a lot).

virtual tvt l_get(literalt l) const = 0;

/// Print satisfying assignment to \p out
Expand Down
8 changes: 8 additions & 0 deletions src/solvers/prop/prop_conv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ Author: Daniel Kroening, [email protected]
\*******************************************************************/

#include "prop_conv.h"

#include "literal_expr.h"

#include <algorithm>

exprt prop_convt::handle(const exprt &expr)
{
return literal_exprt(convert(expr));
}

/// determine whether a variable is in the final conflict
bool prop_convt::is_in_conflict(literalt) const
{
Expand Down
7 changes: 7 additions & 0 deletions src/solvers/prop/prop_conv.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ class prop_convt:public decision_proceduret

using decision_proceduret::operator();

/// returns a 'handle', which is an expression that
/// has the same value as the argument in any model
/// that is generated.
/// This may be the expression itself or a more compact
/// but solver-specific representation.
exprt handle(const exprt &expr) override;

// incremental solving
virtual void set_frozen(literalt a);
virtual void set_frozen(const bvt &);
Expand Down