mirror of
https://github.com/Z3Prover/z3
synced 2025-05-08 00:05:46 +00:00
arith_solver (#4733)
* porting arithmetic solver * integrating arithmetic * lp Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * na Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * na Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com> * na Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
2841796a92
commit
44679d8f5b
33 changed files with 3172 additions and 403 deletions
|
@ -830,6 +830,8 @@ bool arith_util::is_considered_uninterpreted(func_decl* f, unsigned n, expr* con
|
|||
return plugin().is_considered_uninterpreted(f);
|
||||
}
|
||||
|
||||
|
||||
|
||||
func_decl* arith_util::mk_ipower0() {
|
||||
sort* s = mk_int();
|
||||
sort* rs[2] = { s, s };
|
||||
|
@ -861,3 +863,62 @@ func_decl* arith_util::mk_mod0() {
|
|||
sort* rs[2] = { mk_int(), mk_int() };
|
||||
return m_manager.mk_func_decl(m_afid, OP_MOD0, 0, nullptr, 2, rs, mk_int());
|
||||
}
|
||||
|
||||
bool arith_util::is_bounded(expr* n) const {
|
||||
expr* x = nullptr, * y = nullptr;
|
||||
while (true) {
|
||||
if (is_idiv(n, x, y) && is_numeral(y)) {
|
||||
n = x;
|
||||
}
|
||||
else if (is_mod(n, x, y) && is_numeral(y)) {
|
||||
return true;
|
||||
}
|
||||
else if (is_numeral(n)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool arith_util::is_extended_numeral(expr* term, rational& r) const {
|
||||
rational mul(1);
|
||||
do {
|
||||
if (is_numeral(term, r)) {
|
||||
r *= mul;
|
||||
return true;
|
||||
}
|
||||
if (is_uminus(term, term)) {
|
||||
mul.neg();
|
||||
continue;
|
||||
}
|
||||
if (is_to_real(term, term)) {
|
||||
continue;
|
||||
}
|
||||
return false;
|
||||
} while (false);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool arith_util::is_underspecified(expr* e) const {
|
||||
if (!is_app(e))
|
||||
return false;
|
||||
if (to_app(e)->get_family_id() == get_family_id()) {
|
||||
switch (to_app(e)->get_decl_kind()) {
|
||||
case OP_DIV:
|
||||
case OP_IDIV:
|
||||
case OP_REM:
|
||||
case OP_MOD:
|
||||
case OP_DIV0:
|
||||
case OP_IDIV0:
|
||||
case OP_REM0:
|
||||
case OP_MOD0:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue