File: Mathlib/Tactic/Hint.lean

full_name: Mathlib.Tactic.Hint.hintExtension
code: /-- An environment extension for registering hint tactics. -/
initialize hintExtension : SimplePersistentEnvExtension (TSyntax `tactic) (List (TSyntax `tactic)) ←
  registerSimplePersistentEnvExtension {
    addEntryFn := (·.cons)
    addImportedFn := mkStateFromImportedEntries (·.cons) {}
  }
goal: Lean.SimplePersistentEnvExtension (Lean.TSyntax `tactic) (List (Lean.TSyntax `tactic))

full_name: Mathlib.Tactic.Hint.initFn._@.Mathlib.Tactic.Hint._hyg.7
code: /-- An environment extension for registering hint tactics. -/
initialize hintExtension : SimplePersistentEnvExtension (TSyntax `tactic) (List (TSyntax `tactic)) ←
  registerSimplePersistentEnvExtension {
    addEntryFn := (·.cons)
    addImportedFn := mkStateFromImportedEntries (·.cons) {}
  }
goal: IO (Lean.SimplePersistentEnvExtension (Lean.TSyntax `tactic) (List (Lean.TSyntax `tactic)))

full_name: Mathlib.Tactic.Hint.addHint
code: /-- Register a new hint tactic. -/
def addHint (stx : TSyntax `tactic) : CoreM Unit 
goal: Lean.CoreM Unit

full_name: Mathlib.Tactic.Hint.getHints
code: /-- Return the list of registered hint tactics. -/
def getHints : CoreM (List (TSyntax `tactic)) 
goal: Lean.CoreM (List (Lean.TSyntax `tactic))

full_name: Mathlib.Tactic.Hint._aux_Mathlib_Tactic_Hint___elabRules_Mathlib_Tactic_Hint_registerHintStx_1
code: /--
Register a tactic for use with the `hint` tactic, e.g. `register_hint simp_all`.
-/
elab (name := registerHintStx) "register_hint" tac:tactic : command => liftTermElabM do
  -- remove comments
  let tac : TSyntax `tactic := ⟨tac.raw.copyHeadTailInfoFrom .missing⟩
  addHint tac
goal: Lean.Elab.Command.CommandElab

full_name: Mathlib.Tactic.Hint.registerHintStx
code: /--
Register a tactic for use with the `hint` tactic, e.g. `register_hint simp_all`.
-/
elab (name := registerHintStx) "register_hint" tac:tactic : command => liftTermElabM do
  -- remove comments
  let tac : TSyntax `tactic := ⟨tac.raw.copyHeadTailInfoFrom .missing⟩
  addHint tac
goal: Lean.ParserDescr

full_name: Mathlib.Tactic.Hint.initFn._@.Mathlib.Tactic.Hint._hyg.254
code: initialize
  Batteries.Linter.UnreachableTactic.ignoreTacticKindsRef.modify fun s => s.insert ``registerHintStx
goal: IO Unit

full_name: Mathlib.Tactic.Hint.suggestion
code: /--
Construct a suggestion for a tactic.
* Check the passed `MessageLog` for an info message beginning with "Try this: ".
* If found, use that as the suggestion.
* Otherwise use the provided syntax.
* Also, look for remaining goals and pretty print them after the suggestion.
-/
def suggestion (tac : TSyntax `tactic) (msgs : MessageLog := {}) : TacticM Suggestion 
goal: Lean.Elab.Tactic.TacticM Lean.Meta.Tactic.TryThis.Suggestion

full_name: Mathlib.Tactic.Hint.withMessageLog
code: /-- Run a tactic, returning any new messages rather than adding them to the message log. -/
def withMessageLog (t : TacticM Unit) : TacticM MessageLog 
goal: Lean.Elab.Tactic.TacticM Lean.MessageLog

full_name: Mathlib.Tactic.Hint.withoutInfoTrees
code: /--
Run a tactic, but revert any changes to info trees.
We use this to inhibit the creation of widgets by subsidiary tactics.
-/
def withoutInfoTrees (t : TacticM Unit) : TacticM Unit 
goal: Lean.Elab.Tactic.TacticM Unit

full_name: Mathlib.Tactic.Hint.hint
code: /--
Run all tactics registered using `register_hint`.
Print a "Try these:" suggestion for each of the successful tactics.

If one tactic succeeds and closes the goal, we don't look at subsequent tactics.
-/
-- TODO We could run the tactics in parallel.
-- TODO With widget support, could we run the tactics in parallel
--      and do live updates of the widget as results come in?
def hint (stx : Syntax) : TacticM Unit 
goal: Lean.Elab.Tactic.TacticM Unit

full_name: Mathlib.Tactic.Hint.hintStx
code: /--
The `hint` tactic tries every tactic registered using `register_hint tac`,
and reports any that succeed.
-/
syntax (name := hintStx) "hint" : tactic
goal: Lean.ParserDescr

full_name: Mathlib.Tactic.Hint._aux_Mathlib_Tactic_Hint___elabRules_Mathlib_Tactic_Hint_hintStx_1
code: @[inherit_doc hintStx]
elab_rules : tactic
  | `(tactic| hint%$tk) => hint tk
goal: Lean.Elab.Tactic.Tactic