Skip to content

Commit f8866dc

Browse files
authored
fix: grind? dropping options (#11481)
This PR fixes a bug in `grind?`. The suggestion using the `grind` interactive mode was dropping the configuration options provided by the user. In the following account, the third suggestion was dropping the `-reducible` option. ```lean /-- info: Try these: [apply] grind -reducible only [Equiv.congr_fun, #5103] [apply] grind -reducible only [Equiv.congr_fun] [apply] grind -reducible => cases #5103 <;> instantiate only [Equiv.congr_fun] -/ example : (Equiv.sigmaCongrRight e).trans (Equiv.sigmaEquivProd α₁ β₂) = (Equiv.sigmaEquivProd α₁ β₁).trans (prodCongrRight e) := by grind? -reducible [Equiv.congr_fun] ```
1 parent 9263a6c commit f8866dc

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/Lean/Elab/Tactic/Grind/Main.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,10 @@ def evalGrindTraceCore (stx : Syntax) (trace := true) (verbose := true) (useSorr
342342
-- let saved ← saveState
343343
match (← finish.run goal) with
344344
| .closed seq =>
345-
let configCtx' := filterSuggestionsFromGrindConfig configStx
346-
let tacs ← Grind.mkGrindOnlyTactics configCtx' seq
345+
let configStx' := filterSuggestionsFromGrindConfig configStx
346+
let tacs ← Grind.mkGrindOnlyTactics configStx' seq
347347
let seq := Grind.Action.mkGrindSeq seq
348-
let tac ← `(tactic| grind => $seq:grindSeq)
348+
let tac ← `(tactic| grind $configStx':optConfig => $seq:grindSeq)
349349
let tacs := tacs.push tac
350350
return tacs
351351
| .stuck gs =>

tests/lean/run/grind_reducible.lean

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,15 @@ example :
4848
(Equiv.sigmaCongrRight e).trans (Equiv.sigmaEquivProd α₁ β₂)
4949
= (Equiv.sigmaEquivProd α₁ β₁).trans (prodCongrRight e) := by
5050
grind -reducible => cases #5103 <;> instantiate only [Equiv.congr_fun]
51+
52+
/--
53+
info: Try these:
54+
[apply] grind -reducible only [Equiv.congr_fun, #5103]
55+
[apply] grind -reducible only [Equiv.congr_fun]
56+
[apply] grind -reducible => cases #5103 <;> instantiate only [Equiv.congr_fun]
57+
-/
58+
#guard_msgs in
59+
example :
60+
(Equiv.sigmaCongrRight e).trans (Equiv.sigmaEquivProd α₁ β₂)
61+
= (Equiv.sigmaEquivProd α₁ β₁).trans (prodCongrRight e) := by
62+
grind? -reducible [Equiv.congr_fun]

0 commit comments

Comments
 (0)