I am reading Logical Foundations from Software Foundations series and i saw the plus_id_example
that is:
Theorem plus_id_example : forall n m:nat,
n = m ->
n + n = m + m.
Proof.
intros n m.
intros H.
rewrite H.
reflexivity. Qed.
I could understand the solution, so i tried to solve it using absurd, what i want to do is:
Lets consider by absurd, that n+n <> m+m
, so we have 2n <> 2m
, n <> m
, which is a contradiction since we have n=m
as our hypothesis.
How could i write this using Coq tactics?
2n <> 2m
ton = m
), and so you will get a proof at least as complicated as the one of Software Foundation. In general, in this kind of easy examples, reasoning by contradiction is just a way to hide a direct reasoning, so in the end you’ll perform the same steps, just hidden behind negations.