3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-04-30 07:43:38 +00:00

Removed strange code that caused the solver to give up when finding a model instantly

This commit is contained in:
CEisenhofer 2026-04-14 16:06:03 +02:00
parent 3fdd903373
commit 195f2caf25
2 changed files with 3 additions and 16 deletions

View file

@ -707,13 +707,7 @@ namespace smt {
// Nielsen found a consistent assignment for positive constraints. // Nielsen found a consistent assignment for positive constraints.
SASSERT(has_eq_or_mem); // we should have axiomatized them SASSERT(has_eq_or_mem); // we should have axiomatized them
if (!add_nielsen_assumptions()) { add_nielsen_assumptions();
// If assumptions remain undefined, returning SAT can yield
// unsound/invalid models because the chosen Nielsen branch
// is not yet committed in the outer SAT core.
TRACE(seq, tout << "nseq final_check: unresolved assumptions, FC_GIVEUP\n");
return FC_GIVEUP;
}
if (!check_length_coherence()) if (!check_length_coherence())
return FC_CONTINUE; return FC_CONTINUE;
@ -736,8 +730,7 @@ namespace smt {
} }
bool theory_nseq::add_nielsen_assumptions() { void theory_nseq::add_nielsen_assumptions() {
bool has_undef = false;
m_nielsen_literals.reset(); m_nielsen_literals.reset();
struct reset_vector : public trail { struct reset_vector : public trail {
sat::literal_vector &v; sat::literal_vector &v;
@ -760,7 +753,6 @@ namespace smt {
break; break;
case l_undef: case l_undef:
// std::cout << "Undef [" << lit << "]: " << mk_pp(c.fml, m) << std::endl; // std::cout << "Undef [" << lit << "]: " << mk_pp(c.fml, m) << std::endl;
has_undef = true;
// Commit the chosen Nielsen assumption to the SAT core so it // Commit the chosen Nielsen assumption to the SAT core so it
// cannot remain permanently undefined in a partial model. // cannot remain permanently undefined in a partial model.
ctx.force_phase(lit); ctx.force_phase(lit);
@ -771,15 +763,10 @@ namespace smt {
case l_false: case l_false:
// this should not happen because nielsen checks for this before returning a satisfying path. // this should not happen because nielsen checks for this before returning a satisfying path.
TRACE(seq, tout << "nseq final_check: nielsen assumption " << c.fml << " is false; internalized - " << ctx.e_internalized(c.fml) << "\n"); TRACE(seq, tout << "nseq final_check: nielsen assumption " << c.fml << " is false; internalized - " << ctx.e_internalized(c.fml) << "\n");
has_undef = true;
std::cout << "False [" << lit << "]: " << mk_pp(c.fml, m) << std::endl; std::cout << "False [" << lit << "]: " << mk_pp(c.fml, m) << std::endl;
break; break;
} }
} }
// std::cout << std::endl;
if (has_undef)
return false;
return true;
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------

View file

@ -118,7 +118,7 @@ namespace smt {
void populate_nielsen_graph(); void populate_nielsen_graph();
void explain_nielsen_conflict(); void explain_nielsen_conflict();
void set_conflict(enode_pair_vector const& eqs, literal_vector const& lits); void set_conflict(enode_pair_vector const& eqs, literal_vector const& lits);
bool add_nielsen_assumptions(); void add_nielsen_assumptions();
euf::snode* get_snode(expr* e); euf::snode* get_snode(expr* e);
// propagation dispatch helpers // propagation dispatch helpers