# HG changeset patch # User Adam Chlipala # Date 1273920125 14400 # Node ID a636eda0217602c822e0ca23f1460e526ccd8e2b # Parent 19fbda8a8117184f1c1929862e5970fc3f0f6d19 Typo pointed out by Ben Moseley diff -r 19fbda8a8117 -r a636eda02176 src/StackMachine.v --- a/src/StackMachine.v Wed Apr 28 11:40:03 2010 -0400 +++ b/src/StackMachine.v Sat May 15 06:42:05 2010 -0400 @@ -618,7 +618,7 @@ (** This function has just a few differences from the denotation functions we saw earlier. First, [tbinop] is an indexed type, so its indices become additional arguments to [tbinopDenote]. Second, we need to perform a genuine %\textit{%##dependent pattern match##%}% to come up with a definition of this function that type-checks. In each branch of the [match], we need to use branch-specific information about the indices to [tbinop]. General type inference that takes such information into account is undecidable, so it is often necessary to write annotations, like we see above on the line with [match]. -The [in] annotation restates the type of the term being case-analyzed. Though we use the same names for the indices as we use in the type of the original argument binder, these are actually fresh variables, and they are %\textit{%##binding occurrences##%}%. Their scope is the [return] clause. That is, [arg1], [arg2], and [arg3] are new bound variables bound only within the return clause [typeDenote arg1 -> typeDenote arg2 -> typeDenote res]. By being explicit about the functional relationship between the type indices and the match result, we regain decidable type inference. +The [in] annotation restates the type of the term being case-analyzed. Though we use the same names for the indices as we use in the type of the original argument binder, these are actually fresh variables, and they are %\textit{%##binding occurrences##%}%. Their scope is the [return] clause. That is, [arg1], [arg2], and [res] are new bound variables bound only within the return clause [typeDenote arg1 -> typeDenote arg2 -> typeDenote res]. By being explicit about the functional relationship between the type indices and the match result, we regain decidable type inference. In fact, recent Coq versions use some heuristics that can save us the trouble of writing [match] annotations, and those heuristics get the job done in this case. We can get away with writing just: *)