Skip to main content
Log in

Proving and applying program transformations expressed with second-order patterns

  • Published:
Acta Informatica Aims and scope Submit manuscript

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.

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

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Similar content being viewed by others

References

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

  2. Bird, R.S.: Notes on recursion elimination. Comm. ACM 20, 434–439 (1977)

    Google Scholar 

  3. Boyer, B., Moore, J.: Proving theorems about LISP functions. J. Assoc. Comput. Mach. 22, 129–144 (1975)

    Google Scholar 

  4. 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)

  5. Chandra, A.K.: Efficient compilation of linear recursive programs. Res. Rep. CS-72-282, Stanford University, 1972

  6. Cohen, N.H.: Mechanical analysis and restructuring of recursive programs. Internal Report, Harvard University, May 1976

  7. Cooper, D.C.: The equivalence of certain computations. Comput. J. 9, 45–52 (1966)

    Google Scholar 

  8. Darlington, J.: A semantic approach to automatic program improvement. Ph.D. Thesis, Dept. of Machine Intelligence, University of Edinburgh, 1972

  9. 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)

  10. Dershowitz, N., Manna, Z.: The evolution of programs: a system for automatic program modification. Proceedings of 4th POPL Conference, Los Angeles, 1977

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

  12. Gerhart, S.: Correctness preserving program transformations. Proceedings of 2nd POPL Conference, Palo Alto, 1975

  13. Gerhart, S.: Knowledge about programs: a model and case study. Proc. of Intern. Conf. on Reliable Software, Los Angeles, 1975

  14. Gordon, M., Milner, R., Wadsworth, C.: Edinburgh LCF. University of Edinburgh, CSR-11-77, September 1977

  15. Huet, G.: Résolution d'Equations dans des Langages d'ordre 1, 2, ...,ω. Thèse d'Etat, Paris VII, 1976

  16. Huet, G.: A unification algorithm for typed λ-calculus. Theoret. Comput. Sci. 1, 27–58 (1975)

    Google Scholar 

  17. Huet, G.: Confluent reductions: abstract properties and application to term rewriting systems. Proc. of Foundations of Computer Science Conference, Providence, 1977

  18. Knuth, D., Bendix, P.: Simple word problems in universal algebras. In: Computational problems in abstract algebra (J. Leech, ed.). Oxford: Pergamon Press 1969

    Google Scholar 

  19. Knuth, D., Stevenson, P.: Optimal measurement points for program frequency counts. Nordisk Tidskr. Informationsbehandling (BIT) 13, 313–322 (1973)

    Google Scholar 

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

  21. Loveman, D.B.: Program improvement by source-to-source transformation. J. Assoc. Comput. Mach. 24, 121–145 (1977)

    Google Scholar 

  22. Manna, Z., Ness, S., Vuillemin, J.: Inductive methods for proving properties of programs. Comm. ACM 15, 7 (1972)

    Google Scholar 

  23. McCarthy, J.: Recursive functions of symbolic expressions and their computation by machine. Part I. Comm. ACM 3, 184–204 (1960)

    Google Scholar 

  24. Milne, R.E., Strachey, C.: A theory of programming language semantics. London: Chapman & Hall; New York: Wiley 1976

    Google Scholar 

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

  26. Milner, R.: Models of LCF. Stanford Artificial Intelligence Laboratory Memo AIM-186, January 1973

  27. Mont-Reynault, B.: Forthcoming Ph.D. thesis, Stanford University, 1978

  28. Paterson, M., Hewitt, C.: Comparative schematology. Record of Project MAC Conference on Concurrent Systems and Parallel Computations, ACM, New Jersey, pp. 119–128, 1970

    Google Scholar 

  29. Roboh, R., Sacerdoti, E.: Q.LISP reference manual. Technical Note 81, SPI, Aug. 1973

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

    Google Scholar 

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

  32. Steinbrüggen, R.: Equivalent recursive definitions of certain number theoretical functions. Technical Report INFO-7714, Technische Universität München, June 1977

  33. Stickel, M.: Forthcoming Ph.D. thesis, Carnegie Mellon University, 1978

  34. Strong, R.: Translating recursion equations into flow charts. J. Comput. System Sci. 5, 254–285 (1971)

    Google Scholar 

  35. Tennent, R.D.: The denotational semantics of programming languages. Comm. ACM 19, 437–453 (1976)

    Google Scholar 

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

    Google Scholar 

  37. Walker, S.A., Strong, H.R.: Characterizations of flowchartable recursions. J. Comput. System Sci. 7, 404–447 (1973)

    Google Scholar 

  38. Wegbreit, B.: Mechanical program analysis. Comm. ACM 18, 528–539 (1975)

    Google Scholar 

  39. Wegbreit, B.: Goal-directed program transformation. IEEE Trans. Software Engrg. 2, 69–80 (1976)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

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

Reprints 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

Download citation

  • Received:

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF00264598

Keywords

Navigation