Zulip Chat Archive
Stream: new members
Topic: Question about add_succ
Kaixin Wang (Mar 11 2024 at 07:06):
image.png
Why is there an error if I execute add_succ succ(succ 0) succ(succ 0) at h but no error if I do add_succ at h
Mitchell Lee (Mar 11 2024 at 15:50):
add_succ m n
proves m + succ n = succ (m + n)
.
So add_succ (succ (succ 0)) (succ (succ 0))
proves that succ (succ 0) + succ (succ (succ 0)) = succ (succ (succ 0) + succ (succ 0))
.
Since succ (succ 0) + succ (succ (succ 0))
doesn't appear anywhere in the goal, the rewriting fails.
Mitchell Lee (Mar 11 2024 at 15:57):
You might have more success with rw [add_succ (succ (succ 0)) (succ 0)] at h
.
Mitchell Lee (Mar 11 2024 at 16:00):
Also, it is always necessary to put a space between a function and its arguments, so you should write succ (succ 0)
instead of succ(succ 0)
.
Kaixin Wang (Mar 15 2024 at 17:39):
Thanks for your help!
I have a related question
Kaixin Wang (Mar 15 2024 at 17:39):
Kaixin Wang (Mar 15 2024 at 17:40):
add_zero a proves a + 0 = a
Kaixin Wang (Mar 15 2024 at 17:40):
when I tried rw[add_zero a * 0]
there is this error:
Kaixin Wang (Mar 15 2024 at 17:40):
Kaixin Wang (Mar 15 2024 at 17:43):
Oh I see, this works!
image.png
Kaixin Wang (Mar 15 2024 at 18:19):
What is wrong with this:
image.png
Johan Commelin (Mar 15 2024 at 18:20):
one_mul
is for 1 * x = x
. But your goal is x = 1 * x
Johan Commelin (Mar 15 2024 at 18:21):
So you need to take care of the LHS/RHS symmetry.
Kaixin Wang (Mar 15 2024 at 18:34):
exact <- one_mul x and exact (<- one_mul x) doesn't work either
Johan Commelin (Mar 15 2024 at 18:48):
@Kaixin Wang hint: try rw
instead of exact
Kaixin Wang (Mar 15 2024 at 19:03):
Yes rw works, I was just wondering if exact works as well.
I think everything that is doable with exact should be doable with rw.
Kevin Buzzard (Mar 15 2024 at 19:17):
exact (one_mul x).symm
would probably work.
Last updated: May 02 2025 at 03:31 UTC