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

added notes

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2019-12-23 12:31:53 -08:00
parent 3aff0bd7db
commit 77868f3d96
4 changed files with 75 additions and 35 deletions

View file

@ -369,13 +369,6 @@ namespace dd {
}
}
// a = s*x + t, where s is a constant, b = u*x + v, where u is a constant.
// since x is the maximal variable, it does not occur in t or v.
// thus, both a and b are linear in x
bool pdd_manager::spoly_is_invertible(pdd const& a, pdd const& b) {
return !a.is_val() && !b.is_val() && a.hi().is_val() && b.hi().is_val() && a.var() == b.var();
}
/*
* Compare leading monomials.
* The pdd format makes lexicographic comparison easy: compare based on
@ -426,6 +419,23 @@ namespace dd {
}
}
/*
Determine whether p is a linear polynomials.
A linear polynomial is of the form x*v1 + y*v2 + .. + vn,
where v1, v2, .., vn are values.
*/
bool pdd_manager::is_linear(PDD p) {
while (true) {
if (is_val(p)) return true;
if (!is_val(hi(p))) return false;
p = lo(p);
}
}
bool pdd_manager::is_linear(pdd const& p) {
return is_linear(p.root);
}
void pdd_manager::push(PDD b) {
m_pdd_stack.push_back(b);
}

View file

@ -240,11 +240,12 @@ namespace dd {
pdd mul(rational const& c, pdd const& b);
pdd reduce(pdd const& a, pdd const& b);
bool is_linear(PDD p);
bool is_linear(pdd const& p);
// create an spoly r if leading monomials of a and b overlap
bool try_spoly(pdd const& a, pdd const& b, pdd& r);
// true if b can be computed using a and the result of spoly
bool spoly_is_invertible(pdd const& a, pdd const& b);
bool lt(pdd const& a, pdd const& b);
bool different_leading_term(pdd const& a, pdd const& b);
double tree_size(pdd const& p);
@ -274,6 +275,7 @@ namespace dd {
rational const& val() const { SASSERT(is_val()); return m->val(root); }
bool is_val() const { return m->is_val(root); }
bool is_zero() const { return m->is_zero(root); }
bool is_linear() const { return m->is_linear(root); }
pdd operator+(pdd const& other) const { return m->add(*this, other); }
pdd operator-(pdd const& other) const { return m->sub(*this, other); }