Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Performance of simpl

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Performance of simpl


Chronological Thread 
  • From: Duckki Oe <duckki AT mit.edu>
  • To: Kenneth Roe <kendroe AT hotmail.com>
  • Cc: Coq-Club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] Performance of simpl
  • Date: Fri, 5 Apr 2013 10:35:00 -0400

Kenneth,

Defining z as (fact 10) does not actually evaluates (fact 10). If you want to
define z as the value of (fact 10), not the expression itself. You could do
this:

Definition z := Eval simpl in fact 10.

Or you could just print the value by running:

Eval simpl in fact 10.

Of couse, there is an alternative definition that is observationally equal to
your "fact" function and run faster by caching the immediate previous value.

-- Duckki


On Friday, April 5, 2013 at 10:21 AM, Kenneth Roe wrote:

> Consider the following Coq declarations:
>
> Fixpoint fact (x : nat) := match x with
> | 0 => 1
> | (S y) => (S y) * (fact y)
> end.
>
> Definition z := fact 10.
>
> Theorem q: (fact 10)=10*(fact 9).
> Proof.
> simpl.
>
> The definition of "z" happens very quickly. However, the "simpl" at the
> very end takes a long time. And in fact generates a "Stack overflow" error.
> However, the only meaningful operation of simpl is to do an evaluation of
> the "fact" function. Is there an alternative to using "simpl" that is
> faster? What else can I do to speed up performance?
>
> - Ken





Archive powered by MHonArc 2.6.18.

Top of Page