2013-08-25 01:02:38 +00:00
|
|
|
/*
|
|
|
|
Copyright (c) 2013 Microsoft Corporation. All rights reserved.
|
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
|
|
|
Author: Leonardo de Moura
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "metavar_env.h"
|
|
|
|
|
|
|
|
namespace lean {
|
|
|
|
/**
|
|
|
|
\brief Expression elaborator, it is responsible for "filling" holes
|
|
|
|
in terms left by the user. This is the main module resposible for computing
|
|
|
|
the value of implicit arguments.
|
|
|
|
*/
|
|
|
|
class elaborator {
|
2013-08-25 17:34:19 +00:00
|
|
|
environment const & m_env;
|
|
|
|
metavar_env m_metaenv;
|
2013-08-25 01:02:38 +00:00
|
|
|
|
|
|
|
expr lookup(context const & c, unsigned i);
|
|
|
|
void unify(expr const & e1, expr const & e2, context const & ctx);
|
|
|
|
expr check_pi(expr const & e, context const & ctx);
|
|
|
|
level check_universe(expr const & e, context const & ctx);
|
|
|
|
expr process(expr const & e, context const & ctx);
|
|
|
|
|
|
|
|
public:
|
2013-08-25 17:34:19 +00:00
|
|
|
elaborator(environment const & env);
|
2013-08-25 01:02:38 +00:00
|
|
|
expr operator()(expr const & e);
|
2013-08-25 17:34:19 +00:00
|
|
|
|
2013-08-25 18:42:36 +00:00
|
|
|
metavar_env & menv() { return m_metaenv; }
|
|
|
|
|
2013-08-25 17:34:19 +00:00
|
|
|
void clear() { m_metaenv.clear(); }
|
2013-08-28 03:39:38 +00:00
|
|
|
expr mk_metavar(unsigned ctx_sz) { return m_metaenv.mk_metavar(ctx_sz); }
|
2013-08-25 17:34:19 +00:00
|
|
|
|
|
|
|
void set_interrupt(bool flag) { m_metaenv.set_interrupt(flag); }
|
|
|
|
void interrupt() { set_interrupt(true); }
|
|
|
|
void reset_interrupt() { set_interrupt(false); }
|
2013-08-25 18:18:19 +00:00
|
|
|
|
|
|
|
void display(std::ostream & out) const { m_metaenv.display(out); }
|
2013-08-25 01:02:38 +00:00
|
|
|
};
|
2013-08-25 17:34:19 +00:00
|
|
|
|
|
|
|
/** \brief Return true iff \c e is a special constant used to mark application of overloads. */
|
|
|
|
bool is_overload_marker(expr const & e);
|
|
|
|
/** \brief Return the overload marker */
|
|
|
|
expr mk_overload_marker();
|
2013-08-25 01:02:38 +00:00
|
|
|
}
|