@@ -32,7 +32,6 @@ Revision History:
3232#include " ast/occurs.h"
3333#include " ast/rewriter/th_rewriter.h"
3434#include " model/model_evaluator.h"
35- #include " qe/mbp/mbp_arrays.h"
3635#include " util/bit_vector.h"
3736#include " util/obj_pair_hashtable.h"
3837#include " util/uint_set.h"
@@ -184,7 +183,7 @@ class term {
184183 t->get_root ().m_parents .push_back (this );
185184 m_children.push_back (t);
186185 }
187- m_is_peq = is_partial_eq (to_app ( m_expr) );
186+ m_is_peq = is_partial_eq (m_expr);
188187 }
189188
190189 class parents {
@@ -578,7 +577,7 @@ term *term_graph::internalize_term(expr *t) {
578577 merge_flush ();
579578 SASSERT (res);
580579 expr* arg = nullptr ;
581- if (m.is_not (t, arg) && is_app (arg) && is_partial_eq (to_app ( arg) )) {
580+ if (m.is_not (t, arg) && is_partial_eq (arg)) {
582581 term* p = get_term (arg);
583582 SASSERT (p);
584583 p->set_npeq_child ();
@@ -1017,18 +1016,19 @@ void term_graph::to_lits(expr_ref_vector &lits, bool all_equalities,
10171016// assumes that representatives have already been picked
10181017void term_graph::to_lits_qe_lite (expr_ref_vector &lits,
10191018 std::function<bool (expr *)> *non_core) {
1020- DEBUG_CODE (for (auto t : m_terms) SASSERT (t->get_repr ()););
1021- DEBUG_CODE (for (auto t : m_terms)
1022- SASSERT (!t->is_cgr () || t->get_repr ()->is_cgr ()););
1019+ SASSERT (all_of (m_terms, [](term* t) { return !!t->get_repr (); }));
1020+ SASSERT (all_of (m_terms, [](term* t) { return !t->is_cgr () || t->get_repr ()->is_cgr (); }));
10231021 is_non_core not_in_core (non_core);
10241022 check_pred contains_nc (not_in_core, m, false );
10251023 // literals other than eq, neq, distinct
10261024 for (expr *a : m_lits) {
1027- if (!is_internalized (a)) continue ;
1028- if (m_explicit_eq && get_term (a)->is_eq_or_neq ()) continue ;
1029- expr_ref r (m);
1030- r = mk_app (a);
1031- if (non_core == nullptr || !contains_nc (r)) lits.push_back (r);
1025+ if (!is_internalized (a))
1026+ continue ;
1027+ if (m_explicit_eq && get_term (a)->is_eq_or_neq ())
1028+ continue ;
1029+ expr_ref r (mk_app (a), m);
1030+ if (non_core == nullptr || !contains_nc (r))
1031+ lits.push_back (r);
10321032 }
10331033
10341034 // equalities
@@ -1054,7 +1054,8 @@ void term_graph::to_lits_qe_lite(expr_ref_vector &lits,
10541054 d = mk_app (*(c->get_repr ()));
10551055 if (non_core == nullptr || !contains_nc (d)) args.push_back (d);
10561056 }
1057- if (args.size () < 2 ) continue ;
1057+ if (args.size () < 2 )
1058+ continue ;
10581059 if (args.size () == 2 )
10591060 distinct = mk_neq (m, args.get (0 ), args.get (1 ));
10601061 else
@@ -1600,32 +1601,20 @@ class term_graph::projector {
16001601// modifies `vars` to keep the variables that could not be eliminated
16011602void term_graph::qel (app_ref_vector &vars, expr_ref &fml,
16021603 std::function<bool (expr *)> *non_core) {
1603- unsigned i = 0 ;
1604- for (auto v : vars) {
1605- if (is_internalized (v)) { vars[i++] = v; }
1606- }
1607- vars.shrink (i);
1604+
1605+ filter (vars, [this ](auto v) { return is_internalized (v); });
16081606 pick_repr ();
16091607 refine_repr ();
16101608
16111609 expr_ref_vector lits (m);
16121610 to_lits_qe_lite (lits, non_core);
1613- if (lits.size () == 0 )
1614- fml = m.mk_true ();
1615- else if (lits.size () == 1 )
1616- fml = lits[0 ].get ();
1617- else
1618- fml = m.mk_and (lits);
1611+ fml = mk_and (lits);
16191612
16201613 // Remove all variables that are do not appear in the formula
16211614 expr_sparse_mark mark;
16221615 mark_all_sub_expr marker (mark);
16231616 quick_for_each_expr (marker, fml);
1624- i = 0 ;
1625- for (auto v : vars) {
1626- if (mark.is_marked (v)) vars[i++] = v;
1627- }
1628- vars.shrink (i);
1617+ filter (vars, [&mark](auto v) { return mark.is_marked (v); });
16291618}
16301619
16311620void term_graph::set_vars (func_decl_ref_vector const &decls, bool exclude) {
0 commit comments