The areas / V01. The language of Mathlib
Mathlib.Lean.ContextInfo
8 declarations. Mathlib docs · Source
Executing actions using the infotree
This file contains helper functions for running CoreM, MetaM and tactic actions
in the context of an infotree node.
def Lean.Elab.ContextInfo.runCoreMWithMessages E1 #
{α : Type} → Lean.Elab.ContextInfo → Lean.CoreM α → Lean.Elab.Command.CommandElabM α
Embeds a CoreM action in CommandElabM by supplying the information stored in info.
Copy of ContextInfo.runCoreM that makes use of the CommandElabM context for:
- logging messages produced by the
CoreMaction, - metavariable generation,
- auxiliary declaration generation.
def Lean.Elab.ContextInfo.runMetaMWithMessages E1 #
{α : Type} → Lean.Elab.ContextInfo → Lean.LocalContext → Lean.MetaM α → Lean.Elab.Command.CommandElabM α
Embeds a MetaM action in CommandElabM by supplying the information stored in info.
Copy of ContextInfo.runMetaM that makes use of the CommandElabM context for:
- message logging (messages produced by the
CoreMaction are migrated back), - metavariable generation,
- auxiliary declaration generation,
- local instances.
def Lean.Elab.ContextInfo.runTactic E1 #
{α : Type} →
Lean.Elab.ContextInfo →
Lean.Elab.TacticInfo → Lean.MVarId → (Lean.MVarId → Lean.MetaM α) → Lean.Elab.Command.CommandElabM α
Run a tactic computation in the context of an infotree node.
def Lean.Elab.ContextInfo.runTacticCode E1 #
Lean.Elab.ContextInfo →
Lean.Elab.TacticInfo →
Lean.MVarId →
Lean.Syntax →
(m : optParam ((α : Type) × (Lean.MVarId → Lean.MetaM α)) ⟨Lean.MVarId, pure⟩) →
Lean.Elab.Command.CommandElabM (List m.fst)
Run tactic code, given by a piece of syntax, in the context of an infotree node.
The optional MetaM argument m performs postprocessing on the goals produced.
Messages logged by code (for example Try this suggestions) are discarded:
use runTacticCodeCapturingInfoTree to inspect them.
def Lean.Elab.ContextInfo.runCoreMCapturingInfoTree E1 #
{α : Type} →
Lean.Elab.ContextInfo → Lean.CoreM α → Lean.Elab.Command.CommandElabM (α × Lean.PersistentArray Lean.Elab.InfoTree)
Embeds a CoreM action in CommandElabM, returning both the result and the InfoTrees produced.
Similar to runCoreMWithMessages but also captures InfoTrees for extracting "Try this:" suggestions.
def Lean.Elab.ContextInfo.runMetaMCapturingInfoTree E1 #
{α : Type} →
Lean.Elab.ContextInfo →
Lean.LocalContext → Lean.MetaM α → Lean.Elab.Command.CommandElabM (α × Lean.PersistentArray Lean.Elab.InfoTree)
Embeds a MetaM action in CommandElabM, returning both the result and InfoTrees produced.
def Lean.Elab.ContextInfo.runTacticCapturingInfoTree E1 #
{α : Type} →
Lean.Elab.ContextInfo →
Lean.Elab.TacticInfo →
Lean.MVarId →
(Lean.MVarId → Lean.MetaM α) → Lean.Elab.Command.CommandElabM (α × Lean.PersistentArray Lean.Elab.InfoTree)
Run a tactic computation in the context of an infotree node, capturing InfoTrees produced.
def Lean.Elab.ContextInfo.runTacticCodeCapturingInfoTree E1 #
Lean.Elab.ContextInfo →
Lean.Elab.TacticInfo →
Lean.MVarId →
Lean.Syntax → Lean.Elab.Command.CommandElabM (List Lean.MVarId × Lean.PersistentArray Lean.Elab.InfoTree)
Run tactic code in the context of an infotree node, capturing InfoTrees for suggestion extraction.
Returns both the resulting goals and the InfoTrees produced during tactic execution.
Use collectTryThisSuggestions from Mathlib.Lean.Elab.InfoTree to extract suggestions.