mirror of
https://github.com/Z3Prover/z3
synced 2025-06-03 12:51:22 +00:00
add tc and trc functionals for binary relations
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
ae982c5225
commit
182039eb44
3 changed files with 30 additions and 8 deletions
|
@ -633,6 +633,14 @@ namespace z3 {
|
||||||
symbol name() const { Z3_symbol s = Z3_get_decl_name(ctx(), *this); check_error(); return symbol(ctx(), s); }
|
symbol name() const { Z3_symbol s = Z3_get_decl_name(ctx(), *this); check_error(); return symbol(ctx(), s); }
|
||||||
Z3_decl_kind decl_kind() const { return Z3_get_decl_kind(ctx(), *this); }
|
Z3_decl_kind decl_kind() const { return Z3_get_decl_kind(ctx(), *this); }
|
||||||
|
|
||||||
|
func_decl transitive_closure(func_decl const& f) {
|
||||||
|
Z3_func_decl tc = Z3_mk_transitive_closure(ctx(), *this); check_error(); return func_decl(ctx(), tc);
|
||||||
|
}
|
||||||
|
|
||||||
|
func_decl transitive_reflexive_closure(func_decl const& f) {
|
||||||
|
Z3_func_decl tc = Z3_mk_transitive_reflexive_closure(ctx(), *this); check_error(); return func_decl(ctx(), tc);
|
||||||
|
}
|
||||||
|
|
||||||
bool is_const() const { return arity() == 0; }
|
bool is_const() const { return arity() == 0; }
|
||||||
|
|
||||||
expr operator()() const;
|
expr operator()() const;
|
||||||
|
|
|
@ -10379,10 +10379,16 @@ def Range(lo, hi, ctx = None):
|
||||||
|
|
||||||
# Special Relations
|
# Special Relations
|
||||||
|
|
||||||
def PartialOrder(n, s):
|
def TransitiveClosure(f):
|
||||||
ctx = s.ctx
|
"""Given a binary relation R, such that the two arguments have the same sort
|
||||||
return FuncDeclRef(Z3_mk_partial_order(ctx, n, s.ast), ctx)
|
create the transitive closure relation R+.
|
||||||
|
The transitive closure R+ is a new relation.
|
||||||
|
"""
|
||||||
|
return FuncDeclRef(Z3_mk_transitive_closure(f.ctx_ref(), f.ast), f.ctx)
|
||||||
|
|
||||||
def TreeOrder(n, s):
|
def TransitiveReflexiveClosure(f):
|
||||||
ctx = s.ctx
|
"""Given a binary relation R, such that the two arguments have the same sort
|
||||||
return FuncDeclRef(Z3_mk_tree_order(ctx, n, s.ast), ctx)
|
create the transitive reflexive closure relation R*.
|
||||||
|
The transitive reflexive closure R* is a new relation.
|
||||||
|
"""
|
||||||
|
return FuncDeclRef(Z3_mk_transitive_reflexive_closure(f.ctx_ref(), f.ast), f.ctx)
|
||||||
|
|
|
@ -3661,16 +3661,24 @@ extern "C" {
|
||||||
/**
|
/**
|
||||||
\brief create transitive closure of binary relation.
|
\brief create transitive closure of binary relation.
|
||||||
|
|
||||||
|
\pre f is a binary relation, such that the two arguments have the same sorts.
|
||||||
|
|
||||||
|
The resulting relation f+ represents the transitive closure of f.
|
||||||
|
|
||||||
def_API('Z3_mk_transitive_closure', FUNC_DECL ,(_in(CONTEXT), _in(FUNC_DECL)))
|
def_API('Z3_mk_transitive_closure', FUNC_DECL ,(_in(CONTEXT), _in(FUNC_DECL)))
|
||||||
*/
|
*/
|
||||||
Z3_func_decl Z3_API Z3_mk_transitive_closure(Z3_context c,Z3_func_decl f);
|
Z3_func_decl Z3_API Z3_mk_transitive_closure(Z3_context c, Z3_func_decl f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief create transitive reflexive closure of binary relation.
|
\brief create transitive reflexive closure of binary relation.
|
||||||
|
|
||||||
|
\pre f is a binary relation, such that the two arguments have the same sorts.
|
||||||
|
|
||||||
|
The resulting relation f* represents the transitive-reflexive closure of f.
|
||||||
|
|
||||||
def_API('Z3_mk_transitive_reflexive_closure', FUNC_DECL ,(_in(CONTEXT), _in(FUNC_DECL)))
|
def_API('Z3_mk_transitive_reflexive_closure', FUNC_DECL ,(_in(CONTEXT), _in(FUNC_DECL)))
|
||||||
*/
|
*/
|
||||||
Z3_func_decl Z3_API Z3_mk_transitive_reflexive_closure(Z3_context c,Z3_func_decl f);
|
Z3_func_decl Z3_API Z3_mk_transitive_reflexive_closure(Z3_context c, Z3_func_decl f);
|
||||||
|
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue