mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
merge
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
commit
be4bc6caed
26 changed files with 309 additions and 111 deletions
|
@ -24,6 +24,11 @@ namespace nla {
|
|||
}
|
||||
}
|
||||
|
||||
bool monomial_bounds::is_too_big(mpq const& q) const {
|
||||
return rational(q).bitsize() > 256;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Accumulate product of variables in monomial starting at position 'start'
|
||||
*/
|
||||
|
@ -51,6 +56,8 @@ namespace nla {
|
|||
lp::explanation ex;
|
||||
dep.get_upper_dep(range, ex);
|
||||
auto const& upper = dep.upper(range);
|
||||
if (is_too_big(upper))
|
||||
return false;
|
||||
auto cmp = dep.upper_is_open(range) ? llc::LT : llc::LE;
|
||||
new_lemma lemma(c(), "propagate value - upper bound of range is below value");
|
||||
lemma &= ex;
|
||||
|
@ -62,6 +69,8 @@ namespace nla {
|
|||
lp::explanation ex;
|
||||
dep.get_lower_dep(range, ex);
|
||||
auto const& lower = dep.lower(range);
|
||||
if (is_too_big(lower))
|
||||
return false;
|
||||
auto cmp = dep.lower_is_open(range) ? llc::GT : llc::GE;
|
||||
new_lemma lemma(c(), "propagate value - lower bound of range is above value");
|
||||
lemma &= ex;
|
||||
|
@ -106,7 +115,7 @@ namespace nla {
|
|||
auto le = dep.upper_is_open(range) ? llc::LT : llc::LE;
|
||||
new_lemma lemma(c(), "propagate value - root case - upper bound of range is below value");
|
||||
lemma &= ex;
|
||||
lemma |= ineq(v, le, r);
|
||||
lemma |= ineq(v, le, r);
|
||||
return true;
|
||||
}
|
||||
if (p % 2 == 0 && val_v.is_neg()) {
|
||||
|
@ -114,7 +123,7 @@ namespace nla {
|
|||
auto ge = dep.upper_is_open(range) ? llc::GT : llc::GE;
|
||||
new_lemma lemma(c(), "propagate value - root case - upper bound of range is below negative value");
|
||||
lemma &= ex;
|
||||
lemma |= ineq(v, ge, -r);
|
||||
lemma |= ineq(v, ge, -r);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace nla {
|
|||
class monomial_bounds : common {
|
||||
dep_intervals& dep;
|
||||
void var2interval(lpvar v, scoped_dep_interval& i);
|
||||
bool is_too_big(mpq const& q) const;
|
||||
bool propagate_down(monic const& m, lpvar u);
|
||||
bool propagate_value(dep_interval& range, lpvar v);
|
||||
bool propagate_value(dep_interval& range, lpvar v, unsigned power);
|
||||
|
|
|
@ -19,9 +19,10 @@ Notes:
|
|||
--*/
|
||||
#include "math/subpaving/tactic/expr2subpaving.h"
|
||||
#include "ast/expr2var.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "util/ref_util.h"
|
||||
#include "util/z3_exception.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "util/scoped_numeral_buffer.h"
|
||||
#include "util/common_msgs.h"
|
||||
|
||||
|
@ -309,6 +310,10 @@ struct expr2subpaving::imp {
|
|||
case OP_MOD:
|
||||
case OP_REM:
|
||||
case OP_IRRATIONAL_ALGEBRAIC_NUM:
|
||||
case OP_DIV0:
|
||||
case OP_REM0:
|
||||
case OP_MOD0:
|
||||
case OP_IDIV0:
|
||||
throw default_exception("you must apply arithmetic purifier before internalizing expressions into the subpaving module.");
|
||||
case OP_SIN:
|
||||
case OP_COS:
|
||||
|
@ -325,6 +330,7 @@ struct expr2subpaving::imp {
|
|||
// TODO
|
||||
throw default_exception("transcendental and hyperbolic functions are not supported yet.");
|
||||
default:
|
||||
throw default_exception("unhandled arithmetic operator in subpaving");
|
||||
UNREACHABLE();
|
||||
}
|
||||
return subpaving::null_var;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue