2014-06-18 17:36:21 +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
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "kernel/expr.h"
|
2014-07-14 03:12:58 +00:00
|
|
|
#include "kernel/expr_sets.h"
|
2014-09-10 17:24:35 +00:00
|
|
|
#include "frontends/lean/local_decls.h"
|
2014-06-18 17:36:21 +00:00
|
|
|
namespace lean {
|
|
|
|
class parser;
|
|
|
|
void check_atomic(name const & n);
|
2014-08-23 22:44:28 +00:00
|
|
|
void check_in_section_or_context(parser const & p);
|
2014-07-08 02:15:46 +00:00
|
|
|
bool is_root_namespace(name const & n);
|
|
|
|
name remove_root_prefix(name const & n);
|
2014-07-14 02:47:49 +00:00
|
|
|
/** \brief Return the levels in \c ls that are defined in the section. */
|
|
|
|
levels collect_section_levels(level_param_names const & ls, parser & p);
|
|
|
|
/** \brief Collect local (section) constants occurring in type and value, sort them, and store in section_ps */
|
|
|
|
void collect_section_locals(expr const & type, expr const & value, parser const & p, buffer<expr> & section_ps);
|
2014-07-14 03:12:58 +00:00
|
|
|
/** \brief Copy the local parameters to \c section_ps, then sort \c section_ps (using the order in which they were declared). */
|
|
|
|
void sort_section_params(expr_struct_set const & locals, parser const & p, buffer<expr> & section_ps);
|
2014-07-14 04:04:01 +00:00
|
|
|
list<expr> locals_to_context(expr const & e, parser const & p);
|
2014-07-14 04:41:44 +00:00
|
|
|
/** \brief Fun(locals, e), but also propagate \c e position to result */
|
|
|
|
expr Fun(buffer<expr> const & locals, expr const & e, parser & p);
|
|
|
|
/** \brief Pi(locals, e), but also propagate \c e position to result */
|
|
|
|
expr Pi(buffer<expr> const & locals, expr const & e, parser & p);
|
2014-07-14 05:27:36 +00:00
|
|
|
/** \brief Similar to Fun(locals, e, p), but the types are marked as 'as-is' (i.e., they are not processed by the elaborator. */
|
|
|
|
expr Fun_as_is(buffer<expr> const & locals, expr const & e, parser & p);
|
|
|
|
/** \brief Similar to Pi(locals, e, p), but the types are marked as 'as-is' (i.e., they are not processed by the elaborator. */
|
|
|
|
expr Pi_as_is(buffer<expr> const & locals, expr const & e, parser & p);
|
2014-07-29 02:04:57 +00:00
|
|
|
/** \brief Create the resultant universe level using the levels computed during introduction rule elaboration */
|
|
|
|
level mk_result_level(environment const & env, buffer<level> const & r_lvls);
|
|
|
|
/** \brief Return true if \c u occurs in \c l */
|
|
|
|
bool occurs(level const & u, level const & l);
|
2014-09-10 17:24:35 +00:00
|
|
|
|
|
|
|
/** \brief Convert the universe metavariables in \c e in new universe parameters.
|
|
|
|
The substitution \c s is updated with the mapping metavar -> new param.
|
|
|
|
The set of parameter names \c ps and the buffer \c new_ps are also updated.
|
|
|
|
*/
|
|
|
|
expr univ_metavars_to_params(environment const & env, local_decls<level> const & lls, substitution & s,
|
|
|
|
name_set & ps, buffer<name> & new_ps, expr const & e);
|
2014-06-18 17:36:21 +00:00
|
|
|
}
|