fix(library/elaborator): bug in simple_ho_match

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2013-12-15 21:48:55 -08:00
parent 19ad39159e
commit 61bd27ff06
3 changed files with 14 additions and 1 deletions

View file

@ -747,6 +747,14 @@ class elaborator::imp {
(is_eq(c) || (is_lhs && !is_actual_upper(b)) || (!is_lhs && !is_actual_lower(b)));
}
optional<expr> try_get_type(context const & ctx, expr const & e) {
try {
return some_expr(m_type_inferer(e, ctx));
} catch (...) {
return none_expr();
}
}
/**
\brief Return true iff ctx |- a == b is a "simple" higher-order matching constraint. By simple, we mean
a constraint of the form
@ -761,7 +769,7 @@ class elaborator::imp {
expr m = arg(a, 0);
buffer<expr> types;
for (unsigned i = 1; i < num_args(a); i++) {
optional<expr> d = lookup(ctx, var_idx(arg(a, i))).get_domain();
optional<expr> d = try_get_type(ctx, arg(a, i));
if (d)
types.push_back(*d);
else

2
tests/lean/elab6.lean Normal file
View file

@ -0,0 +1,2 @@
Theorem ForallIntro2 (A : Type U) (P : A -> Bool) (H : Pi x, P x) : forall x, P x :=
Abst (fun x, EqTIntro (H x))

View file

@ -0,0 +1,3 @@
Set: pp::colors
Set: pp::unicode
Proved: ForallIntro2