3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-02 21:37:02 +00:00

add facility to solve QF_NRA + QF_UF(and other theories) in joint solver to allow broader use of QF_NRA core

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2015-05-10 09:42:11 -07:00
parent c807ad0927
commit f5c048775b
2 changed files with 34 additions and 4 deletions

View file

@ -518,13 +518,19 @@ struct is_non_qfufnra_functor {
struct found {};
ast_manager & m;
arith_util u;
bool m_has_nonlinear;
is_non_qfufnra_functor(ast_manager & _m): m(_m), u(m) {}
is_non_qfufnra_functor(ast_manager & _m):
m(_m), u(m), m_has_nonlinear(false) {}
void throw_found() {
throw found();
}
bool has_nonlinear() const {
return m_has_nonlinear;
}
void operator()(var * x) {
throw_found();
}
@ -539,14 +545,25 @@ struct is_non_qfufnra_functor {
switch (n->get_decl_kind()) {
case OP_LE: case OP_GE: case OP_LT: case OP_GT:
case OP_ADD: case OP_UMINUS: case OP_SUB: case OP_ABS:
case OP_NUM: case OP_MUL:
case OP_NUM:
case OP_IRRATIONAL_ALGEBRAIC_NUM:
return;
case OP_MUL:
if (n->get_num_args() == 2 ||
(!u.is_numeral(n->get_arg(0)) &&
!u.is_numeral(n->get_arg(1)))) {
m_has_nonlinear = true;
}
return;
case OP_IDIV: case OP_DIV: case OP_REM: case OP_MOD:
case OP_POWER:
if (!u.is_numeral(n->get_arg(1)))
throw_found();
return;
case OP_POWER:
if (!u.is_numeral(n->get_arg(1)))
throw_found();
m_has_nonlinear = true;
return;
case OP_IS_INT:
case OP_TO_INT:
case OP_TO_REAL:
@ -618,7 +635,7 @@ public:
static bool is_qfufnra(goal const& g) {
is_non_qfufnra_functor p(g.m());
return !test(g, p);
return !test(g, p) && p.has_nonlinear();
}
class is_qfufnra_probe : public probe {