fix(kernel/normalizer): bug in Let normalization
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
84bfe2a222
commit
836357c65c
2 changed files with 14 additions and 1 deletions
|
@ -267,7 +267,7 @@ class normalizer::imp {
|
||||||
svalue v = normalize(let_value(a), s, k);
|
svalue v = normalize(let_value(a), s, k);
|
||||||
{
|
{
|
||||||
freset<cache> reset(m_cache);
|
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;
|
break;
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -291,6 +291,18 @@ static void tst8() {
|
||||||
lean_assert_eq(N1, N2);
|
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() {
|
int main() {
|
||||||
save_stack_info();
|
save_stack_info();
|
||||||
tst_church_numbers();
|
tst_church_numbers();
|
||||||
|
@ -302,5 +314,6 @@ int main() {
|
||||||
tst6();
|
tst6();
|
||||||
tst7();
|
tst7();
|
||||||
tst8();
|
tst8();
|
||||||
|
tst9();
|
||||||
return has_violations() ? 1 : 0;
|
return has_violations() ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue