# HG changeset patch # User Adam Chlipala # Date 1320354281 14400 # Node ID 7e57c909f0f2203533eac551f29bf1f01f8f016f # Parent 70ffa4d3726ecee1e36e12566cd318862621dcc2 Explicit note about primitive recursion restriction, early on diff -r 70ffa4d3726e -r 7e57c909f0f2 src/StackMachine.v --- a/src/StackMachine.v Wed Nov 02 17:03:25 2011 -0400 +++ b/src/StackMachine.v Thu Nov 03 17:04:41 2011 -0400 @@ -107,7 +107,7 @@ (** We declare explicitly that this is a recursive definition, using the keyword [Fixpoint]. The rest should be old hat for functional programmers. *) -(** It is convenient to be able to test definitions before starting to prove things about them. We can verify that our semantics is sensible by evaluating some sample uses, using the command %\index{Vernacular commands!Eval}%[Eval]. This command takes an argument expressing a %\index{reduction strategy}\emph{%##reduction strategy##%}%, or an %``%#"#order of evaluation.#"#%''% Unlike with ML, which hardcodes an %\emph{%##eager##%}% reduction strategy, or Haskell, which hardcodes a %\emph{%##lazy##%}% strategy, in Coq we are free to choose between these and many other orders of evaluation, because all Coq programs terminate. In fact, Coq silently checked %\index{termination checking}%termination of our [Fixpoint] definition above, using a simple heuristic based on monotonically decreasing size of arguments across recursive calls. +(** It is convenient to be able to test definitions before starting to prove things about them. We can verify that our semantics is sensible by evaluating some sample uses, using the command %\index{Vernacular commands!Eval}%[Eval]. This command takes an argument expressing a %\index{reduction strategy}\emph{%##reduction strategy##%}%, or an %``%#"#order of evaluation.#"#%''% Unlike with ML, which hardcodes an %\emph{%##eager##%}% reduction strategy, or Haskell, which hardcodes a %\emph{%##lazy##%}% strategy, in Coq we are free to choose between these and many other orders of evaluation, because all Coq programs terminate. In fact, Coq silently checked %\index{termination checking}%termination of our [Fixpoint] definition above, using a simple heuristic based on monotonically decreasing size of arguments across recursive calls. Specifically, recursive calls must be made on arguments that were pulled out of the original recursive argument with [match] expressions. (In Chapter 7, we will see some ways of getting around this restriction, though simply removing the restriction would leave Coq useless as a theorem proving tool, for reasons we will start to learn about in the next chapter.) To return to our test evaluations, we run the [Eval] command using the [simpl] evaluation strategy, whose definition is best postponed until we have learned more about Coq's foundations, but which usually gets the job done. *)