Zulip Chat Archive
Stream: new members
Topic: mul_comm fails
Hank (Dec 28 2021 at 00:11):
The last line fails. I have tried rw mul_comm as well, but it always says the tactic failed.
import data.real.basic
variables a b : ℝ
example : (a + b) * (a + b) = a * a + 2 * (a * b) + b * b :=
calc
(a + b) * (a + b)
= (a + b) * a + (a + b) * b : by rw mul_add
... = (a*a + b*a) + (a + b) * b : by rw add_mul
... = a*a + b*a + (a*b + b*b) : by rw add_mul
... = a*a + (b*a + (a*b + b*b)) : by rw add_assoc
... = a*a + (b*a + a*b + b*b) : by rw add_assoc
... = a*a + (a*b + a*b + b*b) : by rw ←mul_comm b*a /- ?? -/
Patrick Johnson (Dec 28 2021 at 00:15):
rw ←mul_comm b a
Andrew Yang (Dec 28 2021 at 00:15):
You should give mul_comm
the two variables separately, namely rw ← mul_comm b a
Hank (Dec 28 2021 at 00:35):
thank you!
Last updated: Dec 20 2023 at 11:08 UTC