Compare commits

...

1 Commits

Author SHA1 Message Date
Leonardo de Moura
b49b5e2e00 feat: show_term for grind interactive mode
This PR implements the `show_term` combinator in `grind` interactive mode.
2025-10-20 19:17:58 -07:00
2 changed files with 10 additions and 0 deletions

View File

@@ -88,6 +88,10 @@ syntax (name := showCases) "show_cases" ppSpace grindFilter : grind
syntax (name := «showState») "show_state" ppSpace grindFilter : grind
/-- Show active local theorems and their anchors for heuristic instantiation. -/
syntax (name := showLocalThms) "show_local_thms" : grind
/--
`show_term tac` runs `tac`, then displays the generated proof in the InfoView.
-/
syntax (name := showTerm) "show_term " grindSeq : grind
declare_syntax_cat grind_ref (behavior := both)

View File

@@ -126,4 +126,10 @@ public def showState (filter : Filter) (isSilent := false) : GrindTacticM Unit :
let msg := MessageData.trace { cls := `thms, collapsed := false } "Local theorems" msgs
logInfo msg
@[builtin_grind_tactic showTerm] def evalShowTerm : GrindTactic := fun stx => do
let `(grind| show_term $seq:grindSeq) := stx | throwUnsupportedSyntax
let mvarId := ( getMainGoal).mvarId
evalGrindTactic seq
mvarId.withContext do logInfo ( instantiateMVars (mkMVar mvarId))
end Lean.Elab.Tactic.Grind