3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-12 12:08:18 +00:00

remove spurious output

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2020-04-23 22:12:38 -07:00
parent 04fec3f6a0
commit 64cb5cad81
3 changed files with 34 additions and 41 deletions

View file

@ -95,7 +95,6 @@ bool theory_seq::propagate_ne2lit(unsigned idx) {
} }
} }
if (undef_lit == null_literal) { if (undef_lit == null_literal) {
display_disequation(verbose_stream() << "conflict:", n) << "\n";
dependency* dep = n.dep(); dependency* dep = n.dep();
dependency* dep1 = nullptr; dependency* dep1 = nullptr;
if (explain_eq(n.l(), n.r(), dep1)) { if (explain_eq(n.l(), n.r(), dep1)) {

View file

@ -28,11 +28,10 @@ namespace smt {
expr_ref context::antecedent2fml(index_set const& vars) { expr_ref context::antecedent2fml(index_set const& vars) {
expr_ref_vector premises(m); expr_ref_vector premises(m);
index_set::iterator it = vars.begin(), end = vars.end(); for (unsigned v : vars) {
for (; it != end; ++it) { expr* e = bool_var2expr(v);
expr* e = bool_var2expr(*it);
e = m_assumption2orig.find(e); e = m_assumption2orig.find(e);
premises.push_back(get_assignment(*it) != l_false ? e : m.mk_not(e)); premises.push_back(get_assignment(v) != l_false ? e : m.mk_not(e));
} }
return mk_and(premises); return mk_and(premises);
} }
@ -62,9 +61,7 @@ namespace smt {
} }
m_antecedents.insert(lit.var(), s); m_antecedents.insert(lit.var(), s);
TRACE("context", display_literal_verbose(tout, lit); TRACE("context", display_literal_verbose(tout, lit);
for (index_set::iterator it = s.begin(), end = s.end(); it != end; ++it) { for (auto v : s) tout << " " << v;
tout << " " << *it;
}
tout << "\n";); tout << "\n";);
bool found = false; bool found = false;
if (m_var2val.contains(e)) { if (m_var2val.contains(e)) {
@ -162,10 +159,9 @@ namespace smt {
unsigned context::delete_unfixed(expr_ref_vector& unfixed) { unsigned context::delete_unfixed(expr_ref_vector& unfixed) {
ptr_vector<expr> to_delete; ptr_vector<expr> to_delete;
obj_map<expr,expr*>::iterator it = m_var2val.begin(), end = m_var2val.end(); for (auto const& kv : m_var2val) {
for (; it != end; ++it) { expr* k = kv.m_key;
expr* k = it->m_key; expr* v = kv.m_value;
expr* v = it->m_value;
if (m.is_bool(k)) { if (m.is_bool(k)) {
literal lit = get_literal(k); literal lit = get_literal(k);
switch (get_assignment(lit)) { switch (get_assignment(lit)) {
@ -215,10 +211,9 @@ namespace smt {
TRACE("context", tout << "extract fixed consequences\n";); TRACE("context", tout << "extract fixed consequences\n";);
ptr_vector<expr> to_delete; ptr_vector<expr> to_delete;
expr_ref fml(m), eq(m); expr_ref fml(m), eq(m);
obj_map<expr,expr*>::iterator it = m_var2val.begin(), end = m_var2val.end(); for (auto const& kv : m_var2val) {
for (; it != end; ++it) { expr* k = kv.m_key;
expr* k = it->m_key; expr* v = kv.m_value;
expr* v = it->m_value;
if (!m.is_bool(k) && are_equal(k, v)) { if (!m.is_bool(k) && are_equal(k, v)) {
literal_vector literals; literal_vector literals;
m_conflict_resolution->eq2literals(get_enode(v), get_enode(k), literals); m_conflict_resolution->eq2literals(get_enode(v), get_enode(k), literals);
@ -294,8 +289,7 @@ namespace smt {
m_var2orig.insert(c, v); m_var2orig.insert(c, v);
} }
} }
for (unsigned i = 0; i < assumptions0.size(); ++i) { for (expr* a : assumptions0) {
expr* a = assumptions0[i];
if (is_uninterp_const(a)) { if (is_uninterp_const(a)) {
assumptions.push_back(a); assumptions.push_back(a);
m_assumption2orig.insert(a, a); m_assumption2orig.insert(a, a);
@ -318,10 +312,12 @@ namespace smt {
if (pushed) pop(1); if (pushed) pop(1);
return is_sat; return is_sat;
} }
TRACE("context", display(tout););
index_set _assumptions; index_set _assumptions;
for (unsigned i = 0; i < assumptions.size(); ++i) { for (expr* e : assumptions) {
_assumptions.insert(get_literal(assumptions[i].get()).var()); if (!e_internalized(e)) internalize(e, false);
_assumptions.insert(get_literal(e).var());
} }
model_ref mdl; model_ref mdl;
get_model(mdl); get_model(mdl);
@ -329,14 +325,14 @@ namespace smt {
model_evaluator eval(*mdl.get()); model_evaluator eval(*mdl.get());
expr_ref val(m); expr_ref val(m);
TRACE("context", model_pp(tout, *mdl);); TRACE("context", model_pp(tout, *mdl););
for (unsigned i = 0; i < vars.size(); ++i) { for (expr* v : vars) {
eval(vars[i].get(), val); eval(v, val);
if (m.is_value(val)) { if (m.is_value(val)) {
trail.push_back(val); trail.push_back(val);
m_var2val.insert(vars[i].get(), val); m_var2val.insert(v, val);
} }
else { else {
unfixed.push_back(vars[i].get()); unfixed.push_back(v);
} }
} }
unsigned num_units = 0; unsigned num_units = 0;
@ -576,8 +572,7 @@ namespace smt {
unsigned_vector ps; unsigned_vector ps;
max_cliques<neg_literal> mc; max_cliques<neg_literal> mc;
expr_ref lit(m); expr_ref lit(m);
for (unsigned i = 0; i < vars.size(); ++i) { for (expr* n : vars) {
expr* n = vars[i];
bool neg = m.is_not(n, n); bool neg = m.is_not(n, n);
if (b_internalized(n)) { if (b_internalized(n)) {
ps.push_back(literal(get_bool_var(n), neg).index()); ps.push_back(literal(get_bool_var(n), neg).index());
@ -595,10 +590,10 @@ namespace smt {
} }
vector<unsigned_vector> _mutexes; vector<unsigned_vector> _mutexes;
mc.cliques(ps, _mutexes); mc.cliques(ps, _mutexes);
for (unsigned i = 0; i < _mutexes.size(); ++i) { for (auto const& mux : _mutexes) {
expr_ref_vector lits(m); expr_ref_vector lits(m);
for (unsigned j = 0; j < _mutexes[i].size(); ++j) { for (unsigned idx : mux) {
literal2expr(to_literal(_mutexes[i][j]), lit); literal2expr(to_literal(idx), lit);
lits.push_back(lit); lits.push_back(lit);
} }
mutexes.push_back(lits); mutexes.push_back(lits);
@ -614,30 +609,30 @@ namespace smt {
expr_ref_vector const& conseq, expr_ref_vector const& unfixed) { expr_ref_vector const& conseq, expr_ref_vector const& unfixed) {
expr_ref tmp(m); expr_ref tmp(m);
SASSERT(!inconsistent()); SASSERT(!inconsistent());
for (unsigned i = 0; i < conseq.size(); ++i) { for (expr* c : conseq) {
push(); push();
for (unsigned j = 0; j < assumptions.size(); ++j) { for (expr* a : assumptions) {
assert_expr(assumptions[j]); assert_expr(a);
} }
TRACE("context", tout << "checking: " << mk_pp(conseq[i], m) << "\n";); TRACE("context", tout << "checking: " << mk_pp(c, m) << "\n";);
tmp = m.mk_not(conseq[i]); tmp = m.mk_not(c);
assert_expr(tmp); assert_expr(tmp);
VERIFY(check() != l_true); VERIFY(check() != l_true);
pop(1); pop(1);
} }
model_ref mdl; model_ref mdl;
for (unsigned i = 0; i < unfixed.size(); ++i) { for (expr* uf : unfixed) {
push(); push();
for (expr* a : assumptions) for (expr* a : assumptions)
assert_expr(a); assert_expr(a);
TRACE("context", tout << "checking unfixed: " << mk_pp(unfixed[i], m) << "\n";); TRACE("context", tout << "checking unfixed: " << mk_pp(uf, m) << "\n";);
lbool is_sat = check(); lbool is_sat = check();
SASSERT(is_sat != l_false); SASSERT(is_sat != l_false);
if (is_sat == l_true) { if (is_sat == l_true) {
get_model(mdl); get_model(mdl);
tmp = (*mdl)(unfixed[i]); tmp = (*mdl)(uf);
if (m.is_value(tmp)) { if (m.is_value(tmp)) {
tmp = m.mk_not(m.mk_eq(unfixed[i], tmp)); tmp = m.mk_not(m.mk_eq(uf, tmp));
assert_expr(tmp); assert_expr(tmp);
is_sat = check(); is_sat = check();
SASSERT(is_sat != l_false); SASSERT(is_sat != l_false);

View file

@ -2432,9 +2432,8 @@ namespace smt {
} }
void context::pop_to_search_lvl() { void context::pop_to_search_lvl() {
unsigned num_levels = m_scope_lvl - get_search_level(); if (m_scope_lvl > get_search_level()) {
if (num_levels > 0) { pop_scope(m_scope_lvl - get_search_level());
pop_scope(num_levels);
} }
} }