3
0
Fork 0
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:
Nikolaj Bjorner 2020-10-16 10:49:46 -07:00 committed by GitHub
parent 2841796a92
commit 44679d8f5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 3172 additions and 403 deletions

View file

@ -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;
}