fix(library/compiler/lcnf): bug, minor premise must have a lambda for each field in LCNF

This commit is contained in:
Leonardo de Moura 2018-09-20 16:42:57 -07:00
parent 896b45239e
commit f556e0947b
3 changed files with 12 additions and 0 deletions

View file

@ -132,6 +132,11 @@ public:
minor = instantiate_rev(minor, minor_fvars.size(), minor_fvars.data());
if (j < num_fields) {
minor = eta_expand(minor, num_fields - j);
for (; j < num_fields; j++) {
expr new_fvar = m_lctx.mk_local_decl(ngen(), binding_name(minor), binding_domain(minor), binding_info(minor));
minor_fvars.push_back(new_fvar);
minor = instantiate(binding_body(minor), new_fvar);
}
}
flet<cache> save_cache(m_cache, m_cache);
unsigned old_fvars_size = m_fvars.size();

View file

@ -0,0 +1,5 @@
set_option trace.compiler.lcnf true
set_option pp.binder_types false
def tst1 (a : nat) : nat :=
@nat.cases_on (λ _, nat) a 0 id

View file

@ -0,0 +1,2 @@
[compiler.lcnf] tst1
λ a, let _x_3 := nat.cases_on a (let _x_1 := nat.has_zero.0 in _x_1) (λ a, let _x_2 := id a in _x_2) in _x_3