lean4-htt/tests/lean/run/meta5.lean
Leonardo de Moura ab162b3f52
fix: isDefEq, whnf, simp caching and configuration (#6053)
This PR fixes the caching infrastructure for `whnf` and `isDefEq`,
ensuring the cache accounts for all relevant configuration flags. It
also cleans up the `WHNF.lean` module and improves the configuration of
`whnf`.
2024-11-18 01:17:26 +00:00

38 lines
890 B
Text

import Lean.Meta
open Lean
open Lean.Meta
def tst1 : MetaM Unit :=
withLocalDeclD `y (mkConst `Nat) $ fun y => do
withLetDecl `x (mkConst `Nat) (mkNatLit 0) $ fun x => do {
let mvar ← mkFreshExprMVar (mkConst `Nat) MetavarKind.syntheticOpaque;
trace[Meta.debug] mvar;
let r ← mkLambdaFVars #[y, x] mvar;
trace[Message.debug] r;
let v := mkApp2 (mkConst `Nat.add) x y;
mvar.mvarId!.assign v;
trace[Meta.debug] mvar;
trace[Meta.debug] r;
let mctx ← getMCtx;
mctx.decls.forM fun mvarId mvarDecl => do
trace[Meta.debug] m!"?{mvarId.name} : {mvarDecl.type}"
}
set_option pp.mvars false
set_option trace.Meta.debug true
/--
info: [Meta.debug] ?_
[Meta.debug] x.add y
[Meta.debug] fun y =>
let x := 0;
x.add y
[Meta.debug] ?_uniq.3037 : Nat
[Meta.debug] ?_uniq.3038 : Nat →
Nat →
let x := 0;
Nat
-/
#guard_msgs in
#eval tst1