Representing proof transformations for program optimization

  • Penny Anderson
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 814)


In the proofs as programs methodology a program is derived from a formal constructive proof. Because of the close relationship between proof and program structure, transformations can be applied to proofs rather than to programs in order to improve performance. We describe a method for implementing transformations of formal proofs and show that it is applicable to the optimization of extracted programs. The method is based on the representation of derived logical rules in Elf, a logic programming language that gives an operational interpretation to the Edinburgh Logical Framework. It results in declarative implementations with a general correctness property that is verified automatically by the Elf type checking algorithm. We illustrate the technique by applying it to the problem of transforming a recursive function definition to obtain a tail-recursive form.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Penny Anderson. Program Derivation by Proof Transformation. PhD thesis, Department of Computer Science, Carnegie Mellon University, October 1993. Available as Technical Report CMU-CS-93-206.Google Scholar
  2. 2.
    Penny Anderson. Program extraction in a logical framework setting. In Proceedings of the 5th International Conference on Logic Programming and Automated Reasoning, July 1994. To appear.Google Scholar
  3. 3.
    Henk Barendregt. Introduction to generalized type systems. Journal of Functional Programming, 1(2):125–154, April 1991.Google Scholar
  4. 4.
    R.S. Bird. The promotion and accumulation strategies in transformational programming. ACM Transactions on Programming Languages and Systems, 6(4):487–504, October 1984.Google Scholar
  5. 5.
    R. M. Burstall and John Darlington. A transformation system for developing recursive programs. Journal of the Association for Computing Machinery, 24(1):44–67, January 1977.Google Scholar
  6. 6.
    Robert L. Constable et al. Implementing Mathematics with the Nuprl Proof Development System. Prentice-Hall, Englewood Cliffs, New Jersey, 1986.Google Scholar
  7. 7.
    Gilles Dowek, Amy Felty, Hugo Herbelin, Gérard Huet, Christine Paulin-Mohring, and Benjamin Werner. The Coq proof assistant user's guide. Rapport Technique 134, INRIA, Rocquencourt, France, December 1991. Version 5.6.Google Scholar
  8. 8.
    Amy Felty. Specifying and Implementing Theorem Provers in a Higher-Order Logic Programming Language. PhD thesis, Department of Computer and Information Science, University of Pennsylvania, July 1989. Available as Technical Report MS-CIS-89-53.Google Scholar
  9. 9.
    Amy Felty. Implementing tactics and tacticals in a higher-order logic programming language. Journal of Automated Reasoning, 11:43–81, 1993.Google Scholar
  10. 10.
    Christopher A. Goad. Computational uses of the manipulation of formal proofs. Technical Report Stan-CS-80-819, Stanford University, August 1980.Google Scholar
  11. 11.
    David Gries. The Science of Programming. Springer-Verlag, 1981.Google Scholar
  12. 12.
    John Hannan. Investigating a Proof-Theoretic Meta-Language for Functional Programs. PhD thesis, University of Pennsylvania, January 1991. Available as MS-CIS-91-09.Google Scholar
  13. 13.
    John Hannan and Dale Miller. A meta-logic for functional programming. In H. Abramson and M. Rogers, editors, Meta-Programming in Logic Programming, pages 453–476. MIT Press, 1989.Google Scholar
  14. 14.
    Robert Harper, Furio Honsell, and Gordon Plotkin. A framework for defining logics. Journal of the Association for Computing Machinery, 40(1):143–184, January 1993.Google Scholar
  15. 15.
    Susumu Hayashi. An introduction to PX. In Gerard Huet, editor, Logical Foundations of Functional Programming. Addison-Wesley, 1990.Google Scholar
  16. 16.
    Gérard Huet and Bernard Lang. Proving and applying program transformations expressed with second-order patterns. Acta Informatica, 11:31–55, 1978.Google Scholar
  17. 17.
    Peter Madden. Automated Program Transformation Through Proof Transformation. PhD thesis, University of Edinburgh, 1991.Google Scholar
  18. 18.
    Peter Madden. Automatic program optimization through proof transformation. In D. Kapur, editor, Proceedings of the 11th International Conference on Automated Deduction, pages 446–460, Saratoga Springs, New York, June 1992. Springer-Verlag LNAI 607.Google Scholar
  19. 19.
    Spiro Michaylov and Frank Pfenning. Natural semantics and some of its metatheory in Elf. In L.-H. Eriksson, L. Hallnäs, and P. Schroeder-Heister, editors, Proceedings of the Second International Workshop on Extensions of Logic Programming, pages 299–344, Stockholm, Sweden, January 1991. Springer-Verlag LNAI 596.Google Scholar
  20. 20.
    Dale Miller. A logic programming language with lambda-abstraction, function variables, and simple unification. In Peter Schroeder-Heister, editor, Extensions of Logic Programming: International Workshop, Tübingen FRG, December 1989, pages 253–281. Springer-Verlag LNCS 475, 1991.Google Scholar
  21. 21.
    Dale Miller. Unification of simply typed lambda-terms as logic programming. In K. Furukawa, editor, Proceedings of the Eighth International Conference on Logic Programming, pages 255–269. MIT Press, July 1991.Google Scholar
  22. 22.
    Robin Milner, Mads Tofte, and Robert Harper. The Definition of Standard ML. MIT Press, Cambridge, Massachusetts, 1990.Google Scholar
  23. 23.
    Robert Paige and Shaye Koening. Finite differencing of computable expressions. Technical Report LCSR-TR-8, Laboratory for Computer Science Research, Rutgers University, August 1980.Google Scholar
  24. 24.
    Christine Paulin-Mohring. Extracting 589-01 programs from proofs in the calculus of constructions. In Sixteenth Annual Symposium on Principles of Programming Languages, pages 89–104. ACM Press, January 1989.Google Scholar
  25. 25.
    Frank Pfenning. On the undecidability of partial polymorphic type reconstruction. Fundamenta Informaticae, 199? To appear. Preliminary version available as Technical Report CMU-CS-92-105, School of Computer Science, Carnegie Mellon University, Pittsburgh, Pennsylvania, January 1992.Google Scholar
  26. 26.
    Frank Pfenning. Program development through proof transformation. Contemporary Mathematics, 106:251–262, 1990.Google Scholar
  27. 27.
    Frank Pfenning. Logic programming in the LF logical framework. In Gérard Huet and Gordon Plotkin, editors, Logical Frameworks, pages 149–181. Cambridge University Press, 1991.Google Scholar
  28. 28.
    Frank Pfenning. Unification and anti-unification in the Calculus of Constructions. In Sixth Annual IEEE Symposium on Logic in Computer Science, pages 74–85, Amsterdam, The Netherlands, July 1991.Google Scholar
  29. 29.
    Frank Pfenning and Ekkehard Rohwedder. Implementing the meta-theory of deductive systems. In D. Kapur, editor, Proceedings of the 11th International Conference on Automated Deduction, pages 537–551, Saratoga Springs, New York, June 1992. Springer-Verlag LNAI 607.Google Scholar
  30. 30.
    James T. Sasaki. Extracting Efficient Code from Constructive Proofs. PhD thesis, Cornell University, May 1986. Available as Technical Report TR 86-757.Google Scholar
  31. 31.
    Helmut Schwichtenberg. On Martin-Löf's theory of types. In Atti Degli Incontri di Logica Mathematica, pages 299–325. Dipartimento di Matematica, Università di Siena, 1982.Google Scholar
  32. 32.
    Helmut Schwichtenberg. A normal form for natural deductions in a type theory with realizing terms. In Ettore Casari et al., editors, Atti del Congresso Logica e Filosfia della Scienza, oggi. San Gimignano, December 7–11, 1983, pages 95–138, Bologna, Italy, 1985. CLUEB.Google Scholar

Copyright information

© Springer-Verlag 1994

Authors and Affiliations

  • Penny Anderson
    • 1
  1. 1.Unité de Recherche de Sophia-AntipolisINRIASophia-Antipolis CedexFrance

Personalised recommendations