feat(library/norm_num): store the local context
This commit is contained in:
parent
ce6e1c9694
commit
c5d614d4d9
2 changed files with 11 additions and 7 deletions
|
@ -6,22 +6,24 @@ Author: Rob Lewis
|
|||
*/
|
||||
#pragma once
|
||||
#include "kernel/environment.h"
|
||||
#include "library/local_context.h"
|
||||
|
||||
namespace lean {
|
||||
class norm_num_context {
|
||||
environment m_env;
|
||||
environment m_env;
|
||||
local_context m_ctx;
|
||||
public:
|
||||
norm_num_context(environment const & env):m_env(env) {}
|
||||
norm_num_context(environment const & env, local_context const & ctx):m_env(env), m_ctx(ctx) {}
|
||||
|
||||
bool is_numeral(expr const & e) const;
|
||||
pair<expr, expr> mk_norm(expr const & e);
|
||||
};
|
||||
|
||||
inline bool is_numeral(environment const & env, expr const & e) {
|
||||
return norm_num_context(env).is_numeral(e);
|
||||
return norm_num_context(env, local_context()).is_numeral(e);
|
||||
}
|
||||
|
||||
inline pair<expr, expr> mk_norm_num(environment const & env, expr const & e) {
|
||||
return norm_num_context(env).mk_norm(e);
|
||||
inline pair<expr, expr> mk_norm_num(environment const & env, local_context const & ctx, expr const & e) {
|
||||
return norm_num_context(env, ctx).mk_norm(e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,9 +23,11 @@ tactic norm_num_tactic() {
|
|||
throw_tactic_exception_if_enabled(s, "norm_num tactic failed, conclusion is not an equality");
|
||||
return none_proof_state();
|
||||
}
|
||||
|
||||
buffer<expr> hyps;
|
||||
g.get_hyps(hyps);
|
||||
local_context ctx(to_list(hyps));
|
||||
try {
|
||||
pair<expr, expr> p = mk_norm_num(env, lhs);
|
||||
pair<expr, expr> p = mk_norm_num(env, ctx, lhs);
|
||||
expr new_lhs = p.first;
|
||||
expr new_pr = p.second;
|
||||
if (new_lhs != rhs) {
|
||||
|
|
Loading…
Reference in a new issue