coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Adam James Chlipala <adamc AT EECS.Berkeley.EDU>
- To: Jimmy Miller <captainthunder AT gmail.com>
- Cc: coq-club AT pauillac.inria.fr
- Subject: Re: [Coq-Club] Factorial function
- Date: Tue, 11 Sep 2007 09:18:29 -0400
- List-archive: <http://pauillac.inria.fr/pipermail/coq-club/>
- Priority: normal
The variable 'n' is rebound in the 'S n' branch of the pattern match.
----- Original Message -----
From: Jimmy Miller
<captainthunder AT gmail.com>
> In Coq.Arith.Factorial, the fact function is defined as follows:
>
> Fixpoint fact (n:nat) : nat :=
> match n with
> | O => 1
> | S n => S n * fact n
> end.
>
> But I'm having trouble understanding how this function works. Usually
> in a recursive factorial, fact is given n-1 each time it recurses, but
> here I only see n getting passed to it. Wouldn't this cause infinite
> recursion, because fact gets the same argument every time, and thus n
> will never reach 0?
- [Coq-Club] Factorial function, Jimmy Miller
- Re: [Coq-Club] Factorial function, Vincent Aravantinos
- Re: [Coq-Club] Factorial function, Adam James Chlipala
Archive powered by MhonArc 2.6.16.