blob: 112a99c84f6ade6a9f9f011d09dc9c333fa184fb [file]
/-
Copyright (c) 2026 Lean FRO, LLC. All Rights Reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura
-/
module
prelude
public import Lean.Elab.Tactic.Grind.Basic
public import Lean.Elab.Command
namespace Lean.Elab.Command
open Meta
/--
Runs a `GrindTacticM` computation in a minimal context for validation.
-/
public def withGrindTacticM (k : Tactic.Grind.GrindTacticM α) : CommandElabM α := do
liftTermElabM do
let params ← Grind.mkDefaultParams {}
let (ctx, state) ← Grind.GrindM.run (params := params) do
let methods ← Grind.getMethods
let grindCtx ← readThe Meta.Grind.Context
let symCtx ← readThe Sym.Context
let grindState ← get
let symState ← getThe Sym.State
let ctx := {
elaborator := `registerSymSimp,
ctx := grindCtx, sctx := symCtx, methods, params
}
return (ctx, { grindState, symState, goals := [] })
let (a, _) ← Tactic.Grind.GrindTacticM.run k ctx state
return a
end Lean.Elab.Command