Skip to content

Commit

Permalink
chore: rw? uses MVarId.refl not MVarId.applyRfl (#3783)
Browse files Browse the repository at this point in the history
I think this was in error in my original Mathlib implementation. We're
not interested in relations other than `=`, so there is no point uses
`MVarId.applyRfl`, which just looks up `@[refl]` tagged lemmas and tries
those.

In a separate PR, I will change `MVarId.applyRfl` so it has a flag to
control whether on `=` it should just hand-off to `MVarId.refl`, or
fail. Failure is appropriate in the version we call from the `rfl`
macro, to avoid doing a double `IsDefEq` check on every `rfl`!
  • Loading branch information
semorrison committed Mar 27, 2024
1 parent b17c47d commit b4caee8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Lean/Meta/Tactic/Rewrites.lean
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ prelude
import Lean.Meta.LazyDiscrTree
import Lean.Meta.Tactic.Assumption
import Lean.Meta.Tactic.Rewrite
import Lean.Meta.Tactic.Rfl
import Lean.Meta.Tactic.Refl
import Lean.Meta.Tactic.SolveByElim
import Lean.Meta.Tactic.TryThis
import Lean.Util.Heartbeats
Expand Down Expand Up @@ -149,7 +149,7 @@ def dischargableWithRfl? (mctx : MetavarContext) (e : Expr) : MetaM Bool := do
try
withoutModifyingState <| withMCtx mctx do
-- We use `withReducible` here to follow the behaviour of `rw`.
withReducible (← mkFreshExprMVar e).mvarId!.applyRfl
withReducible (← mkFreshExprMVar e).mvarId!.refl
pure true
catch _e =>
pure false
Expand Down

0 comments on commit b4caee8

Please sign in to comment.