My current goal is:
x - 1 + 1 = x
I tried to use rewrite -> (Nat.add_comm (-1) 1). to change the current goal to x + 1 - 1, but it gave me the error Error: Cannot interpret this number as a value of type nat. How can I solve this question?
My current goal is:
x - 1 + 1 = x
I tried to use rewrite -> (Nat.add_comm (-1) 1). to change the current goal to x + 1 - 1, but it gave me the error Error: Cannot interpret this number as a value of type nat. How can I solve this question?
Assuming
xis indeed a natural number, I believe your goal is false. Note that subtraction on the natural numbers is truncated. Thus, ifx = 0, what we have iswhere the parenthesis I added are already there, I just made them explicit (*).
The error you get makes perfect sense.
-1is not a natural number, and hence Coq can't interpret it as a natural number.(*) You can do this with
Set Printing Parentheses.Edit: If you are able to prove that
1 <= xin your context, you can useI found these results by importing
Arithand searching like so: