mirror of
https://github.com/Z3Prover/z3
synced 2025-06-22 22:03:39 +00:00
reduce simplification
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
991e587950
commit
50873c8094
5 changed files with 98 additions and 44 deletions
|
@ -70,7 +70,7 @@ namespace dd {
|
|||
pdd pdd_manager::zero() { return pdd(zero_pdd, this); }
|
||||
pdd pdd_manager::one() { return pdd(one_pdd, this); }
|
||||
|
||||
pdd pdd_manager::mk_or(pdd const& p, pdd const& q) { return p*q + p + q; }
|
||||
pdd pdd_manager::mk_or(pdd const& p, pdd const& q) { return p + q - (p*q); }
|
||||
|
||||
pdd_manager::PDD pdd_manager::apply(PDD arg1, PDD arg2, pdd_op op) {
|
||||
bool first = true;
|
||||
|
@ -448,6 +448,19 @@ namespace dd {
|
|||
return is_linear(p.root);
|
||||
}
|
||||
|
||||
/*
|
||||
Determine whether p is a binary polynomials
|
||||
of the form v1, x*v1 + v2, or x*v1 + y*v2 + v3
|
||||
where v1, v2 are values.
|
||||
*/
|
||||
bool pdd_manager::is_binary(PDD p) {
|
||||
return is_val(p) || (is_val(hi(p)) && (is_val(lo(p)) || (is_val(hi(lo(p))) && is_val(lo(lo(p))))));
|
||||
}
|
||||
|
||||
bool pdd_manager::is_binary(pdd const& p) {
|
||||
return is_binary(p.root);
|
||||
}
|
||||
|
||||
void pdd_manager::push(PDD b) {
|
||||
m_pdd_stack.push_back(b);
|
||||
}
|
||||
|
|
|
@ -252,6 +252,9 @@ namespace dd {
|
|||
bool is_linear(PDD p);
|
||||
bool is_linear(pdd const& p);
|
||||
|
||||
bool is_binary(PDD p);
|
||||
bool is_binary(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);
|
||||
|
||||
|
@ -287,7 +290,10 @@ namespace dd {
|
|||
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); }
|
||||
bool is_binary() const { return m.is_binary(root); }
|
||||
|
||||
pdd minus() const { return m.minus(*this); }
|
||||
pdd operator-() const { return m.minus(*this); }
|
||||
pdd operator+(pdd const& other) const { return m.add(*this, other); }
|
||||
pdd operator-(pdd const& other) const { return m.sub(*this, other); }
|
||||
pdd operator*(pdd const& other) const { return m.mul(*this, other); }
|
||||
|
@ -315,7 +321,10 @@ namespace dd {
|
|||
inline pdd operator+(int x, pdd const& b) { return b + rational(x); }
|
||||
inline pdd operator+(pdd const& b, int x) { return b + rational(x); }
|
||||
|
||||
inline pdd operator-(rational const& r, pdd const& b) { return r + (-b); }
|
||||
inline pdd operator-(int x, pdd const& b) { return rational(x) - b; }
|
||||
inline pdd operator-(pdd const& b, int x) { return b + (-rational(x)); }
|
||||
|
||||
inline pdd& operator*=(pdd & p, pdd const& q) { p = p * q; return p; }
|
||||
inline pdd& operator|=(pdd & p, pdd const& q) { p = p | q; return p; }
|
||||
inline pdd& operator-=(pdd & p, pdd const& q) { p = p - q; return p; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue