fix(library/blast/simplifier): handle scalar in fusion

This commit is contained in:
Daniel Selsam 2015-11-16 20:25:08 -08:00
parent 49ff8640d9
commit a689c66b1e
3 changed files with 24 additions and 7 deletions

View file

@ -958,9 +958,14 @@ result simplifier::fuse(expr const & e) {
buffer<expr> locals; buffer<expr> locals;
variables.clear(); variables.clear();
for (auto v_ns : variable_to_numerals) { for (auto v_ns : variable_to_numerals) {
expr local = m_tmp_tctx->mk_tmp_local(T); expr local;
if (!is_one(v_ns.first)) {
local = m_tmp_tctx->mk_tmp_local(T);
locals.push_back(local); locals.push_back(local);
variables.push_back(v_ns.first); variables.push_back(v_ns.first);
} else {
local = v_ns.first;
}
expr term = zero; expr term = zero;
expr term_ls = zero; expr term_ls = zero;

View file

@ -17,7 +17,11 @@ set_option simplify.fuse true
#simplify eq simplifier.som 0 2 * x2 - 8 * x2 * 4 * x1 #simplify eq simplifier.som 0 2 * x2 - 8 * x2 * 4 * x1
#simplify eq simplifier.som 0 x2 * x1 + 3 * x1 + (2 * x2 - 8 * x2 * 4 * x1) + x1 * x2 #simplify eq simplifier.som 0 x2 * x1 + 3 * x1 + (2 * x2 - 8 * x2 * 4 * x1) + x1 * x2
#simplify eq simplifier.som 0 (x1 * x3 + x1 * 2 + x2 * 3 * x3 + x1 * x2) - 2* x2 * x1 + 1 * x2 * x1 - 3 * x1 * x3 #simplify eq simplifier.som 0 (x1 * x3 + x1 * 2 + x2 * 3 * x3 + x1 * x2) - 2* x2 * x1 + 1 * x2 * x1 - 3 * x1 * x3
#simplify eq simplifier.som 0 200 * x2 * 200 #simplify eq simplifier.som 0 2 * 2 + x1
#simplify eq simplifier.som 0 x1 * 200 * x2 * 200 #simplify eq simplifier.som 0 x2 * (2 * 2) + x1
#simplify eq simplifier.som 0 x1 * 200 * x2 * x3 * 200 #simplify eq simplifier.som 0 2 * 2 * x2 + x1
#simplify eq simplifier.som 0 x1 * 200 * x2 * x3 * x4 * 200 #simplify eq simplifier.som 0 2 * x2 * 2 + x1
#simplify eq simplifier.som 0 200 * x2 * 200 + x1
#simplify eq simplifier.som 0 x1 * 200 * x2 * 200 + x1
#simplify eq simplifier.som 0 x1 * 200 * x2 * x3 * 200 + x1
#simplify eq simplifier.som 0 x1 * 200 * x2 * x3 * x4 * 200 + x1

View file

@ -6,3 +6,11 @@ x2 * 2 + -(x2 * x1 * 32)
x2 * 2 + -(x2 * x1 * 32) x2 * 2 + -(x2 * x1 * 32)
x2 * 2 + (x1 * 3 + -(x2 * x1 * 30)) x2 * 2 + (x1 * 3 + -(x2 * x1 * 30))
x1 * 2 + (-(x3 * x1 * 2) + x3 * x2 * 3) x1 * 2 + (-(x3 * x1 * 2) + x3 * x2 * 3)
x1 + 4
x1 + x2 * 4
x1 + x2 * 4
x1 + x2 * 4
x1 + x2 * 40000
x1 + x2 * x1 * 40000
x1 + x3 * (x2 * x1) * 40000
x1 + x4 * (x3 * (x2 * x1)) * 40000