mirror of
https://github.com/Z3Prover/z3
synced 2025-04-08 02:15:19 +00:00
#4532 - arithmetic using SAT for interpreted atoms such as (< 0 0)
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
e1a0a2e536
commit
ec3066c28a
|
@ -152,7 +152,7 @@ struct goal2sat::imp {
|
|||
sat::bool_var v = m_solver.add_var(ext);
|
||||
m_map.insert(t, v);
|
||||
l = sat::literal(v, sign);
|
||||
TRACE("sat", tout << "new_var: " << v << ": " << mk_bounded_pp(t, m, 2) << "\n";);
|
||||
TRACE("sat", tout << "new_var: " << v << ": " << mk_bounded_pp(t, m, 2) << " " << is_uninterp_const(t) << "\n";);
|
||||
if (!is_uninterp_const(t)) {
|
||||
m_interpreted_atoms.push_back(t);
|
||||
}
|
||||
|
@ -953,6 +953,11 @@ void goal2sat::get_interpreted_atoms(expr_ref_vector& atoms) {
|
|||
}
|
||||
}
|
||||
|
||||
bool goal2sat::has_interpreted_atoms() const {
|
||||
return m_interpreted_atoms && !m_interpreted_atoms->empty();
|
||||
}
|
||||
|
||||
|
||||
|
||||
sat2goal::mc::mc(ast_manager& m): m(m), m_var2expr(m) {}
|
||||
|
||||
|
@ -982,7 +987,10 @@ void sat2goal::mc::flush_gmc() {
|
|||
lit0.neg();
|
||||
def = m.mk_not(def);
|
||||
}
|
||||
m_gmc->add(lit2expr(lit0), def);
|
||||
expr_ref e = lit2expr(lit0);
|
||||
expr* r = nullptr;
|
||||
if (is_uninterp_const(e) || (m.is_not(e, r) && is_uninterp_const(r)))
|
||||
m_gmc->add(e, def);
|
||||
clause.reset();
|
||||
tail.reset();
|
||||
}
|
||||
|
@ -1199,7 +1207,7 @@ struct sat2goal::imp {
|
|||
// collect units
|
||||
unsigned trail_sz = s.init_trail_size();
|
||||
for (unsigned i = 0; i < trail_sz; ++i) {
|
||||
checkpoint();
|
||||
checkpoint();
|
||||
r.assert_expr(lit2expr(mc, s.trail_literal(i)));
|
||||
}
|
||||
|
||||
|
|
|
@ -65,6 +65,8 @@ public:
|
|||
|
||||
void get_interpreted_atoms(expr_ref_vector& atoms);
|
||||
|
||||
bool has_interpreted_atoms() const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ class sat_tactic : public tactic {
|
|||
obj_map<expr, sat::literal> dep2asm;
|
||||
sat::literal_vector assumptions;
|
||||
m_goal2sat(*g, m_params, *m_solver, map, dep2asm);
|
||||
TRACE("sat_solver_unknown", tout << "interpreted_atoms: " << map.interpreted_atoms() << "\n";
|
||||
TRACE("sat", tout << "interpreted_atoms: " << map.interpreted_atoms() << "\n";
|
||||
for (auto const& kv : map) {
|
||||
if (!is_uninterp_const(kv.m_key))
|
||||
tout << mk_ismt2_pp(kv.m_key, m) << "\n";
|
||||
|
@ -112,8 +112,8 @@ class sat_tactic : public tactic {
|
|||
ref<sat2goal::mc> mc;
|
||||
m_sat2goal(*m_solver, map, m_params, *(g.get()), mc);
|
||||
g->add(mc.get());
|
||||
if (produce_core) {
|
||||
// sat2goal does not preseve assumptions
|
||||
if (produce_core || m_goal2sat.has_interpreted_atoms()) {
|
||||
// sat2goal does not preseve assumptions or assignments to interpreted atoms
|
||||
g->updt_prec(goal::OVER);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue