refactor(frontends/lean/local_context): add 'const' modifier

This commit is contained in:
Leonardo de Moura 2014-11-04 18:37:31 -08:00
parent 3bfe5b0b7e
commit b5ad0fb504
2 changed files with 9 additions and 9 deletions

View file

@ -70,18 +70,18 @@ expr local_context::apply_context(expr const & f, tag g) const {
return apply_context_core(f, m_ctx, g); return apply_context_core(f, m_ctx, g);
} }
expr local_context::mk_type_metavar(name_generator & ngen, tag g) { expr local_context::mk_type_metavar(name_generator & ngen, tag g) const {
name n = ngen.next(); name n = ngen.next();
expr s = mk_sort(mk_meta_univ(ngen.next()), g); expr s = mk_sort(mk_meta_univ(ngen.next()), g);
expr t = pi_abstract_context(s, g); expr t = pi_abstract_context(s, g);
return ::lean::mk_metavar(n, t, g); return ::lean::mk_metavar(n, t, g);
} }
expr local_context::mk_type_meta(name_generator & ngen, tag g) { expr local_context::mk_type_meta(name_generator & ngen, tag g) const {
return apply_context(mk_type_metavar(ngen, g), g); return apply_context(mk_type_metavar(ngen, g), g);
} }
expr local_context::mk_metavar(name_generator & ngen, optional<name> const & suffix, optional<expr> const & type, tag g) { expr local_context::mk_metavar(name_generator & ngen, optional<name> const & suffix, optional<expr> const & type, tag g) const {
name n = ngen.next(); name n = ngen.next();
if (suffix) if (suffix)
n = n + *suffix; n = n + *suffix;
@ -90,7 +90,7 @@ expr local_context::mk_metavar(name_generator & ngen, optional<name> const & suf
return ::lean::mk_metavar(n, t, g); return ::lean::mk_metavar(n, t, g);
} }
expr local_context::mk_meta(name_generator & ngen, optional<name> const & suffix, optional<expr> const & type, tag g) { expr local_context::mk_meta(name_generator & ngen, optional<name> const & suffix, optional<expr> const & type, tag g) const {
expr mvar = mk_metavar(ngen, suffix, type, g); expr mvar = mk_metavar(ngen, suffix, type, g);
expr meta = apply_context(mvar, g); expr meta = apply_context(mvar, g);
return meta; return meta;

View file

@ -40,7 +40,7 @@ public:
<tt>(Pi (x_1 : A_1) ... (x_n : A_n[x_1, ..., x_{n-1}]), Type.{?u})</tt>, <tt>(Pi (x_1 : A_1) ... (x_n : A_n[x_1, ..., x_{n-1}]), Type.{?u})</tt>,
where \c ?u is a fresh universe metavariable. where \c ?u is a fresh universe metavariable.
*/ */
expr mk_type_metavar(name_generator & ngen, tag g); expr mk_type_metavar(name_generator & ngen, tag g) const;
/** \brief Assuming \c m_ctx is /** \brief Assuming \c m_ctx is
<tt>[l_n : A_n[l_1, ..., l_{n-1}], ..., l_1 : A_1 ]</tt>, <tt>[l_n : A_n[l_1, ..., l_{n-1}], ..., l_1 : A_1 ]</tt>,
@ -50,7 +50,7 @@ public:
\remark The type of the resulting expression is <tt>Type.{?u}</tt> \remark The type of the resulting expression is <tt>Type.{?u}</tt>
*/ */
expr mk_type_meta(name_generator & ngen, tag g); expr mk_type_meta(name_generator & ngen, tag g) const;
/** \brief Given <tt>type[l_1, ..., l_n]</tt> and assuming \c m_ctx is /** \brief Given <tt>type[l_1, ..., l_n]</tt> and assuming \c m_ctx is
<tt>[l_n : A_n[l_1, ..., l_{n-1}], ..., l_1 : A_1 ]</tt>, <tt>[l_n : A_n[l_1, ..., l_{n-1}], ..., l_1 : A_1 ]</tt>,
@ -64,7 +64,7 @@ public:
\remark If \c suffix is not none, then it is appended to the (fresh) metavariable name. \remark If \c suffix is not none, then it is appended to the (fresh) metavariable name.
*/ */
expr mk_metavar(name_generator & ngen, optional<name> const & suffix, optional<expr> const & type, tag g); expr mk_metavar(name_generator & ngen, optional<name> const & suffix, optional<expr> const & type, tag g) const;
/** \brief Given <tt>type[l_1, ..., l_n]</tt> and assuming \c m_ctx is /** \brief Given <tt>type[l_1, ..., l_n]</tt> and assuming \c m_ctx is
<tt>[l_n : A_n[l_1, ..., l_{n-1}], ..., l_1 : A_1 ]</tt>, <tt>[l_n : A_n[l_1, ..., l_{n-1}], ..., l_1 : A_1 ]</tt>,
@ -75,8 +75,8 @@ public:
\remark If \c suffix is not none, then it is appended to the (fresh) metavariable name. \remark If \c suffix is not none, then it is appended to the (fresh) metavariable name.
*/ */
expr mk_meta(name_generator & ngen, optional<name> const & suffix, optional<expr> const & type, tag g); expr mk_meta(name_generator & ngen, optional<name> const & suffix, optional<expr> const & type, tag g) const;
expr mk_meta(name_generator & ngen, optional<expr> const & type, tag g) { expr mk_meta(name_generator & ngen, optional<expr> const & type, tag g) const {
return mk_meta(ngen, optional<name>(), type, g); return mk_meta(ngen, optional<name>(), type, g);
} }