# Computing with conditional rewrite rules

## Abstract

We present a method for validating abstract data type specifications. The method takes as input a set of ground terms *L*_{0} and a set of conditional equations *A*_{0} over *L*_{0}. The object of this method is to find a normal form function, Norm, for the pair 〈 *L*_{0}, *A*_{0} 〉. The function Norm is computed as a sequence of step functions *S*_{1}, *S*_{2}, ..., *S*_{n}.

Each step function *S*_{i}, 0 ≤ *i* ≤ *n*, takes as input a pair 〈 *L*_{i−1}, *A*_{i−1} 〉, where *L*_{i−1} is a set of ground terms and *A*_{i} is a set of conditional equations over the set of terms *L*_{i−1}. At each step i, a set of equations *E*_{i} is selected from the set of theorems of the pair 〈 *L*_{i−1}, *A*_{i−1} 〉. The set of equations *E*_{i} is transformed into a set of reductions *R*_{i}. The step function *S*_{i} is defined as the top-down reduction extention of *R*_{i} to *L*_{i−1}. The output of *S*_{i} is the pair 〈 *L*_{i}, A_{i} 〉, where *L*_{i} is the set of normal forms of *L*_{i−1} under the set of reductions *R*_{i} and *A*_{i} is the set of normal forms of the equations in *A*_{i−1} under the same set of reductions. This way, a theorem in the system 〈 *L*_{i−1}, *A*_{i−1} 〉 becomes a theorem in the system 〈 *L*_{i}, A_{i} 〉. The last step, *S*_{n}, has as output the pair 〈 *L*_{n}, φ 〉. The only theorems in 〈 *L*_{n}, φ 〉 are the identities. This way the sequence\(< L_0 ,A_0 > \mathop \to \limits^{S_1 } < L_1 ,A_1 > \mathop \to \limits^{S_2 } ... < L_{n - 1} ,A_{n - 1} > \mathop \to \limits^{S_n } < A_n ,\phi >\)gives us a procedure to compute the normal form of the terms in 〈 *L*_{0}, *A*_{0} 〉.

In this paper we present criteria for choosing the sets of equations *E*_{i} which simplify the pair 〈 *L*_{i−1}, *A*_{i−1} 〉. We also present results that characterize the output set 〈 *L*_{i}, A_{i} 〉 of *S*_{i} as a function of the set 〈 *L*_{i−1}, *A*_{i−1} 〉 and of the set of reductions *R*_{i}. If the sets of reductions *R*_{i} are confluent and terminating, then they can be combined, by using a priority system similar to the one developed by Baeten, Bergstra and Klop, to form a confluent and terminating set of reductions on the set 〈 *L*_{0}, *A*_{0} 〉.

## Keywords

Normal Form Free Algebra Transfer Property Computation Sequence Ground Term## Preview

Unable to display preview. Download preview PDF.

## 5. Bibliography

- 1.Baeten, J.C.M.,Bergstra, J.A., and Klop, J.W.:“Term Rewriting Systems with Priorities”, in
*Proceedings of the 2nd Conference on Rewriting Techniques and Applications*, edited by P.Lescanne, Springer-Verlag Lecture Notes in Computer Science, Vol. 256, 1987, pp. 83–94.Google Scholar - 2.Ehrig,H. and Mahr,B.:
*Fundamentals of Algebraic Specifications 1: Equations and Initial Semantics*, Springer-Verlag, 1985.Google Scholar - 3.Goguen,J.A., Thatcher,J.W., Wagner, E.G.:“An Initial Algebra Approach to the Specification, Correctness and Implementation of Abstract Data Types”, in
*Current Trends in Programming Methodology IV: Data Structuring*, Editor R. Yeah, Prentice Hall, 1978, pp. 80–144.Google Scholar - 4.Huet, G.:“Confluent Reductions: Abstract Properties and Applications”, in
*Journal of the ACM*, Vol. 27, 1980,pp. 797–821.CrossRefGoogle Scholar - 5.Huet,G.,and Oppen,D.:“Equations and Rewrite Rules:A Survey”, in
*Formal Language Theory:Perspectives and Open Problems*, Editor R.Book, Academic Press, 1980,pp. 349–405.Google Scholar - 6.Jouannaud, J. and Kirchner, H.:“Completion of a Set Rules Modulo a Set of Equations”,
*SIAM Journal of Computing*, Vol.15(4), 1986, pp. 1155–1194.CrossRefGoogle Scholar - 7.Kaplan,S.:“Symplifying Conditional Term Rewriting Systems: Unification, Termination and Confluence”,
*L.R.I. Report 316*, December, 1986.Google Scholar - 8.Klop,J.W.:“Term Rewriting Systems: A Tutorial”,in
*Bulletin of EATCS*,No.32, June 1987, pp.143–182.Google Scholar - 9.Knuth,D. and Bendix, P.:“Simple Word Problems in Universal Algebras”, in
*Computational Problems in Abstract Algebra*, edited by J. Leech, Pergamon Press, 1970, pp. 263–297.Google Scholar - 10.Pelin,A., and Gallier,J.:“Building Exact Computation Sequences”, to appear in
*Theoretical Computer Science*.Google Scholar - 11.Pelin,A., and Gallier,J.:“Exact Computation Sequences”, in
*11th Colloquium on Trees in Algebra and Programming*, edited by P. Franchi-Zannettacci, Springer-Verlag Lecture Notes in Computer Science, Vol. 214, pp.45–59.Google Scholar - 12.Zhang,H., and Remy,J.-L.: “Contextual Rewriting”, in
*Proceedings of the 1st Conference on Rewriting Techniques and Applications*, edited by J.P. Jouannaud, Springer-Verlag Lecture notes in Computer Science, Vol. 202, pp. 46–62.Google Scholar