3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-07-19 10:52:02 +00:00

adding pdd-grobner

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2019-12-18 12:03:13 -08:00
parent ca0a52c930
commit 5e0799225d
6 changed files with 441 additions and 2 deletions

View file

@ -338,6 +338,56 @@ namespace dd {
}
}
/*
* Compare leading monomials.
* The pdd format makes lexicographic comparison easy: compare based on
* the top variable and descend depending on whether hi(x) == hi(y)
*/
bool pdd_manager::lt(pdd const& a, pdd const& b) {
PDD x = a.root;
PDD y = b.root;
if (x == y) return false;
while (true) {
SASSERT(x != y);
if (is_val(x))
return !is_val(y) || val(x) < val(y);
if (is_val(y))
return false;
if (level(x) == level(y)) {
if (hi(x) == hi(y)) {
x = lo(x);
y = lo(y);
}
else {
x = hi(x);
y = hi(y);
}
}
else {
return level(x) > level(y);
}
}
}
/**
Compare leading terms of pdds
*/
bool pdd_manager::different_leading_term(pdd const& a, pdd const& b) {
PDD x = a.root;
PDD y = b.root;
while (true) {
if (x == y) return false;
if (is_val(x) || is_val(y)) return true;
if (level(x) == level(y)) {
x = hi(x);
y = hi(y);
}
else {
return false;
}
}
}
void pdd_manager::push(PDD b) {
m_pdd_stack.push_back(b);
}