perf(library/blast/congruence_closure): only copy parents that are still congruence roots

This commit is contained in:
Leonardo de Moura 2015-11-23 14:38:31 -08:00
parent f4a7268bd7
commit 11f838c13a

View file

@ -690,8 +690,6 @@ void congruence_closure::remove_parents(name const & R, expr const & e) {
void congruence_closure::reinsert_parents(name const & R, expr const & e) {
auto ps = m_parents.find(child_key(R, e));
if (!ps) return;
// TODO(Leo): consider the following optimization:
// 1- remove from ps any parent that is not a congruence root anymore
ps->for_each([&](parent_occ const & p) {
expr const & fn = get_app_fn(p.m_expr);
unsigned nargs = get_app_num_args(p.m_expr);
@ -796,6 +794,7 @@ void congruence_closure::add_eqv_step(name const & R, expr e1, expr e2, expr con
if (auto it = m_parents.find(k2))
ps2 = *it;
ps1->for_each([&](parent_occ const & p) {
if (is_congr_root(p.m_R, p.m_expr))
ps2.insert(p);
});
m_parents.erase(k1);