mirror of
https://github.com/Z3Prover/z3
synced 2025-06-20 12:53:38 +00:00
fix #4794
This commit is contained in:
parent
9156e355d8
commit
12198d13ac
10 changed files with 42 additions and 28 deletions
|
@ -142,11 +142,6 @@ namespace sat {
|
||||||
buffer[len++] = '\n';
|
buffer[len++] = '\n';
|
||||||
m_out->write(buffer, len);
|
m_out->write(buffer, len);
|
||||||
|
|
||||||
if (n == 3 && c[0] == literal(9357, true) && c[1] == literal(25, true) && c[2] == literal(8691, false)) {
|
|
||||||
m_out->flush();
|
|
||||||
SASSERT(false);
|
|
||||||
UNREACHABLE();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void drat::dump_activity() {
|
void drat::dump_activity() {
|
||||||
|
|
|
@ -3486,7 +3486,6 @@ namespace sat {
|
||||||
return value(v) != l_undef && lvl(v) <= new_lvl;
|
return value(v) != l_undef && lvl(v) <= new_lvl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
for (unsigned i = old_num_vars; i < sz; ++i) {
|
for (unsigned i = old_num_vars; i < sz; ++i) {
|
||||||
bool_var v = m_active_vars[i];
|
bool_var v = m_active_vars[i];
|
||||||
if (is_visited(v) || is_active(v)) {
|
if (is_visited(v) || is_active(v)) {
|
||||||
|
@ -3496,7 +3495,9 @@ namespace sat {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
set_eliminated(v, true);
|
set_eliminated(v, true);
|
||||||
m_free_vars.push_back(v);
|
if (!is_external(v) || true) {
|
||||||
|
m_free_vars.push_back(v);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_active_vars.shrink(j);
|
m_active_vars.shrink(j);
|
||||||
|
|
|
@ -669,6 +669,7 @@ namespace sat {
|
||||||
void set_should_simplify() { m_next_simplify = m_conflicts_since_init; }
|
void set_should_simplify() { m_next_simplify = m_conflicts_since_init; }
|
||||||
bool_var_vector const& get_vars_to_reinit() const { return m_vars_to_reinit; }
|
bool_var_vector const& get_vars_to_reinit() const { return m_vars_to_reinit; }
|
||||||
bool is_probing() const { return m_is_probing; }
|
bool is_probing() const { return m_is_probing; }
|
||||||
|
bool is_free(bool_var v) const { return m_free_vars.contains(v); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void user_push() override;
|
void user_push() override;
|
||||||
|
|
|
@ -436,6 +436,7 @@ namespace arith {
|
||||||
if (_has_var)
|
if (_has_var)
|
||||||
return v;
|
return v;
|
||||||
theory_var w = mk_evar(n);
|
theory_var w = mk_evar(n);
|
||||||
|
internalize_term(n);
|
||||||
svector<lpvar> vars;
|
svector<lpvar> vars;
|
||||||
for (unsigned i = 0; i < p; ++i)
|
for (unsigned i = 0; i < p; ++i)
|
||||||
vars.push_back(register_theory_var_in_lar_solver(w));
|
vars.push_back(register_theory_var_in_lar_solver(w));
|
||||||
|
|
|
@ -360,11 +360,12 @@ namespace bv {
|
||||||
case bv_justification::kind_t::eq2bit:
|
case bv_justification::kind_t::eq2bit:
|
||||||
++s_count;
|
++s_count;
|
||||||
// std::cout << "eq2bit " << s_count << "\n";
|
// std::cout << "eq2bit " << s_count << "\n";
|
||||||
#if 1
|
#if 0
|
||||||
if (s_count == 1899) {
|
if (s_count == 1899) {
|
||||||
std::cout << "eq2bit " << mk_bounded_pp(var2expr(c.m_v1), m) << " == " << mk_bounded_pp(var2expr(c.m_v2), m) << "\n";
|
std::cout << "eq2bit " << mk_bounded_pp(var2expr(c.m_v1), m) << " == " << mk_bounded_pp(var2expr(c.m_v2), m) << "\n";
|
||||||
std::cout << mk_bounded_pp(literal2expr(~c.m_antecedent), m, 2) << "\n";
|
std::cout << mk_bounded_pp(literal2expr(~c.m_antecedent), m, 4) << "\n";
|
||||||
std::cout << mk_bounded_pp(literal2expr(c.m_consequent), m, 2) << "\n";
|
std::cout << mk_bounded_pp(literal2expr(c.m_consequent), m, 4) << "\n";
|
||||||
|
std::cout << literal2expr(c.m_consequent) << "\n";
|
||||||
#if 0
|
#if 0
|
||||||
solver_ref slv = mk_smt2_solver(m, ctx.s().params());
|
solver_ref slv = mk_smt2_solver(m, ctx.s().params());
|
||||||
slv->assert_expr(eq);
|
slv->assert_expr(eq);
|
||||||
|
@ -779,8 +780,6 @@ namespace bv {
|
||||||
}
|
}
|
||||||
|
|
||||||
sat::justification solver::mk_eq2bit_justification(theory_var v1, theory_var v2, sat::literal c, sat::literal a) {
|
sat::justification solver::mk_eq2bit_justification(theory_var v1, theory_var v2, sat::literal c, sat::literal a) {
|
||||||
if (v1 == 3202 && v2 == 3404) std::cout << a << " -> " << c << "\n";
|
|
||||||
SASSERT(!(v1 == 3202 && v2 == 3404 && c.var() == 8691));
|
|
||||||
void* mem = get_region().allocate(bv_justification::get_obj_size());
|
void* mem = get_region().allocate(bv_justification::get_obj_size());
|
||||||
sat::constraint_base::initialize(mem, this);
|
sat::constraint_base::initialize(mem, this);
|
||||||
auto* constraint = new (sat::constraint_base::ptr2mem(mem)) bv_justification(v1, v2, c, a);
|
auto* constraint = new (sat::constraint_base::ptr2mem(mem)) bv_justification(v1, v2, c, a);
|
||||||
|
|
|
@ -76,7 +76,8 @@ namespace euf {
|
||||||
if (!use_drat())
|
if (!use_drat())
|
||||||
return;
|
return;
|
||||||
literal_vector lits;
|
literal_vector lits;
|
||||||
for (literal lit : r) lits.push_back(~lit);
|
for (literal lit : r)
|
||||||
|
lits.push_back(~lit);
|
||||||
if (l != sat::null_literal)
|
if (l != sat::null_literal)
|
||||||
lits.push_back(l);
|
lits.push_back(l);
|
||||||
get_drat().add(lits, sat::status::th(true, get_id()));
|
get_drat().add(lits, sat::status::th(true, get_id()));
|
||||||
|
|
|
@ -692,6 +692,13 @@ namespace euf {
|
||||||
finish_reinit();
|
finish_reinit();
|
||||||
for (auto* e : m_solvers)
|
for (auto* e : m_solvers)
|
||||||
e->pop_reinit();
|
e->pop_reinit();
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
for (enode* n : m_egraph.nodes()) {
|
||||||
|
if (n->bool_var() != sat::null_bool_var && s().is_free(n->bool_var()))
|
||||||
|
std::cout << "has free " << n->bool_var() << "\n";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool solver::validate() {
|
bool solver::validate() {
|
||||||
|
|
|
@ -71,10 +71,12 @@ class smt_checker {
|
||||||
|
|
||||||
void add_units() {
|
void add_units() {
|
||||||
auto const& units = m_drat.units();
|
auto const& units = m_drat.units();
|
||||||
|
#if 0
|
||||||
for (unsigned i = m_units.size(); i < units.size(); ++i) {
|
for (unsigned i = m_units.size(); i < units.size(); ++i) {
|
||||||
sat::literal lit = units[i];
|
sat::literal lit = units[i];
|
||||||
m_lemma_solver->assert_expr(lit2expr(lit));
|
m_lemma_solver->assert_expr(lit2expr(lit));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
m_units.append(units.size() - m_units.size(), units.c_ptr() + m_units.size());
|
m_units.append(units.size() - m_units.size(), units.c_ptr() + m_units.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,20 +115,22 @@ class smt_checker {
|
||||||
std::cout << "drup\n";
|
std::cout << "drup\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_lemma_solver->push();
|
m_input_solver->push();
|
||||||
for (auto lit : drup_units)
|
// for (auto lit : drup_units)
|
||||||
m_lemma_solver->assert_expr(lit2expr(lit));
|
// m_input_solver->assert_expr(lit2expr(lit));
|
||||||
lbool is_sat = m_lemma_solver->check_sat();
|
for (auto lit : lits)
|
||||||
|
m_input_solver->assert_expr(lit2expr(~lit));
|
||||||
|
lbool is_sat = m_input_solver->check_sat();
|
||||||
if (is_sat != l_false) {
|
if (is_sat != l_false) {
|
||||||
std::cout << "did not verify: " << lits << "\n";
|
std::cout << "did not verify: " << lits << "\n";
|
||||||
for (sat::literal lit : lits) {
|
for (sat::literal lit : lits) {
|
||||||
std::cout << lit2expr(lit) << "\n";
|
std::cout << lit2expr(lit) << "\n";
|
||||||
}
|
}
|
||||||
std::cout << "\n";
|
std::cout << "\n";
|
||||||
m_lemma_solver->display(std::cout);
|
m_input_solver->display(std::cout);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
m_lemma_solver->pop(1);
|
m_input_solver->pop(1);
|
||||||
std::cout << "smt\n";
|
std::cout << "smt\n";
|
||||||
// check_assertion_redundant(lits);
|
// check_assertion_redundant(lits);
|
||||||
}
|
}
|
||||||
|
@ -280,8 +284,10 @@ static void verify_smt(char const* drat_file, char const* smt_file) {
|
||||||
switch (r.m_tag) {
|
switch (r.m_tag) {
|
||||||
case dimacs::drat_record::tag_t::is_clause:
|
case dimacs::drat_record::tag_t::is_clause:
|
||||||
checker.add(r.m_lits, r.m_status);
|
checker.add(r.m_lits, r.m_status);
|
||||||
if (drat_checker.inconsistent())
|
if (drat_checker.inconsistent()) {
|
||||||
std::cout << "inconsistent\n";
|
std::cout << "inconsistent\n";
|
||||||
|
return;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case dimacs::drat_record::tag_t::is_node: {
|
case dimacs::drat_record::tag_t::is_node: {
|
||||||
expr_ref e(m);
|
expr_ref e(m);
|
||||||
|
|
|
@ -278,12 +278,15 @@ namespace smt {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
update_state_graph(r);
|
auto info = re().get_info(r);
|
||||||
|
if (info.interpreted) {
|
||||||
|
update_state_graph(r);
|
||||||
|
|
||||||
if (m_state_graph.is_dead(get_state_id(r))) {
|
if (m_state_graph.is_dead(get_state_id(r))) {
|
||||||
STRACE("seq_regex_brief", tout << "(dead) ";);
|
STRACE("seq_regex_brief", tout << "(dead) ";);
|
||||||
th.add_axiom(~lit);
|
th.add_axiom(~lit);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block_unfolding(lit, idx)) {
|
if (block_unfolding(lit, idx)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue