3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-20 04:43:39 +00:00

Merge branch 'unstable' of https://git01.codeplex.com/z3 into fpa-api

This commit is contained in:
Christoph M. Wintersteiger 2014-12-21 18:47:02 +00:00
commit 0ceb67ae33
4 changed files with 33 additions and 21 deletions

2
README
View file

@ -41,3 +41,5 @@ Remark: clang does not support OpenMP yet.
cd build cd build
make make
To clean Z3 you can delete the build directory and run the mk_make.py script again.

View file

@ -3813,6 +3813,18 @@ def RepeatBitVec(n, a):
_z3_assert(is_bv(a), "Second argument must be a Z3 Bitvector expression") _z3_assert(is_bv(a), "Second argument must be a Z3 Bitvector expression")
return BitVecRef(Z3_mk_repeat(a.ctx_ref(), n, a.as_ast()), a.ctx) return BitVecRef(Z3_mk_repeat(a.ctx_ref(), n, a.as_ast()), a.ctx)
def BVRedAnd(a):
"""Return the reduction-and expression of `a`."""
if __debug__:
_z3_assert(is_bv(a), "First argument must be a Z3 Bitvector expression")
return BitVecRef(Z3_mk_bvredand(a.ctx_ref(), a.as_ast()), a.ctx)
def BVRedOr(a):
"""Return the reduction-or expression of `a`."""
if __debug__:
_z3_assert(is_bv(a), "First argument must be a Z3 Bitvector expression")
return BitVecRef(Z3_mk_bvredor(a.ctx_ref(), a.as_ast()), a.ctx)
######################################### #########################################
# #
# Arrays # Arrays

View file

@ -3321,14 +3321,14 @@ namespace smt {
CASSERT("dyn_ack", check_clauses(m_lemmas) && check_clauses(m_aux_clauses)); CASSERT("dyn_ack", check_clauses(m_lemmas) && check_clauses(m_aux_clauses));
} }
if (resource_limits_exceeded()) { if (resource_limits_exceeded() && !inconsistent()) {
SASSERT(!inconsistent());
return l_undef; return l_undef;
} }
if (m_base_lvl == m_scope_lvl && m_fparams.m_simplify_clauses) if (m_base_lvl == m_scope_lvl && m_fparams.m_simplify_clauses)
simplify_clauses(); simplify_clauses();
if (!decide()) { if (!decide()) {
final_check_status fcs = final_check(); final_check_status fcs = final_check();
TRACE("final_check_result", tout << "fcs: " << fcs << " last_search_failure: " << m_last_search_failure << "\n";); TRACE("final_check_result", tout << "fcs: " << fcs << " last_search_failure: " << m_last_search_failure << "\n";);
@ -3342,8 +3342,7 @@ namespace smt {
} }
} }
if (resource_limits_exceeded()) { if (resource_limits_exceeded() && !inconsistent()) {
SASSERT(!inconsistent());
return l_undef; return l_undef;
} }
} }

View file

@ -336,8 +336,9 @@ namespace smt {
theory_var theory_arith<Ext>::internalize_rem(app * n) { theory_var theory_arith<Ext>::internalize_rem(app * n) {
theory_var s = mk_binary_op(n); theory_var s = mk_binary_op(n);
context & ctx = get_context(); context & ctx = get_context();
if (!ctx.relevancy()) if (!ctx.relevancy()) {
mk_rem_axiom(n->get_arg(0), n->get_arg(1)); mk_rem_axiom(n->get_arg(0), n->get_arg(1));
}
return s; return s;
} }
@ -456,22 +457,20 @@ namespace smt {
template<typename Ext> template<typename Ext>
void theory_arith<Ext>::mk_rem_axiom(expr * dividend, expr * divisor) { void theory_arith<Ext>::mk_rem_axiom(expr * dividend, expr * divisor) {
if (!m_util.is_zero(divisor)) { // if divisor is zero, then rem is an uninterpreted function.
// if divisor is zero, then rem is an uninterpreted function. ast_manager & m = get_manager();
ast_manager & m = get_manager(); expr * zero = m_util.mk_numeral(rational(0), true);
expr * zero = m_util.mk_numeral(rational(0), true); expr * rem = m_util.mk_rem(dividend, divisor);
expr * rem = m_util.mk_rem(dividend, divisor); expr * mod = m_util.mk_mod(dividend, divisor);
expr * mod = m_util.mk_mod(dividend, divisor); expr_ref dltz(m), eq1(m), eq2(m);
expr_ref dltz(m), eq1(m), eq2(m); dltz = m_util.mk_lt(divisor, zero);
dltz = m_util.mk_lt(divisor, zero); eq1 = m.mk_eq(rem, mod);
eq1 = m.mk_eq(rem, mod); eq2 = m.mk_eq(rem, m_util.mk_sub(zero, mod));
eq2 = m.mk_eq(rem, m_util.mk_sub(zero, mod)); // n < 0 || rem(a,n) = mod(a, n)
// n < 0 || rem(a,n) = mod(a, n) mk_axiom(dltz, eq1);
mk_axiom(dltz, eq1); dltz = m.mk_not(dltz);
dltz = m.mk_not(dltz); // !n < 0 || rem(a,n) = -mod(a, n)
// !n < 0 || rem(a,n) = -mod(a, n) mk_axiom(dltz, eq2);
mk_axiom(dltz, eq2);
}
} }
// //