File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed
Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -172,5 +172,13 @@ macro_rules
172172/-- `rename_i x_1 ... x_n` renames the last `n` inaccessible names using the given names. -/
173173syntax (name := renameI) "rename_i" (ppSpace colGt binderIdent)+ : grind
174174
175+ /--
176+ `expose_names` renames all inaccessible variables with accessible names, making them available
177+ for reference in generated tactics. However, this renaming introduces machine-generated names
178+ that are not fully under user control. `expose_names` is primarily intended as a preamble for
179+ generated `grind` tactic scripts.
180+ -/
181+ syntax (name := exposeNames) "expose_names" : grind
182+
175183end Grind
176184end Lean.Parser.Tactic
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import Lean.Meta.Tactic.Grind.Anchor
2020import Lean.Meta.Tactic.Grind.Arith.CommRing.PP
2121import Lean.Meta.Tactic.Grind.Arith.Linear.PP
2222import Lean.Meta.Tactic.Grind.AC.PP
23+ import Lean.Meta.Tactic.ExposeNames
2324import Lean.Elab.Tactic.Basic
2425import Lean.Elab.Tactic.RenameInaccessibles
2526namespace Lean.Elab.Tactic.Grind
@@ -354,4 +355,10 @@ where
354355 replaceMainGoal [{ goal with mvarId }]
355356 | _ => throwUnsupportedSyntax
356357
358+ @[builtin_grind_tactic exposeNames] def evalExposeNames : GrindTactic := fun _ => do
359+ let goal ← getMainGoal
360+ let mvarId ← goal.mvarId.exposeNames
361+ liftGrindM <| resetAnchors
362+ replaceMainGoal [{ goal with mvarId }]
363+
357364end Lean.Elab.Tactic.Grind
Original file line number Diff line number Diff line change @@ -473,4 +473,10 @@ example : (a : Point Nat) → p a → x ≠ y → False := by
473473 cases #e2a6
474474 all_goals sorry
475475
476+ example : (a : Point Nat) → p a → x ≠ y → False := by
477+ grind =>
478+ expose_names
479+ cases #6ccb
480+ sorry
481+
476482end Ex1
You can’t perform that action at this time.
0 commit comments