mirror of
https://github.com/Z3Prover/z3
synced 2025-07-19 10:52:02 +00:00
app ordering that puts special skolem constants first
This commit is contained in:
parent
9f0eb367b1
commit
6cf68bee80
2 changed files with 26 additions and 0 deletions
|
@ -384,4 +384,26 @@ bool has_zk_const(expr *e){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_zk_const (const app *a, int &n) {
|
||||||
|
if (!is_uninterp_const(a)) return false;
|
||||||
|
|
||||||
|
const symbol &name = a->get_decl()->get_name();
|
||||||
|
if (name.str().compare (0, 3, "sk!") != 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
n = std::stoi(name.str().substr(3));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool sk_lt_proc::operator()(const app *a1, const app *a2) {
|
||||||
|
if (a1 == a2) return false;
|
||||||
|
int n1, n2;
|
||||||
|
bool z1, z2;
|
||||||
|
z1 = is_zk_const(a1, n1);
|
||||||
|
z2 = is_zk_const(a2, n2);
|
||||||
|
if (z1 && z2) return n1 < n2;
|
||||||
|
if (z1 != z2) return z1;
|
||||||
|
return ast_lt_proc()(a1, a2);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -341,6 +341,10 @@ public:
|
||||||
app* mk_zk_const (ast_manager &m, unsigned idx, sort *s);
|
app* mk_zk_const (ast_manager &m, unsigned idx, sort *s);
|
||||||
void find_zk_const(expr* e, app_ref_vector &out);
|
void find_zk_const(expr* e, app_ref_vector &out);
|
||||||
bool has_zk_const(expr* e);
|
bool has_zk_const(expr* e);
|
||||||
|
|
||||||
|
struct sk_lt_proc {
|
||||||
|
bool operator()(const app* a1, const app* a2);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue