mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 01:25:31 +00:00
record simplified input clauses as lemmas
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
247980c5a2
commit
f2e636c598
7 changed files with 54 additions and 23 deletions
|
@ -78,7 +78,6 @@ namespace sat {
|
|||
}
|
||||
|
||||
void cleaner::cleanup_clauses(clause_vector & cs) {
|
||||
tmp_clause tmp;
|
||||
clause_vector::iterator it = cs.begin();
|
||||
clause_vector::iterator it2 = it;
|
||||
clause_vector::iterator end = cs.end();
|
||||
|
@ -134,10 +133,6 @@ namespace sat {
|
|||
s.del_clause(c);
|
||||
break;
|
||||
default:
|
||||
SASSERT(s.value(c[0]) == l_undef && s.value(c[1]) == l_undef);
|
||||
if (s.m_config.m_drat && new_sz < sz) {
|
||||
tmp.set(c.size(), c.begin(), c.is_learned());
|
||||
}
|
||||
c.shrink(new_sz);
|
||||
*it2 = *it;
|
||||
it2++;
|
||||
|
@ -145,11 +140,12 @@ namespace sat {
|
|||
s.attach_clause(c);
|
||||
}
|
||||
if (s.m_config.m_drat && new_sz < sz) {
|
||||
// for optimization, could also report deletion
|
||||
// of previous version of clause.
|
||||
s.m_drat.add(c, true);
|
||||
s.m_drat.del(*tmp.get());
|
||||
c.restore(sz);
|
||||
s.m_drat.del(c);
|
||||
c.shrink(new_sz);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -320,11 +320,18 @@ namespace sat {
|
|||
clause * solver::mk_clause_core(unsigned num_lits, literal * lits, bool learned) {
|
||||
TRACE("sat", tout << "mk_clause: " << mk_lits_pp(num_lits, lits) << (learned?" learned":" aux") << "\n";);
|
||||
if (!learned) {
|
||||
unsigned old_sz = num_lits;
|
||||
bool keep = simplify_clause(num_lits, lits);
|
||||
TRACE("sat_mk_clause", tout << "mk_clause (after simp), keep: " << keep << "\n" << mk_lits_pp(num_lits, lits) << "\n";);
|
||||
if (!keep) {
|
||||
return nullptr; // clause is equivalent to true.
|
||||
}
|
||||
// if an input clause is simplified, then log the simplified version as learned
|
||||
if (!learned && old_sz > num_lits && m_config.m_drat) {
|
||||
m_lemma.reset();
|
||||
m_lemma.append(num_lits, lits);
|
||||
m_drat.add(m_lemma);
|
||||
}
|
||||
++m_stats.m_non_learned_generation;
|
||||
}
|
||||
|
||||
|
@ -706,7 +713,7 @@ namespace sat {
|
|||
if (curr != prev) {
|
||||
prev = curr;
|
||||
if (i != j)
|
||||
lits[j] = lits[i];
|
||||
std::swap(lits[j], lits[i]);
|
||||
j++;
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue