Compare commits

...

2 Commits

Author SHA1 Message Date
Leonardo de Moura
882b982adb fix: filter +suggestions 2025-12-02 10:52:23 -08:00
Leonardo de Moura
b8c10b8028 fix: grind? dropping options
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]
```
2025-12-02 10:47:24 -08:00
2 changed files with 15 additions and 3 deletions

View File

@@ -342,10 +342,10 @@ def evalGrindTraceCore (stx : Syntax) (trace := true) (verbose := true) (useSorr
-- let saved ← saveState
match ( finish.run goal) with
| .closed seq =>
let configCtx' := filterSuggestionsFromGrindConfig configStx
let tacs Grind.mkGrindOnlyTactics configCtx' seq
let configStx' := filterSuggestionsFromGrindConfig configStx
let tacs Grind.mkGrindOnlyTactics configStx' seq
let seq := Grind.Action.mkGrindSeq seq
let tac `(tactic| grind => $seq:grindSeq)
let tac `(tactic| grind $configStx':optConfig => $seq:grindSeq)
let tacs := tacs.push tac
return tacs
| .stuck gs =>

View File

@@ -48,3 +48,15 @@ example :
(Equiv.sigmaCongrRight e).trans (Equiv.sigmaEquivProd α₁ β₂)
= (Equiv.sigmaEquivProd α₁ β₁).trans (prodCongrRight e) := by
grind -reducible => cases #5103 <;> instantiate only [Equiv.congr_fun]
/--
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]
-/
#guard_msgs in
example :
(Equiv.sigmaCongrRight e).trans (Equiv.sigmaEquivProd α₁ β₂)
= (Equiv.sigmaEquivProd α₁ β₁).trans (prodCongrRight e) := by
grind? -reducible [Equiv.congr_fun]