mirror of
https://github.com/Z3Prover/z3
synced 2025-04-28 19:35:50 +00:00
Added is_unique_value. Its semantics is equal to the old is_value method. The contract for is_value changed. See comments at ast.h for more information.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
bd0366eef7
commit
a07b459fdf
19 changed files with 157 additions and 50 deletions
|
@ -933,9 +933,39 @@ public:
|
|||
virtual func_decl * mk_func_decl(decl_kind k, unsigned num_parameters, parameter const* parameters,
|
||||
unsigned num_args, expr * const * args, sort * range);
|
||||
|
||||
virtual bool is_value(app*) const { return false; }
|
||||
/**
|
||||
\brief Return true if the plugin can decide whether two
|
||||
interpreted constants are equal or not.
|
||||
|
||||
For all a, b:
|
||||
If is_value(a) and is_value(b)
|
||||
Then,
|
||||
are_equal(a, b) != are_distinct(a, b)
|
||||
|
||||
The may be much more expensive than checking a pointer.
|
||||
|
||||
virtual bool are_distinct(app* a, app* b) const { return a != b && is_value(a) && is_value(b); }
|
||||
We need this because some plugin values are too expensive too canonize.
|
||||
*/
|
||||
virtual bool is_value(app * a) const { return false; }
|
||||
|
||||
/**
|
||||
\brief Return true if \c a is a unique plugin value.
|
||||
The following property should hold for unique theory values:
|
||||
|
||||
For all a, b:
|
||||
If is_unique_value(a) and is_unique_value(b)
|
||||
Then,
|
||||
a == b (pointer equality)
|
||||
IFF
|
||||
the interpretations of these theory terms are equal.
|
||||
|
||||
\remark This is a stronger version of is_value.
|
||||
*/
|
||||
virtual bool is_unique_value(app * a) const { return false; }
|
||||
|
||||
virtual bool are_equal(app * a, app * b) const { return a == b && is_unique_value(a) && is_unique_value(b); }
|
||||
|
||||
virtual bool are_distinct(app * a, app * b) const { return a != b && is_unique_value(a) && is_unique_value(b); }
|
||||
|
||||
virtual void get_op_names(svector<builtin_name> & op_names, symbol const & logic = symbol()) {}
|
||||
|
||||
|
@ -1080,6 +1110,8 @@ public:
|
|||
virtual void get_sort_names(svector<builtin_name> & sort_names, symbol const & logic);
|
||||
|
||||
virtual bool is_value(app* a) const;
|
||||
|
||||
virtual bool is_unique_value(app* a) const;
|
||||
|
||||
sort * mk_bool_sort() const { return m_bool_sort; }
|
||||
sort * mk_proof_sort() const { return m_proof_sort; }
|
||||
|
@ -1116,7 +1148,6 @@ public:
|
|||
|
||||
virtual decl_plugin * mk_fresh() { return alloc(label_decl_plugin); }
|
||||
|
||||
|
||||
virtual sort * mk_sort(decl_kind k, unsigned num_parameters, parameter const * parameters);
|
||||
|
||||
/**
|
||||
|
@ -1198,6 +1229,8 @@ public:
|
|||
unsigned arity, sort * const * domain, sort * range);
|
||||
|
||||
virtual bool is_value(app* n) const;
|
||||
|
||||
virtual bool is_unique_value(app* a) const;
|
||||
};
|
||||
|
||||
// -----------------------------------
|
||||
|
@ -1442,9 +1475,13 @@ public:
|
|||
*/
|
||||
void set_next_expr_id(unsigned id);
|
||||
|
||||
bool is_value(expr* e) const;
|
||||
bool is_value(expr * e) const;
|
||||
|
||||
bool is_unique_value(expr * e) const;
|
||||
|
||||
bool are_distinct(expr* a, expr* b) const;
|
||||
bool are_equal(expr * a, expr * b) const;
|
||||
|
||||
bool are_distinct(expr * a, expr * b) const;
|
||||
|
||||
bool contains(ast * a) const { return m_ast_table.contains(a); }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue