lean4-htt/tests/lean/run/mvar_eta_issue.lean
Leonardo de Moura 70b181d88f fix(library/type_context): unifier failed to solve ?m =?= fun x_1 ... x_n, ?m x_1 ... x_n
Before this commit, the unifier would try to solve the unification consraint

     ?m =?= fun x_1 ... x_n, ?m x_1 ... x_n

by assigning

     ?m := fun x_1 ... x_n, ?m x_1 ... x_n

which fails the occurs check.

This commit skips the assignment by using eta-reduction.
2018-04-16 14:27:20 -07:00

26 lines
619 B
Text

open tactic
example : true :=
by do
let n : expr := `(nat),
let t : expr := `(nat → nat),
m ← mk_meta_var t,
let em : expr := (expr.lam `x binder_info.default n (expr.app m (expr.var 0))),
/- The unification constraint
?m =?= (fun x, ?m x)
should work.
-/
unify m em,
constructor
example : true :=
by do
let n : expr := `(nat),
let t : expr := `(nat → nat),
m ← mk_meta_var t,
let em : expr := (expr.lam `x binder_info.default n (expr.app m (expr.var 0))),
/- The unification constraint
?m =?= (fun x, ?m x)
should work.
-/
unify em m,
constructor