TY - GEN
T1 - Shrink fast correctly!
AU - Bélanger, Olivier Savary
AU - Appel, Andrew W.
N1 - Publisher Copyright:
© 2017 Copyright held by the owner/author(s).
PY - 2017/10/9
Y1 - 2017/10/9
N2 - Function inlining, case-folding, projection-folding, and dead-variable elimination are important code transformations in virtually every functional-language compiler. When one of these reductions strictly reduces the size of the program (e.g., when the inlined function has only one applied occurrence), we call it a shrink reduction. Appel and Jim [1] introduced an algorithm to perform all shrink reductions (producing a shrink normal form) in quasilinear time. They proved confluence but not correctness. We have implemented this algorithm as part of an end-to-end verified compiler for Gallina, the specification language of the Coq theorem prover. We have given the first proofs of these properties: correctness with respect to contextual equivalence, reduction (in one pass) of all administrative redexes with one applied occurrence introduced by CPS conversion, and termination. The correctness and termination proofs are machine-checked in Coq. Because we use a pure functional language without imperative array update, our implementation is O(N log N) rather than O(N). Still, it's quite fast: we give performance results on some nontrivial benchmarks.
AB - Function inlining, case-folding, projection-folding, and dead-variable elimination are important code transformations in virtually every functional-language compiler. When one of these reductions strictly reduces the size of the program (e.g., when the inlined function has only one applied occurrence), we call it a shrink reduction. Appel and Jim [1] introduced an algorithm to perform all shrink reductions (producing a shrink normal form) in quasilinear time. They proved confluence but not correctness. We have implemented this algorithm as part of an end-to-end verified compiler for Gallina, the specification language of the Coq theorem prover. We have given the first proofs of these properties: correctness with respect to contextual equivalence, reduction (in one pass) of all administrative redexes with one applied occurrence introduced by CPS conversion, and termination. The correctness and termination proofs are machine-checked in Coq. Because we use a pure functional language without imperative array update, our implementation is O(N log N) rather than O(N). Still, it's quite fast: we give performance results on some nontrivial benchmarks.
UR - http://www.scopus.com/inward/record.url?scp=85033713508&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=85033713508&partnerID=8YFLogxK
U2 - 10.1145/3131851.3131859
DO - 10.1145/3131851.3131859
M3 - Conference contribution
AN - SCOPUS:85033713508
T3 - ACM International Conference Proceeding Series
SP - 49
EP - 60
BT - Proceedings of the 19th International Symposium on Principles and Practice of Declarative Programming, PPDP 2017
PB - Association for Computing Machinery
T2 - 19th International Symposium on Principles and Practice of Declarative Programming, PPDP 2017
Y2 - 9 October 2017 through 11 October 2017
ER -