Closed nateyazdani closed 5 years ago
I think the best thing would be to go over this PR together when we meet.
Alright, I think that I've covered all the needed revisions:
abstract_subterm
now lives in the Abstraction
module.eliminate_fixpoint
now lives in init_fixpoint
.factor_assums
is now named abstract_assums
, consistent with the meaning of "abstraction" in abstract_subterm
. Perhaps this function should also move to the Abstraction
module?
Quick aside: I know that I'm submitting this on a Friday evening, so I want to emphasize that code review can easily wait until next week :-)
The translation approach is mostly as described in Issue #18:
Support for whole-module translation will come in a subsequent PR.
The translated function will not necessary satisfy definitional equality with the original (fixed-point) form but has equivalent computational behavior (more precisely, bisimulative). This "definitional difference" can lead to an ill-typed translation when a proof term contains an expansion of another constant;
List.In_nth
demonstrates such a situation, unlikeList.nth_In
(for comparison). Whole-module translation will solve such problems, via compositionality analogous to ornamental lifting.As one would expect, this translation only supports "primitive" structural recursion, in which each recursive call is on a direct descendent of the current structural guard value (i.e., no fancy transformation for n-induction). (Implicitly, that also leaves mutual recursion unsupported.) The benefit of this restriction is that the translated term corresponds extremely closely to its original form.
The new helper functions for fixed-point support also led to substantial simplification of the translation for bare (non-recursive) match expressions.
Tests were added to
plugin/coq/Desugar.v
and linked intoplugin/test.sh
.I'm going to read through the current resubmission draft this weekend, to check for any mismatch between the paper's description of this translation and its present implementation.