mirror of
https://github.com/Z3Prover/z3
synced 2025-04-13 12:28:44 +00:00
fix detection of arithmetic operations
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
cc216f8cc3
commit
3548057bd1
|
@ -1157,6 +1157,7 @@ namespace sat {
|
|||
}
|
||||
catch (const abort_solver &) {
|
||||
m_reason_unknown = "sat.giveup";
|
||||
IF_VERBOSE(SAT_VB_LVL, verbose_stream() << "(sat \"abort giveup\")\n";);
|
||||
return l_undef;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -328,6 +328,7 @@ namespace sat {
|
|||
if (!m_rlimit.inc()) {
|
||||
m_mc.reset();
|
||||
m_model_is_current = false;
|
||||
TRACE("sat", tout << "canceled\n";);
|
||||
throw solver_exception(Z3_CANCELED_MSG);
|
||||
}
|
||||
++m_num_checkpoints;
|
||||
|
@ -384,7 +385,7 @@ namespace sat {
|
|||
model_converter const & get_model_converter() const { return m_mc; }
|
||||
void flush(model_converter& mc) override { mc.flush(m_mc); }
|
||||
void set_model(model const& mdl);
|
||||
char const* get_reason_unknown() const { return m_reason_unknown.c_str(); }
|
||||
char const* get_reason_unknown() const override { return m_reason_unknown.c_str(); }
|
||||
bool check_clauses(model const& m) const;
|
||||
bool is_assumption(bool_var v) const;
|
||||
void set_activity(bool_var v, unsigned act);
|
||||
|
|
|
@ -50,6 +50,8 @@ namespace sat {
|
|||
// check satisfiability
|
||||
virtual lbool check(unsigned num_lits = 0, literal const* lits = nullptr) = 0;
|
||||
|
||||
virtual char const* get_reason_unknown() const { return "reason unavailable"; }
|
||||
|
||||
// add clauses
|
||||
virtual void add_clause(unsigned n, literal* lits, bool is_redundant) = 0;
|
||||
void add_clause(literal l1, literal l2, bool is_redundant) {
|
||||
|
|
|
@ -65,6 +65,7 @@ class sat_tactic : public tactic {
|
|||
TRACE("sat_dimacs", m_solver->display_dimacs(tout););
|
||||
dep2assumptions(dep2asm, assumptions);
|
||||
lbool r = m_solver->check(assumptions.size(), assumptions.c_ptr());
|
||||
TRACE("sat", tout << "result of checking: " << r << " " << m_solver->get_reason_unknown() << "\n";);
|
||||
if (r == l_false) {
|
||||
expr_dependency * lcore = nullptr;
|
||||
if (produce_core) {
|
||||
|
@ -198,6 +199,10 @@ public:
|
|||
proc.m_solver->collect_statistics(m_stats);
|
||||
throw tactic_exception(ex.msg());
|
||||
}
|
||||
catch (z3_exception& ex) {
|
||||
TRACE("sat", tout << ex.msg() << "\n";);
|
||||
throw;
|
||||
}
|
||||
TRACE("sat_stats", m_stats.display_smt2(tout););
|
||||
}
|
||||
|
||||
|
|
|
@ -318,10 +318,12 @@ class nla2bv_tactic : public tactic {
|
|||
ast_manager& m;
|
||||
pb_util pb;
|
||||
ptr_vector<app> m_vars;
|
||||
bool m_no_arith;
|
||||
bool m_in_supported_fragment;
|
||||
public:
|
||||
get_uninterp_proc(imp& s): m_imp(s), a(s.m_arith), m(a.get_manager()), pb(m), m_in_supported_fragment(true) {}
|
||||
get_uninterp_proc(imp& s): m_imp(s), a(s.m_arith), m(a.get_manager()), pb(m), m_no_arith(true), m_in_supported_fragment(true) {}
|
||||
ptr_vector<app> const& vars() { return m_vars; }
|
||||
bool no_arith() const { return m_no_arith; }
|
||||
void operator()(var * n) {
|
||||
m_in_supported_fragment = false;
|
||||
}
|
||||
|
@ -338,18 +340,20 @@ class nla2bv_tactic : public tactic {
|
|||
else if (m.is_bool(n) && n->get_decl()->get_family_id() == pb.get_family_id()) {
|
||||
|
||||
}
|
||||
else if (!(a.is_mul(n) ||
|
||||
a.is_add(n) ||
|
||||
a.is_sub(n) ||
|
||||
a.is_le(n) ||
|
||||
a.is_lt(n) ||
|
||||
a.is_ge(n) ||
|
||||
a.is_gt(n) ||
|
||||
a.is_numeral(n) ||
|
||||
a.is_uminus(n) ||
|
||||
m_imp.m_bv2real.is_pos_le(n) ||
|
||||
m_imp.m_bv2real.is_pos_lt(n) ||
|
||||
n->get_family_id() == a.get_manager().get_basic_family_id())) {
|
||||
else if (a.is_mul(n) ||
|
||||
a.is_add(n) ||
|
||||
a.is_sub(n) ||
|
||||
a.is_le(n) ||
|
||||
a.is_lt(n) ||
|
||||
a.is_ge(n) ||
|
||||
a.is_gt(n) ||
|
||||
a.is_numeral(n) ||
|
||||
a.is_uminus(n) ||
|
||||
m_imp.m_bv2real.is_pos_le(n) ||
|
||||
m_imp.m_bv2real.is_pos_lt(n)) {
|
||||
m_no_arith = false;
|
||||
}
|
||||
else if (n->get_family_id() != m.get_basic_family_id()) {
|
||||
TRACE("nla2bv", tout << "Not supported: " << mk_ismt2_pp(n, m) << "\n";);
|
||||
m_in_supported_fragment = false;
|
||||
}
|
||||
|
@ -370,7 +374,7 @@ class nla2bv_tactic : public tactic {
|
|||
add_var(fe_var.vars()[i]);
|
||||
}
|
||||
if (!fe_var.is_supported()) return not_supported;
|
||||
if (fe_var.vars().empty()) return is_bool;
|
||||
if (fe_var.vars().empty() && fe_var.no_arith()) return is_bool;
|
||||
return has_num;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue