lean4-htt/src/Lean/Elab/Tactic/Generalize.lean
Leonardo de Moura ad3b0b4a2c feat: nary generalize tactic
This commit also fixes a bug when using multiple targets with the
`induction` and `cases` tactics.
2021-08-30 16:31:39 -07:00

24 lines
819 B
Text

/-
Copyright (c) 2020 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura, Sebastian Ullrich
-/
import Lean.Meta.Tactic.Generalize
import Lean.Meta.Check
import Lean.Meta.Tactic.Intro
import Lean.Elab.Tactic.ElabTerm
namespace Lean.Elab.Tactic
open Meta
@[builtinTactic Lean.Parser.Tactic.generalize] def evalGeneralize : Tactic := fun stx =>
withMainContext do
let args ← stx[1].getSepArgs.mapM fun arg => do
let hName? := if arg[0].isNone then none else some arg[0][0].getId
let expr ← elabTerm arg[1] none
return { hName?, expr, xName? := arg[3].getId : GeneralizeArg }
liftMetaTactic fun mvarId => do
let (_, mvarId) ← generalize mvarId args
return [mvarId]
end Lean.Elab.Tactic