lean2/src/library/occurs.cpp
Leonardo de Moura e769c26800 refactor(kernel): move files that don't need to be in the kernel
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-04-25 18:30:40 -07:00

18 lines
545 B
C++

/*
Copyright (c) 2013 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: Leonardo de Moura
*/
#include "kernel/find_fn.h"
#include "library/occurs.h"
namespace lean {
bool occurs(expr const & n, expr const & m) {
return static_cast<bool>(find(m, [&](expr const & e, unsigned) { return n == e; }));
}
bool occurs(name const & n, expr const & m) {
return static_cast<bool>(find(m, [&](expr const & e, unsigned) { return is_constant(e) && const_name(e) == n; }));
}
}