3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-27 10:55:50 +00:00

sort nla_expr

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
Lev Nachmanson 2019-07-15 15:07:59 -07:00
parent 00d366e3b8
commit 8eaa2bfb02
5 changed files with 103 additions and 20 deletions

View file

@ -72,11 +72,32 @@ void test_cn() {
enable_trace("nla_cn");
// (a(a+(b+c)c+d)d + e(a(e+c)+d)
nex a = nex::var(0), b = nex::var(1), c = nex::var(2), d = nex::var(3), e = nex::var(4);
nex t = a*a*d + a*b*c*d + a*c*c*d + a*d*d + e*a*e + e*a*c + e*d;
std::cout << "t = " << t << "\n";
TRACE("nla_cn", tout << "t=" << t << '\n';);
cross_nested cn(t, [](const nex& n) { std::cout << n << "\n"; } );
cn.run();
{
nex t = a*a*d + a*b*c*d + a*c*c*d + a*d*d + e*a*e + e*a*c + e*d;
std::cout << "t = " << t << "\n";
TRACE("nla_cn", tout << "t=" << t << '\n';);
cross_nested cn(t, [](const nex& n) {
std::cout << n << "\n";
auto nn = n;
nn.sort();
std::cout << "ordered version\n" << nn << "\n______________________\n";
} );
cn.run();
}
{
nex t = a*b*d + a*b*c;
std::cout << "t = " << t << "\n";
TRACE("nla_cn", tout << "t=" << t << '\n';);
cross_nested cn(t, [](const nex& n) {
std::cout << n << "\n";
auto nn = n;
nn.sort();
std::cout << "ordered version\n" << nn << "\n______________________\n";
} );
cn.run();
}
}
} // end of namespace nla