feat(library/blast/simplifier): take simp_rule_sets as argument

This commit is contained in:
Daniel Selsam 2015-11-12 14:14:18 -08:00
parent 98ddc62f6c
commit 031979cb49
3 changed files with 10 additions and 9 deletions

View file

@ -1332,7 +1332,7 @@ static environment simplify_cmd(parser & p) {
std::tie(e, ls) = parse_local_expr(p);
blast::scope_debug scope(p.env(), p.ios());
blast::simp::result r = blast::simplify(rel, e);
blast::simp::result r = blast::simplify(rel, e, get_simp_rule_sets(p.env()));
flycheck_information info(p.regular_stream());
if (info.enabled()) {

View file

@ -95,6 +95,7 @@ class simplifier {
app_builder m_app_builder;
name m_rel;
simp_rule_sets m_srss;
simp_rule_sets m_ctx_srss;
/* Logging */
@ -168,14 +169,14 @@ class simplifier {
list<expr> const & emetas, list<bool> const & instances);
public:
simplifier(name const & rel);
simplifier(name const & rel, simp_rule_sets const & srss);
result operator()(expr const & e) { return simplify(e); }
};
/* Constructor */
simplifier::simplifier(name const & rel):
m_app_builder(*m_tmp_tctx), m_rel(rel) { }
simplifier::simplifier(name const & rel, simp_rule_sets const & srss):
m_app_builder(*m_tmp_tctx), m_rel(rel), m_srss(srss) { }
/* Cache */
@ -401,7 +402,7 @@ result simplifier::rewrite(expr const & e) {
result r(e);
while (true) {
result r_ctx = rewrite(r.get_new(), m_ctx_srss);
result r_new = rewrite(r_ctx.get_new(), get_simp_rule_sets(env()));
result r_new = rewrite(r_ctx.get_new(), m_srss);
if (r_ctx.is_none() && r_new.is_none()) break;
r = join(join(r, r_ctx), r_new);
}
@ -663,9 +664,8 @@ void finalize_simplifier() {
}
/* Entry point */
result simplify(name const & rel, expr const & e) {
return simplifier(rel)(e);
result simplify(name const & rel, expr const & e, simp_rule_sets const & srss) {
return simplifier(rel, srss)(e);
}
}}

View file

@ -6,6 +6,7 @@ Author: Daniel Selsam
#pragma once
#include "kernel/expr_pair.h"
#include "library/blast/state.h"
#include "library/simplifier/simp_rule_set.h"
namespace lean {
namespace blast {
@ -33,7 +34,7 @@ public:
}
simp::result simplify(name const & rel, expr const & e);
simp::result simplify(name const & rel, expr const & e, simp_rule_sets const & srss);
void initialize_simplifier();
void finalize_simplifier();