https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/How.20to.20WHNF.20without.20exposing.20recursors.3F
12 lines
268 B
Text
12 lines
268 B
Text
import Lean
|
|
|
|
open Lean Meta Elab Term in
|
|
elab "whnf%" t:term : term <= expectedType => do
|
|
let r ← whnf (← elabTerm t expectedType)
|
|
trace[Meta.debug] "r: {r}"
|
|
return r
|
|
|
|
constant x : Option Nat := some 42
|
|
|
|
set_option trace.Meta.debug true
|
|
#eval whnf% x.getD 0
|