3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 17:45:32 +00:00

get univariate coefficients

This commit is contained in:
Jakob Rath 2022-03-11 18:03:39 +01:00
parent 74281fa830
commit 1de51da67e
3 changed files with 54 additions and 0 deletions

View file

@ -570,6 +570,28 @@ public :
}
}
static void univariate() {
std::cout << "univariate\n";
pdd_manager m(4, pdd_manager::mod2N_e, 4);
unsigned const va = 0;
unsigned const vb = 1;
pdd const a = m.mk_var(va);
pdd const b = m.mk_var(vb);
pdd p = a*a*b - a*a;
SASSERT(!p.is_univariate());
pdd q = 3*a*a*a + 1*a + 2;
SASSERT(q.is_univariate());
vector<rational> coeff;
q.get_univariate_coefficients(coeff);
SASSERT_EQ(coeff.size(), 4);
SASSERT_EQ(coeff[0], 2);
SASSERT_EQ(coeff[1], 1);
SASSERT_EQ(coeff[2], 0);
SASSERT_EQ(coeff[3], 3);
}
};
}
@ -591,4 +613,5 @@ void tst_pdd() {
dd::test::binary_resolve();
dd::test::pow();
dd::test::subst_val();
dd::test::univariate();
}