I am trying to define Fibonacci numbers using coq. This is my code:
Fixpoint fibonacci (n:nat) : nat :=
match n with
| O => 1
| S O => 1
| S (S n') => fibonacci (S n') + fibonacci n
end.
I met the error message:
Recursive definition of fibonacci is ill-formed. In environment fibonacci : nat -> nat n : nat n0 : nat n' : nat Recursive call to fibonacci has principal argument equal to "S n'" instead of one of the following variables: "n0" "n'". Recursive definition is: "fun n : nat => match n with | S (S n') => fibonacci (S n') + fibonacci n | _ => 1 end".
I am wondering why this is wrong. Parenthetically, in the third clause of the match, I did not define the property of n' (e.g. n': nat), what would be the default of the property of n'?
Thanks in advance!