coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Vilhelm Sj�berg <vilhelm AT cis.upenn.edu>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] SF, Fibonacci, and "Error: This clause is redundant."
- Date: Thu, 3 Nov 2011 15:21:52 -0400
On Thu, Nov 03, 2011 at 03:12:32PM -0400, Andrew Pennebaker wrote:
> Definition one : nat := S O.
> Definition two : nat := S(S O).
>
> Fixpoint fib (n : nat) : nat :=
> match n with
> | O => O
> | one => one
> | _ => plus (fib (minus n one)) (fib (minus n two))
> end.
>
> When I tell CoqIDE to go forward with the fib function, it reports "Error:
> This clause is redundant", and underlines the last case in fib:
>
> _ => plus (fib (minus n one)) (fib (minus n two))
>
> What am I doing wrong?
"one" gets interpreted as a variable bound by the match. You need to write
out
the term using constructors:
| (S O) => one
Vilhelm Sjoberg
- [Coq-Club] SF, Fibonacci, and "Error: This clause is redundant.", Andrew Pennebaker
- Re: [Coq-Club] SF, Fibonacci, and "Error: This clause is redundant.", Edward Z. Yang
- Re: [Coq-Club] SF, Fibonacci, and "Error: This clause is redundant.", Vilhelm Sjöberg
- Re: [Coq-Club] SF, Fibonacci, and "Error: This clause is redundant.", Andrew Pennebaker
- Message not available
- Re: [Coq-Club] SF, Fibonacci, and "Error: This clause is redundant.",
Andrew Pennebaker
- Re: [Coq-Club] SF, Fibonacci, and "Error: This clause is redundant.",
Adam Chlipala
- Re: [Coq-Club] SF, Fibonacci, and "Error: This clause is redundant.",
Andrew Pennebaker
- Message not available
- Re: [Coq-Club] SF, Fibonacci, and "Error: This clause is redundant.", Andrew Pennebaker
- Message not available
- Re: [Coq-Club] SF, Fibonacci, and "Error: This clause is redundant.",
Andrew Pennebaker
- Re: [Coq-Club] SF, Fibonacci, and "Error: This clause is redundant.",
Adam Chlipala
- Re: [Coq-Club] SF, Fibonacci, and "Error: This clause is redundant.",
Andrew Pennebaker
Archive powered by MhonArc 2.6.16.