mirror of
https://github.com/Z3Prover/z3
synced 2025-07-29 07:27:57 +00:00
adding div0
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
1048abfd9f
commit
6cf7d8e523
6 changed files with 86 additions and 14 deletions
|
@ -440,6 +440,7 @@ namespace smt {
|
|||
arith_eq_solver m_arith_eq_solver;
|
||||
bool m_found_unsupported_op;
|
||||
bool m_found_underspecified_op;
|
||||
ptr_vector<app> m_underspecified_ops;
|
||||
arith_eq_adapter m_arith_eq_adapter;
|
||||
vector<row> m_rows;
|
||||
svector<unsigned> m_dead_rows;
|
||||
|
@ -1077,6 +1078,7 @@ namespace smt {
|
|||
//
|
||||
// -----------------------------------
|
||||
bool get_value(enode * n, expr_ref & r) override;
|
||||
bool include_func_interp(func_decl* f) override;
|
||||
|
||||
bool get_lower(enode* n, expr_ref& r);
|
||||
bool get_upper(enode* n, expr_ref& r);
|
||||
|
|
|
@ -39,6 +39,8 @@ namespace smt {
|
|||
|
||||
template<typename Ext>
|
||||
void theory_arith<Ext>::found_underspecified_op(app * n) {
|
||||
m_underspecified_ops.push_back(n);
|
||||
get_context().push_trail(push_back_vector<context, ptr_vector<app>>(m_underspecified_ops));
|
||||
if (!m_found_underspecified_op) {
|
||||
TRACE("arith", tout << "found underspecified expression:\n" << mk_pp(n, get_manager()) << "\n";);
|
||||
get_context().push_trail(value_trail<context, bool>(m_found_underspecified_op));
|
||||
|
@ -388,7 +390,6 @@ namespace smt {
|
|||
theory_var theory_arith<Ext>::internalize_div(app * n) {
|
||||
rational r(1);
|
||||
if (!m_util.is_numeral(n->get_arg(1), r) || r.is_zero()) found_underspecified_op(n);
|
||||
found_underspecified_op(n);
|
||||
theory_var s = mk_binary_op(n);
|
||||
context & ctx = get_context();
|
||||
if (!ctx.relevancy())
|
||||
|
@ -3271,8 +3272,36 @@ namespace smt {
|
|||
if (!m_model_depends_on_computed_epsilon) {
|
||||
refine_epsilon();
|
||||
}
|
||||
for (app* n : m_underspecified_ops) {
|
||||
if (m_util.is_div(n)) {
|
||||
mk_enode(m_util.mk_div0(n->get_arg(0), n->get_arg(1)));
|
||||
}
|
||||
else if (m_util.is_idiv(n)) {
|
||||
mk_enode(m_util.mk_idiv0(n->get_arg(0), n->get_arg(1)));
|
||||
}
|
||||
else if (m_util.is_rem(n)) {
|
||||
mk_enode(m_util.mk_rem0(n->get_arg(0), n->get_arg(1)));
|
||||
}
|
||||
else if (m_util.is_mod(n)) {
|
||||
mk_enode(m_util.mk_mod0(n->get_arg(0), n->get_arg(1)));
|
||||
}
|
||||
else if (m_util.is_power(n)) {
|
||||
mk_enode(m_util.mk_power0(n->get_arg(0), n->get_arg(1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Ext>
|
||||
bool theory_arith<Ext>::include_func_interp(func_decl* f) {
|
||||
return
|
||||
m_util.is_div0(f) ||
|
||||
m_util.is_idiv0(f) ||
|
||||
m_util.is_power0(f) ||
|
||||
m_util.is_rem0(f) ||
|
||||
m_util.is_mod0(f);
|
||||
}
|
||||
|
||||
|
||||
template<typename Ext>
|
||||
model_value_proc * theory_arith<Ext>::mk_value(enode * n, model_generator & mg) {
|
||||
theory_var v = n->get_th_var(get_id());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue