feat(library/blast): classical flag

This commit is contained in:
Daniel Selsam 2015-12-03 20:07:03 -08:00 committed by Leonardo de Moura
parent fe020b49c1
commit 0dfac6d07e
5 changed files with 27 additions and 0 deletions

View file

@ -13,12 +13,14 @@ Author: Leonardo de Moura
#include "library/util.h"
#include "library/reducible.h"
#include "library/class.h"
#include "library/constants.h"
#include "library/type_context.h"
#include "library/relation_manager.h"
#include "library/congr_lemma_manager.h"
#include "library/abstract_expr_manager.h"
#include "library/light_lt_manager.h"
#include "library/projection.h"
#include "library/scoped_ext.h"
#include "library/tactic/goal.h"
#include "library/blast/expr.h"
#include "library/blast/state.h"
@ -69,6 +71,7 @@ class blastenv {
symm_info_getter m_symm_getter;
trans_info_getter m_trans_getter;
unfold_macro_pred m_unfold_macro_pred;
bool m_classical{false};
class tctx : public type_context {
blastenv & m_benv;
@ -462,8 +465,18 @@ public:
delete ctx;
}
void init_classical_flag() {
for_each(get_namespaces(m_env), [&](name const & ns) {
if (m_classical) return;
if (ns == get_classical_name()) m_classical = true;
});
}
bool classical() { return m_classical; }
void init_state(goal const & g) {
init_curr_state(g);
init_classical_flag();
save_initial_context();
m_tctx.set_local_instances(m_initial_context);
m_tmp_ctx->set_local_instances(m_initial_context);
@ -788,6 +801,11 @@ bool is_light_lt(expr const & e1, expr const & e2) {
return g_blastenv->is_light_lt(e1, e2);
}
bool classical() {
lean_assert(g_blastenv);
return g_blastenv->classical();
}
void display_curr_state() {
curr_state().display(env(), ios());
display("\n");

View file

@ -118,6 +118,9 @@ bool abstract_is_equal(expr const & e1, expr const & e2);
/** \brief Order on expressions that supports the "light" annotation */
bool is_light_lt(expr const & e1, expr const & e2);
/** \brief Whether [classical] namespace is open. */
bool classical();
/** \brief Display the current state of the blast tactic in the diagnostic channel. */
void display_curr_state();
/** \brief Display the given expression in the diagnostic channel. */

View file

@ -19,6 +19,7 @@ name const * g_bool_ff = nullptr;
name const * g_bool_tt = nullptr;
name const * g_char = nullptr;
name const * g_char_mk = nullptr;
name const * g_classical = nullptr;
name const * g_congr = nullptr;
name const * g_congr_arg = nullptr;
name const * g_congr_fun = nullptr;
@ -196,6 +197,7 @@ void initialize_constants() {
g_bool_tt = new name{"bool", "tt"};
g_char = new name{"char"};
g_char_mk = new name{"char", "mk"};
g_classical = new name{"classical"};
g_congr = new name{"congr"};
g_congr_arg = new name{"congr_arg"};
g_congr_fun = new name{"congr_fun"};
@ -374,6 +376,7 @@ void finalize_constants() {
delete g_bool_tt;
delete g_char;
delete g_char_mk;
delete g_classical;
delete g_congr;
delete g_congr_arg;
delete g_congr_fun;
@ -551,6 +554,7 @@ name const & get_bool_ff_name() { return *g_bool_ff; }
name const & get_bool_tt_name() { return *g_bool_tt; }
name const & get_char_name() { return *g_char; }
name const & get_char_mk_name() { return *g_char_mk; }
name const & get_classical_name() { return *g_classical; }
name const & get_congr_name() { return *g_congr; }
name const & get_congr_arg_name() { return *g_congr_arg; }
name const & get_congr_fun_name() { return *g_congr_fun; }

View file

@ -21,6 +21,7 @@ name const & get_bool_ff_name();
name const & get_bool_tt_name();
name const & get_char_name();
name const & get_char_mk_name();
name const & get_classical_name();
name const & get_congr_name();
name const & get_congr_arg_name();
name const & get_congr_fun_name();

View file

@ -14,6 +14,7 @@ bool.ff
bool.tt
char
char.mk
classical
congr
congr_arg
congr_fun