mirror of
https://github.com/Z3Prover/z3
synced 2025-07-03 11:25:40 +00:00
fix drat generation in asymmetric branch simplification
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
f835a3c2b2
commit
dc5e4ca1c5
3 changed files with 32 additions and 11 deletions
|
@ -342,7 +342,10 @@ namespace sat {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (!m_to_delete.contains(lit)) {
|
if (!m_to_delete.contains(lit)) {
|
||||||
c[j++] = lit;
|
if (i != j) {
|
||||||
|
std::swap(c[i], c[j]);
|
||||||
|
}
|
||||||
|
j++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -406,9 +409,10 @@ namespace sat {
|
||||||
|
|
||||||
bool asymm_branch::re_attach(scoped_detach& scoped_d, clause& c, unsigned new_sz) {
|
bool asymm_branch::re_attach(scoped_detach& scoped_d, clause& c, unsigned new_sz) {
|
||||||
VERIFY(s.m_trail.size() == s.m_qhead);
|
VERIFY(s.m_trail.size() == s.m_qhead);
|
||||||
m_elim_literals += c.size() - new_sz;
|
unsigned old_sz = c.size();
|
||||||
|
m_elim_literals += old_sz - new_sz;
|
||||||
if (c.is_learned()) {
|
if (c.is_learned()) {
|
||||||
m_elim_learned_literals += c.size() - new_sz;
|
m_elim_learned_literals += old_sz - new_sz;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (new_sz) {
|
switch (new_sz) {
|
||||||
|
@ -430,8 +434,12 @@ namespace sat {
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
c.shrink(new_sz);
|
c.shrink(new_sz);
|
||||||
if (s.m_config.m_drat) s.m_drat.add(c, true);
|
if (s.m_config.m_drat && new_sz < old_sz) {
|
||||||
// if (s.m_config.m_drat) s.m_drat.del(c0); // TBD
|
s.m_drat.add(c, true);
|
||||||
|
c.restore(old_sz);
|
||||||
|
s.m_drat.del(c);
|
||||||
|
c.shrink(new_sz);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -585,8 +585,21 @@ namespace sat {
|
||||||
|
|
||||||
void drat::del(clause& c) {
|
void drat::del(clause& c) {
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// check_duplicates:
|
||||||
|
for (literal lit : c) {
|
||||||
|
VERIFY(!m_seen[lit.index()]);
|
||||||
|
m_seen[lit.index()] = true;
|
||||||
|
}
|
||||||
|
for (literal lit : c) {
|
||||||
|
m_seen[lit.index()] = false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
TRACE("sat", tout << "del: " << c << "\n";);
|
TRACE("sat", tout << "del: " << c << "\n";);
|
||||||
if (m_out) dump(c.size(), c.begin(), status::deleted);
|
if (m_out) {
|
||||||
|
dump(c.size(), c.begin(), status::deleted);
|
||||||
|
}
|
||||||
if (m_check) {
|
if (m_check) {
|
||||||
clause* c1 = s.alloc_clause(c.size(), c.begin(), c.is_learned());
|
clause* c1 = s.alloc_clause(c.size(), c.begin(), c.is_learned());
|
||||||
append(*c1, status::deleted);
|
append(*c1, status::deleted);
|
||||||
|
|
|
@ -480,15 +480,15 @@ void goal::display_dimacs(std::ostream & out) const {
|
||||||
out << "-";
|
out << "-";
|
||||||
l = to_app(l)->get_arg(0);
|
l = to_app(l)->get_arg(0);
|
||||||
}
|
}
|
||||||
unsigned id = expr2var[l->get_id()];
|
SASSERT(exprs[l->get_id()]);
|
||||||
SASSERT(id != UINT_MAX);
|
out << expr2var[l->get_id()] << " ";
|
||||||
out << id << " ";
|
|
||||||
}
|
}
|
||||||
out << "0\n";
|
out << "0\n";
|
||||||
}
|
}
|
||||||
for (expr* e : exprs) {
|
for (expr* e : exprs) {
|
||||||
if (e && is_app(e)) {
|
if (e && is_app(e)) {
|
||||||
out << "c " << expr2var[e->get_id()] << " " << to_app(e)->get_decl()->get_name() << "\n";
|
symbol const& n = to_app(e)->get_decl()->get_name();
|
||||||
|
out << "c " << expr2var[e->get_id()] << " " << n << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue