2014-06-13 22:13:32 +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 "util/name_set.h"
|
|
|
|
#include "kernel/expr.h"
|
2014-07-14 03:12:58 +00:00
|
|
|
#include "kernel/expr_sets.h"
|
2014-06-13 22:13:32 +00:00
|
|
|
namespace lean {
|
|
|
|
name_set collect_univ_params(expr const & e, name_set const & ls = name_set());
|
2014-07-14 03:12:58 +00:00
|
|
|
void collect_locals(expr const & e, expr_struct_set & ls);
|
2014-06-13 22:13:32 +00:00
|
|
|
level_param_names to_level_param_names(name_set const & ls);
|
2014-08-03 23:03:58 +00:00
|
|
|
|
|
|
|
/** \brief Return true iff \c [begin_locals, end_locals) contains \c local */
|
|
|
|
template<typename It> bool contains_local(expr const & local, It const & begin_locals, It const & end_locals) {
|
|
|
|
return std::any_of(begin_locals, end_locals, [&](expr const & l) { return mlocal_name(local) == mlocal_name(l); });
|
|
|
|
}
|
|
|
|
|
|
|
|
/** \brief Return true iff \c locals contains \c local */
|
|
|
|
inline bool contains_local(expr const & local, buffer<expr> const & locals) {
|
|
|
|
return contains_local(local, locals.begin(), locals.end());
|
|
|
|
}
|
2014-11-26 21:09:42 +00:00
|
|
|
|
|
|
|
/** \brief Return true iff \c e contains a local constant named \c n (it uses mlocal_name) */
|
|
|
|
bool contains_local(expr const & e, name const & n);
|
2014-11-27 01:08:14 +00:00
|
|
|
|
|
|
|
/** \brief Return true iff \e contains the local constant \c h */
|
|
|
|
inline bool depends_on(expr const & e, expr const & h) {
|
|
|
|
return contains_local(e, mlocal_name(h));
|
|
|
|
}
|
|
|
|
|
|
|
|
/** \brief Return true iff one of \c es contains the local constant \c h */
|
|
|
|
bool depends_on(unsigned sz, expr const * es, expr const & h);
|
2014-06-13 22:13:32 +00:00
|
|
|
}
|