A Generalization of Short-Cut Fusion and its Correctness Proof

  • Authors:
  • Patricia Johann

  • Affiliations:
  • Department of Computer Science, Rutgers University, Camden, NJ 08102, USA. pjohann@crab.rutgers.edu

  • Venue:
  • Higher-Order and Symbolic Computation
  • Year:
  • 2002

Quantified Score

Hi-index 0.00

Visualization

Abstract

Short-cut fusion is a program transformation technique that uses a single, local transformation—called the \tt 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 \tt 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.