Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolajBjorner committed Sep 1, 2021
1 parent a7bc471 commit 7ce4be8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/sat/smt/euf_internalize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,9 @@ namespace euf {
break;
}
}

if (m.is_bool(n->get_expr()) && th_id != m.get_basic_family_id())
return true;

for (enode* parent : euf::enode_parents(n)) {
app* p = to_app(parent->get_expr());
family_id fid = p->get_family_id();
Expand Down
21 changes: 20 additions & 1 deletion src/sat/smt/euf_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ namespace euf {
size_t* c = to_ptr(l);
SASSERT(is_literal(c));
SASSERT(l == get_literal(c));
if (n->value_conflict()) {
if (n->value_conflict()) {
euf::enode* nb = sign ? mk_false() : mk_true();
euf::enode* r = n->get_root();
euf::enode* rb = sign ? mk_true() : mk_false();
Expand Down Expand Up @@ -458,6 +458,8 @@ namespace euf {
give_up = true;

unsigned num_nodes = m_egraph.num_nodes();
if (merge_shared_bools())
cont = true;
for (auto* e : m_solvers) {
if (!m.inc())
return sat::check_result::CR_GIVEUP;
Expand Down Expand Up @@ -485,6 +487,23 @@ namespace euf {
return sat::check_result::CR_DONE;
}

bool solver::merge_shared_bools() {
bool merged = false;
for (euf::enode* n : m_egraph.nodes()) {
if (!is_shared(n) || !m.is_bool(n->get_expr()))
continue;
if (n->value() == l_true && !m.is_true(n->get_root()->get_expr())) {
m_egraph.merge(n, mk_true(), to_ptr(sat::literal(n->bool_var())));
merged = true;
}
if (n->value() == l_false && !m.is_false(n->get_root()->get_expr())) {
m_egraph.merge(n, mk_false(), to_ptr(~sat::literal(n->bool_var())));
merged = true;
}
}
return merged;
}

void solver::push() {
si.push();
scope s;
Expand Down
2 changes: 2 additions & 0 deletions src/sat/smt/euf_solver.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ namespace euf {
bool is_self_propagated(th_eq const& e);
void get_antecedents(literal l, constraint& j, literal_vector& r, bool probing);
void new_diseq(enode* a, enode* b, literal lit);
bool merge_shared_bools();

// proofs
void log_antecedents(std::ostream& out, literal l, literal_vector const& r);
Expand Down Expand Up @@ -286,6 +287,7 @@ namespace euf {

void propagate(literal lit, th_explain* p) { propagate(lit, p->to_index()); }
bool propagate(enode* a, enode* b, th_explain* p) { return propagate(a, b, p->to_index()); }
size_t* to_justification(sat::literal l) { return to_ptr(l); }
void set_conflict(th_explain* p) { set_conflict(p->to_index()); }

bool set_root(literal l, literal r) override;
Expand Down

0 comments on commit 7ce4be8

Please sign in to comment.