A Generalization of Short-Cut Fusion and its Correctness Proof |
| |
Authors: | Patricia Johann |
| |
Affiliation: | (1) Department of Computer Science, Rutgers University, Camden, NJ 08102, USA |
| |
Abstract: | Short-cut fusion is a program transformation technique that uses a single, local transformation—called the foldr-build rule—to remove certain intermediate lists from modularly constructed functional programs. Arguments that short-cut fusion is correct typically appeal either to intuition or to free theorems—even though the latter have not been known to hold for the languages supporting higher-order polymorphic functions and fixed point recursion in which short-cut fusion is usually applied. In this paper we use Pitts' recent demonstration that contextual equivalence in such languages is relationally parametric to prove that programs in them which have undergone short-cut fusion are contextually equivalent to their unfused counterparts. For each algebraic data type we then define a generalization of build which constructs substitution instances of its associated data structures, and use Pitts' techniques to prove the correctness of a contextual equivalence-preserving fusion rule which generalizes short-cut fusion. These rules optimize compositions of functions that uniformly consume algebraic data structures with functions that uniformly produce substitution instances of those data sructures. |
| |
Keywords: | functional programming program transformation polymorphism parametricity operational semantics correctness proofs short-cut fusion theorems for free |
本文献已被 SpringerLink 等数据库收录! |