Skip to content

Commit 1fc4768

Browse files
authored
fix: incorrect reducibility setting in grind interactive mode (#11471)
This PR fixes an incorrect reducibility setting when using `grind` interactive mode. Signed-off-by: Leonardo de Moura <[email protected]>
1 parent 1e1ed16 commit 1fc4768

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,10 @@ def tryTactic (tac : GrindTacticM α) : GrindTacticM Bool := do
282282

283283
open Grind
284284

285-
def liftGrindM (k : GrindM α) : GrindTacticM α := do
285+
/-
286+
**Note**: Recall that `grind` uses `Reducible` setting to avoid expensive definitionally equality tests.
287+
-/
288+
def liftGrindM (k : GrindM α) : GrindTacticM α := withReducible do
286289
let ctx ← read
287290
let s ← get
288291
let (a, state) ← liftMetaM <| k ctx.methods.toMethodsRef ctx.ctx |>.run s.state

src/Lean/Meta/Tactic/Grind/EMatch.lean

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,11 @@ where
499499
-- We must add a hint because `annotateEqnTypeConds` introduces `Grind.PreMatchCond`
500500
-- which is not reducible.
501501
proof := mkExpectedPropHint proof prop
502-
addTheoremInstance thm proof prop (generation+1) guards
502+
/-
503+
**Note**: Must restore `reducible` setting because with use `withDefault` at `instantiateTheorem`.
504+
-/
505+
withReducible do
506+
addTheoremInstance thm proof prop (generation+1) guards
503507

504508
private def synthesizeInsts (mvars : Array Expr) (bis : Array BinderInfo) : OptionT M Unit := do
505509
let thm := (← read).thm

0 commit comments

Comments
 (0)