mirror of
https://github.com/Z3Prover/z3
synced 2025-06-21 05:13:39 +00:00
fix mk_div
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
parent
a8dd908fa0
commit
9f8f6dee9e
2 changed files with 16 additions and 17 deletions
|
@ -371,6 +371,7 @@ public:
|
||||||
}
|
}
|
||||||
// all factors of j go to a, the rest to b
|
// all factors of j go to a, the rest to b
|
||||||
void pre_split(nex_sum * e, lpvar j, nex_sum*& a, nex*& b) {
|
void pre_split(nex_sum * e, lpvar j, nex_sum*& a, nex*& b) {
|
||||||
|
TRACE("nla_cn_details", tout << "e = " << * e << ", j = " << m_nex_creator.ch(j) << std::endl;);
|
||||||
a = m_nex_creator.mk_sum();
|
a = m_nex_creator.mk_sum();
|
||||||
m_b_split_vec.clear();
|
m_b_split_vec.clear();
|
||||||
for (nex * ce: e->children()) {
|
for (nex * ce: e->children()) {
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
#include "math/lp/nex_creator.h"
|
#include "math/lp/nex_creator.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
namespace nla {
|
namespace nla {
|
||||||
|
|
||||||
nex * nex_creator::mk_div(const nex* a, lpvar j) {
|
nex * nex_creator::mk_div(const nex* a, lpvar j) {
|
||||||
SASSERT(is_simplified(a));
|
SASSERT(is_simplified(a));
|
||||||
TRACE("nla_cn_details", tout << "a=" << *a << ", " << ch(j) << "\n";);
|
|
||||||
SASSERT((a->is_mul() && a->contains(j)) || (a->is_var() && to_var(a)->var() == j));
|
SASSERT((a->is_mul() && a->contains(j)) || (a->is_var() && to_var(a)->var() == j));
|
||||||
if (a->is_var())
|
if (a->is_var())
|
||||||
return mk_scalar(rational(1));
|
return mk_scalar(rational(1));
|
||||||
|
@ -31,12 +31,11 @@ nex * nex_creator::mk_div(const nex* a, lpvar j) {
|
||||||
for (auto& p : to_mul(a)->children()) {
|
for (auto& p : to_mul(a)->children()) {
|
||||||
const nex * c = p.e();
|
const nex * c = p.e();
|
||||||
int pow = p.pow();
|
int pow = p.pow();
|
||||||
if (!seenj) {
|
if (!seenj && c->contains(j)) {
|
||||||
if (c->contains(j)) {
|
|
||||||
if (!c->is_var()) {
|
if (!c->is_var()) {
|
||||||
bv.push_back(nex_pow(mk_div(c, j)));
|
bv.push_back(nex_pow(mk_div(c, j)));
|
||||||
if (pow != 1) {
|
if (pow != 1) {
|
||||||
bv.push_back(nex_pow(clone(c), pow));
|
bv.push_back(nex_pow(clone(c), pow - 1));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SASSERT(to_var(c)->var() == j);
|
SASSERT(to_var(c)->var() == j);
|
||||||
|
@ -45,9 +44,8 @@ nex * nex_creator::mk_div(const nex* a, lpvar j) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
seenj = true;
|
seenj = true;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
bv.push_back(nex_pow(clone(c)));
|
bv.push_back(nex_pow(clone(c), pow));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (bv.size() > 1) {
|
if (bv.size() > 1) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue