lean4-htt/tests/lean/run/sym_intro_have.lean
Leonardo de Moura 1ca4faae18
fix: Sym.intro for have-declarations (#11851)
This PR fixes `Sym/Intro.lean` support for `have`-declarations.
2025-12-31 01:36:23 +00:00

29 lines
579 B
Text

import Lean.Meta.Tactic
import Lean.Meta.Sym
def f (x : Nat) :=
let y := x + 1
2*y
open Lean Meta Sym
/--
info: x : Nat
⊢ have y := x + 1;
x ≤ 2 * y
---
info: x : Nat
y : Nat := x + 1
⊢ x ≤ 2 * y
-/
#guard_msgs in
run_meta SymM.run' do
withLocalDeclD `x Nat.mkType fun x => do
let m ← mkFreshExprMVar <| mkNatLE x (mkApp (mkConst ``f) x)
let mvarId := m.mvarId!
let mvarId ← unfoldTarget mvarId ``f
let mvarId ← mvarId.liftLets
let goal ← mkGoal mvarId
logInfo goal.mvarId
let (_, goal) ← intro goal `y
logInfo goal.mvarId
return ()