Mechanical translation of set theoretic problem specifications into efficient RAM code — A case study

  • Robert Paige
  • Fritz Henglein
Automatic Programming II
Part of the Lecture Notes in Computer Science book series (LNCS, volume 204)


There have been various proposals for program development methodologies in which a computer system is used to aid in the formulation of precise problem specifications, in the synthesis of efficient and correct programs, and in the analysis of performance. A few systems have actually been implemented. Although some of these systems are fully general in expressive power, they all lack a sufficient degree of automation to make them viable alternatives to conventional ad hoc approaches.

This paper illustrates a radically different, fully automatic top-down approach to program development in which formal problem specifications are mechanically translated into efficient RAM code. This code is guaranteed to be totally correct and its asymptotic running time is automatically determined. The user is only required to supply the system with a formal problem specification, and is relieved of major responsibilities in the rest of the program development process. These sharp results are obtained, in part, by restricting the system to handle a class of determinate, set theoretic, tractable problems. Most of the techniques described in this paper have been implemented and used effectively in the RAPTS transformational programming system.

This paper explains the conceptual underpinnings of our approach by considering the problem of attribute closure for relational databases and systematically deriving a program that implements a solution.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Aho, A., Hopcroft, J., Ullman, J.. Design and Analysis of Computer Algorithms. Addison-Wesley, 1974.Google Scholar
  2. 2.
    Allen, F. E., Cocke, J., and Kennedy, K. Reduction of Operator Strength. In Program Flow Analysis, Muchnick, S., Jones, N., Eds., Prentice Hall, 1981, pp. 79–101.Google Scholar
  3. 3.
    Armstrong, W. Dependency Structures of Data Base Relationships. Proc. 1974 IFIP Congress, Amsterdam, 1974, pp. 580–583.Google Scholar
  4. 4.
    Bates, J., Constable, R. “Proofs as Programs”. ACM TOPLAS 7, 2 (Jan. 1985), 113–136.CrossRefGoogle Scholar
  5. 5.
    Bauer, F. L., Wossner, H.. Algorithmic Language and Program Development. Springer-Verlag, Berlin, 1982.Google Scholar
  6. 6.
    Beeri, C. and Bernstein, P. “Computational Problems Related to the Design of Normal Form Relation Schemes”. ACM TOPLAS 4, 1 (1979), 30–59.Google Scholar
  7. 7.
    Bibel, W. “Syntax-directed, Semantics-supported Program Synthesis”. Artificial Intelligence 14, 3 (October 1980), 243–262.Google Scholar
  8. 8.
    Bird, R. “The Promotion and Accumulation Strategies in Transformational Programming”. ACM TOPLAS 6, 4 (Oct. 1984), pp. 487–504.CrossRefGoogle Scholar
  9. 9.
    Boyle, J. A Transformational Component for Programming Language Grammar. ANL-7640, Argonne National Laboratory, Argonne, IL 60439, Jul, 1970.Google Scholar
  10. 10.
    Buchberger, B., Collins, G., Loos, R. and Albrecht R. (Ed.). Computer Algebra Symbolic and Algebraic Computation. Springer-Verlag, 1983.Google Scholar
  11. 11.
    Burstall, R., and Darlington, J.. “A Transformation System for Developing Recursive Programs”. JACM 24, 1 (Jan 1977).Google Scholar
  12. 12.
    Cheatham, T., Holloway, G., Townley, J. Program Refinement by Transformation. Proc 5th Int. Conf. on Software Engineering, Mar, 1981.Google Scholar
  13. 13.
    Cohen, J. “Computer-Assisted Microanalysis of Programs”. CACM 25, 10 (Oct 1982), 724–733.Google Scholar
  14. 14.
    Dershowitz, N. Computing with Rewrite Systems. Proc. NSF Workshop on the Rewrite Rule Laboratory, Sept., 1983, pp. 269–298.Google Scholar
  15. 15.
    Dewar, R., Grand, A., Liu S. C., Schwartz, J. T., and Schonberg, E. “Program by Refinement, as Exemplified by the SETL Representation Sublanguage”. TOPLAS 1, 1 (July 1979).Google Scholar
  16. 16.
    Dijkatra, E. W., A Discipline of Programming. Prentice-Hall, 1976.Google Scholar
  17. 17.
    Earley, J. High Level Operations in Automatic Programming. Proc. Symp. on Very High Level Langs., Apr, 1974. Sigpian Notices, Vol 9, Num 4.Google Scholar
  18. 18.
    Earley, J. “High Level Iterators and a Method for Automatically Designing Data Structure Representation”. Journal of Computer Languages 1, 4 (1976), 321–342.Google Scholar
  19. 19.
    Floyd, R. Assigning Meaning to Programs. Proceedings of Symposia on Applied Mathematics Vol. XIX, American Mathematics Society, Providence, R. I., 1967.Google Scholar
  20. 20.
    Fong, A. Elimination of Common Subexpressions in Very High Level Languages. Proceedings 4th ACM Symposium on Principles of Programming Languages, Jan, 1977, pp. 48–57.Google Scholar
  21. 21.
    Fong, A. Inductively Computable Constructs in Very High Level Languages. Proceedings 6th ACM Symposium on Principles of Programming Languages, Jan, 1979, pp. 21–28.Google Scholar
  22. 22.
    Fong, A., and Ullman, J. Induction Variables in Very High Level Languages. Proceedings Third ACM Symposium on Principles of Programming Languages, Jan, 1976, pp. 104–112.Google Scholar
  23. 23.
    Freudenberger, S., Schwartz, J. T., and Sharir, M. “Experience with the SETL Optimizer”. ACM TOPLAS 5, 1 (1983), 26–45.Google Scholar
  24. 24.
    Gerhart, S. Correciness Preserving Program Transformations. Proc. Second ACM Symposium on Principles of Programming Languages, 1975.Google Scholar
  25. 25.
    Goad, C. Computational Uses of the Manipulation of Formal Proofs. Ph.D. Th., Stanford University, August 1980.Google Scholar
  26. 26.
    Goldberg, A., Paige, R. Stream Processing. ACM Symposium on LISP and Functional Programming, Aug, 1984, pp. 53–62.Google Scholar
  27. 27.
    Goldstine, H.. The Computer from Pascal to Von Neumann. Princeton University Press, Princeton, New Jersey, 1972.Google Scholar
  28. 28.
    Goldstine, H.. A History of Numerical Analysis. Springer-Verlag, New York, 1977.Google Scholar
  29. 29.
    Goto, S. Program Synthesis from Natural Deduction Proofs. Proc. 6th Intl. Joint Conf. on Artificial Intelligence, Tokyo, Japan, August, 1979, pp. 339–341.Google Scholar
  30. 30.
    Guttag, J. and Horowitz, E. “Abstract Data Types and Software Validation”. CACM 21, 12 (Dec. 1978), 1048–1064.Google Scholar
  31. 31.
    Hoare, C. A. R. “An Axiomatic Basis for Computer Programming”. CACM 12, 10 (1969), 576–581.Google Scholar
  32. 32.
    Hoffmann, C. and O'Donnell, M. “Programming with Equations”. ACM TOPLAS 4, 1 (Jan. 1982), 83–112.CrossRefGoogle Scholar
  33. 33.
    Huet, G. “Confluent Reduction: Abstract Properties and Applications to Term Rewriting Systems”. JACM 27, 4 (Oct 1980), 797–821.CrossRefGoogle Scholar
  34. 34.
    Kennedy, K. A Survey of Compiler Optimization Techniques. In Program Flow Analysis, Muchnick, S. and Jones, N., Eds., Prentice Hall, 1981, pp. 5–54.Google Scholar
  35. 35.
    Knuth, D. and Bendix, P. Simple Word Problems in Universal Algebras. In Leech, J., Ed., Computational Problems in Abstract Algebra, Pergamon Press, 1970, pp. 263–297.Google Scholar
  36. 36.
    Knuth, D.. The Art of Computer Programming, 3 Volumes. Addison-Wesley, 1968–1972.Google Scholar
  37. 37.
    Kowalski, R. Predicate Logic as Programming Language. Proc. IFIP 1974, 1974, pp. 569–574.Google Scholar
  38. 38.
    Lescanne, P. Computer Experiments with the REVE Term Rewriting System Generator. Proc. 10th ACM Conf. on Principles of Programming Languages, Jan., 1983, pp. 99–108.Google Scholar
  39. 39.
    Loveman, D. “Program Improvement by Source to Source Transformation”. JACM 24, 1 (Jan 1977).Google Scholar
  40. 40.
    Manna, Z. and Waldinger, R. “A Deductive Approach to Program Synthesis”. ACM TOPLAS 2, 1 (Jan 1980).Google Scholar
  41. 41.
    Math Lab Group. MACSYMA Reference Manual. 9 edition, LCS, MIT, Cambridge, Mass., 1977.Google Scholar
  42. 42.
    Mehlhorn, K.. Data Structures and Algorithms. Volume 1: Sorting and Searching. Springer-Verlag, 1984.Google Scholar
  43. 43.
    Paige, R.. Formal Differentiation. UMI Research Press, Ann Arbor, Mich, 1981. Revision of Ph.D. thesis, NYU, June 1979.Google Scholar
  44. 44.
    Paige, R. Transformational Programming — Applications to Algorithms and Systems. Proceedings Tenth ACM Symposium on Principles of Programming Languages, Jan, 1983, pp. 73–87.Google Scholar
  45. 45.
    Paige, R. Supercompilers — Extended Abstract. In Program Transformation and Programming Environments, P. Pepper, Ed., Springer Verlag, 1984, pp. 331–340.Google Scholar
  46. 46.
    Paige, R., Tarjan, R. A Linear Time Algorithm to Solve the Single Function Coarsest Partition Problem. 11th ICALP, Jul, 1984.Google Scholar
  47. 47.
    Paige, R. Applications of Finite Differencing to Database Integrity Control and Query/Transaction Optimisation. In Advances In Database Theory, Volume 2, Gallaire, H., Minker, J., and Nicolas, J.-M., Ed., Plenum Press, New York, 1984, pp. 171–210.Google Scholar
  48. 48.
    Paige, R., and Koenig, S. “Finite Differencing of Computable Expressions”. ACM TOPLAS 4, 3 (July 1982), 402–454.CrossRefGoogle Scholar
  49. 49.
    Ramshaw, L. Formalizing the Analysis of Algorithms. SL-79-5, Xerox Palo Alto Research Center, June, 1979.Google Scholar
  50. 50.
    Robinson, J. A. “A Machine Oriented Logic Based on the Resolution Principle”. JACM (January 1965), 23–41.Google Scholar
  51. 51.
    Scherlis, W. Program Improvement by Internal Specialization. 8th POPL, Jan, 1981.Google Scholar
  52. 52.
    Scherlis, W., Scott, D. Semantically Based Programming Tools (Summary). Tapsoft Joint Conference on Theory and Practice of Software Development, Mar, 1985.Google Scholar
  53. 53.
    Schonberg, E., Schwartz, J. T., and Sharir, M. “An Automatic Technique for Selection of Data Representations in in SETL Programs”. ACM TOPLAS 3, 2 (Apr 1981), 126–143.Google Scholar
  54. 54.
    Schwartz, J. T.. On Programming: An Interim Report on the SETL Project, Installments I and II. CIMS, New York Univ., New York, 1974.Google Scholar
  55. 55.
    Schwartz, J.T. “Automatic Data Structure Choice in a Language of Very High Level”. CACM 18, 12 (Dec 1975), 722–728.Google Scholar
  56. 56.
    Standish, T., Kibler, D., and Neighbors, J. The Irvine Program Transformation Catalogue. Univ. of Cal. at Irvine, Dept. of Information and Computer Science, Jan, 1976.Google Scholar
  57. 57.
    Suppes, P.. Aziomatic Set Theory. Dover, 1972.Google Scholar
  58. 58.
    Tarjan, R. Amortized computational complexity. SIAM J. Alg. Disc. Meth. to appear.Google Scholar
  59. 59.
    Tarski, A. “A Lattice-Theoretical Fixpoint Theorem and its Application”. Pacific Journal of Mathematics 5 (1955), 285–309.Google Scholar
  60. 60.
    Ullman, J.. Principles of Database Systems. Computer Science Press, 1980.Google Scholar
  61. 61.
    Wirth, N. “Program Development by Stepwise Refinement”. CACM 14, 4 (April 1971), 221–227.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1985

Authors and Affiliations

  • Robert Paige
    • 1
  • Fritz Henglein
    • 1
  1. 1.Dept. of Computer ScienceRutgers UniversityNew BrunswickUSA

Personalised recommendations