lean4-htt/tests/lean/run/DefEqAssignBug.lean
2020-09-26 19:12:01 -07:00

32 lines
689 B
Text

import Lean.Meta
new_frontend
open Lean
open Lean.Meta
def mkArrow (d b : Expr) : Expr := mkForall `_ BinderInfo.default d b
def check (x : MetaM Bool) : MetaM Unit :=
unlessM x $ throwError "check failed"
def tst1 : MetaM Unit := do
let nat := mkConst `Nat;
let m1 ← mkFreshExprMVar nat;
let m2 ← mkFreshExprMVar (mkArrow nat nat);
withLocalDeclD `x nat $ fun x => do
let t := mkApp m2 x;
check $ isDefEq t m1
def tst2 : MetaM Unit := do
let nat := mkConst `Nat;
let m1 ← mkFreshExprMVar nat;
let m2 ← mkFreshExprMVar (mkArrow nat nat);
withLocalDeclD `x nat $ fun x => do
let t := mkApp m2 x;
check $ isDefEq m1 t
set_option trace.Meta true
#eval tst1
#eval tst2