skip to main content
10.1145/1069774.1069780acmconferencesArticle/Chapter ViewAbstractPublication PagesppdpConference Proceedingsconference-collections
Article

Program transformation by templates based on term rewriting

Published: 11 July 2005 Publication History

Abstract

Huet and Lang (1978) presented a framework of automated program transformation based on lambda calculus in which programs are transformed according to a given program transformation template. They introduced a second-order matching algorithm of simply-typed lambda calculus to verify whether the input program matches the template. They also showed how to validate the correctness of the program transformation using the denotational semantics.We propose in this paper a framework of program transformation by templates based on term rewriting. In our new framework, programs are given by term rewriting systems. To automate our program transformation, we introduce a term pattern matching problem and present a sound and complete algorithm that solves this problem.We also discuss how to validate the correctness of program transformation in our framework. We introduce a notion of developed templates and a simple method to construct such templates without explicit use of induction. We then show that in any program transformation by developed templates the correctness of the transformation can be verified automatically. In our framework the correctness of the program transformation is discussed based on the operational semantics. This is a sharp contrast to Huet and Lang's framework.

References

[1]
F. Baader and T. Nipkow. Term Rewriting and All That. Cambridge University Press, 1998.
[2]
A. Bouhoula, E. Kounalis, and M. Rusinowitch. Automated mathematical induction. Journal of Logic and Computation, 5(5):631--668, 1995.
[3]
H. Comon, M. Dauchet, R. Gilleron, F. Jacquemard, D. Lugiez, S. Tison, and M. Tommasi. Tree Automata Techniques and Applications. 1997.
[4]
R. Curien, Z. Qian, and H. Shi. Efficient second-order matching. In Proceedings of the 7th International Conference on Rewriting Techniques and Applications, volume 1103 of LNCS, pages 317--331. Springer-Verlag, 1996.
[5]
O. de Moor and G. Sittampalam. Generic program transformation. In Proceedings of the 3rd International Summer School on Advanced Functional Programming, volume 1608 of LNCS, pages 116--149. Springer-Verlag, 1999.
[6]
O. de Moor and G. Sittampalam. Higher-order matching for program transformation. Theoretical Computer Science, 269:135--162, 2001.
[7]
J. Giesl, R. Thiemann, P. Schneider-Kamp, and S. Falke. Automated termination proofs with AProVE. In Proceedings of the 15th International Conference on Rewriting Techniques and Applications, volume 3091 of LNCS, pages 210--220. Springer-Verlag, 2004.
[8]
K. Hirata, K. Yamada, and M. Harao. Tractable and intractable second-order matching problems. Journal of Symbolic Computation, 37(5):611--628, 2004.
[9]
N. Hirokawa and A. Middeldorp. Tsukuba termination tool. In Proceedings of the 14th International Conference on Rewriting Techniques and Applications, volume 2706 of LNCS, pages 311--320. Springer-Verlag, 2003.
[10]
G. Huet. A unification algorithm for typed λ-calculus. Theoretical Computer Science, 1:27--57, 1975.
[11]
G. Huet and B. Lang. Proving and applying program transformations expressed with second order patterns. Acta Informatica, 11:31--55, 1978.
[12]
S. Kamin and J.-J. Lévy. Two generalizations of the recursive path ordering. Unpublished manuscript, University of Illinois, 1980.
[13]
U. S. Reddy. Term rewriting induction. In Proceedings of the 10th International Conference on Automated Deduction, volume 449 of LNAI, pages 162--177, 1990.
[14]
G. Sittampalam. Higher-Order Matching for Program Transformation. PhD thesis, Magdalen College, 2001.
[15]
Terese. Term Rewriting Systems. Cambridge University Press, 2003.
[16]
Y. Toyama. Commutativity of term rewriting systems. In The Second France-Japan Artificial Intelligence and Computer Science Symposium, 1987.
[17]
Y. Toyama. How to prove equivalence of term rewriting systems without induction. Theoretical Computer Science, 90:369--390, 1991.
[18]
Eelco Visser. A survey of rewriting strategies in program transformation systems. In Workshop on Reduction Strategies in Rewriting and Programming, volume~57 of Electronic Notes in Theoretical Computer Science. Elsevier Science Publishers, 2001.
[19]
T. Yokoyama, Z. Hu, and M. Takeichi. Deterministic second-order patterns. Information Processing Letters, 89(6):309--314, 2004.

Cited By

View all
  • (2023)Optimizing Homomorphic Evaluation Circuits by Program Synthesis and Time-bounded Exhaustive SearchACM Transactions on Programming Languages and Systems10.1145/359162245:3(1-37)Online publication date: 23-Sep-2023
  • (2020)Optimizing homomorphic evaluation circuits by program synthesis and term rewritingProceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/3385412.3385996(503-518)Online publication date: 11-Jun-2020
  • (2020)Confluence and Commutation for Nominal Rewriting Systems with Atom-VariablesLogic-Based Program Synthesis and Transformation10.1007/978-3-030-68446-4_3(56-73)Online publication date: 7-Sep-2020
  • Show More Cited By

Recommendations

Reviews

Marlin W Thomas

The automatic rewriting of programming code to enhance efficiency is fundamental to compiler design, and is an important area in theoretical computer science. The most typical current practice uses templates that comprise input and output schemas and equations that programs must satisfy to ensure the correctness of the transformation. Denotational semantics provides the mechanism for formal verification. In contrast to the current standard practice, the authors use templates that comprise term rewriting systems, and they employ operational semantics for formal verification. One benefit is that their system reduces the burden of verification that is present in current standard practice. The authors provide the necessary theoretical background for their paper, develop a system of term rewriting rules using templates, demonstrate the correctness of the transformations, and present and solve a term pattern matching problem. The authors make clear that their work complements existing practice, and they detail the subtle differences that their approach provides. Readers will need to be familiar with operational semantics and the seminal work of Huet and Lang [1] to fully appreciate the argument presented and the issues addressed. Online Computing Reviews Service

Access critical reviews of Computing literature here

Become a reviewer for Computing Reviews.

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
PPDP '05: Proceedings of the 7th ACM SIGPLAN international conference on Principles and practice of declarative programming
July 2005
260 pages
ISBN:1595930906
DOI:10.1145/1069774
  • General Chair:
  • Pedro Barahona,
  • Program Chair:
  • Amy Felty
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 11 July 2005

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. inductive theorem proving
  2. program transformation
  3. term rewriting
  4. tree homomorphism

Qualifiers

  • Article

Conference

PPDP05
Sponsor:

Acceptance Rates

Overall Acceptance Rate 230 of 486 submissions, 47%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)0
  • Downloads (Last 6 weeks)0
Reflects downloads up to 15 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2023)Optimizing Homomorphic Evaluation Circuits by Program Synthesis and Time-bounded Exhaustive SearchACM Transactions on Programming Languages and Systems10.1145/359162245:3(1-37)Online publication date: 23-Sep-2023
  • (2020)Optimizing homomorphic evaluation circuits by program synthesis and term rewritingProceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/3385412.3385996(503-518)Online publication date: 11-Jun-2020
  • (2020)Confluence and Commutation for Nominal Rewriting Systems with Atom-VariablesLogic-Based Program Synthesis and Transformation10.1007/978-3-030-68446-4_3(56-73)Online publication date: 7-Sep-2020
  • (2013)A Two-Valued Logic for Properties of Strict Functional Programs Allowing Partial FunctionsJournal of Automated Reasoning10.1007/s10817-012-9253-650:4(383-421)Online publication date: 1-Apr-2013
  • (2010)Program Transformation Templates for Tupling Based on Term RewritingIEICE Transactions on Information and Systems10.1587/transinf.E93.D.963E93-D:5(963-973)Online publication date: 2010
  • (2010)A fold/unfold transformation framework for rewrite theories extended to CCTProceedings of the 2010 ACM SIGPLAN workshop on Partial evaluation and program manipulation10.1145/1706356.1706367(43-52)Online publication date: 19-Jan-2010
  • (2010)On the relation between Context and Sequence UnificationJournal of Symbolic Computation10.1016/j.jsc.2009.07.00145:1(74-95)Online publication date: 1-Jan-2010
  • (2006)RAPTProceedings of the 17th international conference on Term Rewriting and Applications10.1007/11805618_20(267-276)Online publication date: 12-Aug-2006

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media