diff --git a/src/library/definitional/eq.cpp b/src/library/definitional/eq.cpp new file mode 100644 index 000000000..f4dc59802 --- /dev/null +++ b/src/library/definitional/eq.cpp @@ -0,0 +1,24 @@ +/* +Copyright (c) 2014 Microsoft Corporation. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. + +Author: Leonardo de Moura +*/ +#include "kernel/environment.h" + +namespace lean { +bool has_eq_decls(environment const & env) { + auto d = env.find(name({"eq", "refl"})); + if (!d) + return false; + if (length(d->get_univ_params()) != 1) + return false; + expr type = d->get_type(); + if (!is_pi(type) || !is_pi(binding_body(type))) + return false; + type = get_app_fn(binding_body(binding_body(type))); + if (!is_constant(type)) + return false; + return const_name(type) == "eq"; +} +} diff --git a/src/library/definitional/eq.h b/src/library/definitional/eq.h new file mode 100644 index 000000000..c1534c47c --- /dev/null +++ b/src/library/definitional/eq.h @@ -0,0 +1,12 @@ +/* +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/environment.h" + +namespace lean { +bool has_eq_decls(environment const & env); +}