The following proof is given in Coq in a Hurry:
Fixpoint add n m := match n with 0 => m | S p => add p (S m) end.
Lemma exercise6 : forall n m, add n (S m) = S (add n m).
Proof.
induction n; intros m; simpl.
reflexivity.
rewrite IHn; reflexivity.
Qed.
I tried writing this step by step to understand what was happening, but the inductive hypothesis isn't the same after solving the base case! Therefore, the tactics fail:
Lemma exercise6' : forall n m, add n (S m) = S (add n m).
Proof.
induction n.
intros m.
simpl.
reflexivity.
rewrite IHn. reflexivity.
Qed.
They fail at the line staring with "rewrite", with the following error:
Error: Found no subterm matching
add n (S ?M1580)
in the current goal.
Why does the same code fail when written step-by-step? What is the difference between the semicolon and period?
Furthermore, is there a way I can view the step-by-step progression of the proof given in Coq in a Hurry?