chore(frontends/lean/builtin_cmds,library/blast/simplifier): fix style
This commit is contained in:
parent
b3ca5faa49
commit
7abb0d6b96
2 changed files with 16 additions and 15 deletions
|
@ -1338,7 +1338,7 @@ static environment simplify_cmd(parser & p) {
|
||||||
blast::scope_debug scope(p.env(), p.ios());
|
blast::scope_debug scope(p.env(), p.ios());
|
||||||
simp_rule_sets srss;
|
simp_rule_sets srss;
|
||||||
if (ns == name("null")) { }
|
if (ns == name("null")) { }
|
||||||
if (ns == name("env")) { srss = get_simp_rule_sets(p.env()); }
|
else if (ns == name("env")) { srss = get_simp_rule_sets(p.env()); }
|
||||||
else { srss = get_simp_rule_sets(p.env(), p.ios(), ns); }
|
else { srss = get_simp_rule_sets(p.env(), p.ios(), ns); }
|
||||||
|
|
||||||
blast::simp::result r = blast::simplify(rel, e, srss);
|
blast::simp::result r = blast::simplify(rel, e, srss);
|
||||||
|
|
|
@ -836,7 +836,7 @@ result simplifier::fuse(expr const & e) {
|
||||||
|
|
||||||
/* Construct useful expressions */
|
/* Construct useful expressions */
|
||||||
buffer<expr> args;
|
buffer<expr> args;
|
||||||
get_app_args(e,args);
|
get_app_args(e, args);
|
||||||
expr T = args[0];
|
expr T = args[0];
|
||||||
expr f_add, f_mul, zero, one;
|
expr f_add, f_mul, zero, one;
|
||||||
try {
|
try {
|
||||||
|
@ -856,7 +856,7 @@ result simplifier::fuse(expr const & e) {
|
||||||
expr s = e;
|
expr s = e;
|
||||||
while (is_add_app(s)) {
|
while (is_add_app(s)) {
|
||||||
buffer<expr> args;
|
buffer<expr> args;
|
||||||
expr f = get_app_args(s,args);
|
expr f = get_app_args(s, args);
|
||||||
auto n_v = split_summand(args[2], f_mul, one);
|
auto n_v = split_summand(args[2], f_mul, one);
|
||||||
numerals.push_back(n_v.first);
|
numerals.push_back(n_v.first);
|
||||||
variables.push_back(n_v.second);
|
variables.push_back(n_v.second);
|
||||||
|
@ -872,7 +872,7 @@ result simplifier::fuse(expr const & e) {
|
||||||
for (unsigned i = 0; i < numerals.size(); i++) {
|
for (unsigned i = 0; i < numerals.size(); i++) {
|
||||||
auto it = variable_to_numerals.find(variables[i]);
|
auto it = variable_to_numerals.find(variables[i]);
|
||||||
if (it != variable_to_numerals.end()) it->second = cons(numerals[i], it->second);
|
if (it != variable_to_numerals.end()) it->second = cons(numerals[i], it->second);
|
||||||
else variable_to_numerals.insert({variables[i],list<expr>(numerals[i])});
|
else variable_to_numerals.insert({variables[i], list<expr>(numerals[i])});
|
||||||
}
|
}
|
||||||
|
|
||||||
expr e_grp = zero;
|
expr e_grp = zero;
|
||||||
|
@ -942,23 +942,25 @@ expr_pair simplifier::split_summand(expr const & e, expr const & f_mul, expr con
|
||||||
expr variable = one;
|
expr variable = one;
|
||||||
if (is_neg_app(s)) {
|
if (is_neg_app(s)) {
|
||||||
buffer<expr> args;
|
buffer<expr> args;
|
||||||
get_app_args(s,args);
|
get_app_args(s, args);
|
||||||
numeral = m_app_builder.mk_app(get_neg_name(), one);
|
numeral = m_app_builder.mk_app(get_neg_name(), one);
|
||||||
s = args[2];
|
s = args[2];
|
||||||
}
|
}
|
||||||
while (is_mul_app(s)) {
|
while (is_mul_app(s)) {
|
||||||
buffer<expr> args;
|
buffer<expr> args;
|
||||||
get_app_args(s,args);
|
get_app_args(s, args);
|
||||||
expr const & multiplicand = args[2];
|
expr const & multiplicand = args[2];
|
||||||
if (is_num(multiplicand)) numeral = mk_app(f_mul, multiplicand, numeral);
|
if (is_num(multiplicand)) {
|
||||||
else {
|
numeral = mk_app(f_mul, multiplicand, numeral);
|
||||||
|
} else {
|
||||||
if (variable == one) variable = multiplicand;
|
if (variable == one) variable = multiplicand;
|
||||||
else variable = mk_app(f_mul, multiplicand, variable);
|
else variable = mk_app(f_mul, multiplicand, variable);
|
||||||
}
|
}
|
||||||
s = args[3];
|
s = args[3];
|
||||||
}
|
}
|
||||||
if (is_num(s)) numeral = mk_app(f_mul, s, numeral);
|
if (is_num(s)) {
|
||||||
else {
|
numeral = mk_app(f_mul, s, numeral);
|
||||||
|
} else {
|
||||||
if (variable == one) variable = s;
|
if (variable == one) variable = s;
|
||||||
else variable = mk_app(f_mul, s, variable);
|
else variable = mk_app(f_mul, s, variable);
|
||||||
}
|
}
|
||||||
|
@ -968,11 +970,10 @@ expr_pair simplifier::split_summand(expr const & e, expr const & f_mul, expr con
|
||||||
/* Setup and teardown */
|
/* Setup and teardown */
|
||||||
|
|
||||||
void initialize_simplifier() {
|
void initialize_simplifier() {
|
||||||
g_simplify_unit_namespace = new name{"simplifier","unit"};
|
g_simplify_unit_namespace = new name{"simplifier", "unit"};
|
||||||
g_simplify_ac_namespace = new name{"simplifier","ac"};
|
g_simplify_ac_namespace = new name{"simplifier", "ac"};
|
||||||
g_simplify_som_namespace = new name{"simplifier","som"};
|
g_simplify_som_namespace = new name{"simplifier", "som"};
|
||||||
g_simplify_numeral_namespace = new name{"simplifier","numeral"};
|
g_simplify_numeral_namespace = new name{"simplifier", "numeral"};
|
||||||
|
|
||||||
|
|
||||||
g_simplify_max_steps = new name{"simplify", "max_steps"};
|
g_simplify_max_steps = new name{"simplify", "max_steps"};
|
||||||
g_simplify_top_down = new name{"simplify", "top_down"};
|
g_simplify_top_down = new name{"simplify", "top_down"};
|
||||||
|
|
Loading…
Reference in a new issue