Skip to main content

Deterministic Higher-Order Patterns for Program Transformation

  • Conference paper
Logic Based Program Synthesis and Transformation (LOPSTR 2003)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 3018))

Abstract

Higher-order patterns, together with higher-order matching, enable concise specification of program transformation, and have been implemented in several program transformation systems. However,higher-order matching in general is nondeterministic, and the matching algorithm is so expensive that even second-order matching is NP-complete. It is orthodox to impose constraint on the form of patterns to obtain the desirable matches satisfying certain properties such as decidability and finiteness. In the context of unification, Miller’s higher-order patterns have a single most general unifier. We relax the restrictions in his patterns without changing determinism within the context of matching instead of unification. As a consequence, the new class of patterns covers a wide class of useful patterns for program transformation. The time-complexity of the matching algorithm is linear for the size of a term for a fixed pattern.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Huet, G.P., Lang, B.: Proving and applying program transformations expressed with second-order patterns. Acta Informatica 11, 31–55 (1978)

    Article  MATH  MathSciNet  Google Scholar 

  2. de Moor, O., Sittampalam, G.: Higher-order matching for program transformation. Theoretical Computer Science 269, 135–162 (2001)

    Article  MATH  MathSciNet  Google Scholar 

  3. Krieg-Brückner, B., Liu, J., Shi, H., Wolff, B.: Towards correct, efficient and reusable transformational developments. In: Broy, M., Jähnichen, S. (eds.) KORSO 1995. LNCS, vol. 1009, pp. 270–284. Springer, Heidelberg (1995)

    Chapter  Google Scholar 

  4. Gill, A., Launchbury, J., Jones, S.L.P.: A short cut to deforestation. In: Proceedings of the 6th International Conference on Functional Programming Languages and Computer Architecture (FPCA 1993), Copenhagen, Denmark, pp. 223–232. ACM Press, New York (1993)

    Chapter  Google Scholar 

  5. Sheard, T., Launchbury, J.: Warm fusion: Deriving build-catas from recursive definitions. In: Conference on Functional Programming Languages and Computer Architecture, La Jolla, CA, USA, ACM, pp. 314–323. ACM, New York (1995)

    Google Scholar 

  6. Bird, R.: Introduction to Functional Programming using Haskell, 2nd edn. Prentice-Hall, Englewood Cliffs (1998)

    Google Scholar 

  7. Baxter, L.: The complexity of unification. PhD thesis, Department of Computer Science, University of Waterloo (1977)

    Google Scholar 

  8. Schubert, A.: Linear interpolation for the higher-order matching problem. In: Bidoit, M., Dauchet, M. (eds.) CAAP 1997, FASE 1997, and TAPSOFT 1997. LNCS, vol. 1214, pp. 441–452. Springer, Heidelberg (1997)

    Chapter  Google Scholar 

  9. Miller, D.: A logic programming language with lambda-abstraction, function variables, and simple unification. Journal of Logic and Computation 1, 497–536 (1991)

    Article  MATH  MathSciNet  Google Scholar 

  10. Nipkow, T.: Functional unification of higher-order patterns. In: 8th IEEE Symposium on Logic in Computer Science, pp. 64–74. IEEE Computer Society Press, Los Alamitos (1993)

    Google Scholar 

  11. Meijer, E., Fokkinga, M., Paterson, R.: Functional programming with bananas, lenses, envelopes and barbed wire. In: Hughes, J. (ed.) FPCA 1991. LNCS, vol. 523, pp. 124–144. Springer, Heidelberg (1991)

    Google Scholar 

  12. Sheard, T., Fegaras, L.: A fold for all seasons. In: Conference on Functional Programming Languages and Computer Architecture, pp. 233–242 (1993)

    Google Scholar 

  13. Heckmann, R.: A functional language for the specification of complex tree transformation. In: Ganzinger, H. (ed.) ESOP 1988. LNCS, vol. 300, pp. 175–190. Springer, Heidelberg (1988)

    Google Scholar 

  14. Sheard, T., Peyton Jones, S.L.: Template metaprogramming for Haskell. In: Haskell Workshop, Pittsburgh, Pennsylvania, pp. 1–16 (2002)

    Google Scholar 

  15. Hu, Z., Iwasaki, H., Takeichi, M., Takano, A.: Tupling calculation eliminates multiple data traversals. In: Proceedings of the 2nd ACM SIGPLAN International Conference on Functional Programming (ICFP 1997), Amsterdam, The Netherlands, pp. 164–175. ACM Press, New York (1997)

    Chapter  Google Scholar 

  16. Curien, R., Qian, Z., Shi, H.: Efficient second-order matching. In: Ganzinger, H. (ed.) RTA 1996. LNCS, vol. 1103, pp. 317–331. Springer, Heidelberg (1996)

    Google Scholar 

  17. Wierzbicki, T.: Complexity of the higher order matching. In: Ganzinger, H. (ed.) CADE 1999. LNCS (LNAI), vol. 1632, pp. 82–96. Springer, Heidelberg (1999)

    Chapter  Google Scholar 

  18. Hirata, K., Yamada, K., Harao, M.: Tractable and intractable second-order matching problems. In: Asano, T., Imai, H., Lee, D.T., Nakano, S.-i., Tokuyama, T. (eds.) COCOON 1999. LNCS, vol. 1627, pp. 432–441. Springer, Heidelberg (1999)

    Chapter  Google Scholar 

  19. Schmidt-Schauß, M., Stuber, J.: On the complexity of linear and stratified context matching problems. Rapport de Recherche RR-4923, Institut National de Recherche en Informatique et en Automatique (2003)

    Google Scholar 

  20. Guttmann, W., Partsch, H., Schulte, W., Vullinghs, T.: Tool support for the interactive derivation of formally correct functional programs. Journal of Universal Computer Science 9, 173–188 (2003)

    Google Scholar 

  21. Peyton Jones, S.L., Tolmach, A., Hoare, T.: Playing by the rules: rewriting as a practical optimisation technique in ghc. In: Haskell Workshop (2001)

    Google Scholar 

  22. Visser, E.: Stratego: A language for program transformation based on rewriting strategies. system description of stratego 0.5. In Middeldorp. In: Middeldorp, A. (ed.) RTA 2001. LNCS, vol. 2051, pp. 357–362. Springer, Heidelberg (2001)

    Chapter  Google Scholar 

  23. Bauer, F., Ehler, H., Horsch, B., Möller, B., Partsch, H., Paukner, O., Pepper, P. (eds.): The Munich Project CIP. LNCS, vol. 292. Springer, Heidelberg (1988)

    Google Scholar 

  24. Taha, W., Sheard, T.: Multi-stage programming with explicit annotations. In: Proc. Conference on Partial Evaluation and Program Manipulation, Amsterdam, Amsterdam, pp. 203–217. ACM Press, New York (1997)

    Google Scholar 

  25. Tullsen, M., Hudak, P.: An intermediate meta-language for program transformation. Research report yaleu/dcs/rr-1154, Department of Computer Science, Yale University (1998)

    Google Scholar 

  26. de Moor, O., Sittampalam, G.: Generic program transformation. In: Swierstra, S.D., Oliveira, J.N. (eds.) AFP 1998. LNCS, vol. 1608, pp. 116–149. Springer, Heidelberg (1999)

    Chapter  Google Scholar 

  27. Sittampalam, G.: Higher-order matching for program transformation. PhD thesis, University of Oxford (2001)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2004 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Yokoyama, T., Hu, Z., Takeichi, M. (2004). Deterministic Higher-Order Patterns for Program Transformation. In: Bruynooghe, M. (eds) Logic Based Program Synthesis and Transformation. LOPSTR 2003. Lecture Notes in Computer Science, vol 3018. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-25938-1_12

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-25938-1_12

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-22174-6

  • Online ISBN: 978-3-540-25938-1

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics