3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-07 11:41:22 +00:00

use a more liberal static feature for difference logic

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2012-10-20 06:33:14 -07:00
parent 4e94fa7d37
commit 630ba0c675
2 changed files with 97 additions and 12 deletions

View file

@ -193,12 +193,17 @@ bool theory_diff_logic<Ext>::internalize_atom(app * n, bool gate_ctx) {
SASSERT(m_util.is_le(n) || m_util.is_ge(n));
SASSERT(!ctx.b_internalized(n));
bool is_ge = m_util.is_ge(n);
bool_var bv;
rational kr;
app * x, *y, *z;
theory_var source, target; // target - source <= k
app * lhs = to_app(n->get_arg(0));
app * rhs = to_app(n->get_arg(1));
if (!m_util.is_numeral(rhs)) {
std::swap(rhs, lhs);
is_ge = !is_ge;
}
if (!m_util.is_numeral(rhs, kr)) {
found_non_diff_logic_expr(n);
return false;
@ -224,7 +229,7 @@ bool theory_diff_logic<Ext>::internalize_atom(app * n, bool gate_ctx) {
target = mk_var(lhs);
source = get_zero(lhs);
}
if (m_util.is_ge(n)) {
if (is_ge) {
std::swap(target, source);
k.neg();
}