fix(frontends/lean/elaborator): unassigned metavariable when using nested begin-end blocks
Closes #454
This commit is contained in:
parent
10f1232296
commit
c772d7bf84
2 changed files with 11 additions and 7 deletions
|
@ -1580,13 +1580,11 @@ bool elaborator::try_using_begin_end(substitution & subst, expr const & mvar, pr
|
||||||
throw_elaborator_exception("invalid nested begin-end block, there are no goals to be solved", ptac);
|
throw_elaborator_exception("invalid nested begin-end block, there are no goals to be solved", ptac);
|
||||||
goal g = head(gs);
|
goal g = head(gs);
|
||||||
expr mvar = g.get_mvar();
|
expr mvar = g.get_mvar();
|
||||||
proof_state focus_ps(ps, goals(g));
|
name_generator ngen = ps.get_ngen();
|
||||||
|
proof_state focus_ps(ps, goals(g), ngen.mk_child());
|
||||||
if (!try_using_begin_end(subst, mvar, focus_ps, ptac))
|
if (!try_using_begin_end(subst, mvar, focus_ps, ptac))
|
||||||
return false;
|
return false;
|
||||||
substitution ps_new_subst = ps.get_subst();
|
ps = proof_state(ps, tail(gs), subst, ngen);
|
||||||
name const & mvar_name = mlocal_name(mvar);
|
|
||||||
ps_new_subst.assign(mvar_name, *subst.get_expr(mvar_name));
|
|
||||||
ps = proof_state(ps, tail(gs), ps_new_subst);
|
|
||||||
} else {
|
} else {
|
||||||
expr new_ptac = subst.instantiate_all(ptac);
|
expr new_ptac = subst.instantiate_all(ptac);
|
||||||
if (auto tac = pre_tactic_to_tactic(new_ptac)) {
|
if (auto tac = pre_tactic_to_tactic(new_ptac)) {
|
||||||
|
|
6
tests/lean/run/454.lean
Normal file
6
tests/lean/run/454.lean
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
constants (A : Type₁) (P : A → Type₁) (H : Π{a b : A}, P a → P b) (a b : A) (K : P a)
|
||||||
|
|
||||||
|
theorem foo : P b :=
|
||||||
|
begin
|
||||||
|
apply H, {apply K}
|
||||||
|
end
|
Loading…
Reference in a new issue