2015-09-25 19:45:16 +00:00
|
|
|
/*
|
|
|
|
Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
|
|
|
Author: Leonardo de Moura
|
|
|
|
*/
|
|
|
|
#pragma once
|
2015-10-31 01:14:34 +00:00
|
|
|
#include <memory>
|
2015-10-31 00:45:27 +00:00
|
|
|
#include "kernel/environment.h"
|
|
|
|
#include "library/io_state.h"
|
|
|
|
#include "library/blast/state.h"
|
2015-09-25 19:45:16 +00:00
|
|
|
|
|
|
|
namespace lean {
|
2015-10-31 00:45:27 +00:00
|
|
|
struct projection_info;
|
|
|
|
class goal;
|
|
|
|
namespace blast {
|
|
|
|
/** \brief Return the thread local environment being used by the blast tactic. */
|
|
|
|
environment const & env();
|
|
|
|
/** \brief Return the thread local io_state being used by the blast tactic. */
|
|
|
|
io_state const & ios();
|
|
|
|
/** \brief Return the thread local current state begin processed by the blast tactic. */
|
|
|
|
state & curr_state();
|
|
|
|
/** \brief Return a thread local fresh name meant to be used to name local constants. */
|
|
|
|
name mk_fresh_local_name();
|
|
|
|
expr mk_fresh_local(expr const & type, binder_info const & bi = binder_info());
|
|
|
|
/** \brief Return true iff the given constant name is marked as reducible in env() */
|
|
|
|
bool is_reducible(name const & n);
|
|
|
|
/** \brief Return a nonnull projection_info object if \c n is the name of a projection in env() */
|
|
|
|
projection_info const * get_projection_info(name const & n);
|
|
|
|
/** \brief Put the given expression in weak-head-normal-form with respect to the
|
|
|
|
current state being processed by the blast tactic. */
|
|
|
|
expr whnf(expr const & e);
|
|
|
|
/** \brief Return the type of the given expression with respect to the current state being
|
|
|
|
processed by the blast tactic.
|
|
|
|
|
|
|
|
\remark: (potential side-effect) this procedure may update the meta-variable assignment
|
|
|
|
associated with the current state. */
|
|
|
|
expr infer_type(expr const & e);
|
|
|
|
/** \brief Return true if \c e is a Proposition */
|
|
|
|
bool is_prop(expr const & e);
|
|
|
|
/** \brief Return true iff the two expressions are definitionally equal in the
|
|
|
|
current state being processed by the blast tactic.
|
|
|
|
|
|
|
|
\remark: (potential side-effect) this procedure may update the meta-variable assignment
|
|
|
|
associated with the current state. */
|
|
|
|
bool is_def_eq(expr const & e1, expr const & e2);
|
|
|
|
/** \brief Try to synthesize an element of the given type class with respect to the blast local context. */
|
|
|
|
optional<expr> mk_class_instance(expr const & e);
|
|
|
|
|
|
|
|
/** \brief Display the current state of the blast tactic in the diagnostic channel. */
|
|
|
|
void display_curr_state();
|
2015-10-31 01:14:34 +00:00
|
|
|
/** \brief Display the given expression in the diagnostic channel. */
|
|
|
|
void display_expr(expr const & e);
|
2015-10-31 00:45:27 +00:00
|
|
|
/** \brief Display message in the blast tactic diagnostic channel. */
|
|
|
|
void display(char const * msg);
|
|
|
|
void display(sstream const & msg);
|
|
|
|
/**
|
|
|
|
\brief Create a local scope for saving the assignment and
|
|
|
|
metavariable declarations at curr_state() */
|
2015-10-31 01:14:34 +00:00
|
|
|
class scope_assignment {
|
2015-10-31 00:45:27 +00:00
|
|
|
bool m_keep;
|
|
|
|
public:
|
2015-10-31 01:14:34 +00:00
|
|
|
scope_assignment();
|
|
|
|
~scope_assignment();
|
2015-10-31 00:45:27 +00:00
|
|
|
void commit();
|
|
|
|
};
|
2015-10-31 01:14:34 +00:00
|
|
|
|
|
|
|
/** \brief Auxiliary object for setting thread local storage associated with blast tactic.
|
|
|
|
|
|
|
|
This is for debugging purposes only. It allow us to debug/test procedures that can
|
|
|
|
only be invoked from blast. */
|
|
|
|
class scope_debug {
|
|
|
|
struct imp;
|
|
|
|
std::unique_ptr<imp> m_imp;
|
|
|
|
public:
|
|
|
|
scope_debug(environment const & env, io_state const & ios);
|
|
|
|
~scope_debug();
|
|
|
|
};
|
2015-10-31 00:45:27 +00:00
|
|
|
}
|
2015-09-25 19:45:16 +00:00
|
|
|
optional<expr> blast_goal(environment const & env, io_state const & ios, list<name> const & ls, list<name> const & ds,
|
|
|
|
goal const & g);
|
2015-09-25 21:43:42 +00:00
|
|
|
void initialize_blast();
|
|
|
|
void finalize_blast();
|
2015-09-25 19:45:16 +00:00
|
|
|
}
|