2013-09-13 01:25:38 +00:00
|
|
|
/*
|
2014-05-31 03:26:06 +00:00
|
|
|
Copyright (c) 2013-2014 Microsoft Corporation. All rights reserved.
|
2013-09-13 01:25:38 +00:00
|
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
|
|
|
|
|
|
Author: Leonardo de Moura
|
|
|
|
*/
|
|
|
|
#pragma once
|
2013-12-20 05:36:17 +00:00
|
|
|
#include "util/lua.h"
|
2013-09-13 01:25:38 +00:00
|
|
|
#include "kernel/expr.h"
|
|
|
|
|
2014-05-31 03:26:06 +00:00
|
|
|
// Placeholders are used to mark locations where additional
|
|
|
|
// metavariables should be inserted.
|
2013-09-13 01:25:38 +00:00
|
|
|
namespace lean {
|
2014-05-31 03:26:06 +00:00
|
|
|
/** \brief Return a new universe level placeholder. */
|
|
|
|
level mk_level_placeholder();
|
2013-09-13 01:25:38 +00:00
|
|
|
|
2014-08-15 19:45:54 +00:00
|
|
|
enum class expr_placeholder_kind { Implicit, StrictImplicit, Explicit };
|
2014-05-31 03:26:06 +00:00
|
|
|
/** \brief Return a new expression placeholder expression. */
|
2014-08-15 19:45:54 +00:00
|
|
|
expr mk_expr_placeholder(optional<expr> const & type = none_expr(), expr_placeholder_kind k = expr_placeholder_kind::Implicit);
|
|
|
|
inline expr mk_explicit_expr_placeholder(optional<expr> const & type = none_expr()) {
|
|
|
|
return mk_expr_placeholder(type, expr_placeholder_kind::Explicit);
|
|
|
|
}
|
|
|
|
inline expr mk_strict_expr_placeholder(optional<expr> const & type = none_expr()) {
|
|
|
|
return mk_expr_placeholder(type, expr_placeholder_kind::StrictImplicit);
|
|
|
|
}
|
2014-05-31 03:26:06 +00:00
|
|
|
|
|
|
|
/** \brief Return true if the given level is a placeholder. */
|
|
|
|
bool is_placeholder(level const & e);
|
|
|
|
|
2014-08-15 19:45:54 +00:00
|
|
|
/** \brief Return true iff the given expression is a placeholder (strict, explicit or implicit). */
|
2013-09-13 01:25:38 +00:00
|
|
|
bool is_placeholder(expr const & e);
|
|
|
|
|
2014-08-15 19:45:54 +00:00
|
|
|
/** \brief Return true iff the given expression is a strict placeholder. */
|
2014-07-14 01:53:02 +00:00
|
|
|
bool is_strict_placeholder(expr const & e);
|
|
|
|
|
2014-08-15 19:45:54 +00:00
|
|
|
/** \brief Return true iff the given expression is an explicit placeholder. */
|
|
|
|
bool is_explicit_placeholder(expr const & e);
|
|
|
|
|
2014-06-16 21:35:55 +00:00
|
|
|
/** \brief Return the type of the placeholder (if available) */
|
|
|
|
optional<expr> placeholder_type(expr const & e);
|
|
|
|
|
2014-05-31 03:26:06 +00:00
|
|
|
/** \brief Return true iff the given expression contains placeholders. */
|
2013-09-13 01:25:38 +00:00
|
|
|
bool has_placeholder(expr const & e);
|
2013-09-17 18:09:59 +00:00
|
|
|
|
2013-12-20 05:36:17 +00:00
|
|
|
void open_placeholder(lua_State * L);
|
2013-09-13 01:25:38 +00:00
|
|
|
}
|