From edd94c00dfe2668579f39fd4d5d55cb4d85c35ae Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Mon, 3 Nov 2014 18:36:25 -0800 Subject: [PATCH] fix(library/definitional): add missing files --- src/library/definitional/eq.cpp | 24 ++++++++++++++++++++++++ src/library/definitional/eq.h | 12 ++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 src/library/definitional/eq.cpp create mode 100644 src/library/definitional/eq.h 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); +}