mirror of
https://github.com/Z3Prover/z3
synced 2025-08-11 13:40:52 +00:00
fix bugs related to model-converter
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
ae728374c8
commit
7b8101c502
20 changed files with 211 additions and 112 deletions
|
@ -892,14 +892,15 @@ void sat2goal::mc::flush_smc(sat::solver& s, atom2bool_var const& map) {
|
|||
|
||||
void sat2goal::mc::flush_gmc() {
|
||||
sat::literal_vector updates;
|
||||
m_smc.expand(updates);
|
||||
m_smc.expand(updates);
|
||||
m_smc.reset();
|
||||
if (!m_gmc) m_gmc = alloc(generic_model_converter, m);
|
||||
// now gmc owns the model converter
|
||||
sat::literal_vector clause;
|
||||
expr_ref_vector tail(m);
|
||||
expr_ref def(m);
|
||||
for (sat::literal l : updates) {
|
||||
for (unsigned i = 0; i < updates.size(); ++i) {
|
||||
sat::literal l = updates[i];
|
||||
if (l == sat::null_literal) {
|
||||
sat::literal lit0 = clause[0];
|
||||
for (unsigned i = 1; i < clause.size(); ++i) {
|
||||
|
@ -914,6 +915,21 @@ void sat2goal::mc::flush_gmc() {
|
|||
clause.reset();
|
||||
tail.reset();
|
||||
}
|
||||
// short circuit for equivalences:
|
||||
else if (clause.empty() && tail.empty() &&
|
||||
i + 5 < updates.size() &&
|
||||
updates[i] == ~updates[i + 3] &&
|
||||
updates[i + 1] == ~updates[i + 4] &&
|
||||
updates[i + 2] == sat::null_literal &&
|
||||
updates[i + 5] == sat::null_literal) {
|
||||
sat::literal r = ~updates[i+1];
|
||||
if (l.sign()) {
|
||||
l.neg();
|
||||
r.neg();
|
||||
}
|
||||
m_gmc->add(lit2expr(l), lit2expr(r));
|
||||
i += 5;
|
||||
}
|
||||
else {
|
||||
clause.push_back(l);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue