3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 09:35:32 +00:00

add non-units method

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2018-09-20 20:37:14 -07:00
parent 39ed27101e
commit c59a957737
5 changed files with 55 additions and 0 deletions

View file

@ -256,3 +256,32 @@ expr_ref_vector solver::get_units(ast_manager& m) {
return result;
}
expr_ref_vector solver::get_non_units(ast_manager& m) {
expr_ref_vector result(m), fmls(m);
get_assertions(fmls);
family_id bfid = m.get_basic_family_id();
expr_mark marked;
for (unsigned i = 0; i < fmls.size(); ++i) {
expr* f = fmls.get(i);
if (marked.is_marked(f)) continue;
marked.mark(f);
if (!is_app(f)) {
result.push_back(f);
continue;
}
app* _f = to_app(f);
if (_f->get_family_id() == bfid) {
if (_f->get_num_args() > 0 && m.is_bool(_f->get_arg(0))) {
fmls.append(_f->get_num_args(), _f->get_args());
}
else if (m.is_eq(f) || m.is_distinct(f)) {
result.push_back(f);
}
}
else {
result.push_back(f);
}
}
return result;
}

View file

@ -236,6 +236,8 @@ public:
*/
expr_ref_vector get_units(ast_manager& m);
expr_ref_vector get_non_units(ast_manager& m);
class scoped_push {
solver& s;
bool m_nopop;