diff --git a/src/Init/Tactics.lean b/src/Init/Tactics.lean index 861405d644..7f9a745d10 100644 --- a/src/Init/Tactics.lean +++ b/src/Init/Tactics.lean @@ -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 diff --git a/src/Lean/Elab/Tactic/Unfold.lean b/src/Lean/Elab/Tactic/Unfold.lean index 64d9451459..a03affed13 100644 --- a/src/Lean/Elab/Tactic/Unfold.lean +++ b/src/Lean/Elab/Tactic/Unfold.lean @@ -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 diff --git a/tests/lean/run/unfoldMany.lean b/tests/lean/run/unfoldMany.lean new file mode 100644 index 0000000000..0f331aa818 --- /dev/null +++ b/tests/lean/run/unfoldMany.lean @@ -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