feat: unfold ident,+
This commit is contained in:
parent
2680711f6a
commit
fc03b2fc31
3 changed files with 11 additions and 7 deletions
|
|
@ -260,10 +260,10 @@ syntax (name := dsimp) "dsimp " (config)? (discharger)? (&"only ")? ("[" (simpEr
|
|||
This is a low-level tactic, it will expose how recursive definitions have been compiled by Lean. -/
|
||||
syntax (name := delta) "delta " ident (location)? : tactic
|
||||
/--
|
||||
`unfold id` unfolds definition `id`. For non-recursive definitions, this tactic is identical to `delta`.
|
||||
`unfold id,+` unfolds definition `id`. For non-recursive definitions, this tactic is identical to `delta`.
|
||||
For recursive definitions, it hides the encoding tricks used by the Lean frontend to convince the
|
||||
kernel that the definition terminates. -/
|
||||
syntax (name := unfold) "unfold " ident (location)? : tactic
|
||||
syntax (name := unfold) "unfold " ident,+ (location)? : tactic
|
||||
|
||||
-- Auxiliary macro for lifting have/suffices/let/...
|
||||
-- It makes sure the "continuation" `?_` is the main goal after refining
|
||||
|
|
|
|||
|
|
@ -21,11 +21,8 @@ def unfoldTarget (declName : Name) : TacticM Unit := do
|
|||
-/
|
||||
@[builtinTactic Lean.Parser.Tactic.unfold] def evalUnfold : Tactic := fun stx => do
|
||||
let loc := expandOptLocation stx[2]
|
||||
if stx[1].isIdent then
|
||||
go stx[1] loc
|
||||
else
|
||||
for declNameId in stx[1].getSepArgs do
|
||||
go declNameId loc
|
||||
for declNameId in stx[1].getSepArgs do
|
||||
go declNameId loc
|
||||
where
|
||||
go (declNameId : Syntax) (loc : Location) : TacticM Unit := do
|
||||
let declName ← resolveGlobalConstNoOverload declNameId
|
||||
|
|
|
|||
7
tests/lean/run/unfoldMany.lean
Normal file
7
tests/lean/run/unfoldMany.lean
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
def f (x : Nat) := x + 1
|
||||
|
||||
def g (x : Nat) := f x + f x
|
||||
|
||||
example : g x > 0 := by
|
||||
unfold g, f
|
||||
simp_arith
|
||||
Loading…
Add table
Reference in a new issue