Zulip Chat Archive

Stream: new members

Topic: Best way to calculate x + y + z = x + z + y


Nick Pilotti (Sep 09 2021 at 23:06):

I'm working on a proof that requires me to swap the 2nd and 3rd terms in a sum. I tried to do the obvious thing and apply the tactic
x + y + z = x + (y + z) := by rw [add_assoc]
and I was hoping Lean could get to

_ = x + (z + y) := by rw [add_comm]
but instead it gives (z + y) + x. This makes sense, but what would be the easiest way to get what I am trying to achieve? I feel as if there has to be an easy tactic for this sort of thing but I don't know what it is.


Last updated: Dec 20 2023 at 11:08 UTC