Open antalsz opened 6 years ago
We have the following edit in CoreUtils/edits
:
in CoreUtils.eqExpr rewrite forall p, Util.all2 p a1 a2 = NestedRecursionHelpers.all2Map p id id a1 a2
We wouldn't need this at all if Util.all2
were defined one of those better ways.
Util.mapAndUnzip
is another example that would benefit with this edit. Right now, we manually redefine the function in module-edits/Util/edits
Coq has an easier time doing termination proofs when we pull out fixpoint arguments that don't change. For instance, in GHC's
compiler/utils/Util.hs
, we find the functionWe translate this, in
ghc/Util.v
, toHere,
arg_0__
isp
, and is the function to apply to the list elements pairwise. If this function is or contains a nested recursive call at a call site ofand2
, this will break! But if we instead producedor
or even
Coq can β-reduce the outer
fun
ction, inline the definition ofp
with the nested recursive call into thefix
, and potentially see that the result is terminating.It would be incredible to do this automatically, but even some sort of
uniform fix arguments
edit would be great.