Higher-Order Pattern Matching for Automatically Applying Fusion Transformations

  • Ganesh Sittampalam
  • Oege de Moor
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2053)


We give an algorithm for higher-order pattern matching in the context of automatic program transformation. In particular, we show how accumulating parameter optimisations of functional programs can be automatically derived with the aid of programmer annotations. These techniques have been successfully applied to some complex manual derivations in the literature, such as Bird’s “longest path-sequence”.


Fusion Rule Minimum Depth Side Condition Program Transformation General Match 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    H. P. Barendregt. The Lambda Calculus: Its Syntax and Semantics. Studies in Logic and the Foundations of Mathematics. North-Holland, 1984.zbMATHGoogle Scholar
  2. [2]
    R. S Bird. The promotion and accumulation strategies in transformational programming. ACM Transactions on Programming Languages and Systems, 6(4):487–504, 1984.zbMATHCrossRefMathSciNetGoogle Scholar
  3. [3]
    R. S Bird. Introduction to Functional Programming in Haskell. International Series in Computer Science. Prentice Hall, 1998.Google Scholar
  4. [4]
    R. S. Bird and John Hughes. An alpha-beta algorithm: an exercise in program transformation. Information Processing Letters, 24(1):53–57, 1987.CrossRefGoogle Scholar
  5. [5]
    O. Chitil. Type-inference based short cut deforestation (nearly) without inlining. In C. Clack and P. Koopman, editors, Eleventh International Workshop on Implementation of Functional Languages, Lecture Notes in Computer Science. Springer-Verlag, 2000.Google Scholar
  6. [6]
    H. Comon. Higher-order matching and tree automata. In M. Nielsen and W. Thomas, editors, Proc. Conf. on Computer Science Logic, volume 1414 of Lecture Notes in Computer Science, pages 157–176. Springer-Verlag, 1997.CrossRefGoogle Scholar
  7. [7]
    O. de Moor and G. Sittampalam. Generic program transformation. In Third International Summer School on Advanced Functional Programming, volume 1608 of Lecture Notes in Computer Science, pages 116–149. Springer-Verlag, 1998.Google Scholar
  8. [8]
    O. de Moor and G. Sittampalam. Higher-order matching for program transformation (full report). Theoretical Computer Science, To appear, 2001. Available from URL:
  9. [9]
    A. Gill, Launchbury J., and Peyton Jones S.L. A short cut to deforestation. In Conference on Functional Programming Languages and Computer Architecture, pages 223–232, June 1993.Google Scholar
  10. [10]
    G. Huet and B. Lang. Proving and applying program transformations expressed with second-order patterns. Acta Informatica, 11:31–55, 1978.zbMATHCrossRefMathSciNetGoogle Scholar
  11. [11]
    B. Krieg-Brückner, J. Liu, H. Shi, and B. Wolff. Towards correct, efficient and reusable transformational developments. In M. Broy and S. Jähnichen, editors, KORSO: Methods, Languages, and Tools for the Construction of Correct Software, volume 1009 of Lecture Notes in Computer Science, pages 270–284. Springer-Verlag, 1995.CrossRefGoogle Scholar
  12. [12]
    D. Miller. A logic programming language with lambda-abstraction, function variables, and simple unification. Journal of Logic and Computation, 1:479–536, 1991.CrossRefGoogle Scholar
  13. [13]
    T. Nipkow. Functional unification of higher-order patterns. In 8th IEEE Symposium on Logic in Computer Science, pages 64–74. IEEE Computer Society Press, 1993.Google Scholar
  14. [14]
    Y. Onoue, Z. Hu, H. Iwasaki, and M. Takeichi. A calculational fusion system hylo. In R. S. Bird and L. Meertens, editors, IFIP TC2 Working Conference on Algorithmic Languages and Calculi, pages 76–106. Chapman and Hall, 1997.Google Scholar
  15. [15]
    S. L. Peyton-Jones and A. L. M. Santos. A transformation-based optimiser for Haskell. Science of Computer Programming, 32(1-3):3–48, 1998.CrossRefGoogle Scholar
  16. [16]
    F. Pfenning and C. Elliott. Higher-order abstract syntax. In Proc. SIGPLAN’ 88 Conf. on Programming Language Design and Implementation, pages 199–208. ACM, 1988.Google Scholar
  17. [17]
    D. R. Smith. KIDS: A semiautomatic program development system. IEEE Transactions on Software Engineering, 16(9):1024–1043, 1990.CrossRefGoogle Scholar
  18. [18]
    D. A. Wolfram. The Clausal Theory of Types, volume 21 of Cambridge Tracts in Theoretical Computer Science. Cambridge University Press, 1993.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2001

Authors and Affiliations

  • Ganesh Sittampalam
    • 1
  • Oege de Moor
    • 1
  1. 1.Programming Research GroupOxford University Computing LaboratoryUK

Personalised recommendations