Summary
We propose a program transformation method based on rewriting-rules composed of second-order schemas. A complete second-order matching algorithm is presented that allows effective use of these rules. We show how to formally prove the correctness of the rules using a denotational semantics for the programming language. We establish the correctness of the transformation method itself, and give techniques pertaining to its actual implementation. The paper is illustrated with recursion removal examples.
Similar content being viewed by others
References
Bauer, F.L., Broy, M., Gnatz, R., Hesse, W., Krieg-Brückner, B.: Notes on the project CIP: Outline of a transformation system. Technische Universität München, TUM-INFO-7729, July 1977
Bird, R.S.: Notes on recursion elimination. Comm. ACM 20, 434–439 (1977)
Boyer, B., Moore, J.: Proving theorems about LISP functions. J. Assoc. Comput. Mach. 22, 129–144 (1975)
Burstall, R., Darlington, J.: Some transformations for developping recursive programs. Proceedings International Conference on Reliable Software, Los Angeles, California, 1975. Also: J. Assoc. Comput. Mach. 24, 44–67 (1977)
Chandra, A.K.: Efficient compilation of linear recursive programs. Res. Rep. CS-72-282, Stanford University, 1972
Cohen, N.H.: Mechanical analysis and restructuring of recursive programs. Internal Report, Harvard University, May 1976
Cooper, D.C.: The equivalence of certain computations. Comput. J. 9, 45–52 (1966)
Darlington, J.: A semantic approach to automatic program improvement. Ph.D. Thesis, Dept. of Machine Intelligence, University of Edinburgh, 1972
Darlington, J., Burstall, R.: A system which automatically improves programs. Proceedings of the 3 International Joint Conference on Artificial Intelligence, 1973, Stanford, Cal., pp. 479–484. Also: Acta Informat. 6, 41–60 (1976)
Dershowitz, N., Manna, Z.: The evolution of programs: a system for automatic program modification. Proceedings of 4th POPL Conference, Los Angeles, 1977
Donzeau-Gouge, V., Huet, G., Kahn, G., Lang, B., Lévy, J.J.: A structure-oriented program editor: a first step towards computer assisted programming. Proceedings of ICS, Antibes, France, 1975
Gerhart, S.: Correctness preserving program transformations. Proceedings of 2nd POPL Conference, Palo Alto, 1975
Gerhart, S.: Knowledge about programs: a model and case study. Proc. of Intern. Conf. on Reliable Software, Los Angeles, 1975
Gordon, M., Milner, R., Wadsworth, C.: Edinburgh LCF. University of Edinburgh, CSR-11-77, September 1977
Huet, G.: Résolution d'Equations dans des Langages d'ordre 1, 2, ...,ω. Thèse d'Etat, Paris VII, 1976
Huet, G.: A unification algorithm for typed λ-calculus. Theoret. Comput. Sci. 1, 27–58 (1975)
Huet, G.: Confluent reductions: abstract properties and application to term rewriting systems. Proc. of Foundations of Computer Science Conference, Providence, 1977
Knuth, D., Bendix, P.: Simple word problems in universal algebras. In: Computational problems in abstract algebra (J. Leech, ed.). Oxford: Pergamon Press 1969
Knuth, D., Stevenson, P.: Optimal measurement points for program frequency counts. Nordisk Tidskr. Informationsbehandling (BIT) 13, 313–322 (1973)
Lang, B.: Threshold evaluation and the semantics of call by value, assignment and generic procedures. Proceedings of 4th Conf. on Principles of Prog. Lang., Los Angeles, 1977
Loveman, D.B.: Program improvement by source-to-source transformation. J. Assoc. Comput. Mach. 24, 121–145 (1977)
Manna, Z., Ness, S., Vuillemin, J.: Inductive methods for proving properties of programs. Comm. ACM 15, 7 (1972)
McCarthy, J.: Recursive functions of symbolic expressions and their computation by machine. Part I. Comm. ACM 3, 184–204 (1960)
Milne, R.E., Strachey, C.: A theory of programming language semantics. London: Chapman & Hall; New York: Wiley 1976
Milner, R.: Implementation and applications of Scott's logic for computable functions. Proc. ACM Conference on Proving Assertions about Programs, Las Cruces, New Mexico, 1972
Milner, R.: Models of LCF. Stanford Artificial Intelligence Laboratory Memo AIM-186, January 1973
Mont-Reynault, B.: Forthcoming Ph.D. thesis, Stanford University, 1978
Paterson, M., Hewitt, C.: Comparative schematology. Record of Project MAC Conference on Concurrent Systems and Parallel Computations, ACM, New Jersey, pp. 119–128, 1970
Roboh, R., Sacerdoti, E.: Q.LISP reference manual. Technical Note 81, SPI, Aug. 1973
Standish, T.A., Harriman, D.C., Kibler, D.F., Neighbors, J.M.: The Irvine program transformation catalogue. Dept. Inform. and Computer Science, Univ. of California at Irvine, Irvine, Calif., Jan. 1976
Standish, T.A., Harriman, D.C., Kibler, D.F., Neighbors, J.M.: Improving and refining programs by program manipulation. Proc. 1976 ACM Annual Conf., Oct. 20–22, pp. 509–516, 1976
Steinbrüggen, R.: Equivalent recursive definitions of certain number theoretical functions. Technical Report INFO-7714, Technische Universität München, June 1977
Stickel, M.: Forthcoming Ph.D. thesis, Carnegie Mellon University, 1978
Strong, R.: Translating recursion equations into flow charts. J. Comput. System Sci. 5, 254–285 (1971)
Tennent, R.D.: The denotational semantics of programming languages. Comm. ACM 19, 437–453 (1976)
Vuillemin, J.: Syntaxe, semantique et axiomatique d'un langage de programmation simple. Thèse de Doctorat ès-sciences, Mathematiques Université de Paris VI, Paris, 1974
Walker, S.A., Strong, H.R.: Characterizations of flowchartable recursions. J. Comput. System Sci. 7, 404–447 (1973)
Wegbreit, B.: Mechanical program analysis. Comm. ACM 18, 528–539 (1975)
Wegbreit, B.: Goal-directed program transformation. IEEE Trans. Software Engrg. 2, 69–80 (1976)
Author information
Authors and Affiliations
Additional information
A preliminary version of this paper appeared in the Proceedings of the International School of Theory and Application of Computers, ERICE (Sicily), May 1976
Rights and permissions
About this article
Cite this article
Huet, G., Lang, B. Proving and applying program transformations expressed with second-order patterns. Acta Informatica 11, 31–55 (1978). https://doi.org/10.1007/BF00264598
Received:
Issue Date:
DOI: https://doi.org/10.1007/BF00264598