Zulip Chat Archive

Stream: mathlib4

Topic: nth_rewrite


Kevin Buzzard (Dec 21 2023 at 22:44):

a NNG user just reported this and it's reproducible in mathlib:

import Mathlib.Tactic

example (b c : ) : 0 + b = 0 + c := by
  nth_rewrite 2 [zero_add]
/-
tactic 'rewrite' failed, did not find instance of the pattern in the target expression
  0 + b
b c : ℕ
⊢ 0 + b = 0 + c
-/

Is that expected behaviour? My guess is that Lean is deciding that it's going to be rewriting the second occurrence of 0 + b rather than the second occurrence of 0 + ?.

Kim Morrison (Dec 21 2023 at 22:47):

This is lean4#2539, which I'm trying to get merged. :-)

Kevin Buzzard (Dec 21 2023 at 22:56):

I added a link to @Nikolai Morin 's post on the issue.

Michael Stoll (Dec 22 2023 at 09:17):

Another thread.

Michael Stoll (Dec 22 2023 at 09:20):

And here.

Kim Morrison (Dec 22 2023 at 11:24):

Please make sure they are all linked at lean4#2539. :-)

Kim Morrison (Jan 04 2024 at 03:10):

Happily this has now been merged, as so will become available in Mathlib at the end of January.


Last updated: May 02 2025 at 03:31 UTC