@@ -200,6 +200,21 @@ def setGrindParams (stx : TSyntax `tactic) (params : Array Syntax) : TSyntax `ta
200200def getGrindParams (stx : TSyntax `tactic) : Array Syntax :=
201201 stx.raw[grindParamsPos][1 ].getSepArgs
202202
203+ /-- Filter out `+premises` from the config syntax -/
204+ def filterPremisesFromConfig (config : TSyntax ``Lean.Parser.Tactic.optConfig) : TSyntax ``Lean.Parser.Tactic.optConfig :=
205+ let configItems := config.raw.getArgs
206+ let filteredItems := configItems.filter fun item =>
207+ -- Keep all items except +premises
208+ -- Structure: null node -> configItem -> posConfigItem -> ["+", ident]
209+ match item[0 ]? with
210+ | some configItem => match configItem[0 ]? with
211+ | some posConfigItem => match posConfigItem[1 ]? with
212+ | some ident => !(posConfigItem.getKind == ``Lean.Parser.Tactic.posConfigItem && ident.getId == `premises)
213+ | none => true
214+ | none => true
215+ | none => true
216+ ⟨config.raw.setArgs filteredItems⟩
217+
203218def mkGrindOnly
204219 (config : TSyntax ``Lean.Parser.Tactic.optConfig)
205220 (trace : Grind.Trace)
@@ -216,7 +231,8 @@ def mkGrindOnly
216231 else
217232 let param ← Grind.globalDeclToGrindParamSyntax declName kind minIndexable
218233 params := params.push param
219- let result ← `(tactic| grind $config:optConfig only)
234+ let filteredConfig := filterPremisesFromConfig config
235+ let result ← `(tactic| grind $filteredConfig:optConfig only)
220236 return setGrindParams result params
221237
222238private def elabGrindConfig' (config : TSyntax ``Lean.Parser.Tactic.optConfig) (interactive : Bool) : TacticM Grind.Config := do
0 commit comments