Zulip Chat Archive

Stream: new members

Topic: Applying rewrite to the nth match?


view this post on Zulip Christopher Hoskin (Mar 10 2021 at 20:41):

Sometimes I find myself trying to do something like rw ← add_zero a to replace a with a+0 in a goal. But I only want to do this for a particular occurrence of a in the goal, whereas rewrite replaces every occurrence. Is there a way to do this?

Thanks,

Christopher

view this post on Zulip Bryan Gin-ge Chen (Mar 10 2021 at 20:43):

In mathlib there's nth_rewrite. There's also conv mode which is more powerful but often more verbose.

view this post on Zulip Christopher Hoskin (Mar 10 2021 at 20:45):

Thanks! nth_rewrite is just what I was looking for.


Last updated: May 13 2021 at 20:13 UTC