File tree Expand file tree Collapse file tree 4 files changed +22
-11
lines changed
Expand file tree Collapse file tree 4 files changed +22
-11
lines changed Original file line number Diff line number Diff line change @@ -834,7 +834,7 @@ theorem getElem_length_sub_one_eq_getLast {l : List α} (h : l.length - 1 < l.le
834834 rw [← getLast_eq_getElem]
835835
836836@[simp, grind] theorem getLast_cons_cons {a : α} {l : List α} :
837- getLast (a :: b :: l) (by simp) = getLast (b :: l) (by simp) := by
837+ getLast (a :: b :: l) (by simp) = getLast (b :: l) (by simp) :=
838838 rfl
839839
840840theorem getLast_cons {a : α} {l : List α} : ∀ (h : l ≠ nil),
Original file line number Diff line number Diff line change @@ -28,7 +28,6 @@ builtin_initialize registerTraceClass `Meta.Tactic.simp.unify (inherited := true
2828builtin_initialize registerTraceClass `Meta.Tactic.simp.ground (inherited := true )
2929builtin_initialize registerTraceClass `Meta.Tactic.simp.numSteps
3030builtin_initialize registerTraceClass `Meta.Tactic.simp.heads
31- builtin_initialize registerTraceClass `Meta.Tactic.simp.rflAttrMismatch
3231builtin_initialize registerTraceClass `Debug.Meta.Tactic.simp
3332builtin_initialize registerTraceClass `Debug.Meta.Tactic.simp.congr (inherited := true )
3433
Original file line number Diff line number Diff line change @@ -218,15 +218,20 @@ where
218218 else
219219 let candidates := candidates.insertionSort fun e₁ e₂ => e₁.1 .priority > e₂.1 .priority
220220 for (thm, numExtraArgs) in candidates do
221- unless inErasedSet thm || (rflOnly && !thm.isRfl (← getEnv)) do
222- if let some result ← tryTheoremWithExtraArgs? e thm numExtraArgs then
223- trace[Debug.Meta.Tactic.simp] "rewrite result {e} => {result.expr}"
224- return some result
225- if !inErasedSet thm && rflOnly && !thm.isRfl (← getEnv) then
226- let r ← withOptions (experimental.tactic.simp.useRflAttr.set · false ) do
227- isRflProof thm.proof
228- if r then
229- trace[Meta.Tactic.simp.rflAttrMismatch] "theorem {thm.proof} is no longer rfl"
221+ if inErasedSet thm then continue
222+ if rflOnly then
223+ let isRfl := thm.isRfl (← getEnv)
224+ if !isRfl then
225+ if debug.tactic.simp.checkRflAttr.get (← getOptions) &&
226+ experimental.tactic.simp.useRflAttr.get (← getOptions) then
227+ let isRflOld ← withOptions (experimental.tactic.simp.useRflAttr.set · false ) do
228+ isRflProof thm.proof
229+ if isRflOld then
230+ logWarning "theorem {thm.proof} is no longer rfl"
231+ continue
232+ if let some result ← tryTheoremWithExtraArgs? e thm numExtraArgs then
233+ trace[Debug.Meta.Tactic.simp] "rewrite result {e} => {result.expr}"
234+ return some result
230235 return none
231236
232237 /--
Original file line number Diff line number Diff line change @@ -20,6 +20,13 @@ register_builtin_option experimental.tactic.simp.useRflAttr : Bool := {
2020 descr := "use `rfl` attribute rather than theorem body to decide rfl-ness"
2121}
2222
23+ register_builtin_option debug.tactic.simp.checkRflAttr : Bool := {
24+ defValue := false
25+ descr := "if true, whenever `dsimp` fails to apply a rewrite rule because it is not marked as \
26+ `rfl`, check whether it would have been considered as a rfl theorem before the introduction of \
27+ the `rfl` attribute, and warn if it was. Note that this is a costly check."
28+ }
29+
2330/--
2431An `Origin` is an identifier for simp theorems which indicates roughly
2532what action the user took which lead to this theorem existing in the simp set.
You can’t perform that action at this time.
0 commit comments