mirror of
https://github.com/Z3Prover/z3
synced 2025-07-19 10:52:02 +00:00
order lemma
Signed-off-by: Lev <levnach@hotmail.com>
This commit is contained in:
parent
cebee656bd
commit
fc277f5648
2 changed files with 34 additions and 9 deletions
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
#pragma once
|
||||||
#include "util/rational.h"
|
#include "util/rational.h"
|
||||||
#include "util/lp/monomial.h"
|
#include "util/lp/monomial.h"
|
||||||
|
|
||||||
|
@ -41,6 +42,15 @@ public:
|
||||||
bool is_var() const { return m_type == factor_type::VAR; }
|
bool is_var() const { return m_type == factor_type::VAR; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline bool operator==(const factor& a, const factor& b) {
|
||||||
|
return a.index() == b.index() && a.type() == b.type();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool operator!=(const factor& a, const factor& b) {
|
||||||
|
return ! (a == b);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class factorization {
|
class factorization {
|
||||||
vector<factor> m_vars;
|
vector<factor> m_vars;
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1034,8 +1034,23 @@ struct solver::imp {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void generate_ol() {
|
void generate_ol(const rooted_mon& ac,
|
||||||
NOT_IMPLEMENTED_YET();
|
const factor& a,
|
||||||
|
const factor& c,
|
||||||
|
const rooted_mon& bd,
|
||||||
|
const factor& b,
|
||||||
|
const factor& d) {
|
||||||
|
if (c != d) {
|
||||||
|
lpvar i = var(c);
|
||||||
|
lpvar j = var(d);
|
||||||
|
auto iv = vvr(i), jv = vvr(j);
|
||||||
|
SASSERT(abs(iv) == abs(jv));
|
||||||
|
if (iv == jv) {
|
||||||
|
mk_ineq(i, -rational(1), j, lp::lconstraint_kind::NE);
|
||||||
|
} else { // iv == -jv
|
||||||
|
mk_ineq(i, j, lp::lconstraint_kind::NE);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool order_lemma_on_ac_and_bd_and_factors(const rooted_mon& ac,
|
bool order_lemma_on_ac_and_bd_and_factors(const rooted_mon& ac,
|
||||||
|
@ -1052,11 +1067,11 @@ struct solver::imp {
|
||||||
auto bd_v = vvr(bd);
|
auto bd_v = vvr(bd);
|
||||||
|
|
||||||
if (ac_m < bd_m && !(ac_v < bd_v)) {
|
if (ac_m < bd_m && !(ac_v < bd_v)) {
|
||||||
generate_ol();
|
generate_ol(ac, a, c, bd, b, d);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (ac_m > bd_m && !(ac_v > bd_v)) {
|
else if (ac_m > bd_m && !(ac_v > bd_v)) {
|
||||||
generate_ol();
|
generate_ol(ac, a, c, bd, b, d);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue