feat(library/blast/blast): use blast tmp_type_context to generate type class instances

This commit is contained in:
Leonardo de Moura 2016-01-10 16:30:51 -08:00
parent 912bccb3f9
commit 6c015a4954
2 changed files with 15 additions and 1 deletions

View file

@ -701,7 +701,14 @@ public:
expr infer_type(expr const & e) { return m_tctx.infer(e); }
bool is_prop(expr const & e) { return m_tctx.is_prop(e); }
bool is_def_eq(expr const & e1, expr const & e2) { return m_tctx.is_def_eq(e1, e2); }
optional<expr> mk_class_instance(expr const & e) { return m_tctx.mk_class_instance(e); }
optional<expr> mk_class_instance(expr const & e) {
m_tmp_ctx->clear();
return m_tmp_ctx->mk_class_instance(e);
}
optional<expr> mk_subsingleton_instance(expr const & type) {
m_tmp_ctx->clear();
return m_tmp_ctx->mk_subsingleton_instance(type);
}
tmp_type_context * mk_tmp_type_context();
@ -1083,6 +1090,11 @@ optional<expr> mk_class_instance(expr const & e) {
return g_blastenv->mk_class_instance(e);
}
optional<expr> mk_subsingleton_instance(expr const & type) {
lean_assert(g_blastenv);
return g_blastenv->mk_subsingleton_instance(type);
}
expr mk_fresh_local(expr const & type, binder_info const & bi) {
lean_assert(g_blastenv);
return g_blastenv->mk_fresh_local(type, bi);

View file

@ -112,6 +112,8 @@ bool is_prop(expr const & e);
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 Try to synthesize an instance of (subsingleton type) with respect to the blast local context. */
optional<expr> mk_subsingleton_instance(expr const & type);
/** \brief Create a congruence lemma for the given function.
\pre num_args <= arity of fn