chore: remove aux_match module

This is not needed anymore since the old equation compiler was removed.
This commit is contained in:
Leonardo de Moura 2020-10-27 09:44:26 -07:00
parent 7d8c079d71
commit 270f6df5cb
7 changed files with 2 additions and 96 deletions

View file

@ -10,4 +10,4 @@ add_library(library OBJECT expr_lt.cpp io_state.cpp
locals.cpp messages.cpp message_builder.cpp check.cpp
profiling.cpp time_task.cpp
scope_pos_info_provider.cpp formatter.cpp json.cpp
pos_info_provider.cpp abstract_type_context.cpp aux_match.cpp)
pos_info_provider.cpp abstract_type_context.cpp)

View file

@ -1,71 +0,0 @@
/*
Copyright (c) 2018 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: Leonardo de Moura
*/
#include <algorithm>
#include "kernel/environment.h"
#include "kernel/instantiate.h"
#include "library/replace_visitor.h"
namespace lean {
static name * g_aux_match_suffix = nullptr;
name const & get_aux_match_suffix() {
return *g_aux_match_suffix;
}
name mk_aux_match_suffix(unsigned idx) {
return g_aux_match_suffix->append_after(idx);
}
bool is_aux_match(name const & n) {
return
is_internal_name(n) && !n.is_atomic() && n.is_string() &&
strncmp(n.get_string().data(), "_match", 6) == 0;
}
struct unfold_aux_match_fn : public replace_visitor {
environment const & m_env;
unfold_aux_match_fn(environment const & env):m_env(env) {}
virtual expr visit_app(expr const & e) override {
buffer<expr> args;
expr const & fn = get_app_args(e, args);
expr new_fn = visit(fn);
bool modified = !is_eqp(fn, new_fn);
for (expr & arg : args) {
expr new_arg = visit(arg);
if (!is_eqp(new_arg, arg))
modified = true;
arg = new_arg;
}
if (is_constant(new_fn)) {
name const & n = const_name(new_fn);
if (is_aux_match(n)) {
new_fn = instantiate_value_lparams(m_env.get(n), const_levels(new_fn));
std::reverse(args.begin(), args.end());
return visit(apply_beta(new_fn, args.size(), args.data()));
}
}
if (!modified)
return e;
else
return mk_app(new_fn, args);
}
};
expr unfold_aux_match(environment const & env, expr const & e) {
return unfold_aux_match_fn(env)(e);
}
void initialize_aux_match() {
g_aux_match_suffix = new name("_match");
mark_persistent(g_aux_match_suffix->raw());
}
void finalize_aux_match() {
delete g_aux_match_suffix;
}
}

View file

@ -1,16 +0,0 @@
/*
Copyright (c) 2018 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: Leonardo de Moura
*/
#pragma once
#include "kernel/environment.h"
namespace lean {
name const & get_aux_match_suffix();
name mk_aux_match_suffix(unsigned idx);
expr unfold_aux_match(environment const & env, expr const & e);
bool is_aux_match(name const & n);
void initialize_aux_match();
void finalize_aux_match();
}

View file

@ -17,7 +17,6 @@ Author: Leonardo de Moura
#include "library/aux_recursors.h"
#include "library/constants.h"
#include "library/projection.h"
#include "library/aux_match.h"
#include "library/compiler/util.h"
#include "library/compiler/implemented_by_attribute.h"
@ -622,8 +621,7 @@ public:
};
expr to_lcnf_core(environment const & env, local_ctx const & lctx, expr const & e) {
expr new_e = unfold_aux_match(env, e);
new_e = unfold_macro_defs(env, new_e);
expr new_e = unfold_macro_defs(env, e);
return to_lcnf_fn(env, lctx)(new_e);
}

View file

@ -24,7 +24,6 @@ Author: Leonardo de Moura
#include "library/time_task.h"
#include "library/formatter.h"
#include "library/pos_info_provider.h"
#include "library/aux_match.h"
namespace lean {
void initialize_library_core_module() {
@ -44,7 +43,6 @@ void finalize_library_core_module() {
}
void initialize_library_module() {
initialize_aux_match();
initialize_local_context();
initialize_metavar_context();
initialize_print();
@ -76,6 +74,5 @@ void finalize_library_module() {
finalize_print();
finalize_metavar_context();
finalize_local_context();
finalize_aux_match();
}
}

View file

@ -29,7 +29,6 @@ Author: Leonardo de Moura
#include "library/aux_recursors.h"
#include "library/num.h"
#include "library/check.h"
#include "library/aux_match.h"
#include "library/time_task.h"
namespace lean {

View file

@ -22,7 +22,6 @@ Author: Leonardo de Moura
#include "library/projection.h"
#include "library/replace_visitor.h"
#include "library/type_context.h"
// #include "library/string.h"
#include "library/num.h"
#include "version.h"
#include "githash.h" // NOLINT