fix(kernel/normalizer): bug in Let normalization

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2013-12-17 12:35:25 -08:00
parent 84bfe2a222
commit 836357c65c
2 changed files with 14 additions and 1 deletions

View file

@ -267,7 +267,7 @@ class normalizer::imp {
svalue v = normalize(let_value(a), s, k);
{
freset<cache> reset(m_cache);
r = normalize(let_body(a), extend(s, v), k+1);
r = normalize(let_body(a), extend(s, v), k);
}
break;
}}

View file

@ -291,6 +291,18 @@ static void tst8() {
lean_assert_eq(N1, N2);
}
static void tst9() {
environment env;
expr f = Const("f");
env->add_var("f", Type() >> (Type() >> Type()));
expr x = Const("x");
expr v = Const("v");
expr F = Fun({x, Type()}, Let({v, Bool}, f(x, v)));
expr N = normalizer(env)(F);
std::cout << F << " ==> " << N << "\n";
lean_assert_eq(N, Fun({x, Type()}, f(x, Bool)));
}
int main() {
save_stack_info();
tst_church_numbers();
@ -302,5 +314,6 @@ int main() {
tst6();
tst7();
tst8();
tst9();
return has_violations() ? 1 : 0;
}