3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-12 12:08:18 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2020-04-23 22:35:33 -07:00
parent 64cb5cad81
commit eb2d7d3e81
3 changed files with 19 additions and 31 deletions

View file

@ -750,10 +750,10 @@ void theory_seq::branch_unit_variable(dependency* dep, expr* X, expr_ref_vector
bool theory_seq::branch_ternary_variable1() { bool theory_seq::branch_ternary_variable1() {
int start = get_context().get_random_value(); int start = get_context().get_random_value();
for (unsigned i = 0; i < m_eqs.size(); ++i) { for (unsigned i = 0; i < m_eqs.size(); ++i) {
eq const& e = m_eqs[(i + start) % m_eqs.size()]; if (branch_ternary_variable(m_eqs[(i + start) % m_eqs.size()]))
if (branch_ternary_variable(e) || branch_ternary_variable2(e)) { return true;
if (branch_ternary_variable2(m_eqs[(i + start) % m_eqs.size()]))
return true; return true;
}
} }
return false; return false;
} }
@ -917,20 +917,10 @@ bool theory_seq::branch_ternary_variable(eq const& e, bool flag1) {
expr_ref y1ysZ = mk_concat(y1ys, Z); expr_ref y1ysZ = mk_concat(y1ys, Z);
if (indexes.empty()) { if (indexes.empty()) {
return false; return false;
#if 0
TRACE("seq", display_equation(tout << "one case\n", e);
tout << "xs: " << xs << "\n";
tout << "ys: " << ys << "\n";);
literal_vector lits;
dependency* dep = e.dep();
propagate_eq(dep, lits, x, y1ysZ, true);
propagate_eq(dep, lits, y2, ZxsE, true);
#endif
} }
literal ge = m_ax.mk_ge(mk_len(y2), xs.size()); literal ge = m_ax.mk_ge(mk_len(y2), xs.size());
dependency* dep = e.dep(); dependency* dep = e.dep();
literal_vector lits;
switch (ctx.get_assignment(ge)) { switch (ctx.get_assignment(ge)) {
case l_undef: case l_undef:
TRACE("seq", tout << "rec case init\n";); TRACE("seq", tout << "rec case init\n";);
@ -940,12 +930,11 @@ bool theory_seq::branch_ternary_variable(eq const& e, bool flag1) {
case l_true: case l_true:
TRACE("seq", tout << "true branch\n";); TRACE("seq", tout << "true branch\n";);
TRACE("seq", display_equation(tout, e);); TRACE("seq", display_equation(tout, e););
lits.push_back(ge); propagate_eq(dep, ge, x, y1ysZ, true);
propagate_eq(dep, lits, x, y1ysZ, true); propagate_eq(dep, ge, y2, ZxsE, true);
propagate_eq(dep, lits, y2, ZxsE, true);
break; break;
default: default:
return branch_ternary_variable_base(e.dep(), indexes, x, xs, y1, ys, y2); return branch_ternary_variable_base(dep, indexes, x, xs, y1, ys, y2);
} }
return true; return true;
} }

View file

@ -347,15 +347,16 @@ namespace smt {
unsigned chunk_size = 100; unsigned chunk_size = 100;
while (!m_var2val.empty()) { while (!m_var2val.empty()) {
obj_map<expr,expr*>::iterator it = m_var2val.begin(), end = m_var2val.end();
unsigned num_vars = 0; unsigned num_vars = 0;
for (; it != end && num_vars < chunk_size; ++it) { for (auto const& kv : m_var2val) {
if (num_vars >= chunk_size)
break;
if (get_cancel_flag()) { if (get_cancel_flag()) {
if (pushed) pop(1); if (pushed) pop(1);
return l_undef; return l_undef;
} }
expr* e = it->m_key; expr* e = kv.m_key;
expr* val = it->m_value; expr* val = kv.m_value;
literal lit = mk_diseq(e, val); literal lit = mk_diseq(e, val);
mark_as_relevant(lit); mark_as_relevant(lit);
if (get_assignment(lit) != l_undef) { if (get_assignment(lit) != l_undef) {
@ -364,14 +365,12 @@ namespace smt {
++num_vars; ++num_vars;
push_scope(); push_scope();
assign(lit, b_justification::mk_axiom(), true); assign(lit, b_justification::mk_axiom(), true);
if (!propagate()) { if (!propagate() && (!resolve_conflict() || inconsistent())) {
if (!resolve_conflict() || inconsistent()) { TRACE("context", tout << "inconsistent\n";);
TRACE("context", tout << "inconsistent\n";); SASSERT(inconsistent());
SASSERT(inconsistent()); m_conflict = null_b_justification;
m_conflict = null_b_justification; m_not_l = null_literal;
m_not_l = null_literal; SASSERT(m_search_lvl == get_search_level());
SASSERT(m_search_lvl == get_search_level());
}
} }
} }
SASSERT(!inconsistent()); SASSERT(!inconsistent());

View file

@ -1891,7 +1891,7 @@ namespace smt {
m_region.push_scope(); m_region.push_scope();
m_scopes.push_back(scope()); m_scopes.push_back(scope());
scope & s = m_scopes.back(); scope & s = m_scopes.back();
TRACE("context", tout << "push " << m_scope_lvl << "\n";); // TRACE("context", tout << "push " << m_scope_lvl << "\n";);
m_relevancy_propagator->push(); m_relevancy_propagator->push();
s.m_assigned_literals_lim = m_assigned_literals.size(); s.m_assigned_literals_lim = m_assigned_literals.size();
@ -2335,7 +2335,7 @@ namespace smt {
if (m.has_trace_stream() && !m_is_auxiliary) if (m.has_trace_stream() && !m_is_auxiliary)
m.trace_stream() << "[pop] " << num_scopes << " " << m_scope_lvl << "\n"; m.trace_stream() << "[pop] " << num_scopes << " " << m_scope_lvl << "\n";
TRACE("context", tout << "backtracking: " << num_scopes << " from " << m_scope_lvl << "\n";); // TRACE("context", tout << "backtracking: " << num_scopes << " from " << m_scope_lvl << "\n";);
TRACE("pop_scope_detail", display(tout);); TRACE("pop_scope_detail", display(tout););
SASSERT(num_scopes > 0); SASSERT(num_scopes > 0);
SASSERT(num_scopes <= m_scope_lvl); SASSERT(num_scopes <= m_scope_lvl);