## Program transformation by templates based on term rewriting (2005)

### Cached

### Download Links

- [www.nue.riec.tohoku.ac.jp]
- [www.jaist.ac.jp]
- DBLP

### Other Repositories/Bibliography

Venue: | In Proceedings of the 7th ACM-SIGPLAN International Conference on Principles and Practice of Declarative Programming (PPDP 2005 |

Citations: | 5 - 3 self |

### BibTeX

@INPROCEEDINGS{Chiba05programtransformation,

author = {Yuki Chiba and Takahito Aoto},

title = {Program transformation by templates based on term rewriting},

booktitle = {In Proceedings of the 7th ACM-SIGPLAN International Conference on Principles and Practice of Declarative Programming (PPDP 2005},

year = {2005},

pages = {59--69},

publisher = {ACM Press}

}

### OpenURL

### 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.

### Citations

1015 |
T.: Term Rewriting and All That
- Baader, Nipkow
- 1998
(Show Context)
Citation Context ...rectness of transformation by developed templates is verified automatically. We conclude our result in Section 7. 2. PRELIMINARIES In this section, we introduce some notions of term rewriting systems =-=[1, 15]-=-. Let F and V be a set of function symbols and variables, respectively. We assume that these sets are mutually disjoint. Any function symbol f ∈ F has its arity (denoted by arity(f)). We define the se... |

157 | Tree Automata Techniques and Applications
- Comon, Dauchet, et al.
- 1999
(Show Context)
Citation Context ...tion of a list of lists is specified by the following TRS R. R 8 >< >: cat([ ]) → [ ] cat(x1:y1) → app(x1, cat(y1)) app([ ], x2) → x2 app(x3:y3, z3) → x3:app(y3, z3) For example, we have cat([[1, 2], =-=[3]-=-, [4, 5]]) ∗ →R [1, 2, 3, 4, 5]. Similarly to the Example 1, the transformation from the recursive form to the iterative form gives a more efficient TRS R ′ as follows. R ′ 8 >< >: cat(x4) → cat1(x4, ... |

153 |
Proving and applying program transformations expressed with second-order patterns
- Huet, Lang
- 1978
(Show Context)
Citation Context ...rem Proving 1. INTRODUCTION Transforming given programs automatically to optimize the efficiency is one of the most fascinating techniques for declarative programming languages [5, 18]. Huet and Lang =-=[11]-=- presented a framework of automated program transformation in which programs are transformed according to a given program transformation template, where the template consists of program schemas for in... |

120 |
A unification algorithm for typed λ-calculus
- Huet
- 1975
(Show Context)
Citation Context ...)) u7 s(+(u8, v8)) Thus, the output TRS is R ′ . Our TRS matching algorithm, in particular, term pattern matching algorithm and the second-order matching algorithm in lambda calculus by Huet and Lang =-=[4, 10, 11]-=- seem to have an obvious resemblance although they are incomparable. In the rest of this section, we explain this briefly. In the framework based on the lambda calculus, each program is given by a rec... |

87 |
Term Rewriting Systems
- TeReSe
- 2003
(Show Context)
Citation Context ...rectness of transformation by developed templates is verified automatically. We conclude our result in Section 7. 2. PRELIMINARIES In this section, we introduce some notions of term rewriting systems =-=[1, 15]-=-. Let F and V be a set of function symbols and variables, respectively. We assume that these sets are mutually disjoint. Any function symbol f ∈ F has its arity (denoted by arity(f)). We define the se... |

62 | Automated termination proofs with AProVE
- Giesl, Thiemann, et al.
- 2004
(Show Context)
Citation Context ...e criteria (1). But, for the later use, we remark that SN(R) can be proved easily by the lexicographic path ordering [12] which is builded in to most of automated termination tools for term rewriting =-=[7, 9]-=-. We next describe for G = {sum, :, [ ], s, 0} how SC(R, G ) is verified. For this, we assume that existence of coversets (of substitution) for sorted variables. In our example, a coverset Θ(x Nat ) f... |

51 |
Attempts for generalizing the recursive path ordering. Unpublished manuscript
- Kamin, Levy
- 1980
(Show Context)
Citation Context ...hod. For our example, since R is left-linear and non-overlapping, CR(R) holds by the criteria (1). But, for the later use, we remark that SN(R) can be proved easily by the lexicographic path ordering =-=[12]-=- which is builded in to most of automated termination tools for term rewriting [7, 9]. We next describe for G = {sum, :, [ ], s, 0} how SC(R, G ) is verified. For this, we assume that existence of cov... |

46 |
Term rewriting induction
- Reddy
- 1990
(Show Context)
Citation Context ...ere G ′ = G ∪ {sum1}. Finally, a short remark on how inductive validity is proved automatically. In fact, this can be proved by automated inductive theorem proving methods such as rewriting induction =-=[2, 13]-=-. In our case, since SN(R), one easily verifies automatically that any equations in E 8 < : +(x Nat , 0) ≈ +(0, x Nat ) +(+(x Nat , y Nat ), z Nat ) ≈ +(x Nat , +(y Nat , z Nat )) are inductively vali... |

32 | G.: Generic program transformation
- Moor, Sittampalam
- 1998
(Show Context)
Citation Context ...orphism, Inductive Theorem Proving 1. INTRODUCTION Transforming given programs automatically to optimize the efficiency is one of the most fascinating techniques for declarative programming languages =-=[5, 18]-=-. Huet and Lang [11] presented a framework of automated program transformation in which programs are transformed according to a given program transformation template, where the template consists of pr... |

29 | A survey of rewriting strategies in program transformation systems
- Visser
- 2001
(Show Context)
Citation Context ...orphism, Inductive Theorem Proving 1. INTRODUCTION Transforming given programs automatically to optimize the efficiency is one of the most fascinating techniques for declarative programming languages =-=[5, 18]-=-. Huet and Lang [11] presented a framework of automated program transformation in which programs are transformed according to a given program transformation template, where the template consists of pr... |

25 | Automated mathematical induction
- Bouhoula, Kounalis, et al.
- 1995
(Show Context)
Citation Context ...ncatenation of a list of lists is specified by the following TRS R. R 8 >< >: cat([ ]) → [ ] cat(x1:y1) → app(x1, cat(y1)) app([ ], x2) → x2 app(x3:y3, z3) → x3:app(y3, z3) For example, we have cat([=-=[1, 2]-=-, [3], [4, 5]]) ∗ →R [1, 2, 3, 4, 5]. Similarly to the Example 1, the transformation from the recursive form to the iterative form gives a more efficient TRS R ′ as follows. R ′ 8 >< >: cat(x4) → cat1... |

21 | Efficient second-order matching
- Curien, Qian, et al.
- 1996
(Show Context)
Citation Context ...n be applied to an input program. They also showed how to validate the correctness of the program transformation using the denotational semantics. After Huet and Lang’s pioneering work, Curien et al. =-=[4]-=- gave an improved matching algorithm by top down matching method. Yokoyama et al. [19] presented a sufficient condition to have at most one solution and a deterministic algorithm to find such a soluti... |

19 | Tsukuba termination tool
- Hirokawa, Middeldorp
- 2003
(Show Context)
Citation Context ...e criteria (1). But, for the later use, we remark that SN(R) can be proved easily by the lexicographic path ordering [12] which is builded in to most of automated termination tools for term rewriting =-=[7, 9]-=-. We next describe for G = {sum, :, [ ], s, 0} how SC(R, G ) is verified. For this, we assume that existence of coversets (of substitution) for sorted variables. In our example, a coverset Θ(x Nat ) f... |

17 | Higher-order matching for program transformation
- Moor, Sittampalam
- 2001
(Show Context)
Citation Context ...y top down matching method. Yokoyama et al. [19] presented a sufficient condition to have at most one solution and a deterministic algorithm to find such a solution. Recently, de Moor and Sittampalam =-=[6]-=- gave a matching algorithm that can be applied also to third-order matching problems. In all of these algorithms, programs are represented by lambda terms and higher-order substitutions are performed ... |

16 | Commutativity of term rewriting systems
- Toyama
- 1988
(Show Context)
Citation Context ... CR(R0) and the fact that each introduced rewrite rule f(x1, . . . , xn) → r at i + 1 is left-linear and non-overlapping with left-linear TRS Ri, it follows that CR(RI) using the commutativity of TRSs=-=[16, 17]-=-. Thus for RI, we have (1) SC(RI, F ), (2) R ⊆ RI, and (3) CR(RI). We next show that ∗ ↔R = ∗ ↔R ′ on T (G ∩ G ′ ). 1. ∗ ↔R = ∗ ↔R I on T (G ). (i.e. for any s, t ∈ T (G ), s ∗ ↔R t iff s ∗ ↔R I t.) (... |

11 | Tractable and intractable second-order matching problems
- Hirata, Yamada, et al.
(Show Context)
Citation Context ...m transformation by developed templates the correctness of the transformation is verified automatically. We now compare our framework for the program transformation and those based on lambda calculus =-=[4, 6, 8, 10, 11, 14]-=-. There is no significant difference between the second-order matching algorithm by Huet and Lang [11] and ours. However, we preferred organizing the matching algorithm in the rewriting framework to e... |

8 |
How to prove equivalence of term rewriting systems without induction
- Toyama
- 1991
(Show Context)
Citation Context ...alent is an undecidable problem in general, for some restricted class of leftlinear TRSs, it is known that two TRSs are equivalent when there exists an equivalent transformation from one to the other =-=[17]-=-. We now simplify and improve this technique for our framework. For a set G of function symbols, we speak of a TRS R (or a set E of equations) over G when all rewrite rules (resp. equations) consist o... |

4 | Deterministic second-order patterns
- Yokoyama, Hu, et al.
- 2004
(Show Context)
Citation Context ... the program transformation using the denotational semantics. After Huet and Lang’s pioneering work, Curien et al. [4] gave an improved matching algorithm by top down matching method. Yokoyama et al. =-=[19]-=- presented a sufficient condition to have at most one solution and a deterministic algorithm to find such a solution. Recently, de Moor and Sittampalam [6] gave a matching algorithm that can be applie... |