2014-05-01 01:42:01 +00:00
|
|
|
/*
|
|
|
|
Copyright (c) 2014 Microsoft Corporation. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
|
|
|
Author: Leonardo de Moura
|
|
|
|
*/
|
|
|
|
#include "util/interrupt.h"
|
|
|
|
#include "util/lbool.h"
|
|
|
|
#include "kernel/converter.h"
|
|
|
|
#include "kernel/expr_maps.h"
|
|
|
|
#include "kernel/instantiate.h"
|
|
|
|
#include "kernel/free_vars.h"
|
2014-06-22 20:52:47 +00:00
|
|
|
#include "kernel/type_checker.h"
|
2015-02-07 19:33:37 +00:00
|
|
|
#include "kernel/default_converter.h"
|
2014-05-01 01:42:01 +00:00
|
|
|
|
|
|
|
namespace lean {
|
2015-02-08 03:19:01 +00:00
|
|
|
static no_delayed_justification * g_no_delayed_jst = nullptr;
|
2014-07-05 22:52:40 +00:00
|
|
|
|
2015-02-08 03:19:01 +00:00
|
|
|
pair<bool, constraint_seq> converter::is_def_eq(expr const & t, expr const & s, type_checker & c) {
|
|
|
|
return is_def_eq(t, s, c, *g_no_delayed_jst);
|
2014-09-18 00:05:13 +00:00
|
|
|
}
|
|
|
|
|
2015-02-08 03:19:01 +00:00
|
|
|
name converter::mk_fresh_name(type_checker & tc) { return tc.mk_fresh_name(); }
|
2014-07-05 22:52:40 +00:00
|
|
|
|
2015-02-08 03:19:01 +00:00
|
|
|
pair<expr, constraint_seq> converter::infer_type(type_checker & tc, expr const & e) { return tc.infer_type(e); }
|
|
|
|
|
|
|
|
extension_context & converter::get_extension(type_checker & tc) { return tc.get_extension(); }
|
2014-09-18 00:05:13 +00:00
|
|
|
|
2014-05-01 01:42:01 +00:00
|
|
|
|
|
|
|
/** \brief Do nothing converter */
|
|
|
|
struct dummy_converter : public converter {
|
2014-08-20 05:31:26 +00:00
|
|
|
virtual pair<expr, constraint_seq> whnf(expr const & e, type_checker &) {
|
|
|
|
return mk_pair(e, constraint_seq());
|
|
|
|
}
|
|
|
|
virtual pair<bool, constraint_seq> is_def_eq(expr const &, expr const &, type_checker &, delayed_justification &) {
|
|
|
|
return mk_pair(true, constraint_seq());
|
|
|
|
}
|
2014-07-27 19:01:06 +00:00
|
|
|
virtual optional<module_idx> get_module_idx() const { return optional<module_idx>(); }
|
2014-09-25 18:19:54 +00:00
|
|
|
virtual bool is_opaque(declaration const &) const { return false; }
|
2015-02-08 04:14:19 +00:00
|
|
|
virtual optional<declaration> is_delta(expr const &) const { return optional<declaration>(); }
|
2015-04-27 18:20:15 +00:00
|
|
|
virtual bool is_stuck(expr const &, type_checker &) { return false; }
|
2014-05-01 01:42:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
std::unique_ptr<converter> mk_dummy_converter() {
|
|
|
|
return std::unique_ptr<converter>(new dummy_converter());
|
|
|
|
}
|
|
|
|
|
2014-09-23 19:09:13 +00:00
|
|
|
void initialize_converter() {
|
|
|
|
g_no_delayed_jst = new no_delayed_justification();
|
|
|
|
}
|
|
|
|
|
|
|
|
void finalize_converter() {
|
|
|
|
delete g_no_delayed_jst;
|
|
|
|
}
|
2014-05-01 01:42:01 +00:00
|
|
|
}
|