2013-08-14 19:00:11 +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
|
|
|
|
*/
|
2013-09-13 10:35:29 +00:00
|
|
|
#include "kernel/occurs.h"
|
2013-11-19 21:03:46 +00:00
|
|
|
#include "kernel/find_fn.h"
|
2013-08-14 19:00:11 +00:00
|
|
|
|
|
|
|
namespace lean {
|
|
|
|
bool occurs(name const & n, context const * c, unsigned sz, expr const * es) {
|
2013-12-03 07:02:39 +00:00
|
|
|
return static_cast<bool>(find(c, sz, es, [&](expr const & e) { return is_constant(e) && const_name(e) == n; }));
|
2013-08-14 19:00:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool occurs(expr const & n, context const * c, unsigned sz, expr const * es) {
|
2013-12-03 07:02:39 +00:00
|
|
|
return static_cast<bool>(find(c, sz, es, [&](expr const & e) { return e == n; }));
|
2013-08-14 19:00:11 +00:00
|
|
|
}
|
|
|
|
bool occurs(expr const & n, expr const & m) { return occurs(n, nullptr, 1, &m); }
|
|
|
|
bool occurs(name const & n, expr const & m) { return occurs(n, nullptr, 1, &m); }
|
|
|
|
bool occurs(expr const & n, context const & c) { return occurs(n, &c, 0, nullptr); }
|
|
|
|
bool occurs(name const & n, context const & c) { return occurs(n, &c, 0, nullptr); }
|
|
|
|
bool occurs(expr const & n, context const & c, unsigned sz, expr const * es) { return occurs(n, &c, sz, es); }
|
|
|
|
bool occurs(name const & n, context const & c, unsigned sz, expr const * es) { return occurs(n, &c, sz, es); }
|
|
|
|
}
|