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

add ddnf tests, 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-09 19:40:34 -07:00
parent 9377779e58
commit 839e3fbb7c
20 changed files with 1158 additions and 8 deletions

View file

@ -513,6 +513,53 @@ static bool is_lira(goal const & g) {
return !test(g, p);
}
struct is_non_qfufnra_functor {
struct found {};
ast_manager & m;
arith_util u;
is_non_qfufnra_functor(ast_manager & _m): m(_m), u(m) {}
void throw_found() {
throw found();
}
void operator()(var * x) {
throw_found();
}
void operator()(quantifier *) {
throw_found();
}
void operator()(app * n) {
family_id fid = n->get_family_id();
if (fid == m.get_basic_family_id())
return;
if (fid == u.get_family_id()) {
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_IRRATIONAL_ALGEBRAIC_NUM:
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_IS_INT:
case OP_TO_INT:
case OP_TO_REAL:
throw_found();
return;
default:
throw_found();
}
}
}
};
class is_qfnia_probe : public probe {
public:
virtual result operator()(goal const & g) {
@ -569,6 +616,18 @@ public:
}
};
static bool is_qfufnra(goal const& g) {
is_non_qfufnra_functor p(g.m());
return !test(g, p);
}
class is_qfufnra_probe : public probe {
public:
virtual result operator()(goal const & g) {
return is_qfufnra(g);
}
};
probe * mk_is_qfnia_probe() {
return alloc(is_qfnia_probe);
}
@ -600,3 +659,7 @@ probe * mk_is_lra_probe() {
probe * mk_is_lira_probe() {
return alloc(is_lira_probe);
}
probe* mk_is_qfufnra_probe() {
return alloc(is_qfufnra_probe);
}

View file

@ -55,6 +55,7 @@ probe * mk_is_nira_probe();
probe * mk_is_lia_probe();
probe * mk_is_lra_probe();
probe * mk_is_lira_probe();
probe * mk_is_qfufnra_probe();
/*
ADD_PROBE("is-qfnia", "true if the goal is in QF_NIA (quantifier-free nonlinear integer arithmetic).", "mk_is_qfnia_probe()")
@ -65,5 +66,6 @@ probe * mk_is_lira_probe();
ADD_PROBE("is-lia", "true if the goal is in LIA (linear integer arithmetic, formula may have quantifiers).", "mk_is_lia_probe()")
ADD_PROBE("is-lra", "true if the goal is in LRA (linear real arithmetic, formula may have quantifiers).", "mk_is_lra_probe()")
ADD_PROBE("is-lira", "true if the goal is in LIRA (linear integer and real arithmetic, formula may have quantifiers).", "mk_is_lira_probe()")
ADD_PROBE("is-qfufnra", "true if the goal is QF_UFNRA (quantifier-free nonlinear real arithmetic with other theories).", mk_is_qfufnra_probe()");
*/
#endif