Advertisement

A semantic model of binding times for safe partial evaluation

  • Fritz Henglein
  • David Sands
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 982)

Abstract

In program optimisation an analysis determines some information about a portion of a program, which is then used to justify certain transformations on the code. The correctness of the optimisation can be argued monolithically by considering the behaviour of the optimiser and a particular analysis in conjunction. Alternatively, correctness can be established by finding an interface, a semantic property, between the analysis and the transformation. The semantic property provides modularity by giving a specification for a systematic construction of the analysis, and the program transformations are justified via the semantic properties.

This paper considers the problem of partial evaluation. The safety of a partial evaluator (“it does not go wrong”) has previously been argued in the monolithic style by considering the behaviour of a particular binding-time analysis and program specialiser in conjunction. In this paper we pursue the alternative approach of justifying the binding-time properties semantically. While several semantic models have been proposed for binding times, we are not aware of any application of these models in proving the safety of a partial evaluator. In this paper we:
  • identify problems of existing models of binding-time properties based on projections and partial equivalence relations (PERs), which imply that they are not adequate to prove the safety of simple off-line partial evaluators;

  • propose a new model for binding times that avoids the potential pitfalls of projections/PERs;

  • specify binding-time annotations justified by a “collecting” semantics, and clarify the connection between extensional properties (local analysis) and program annotations (global analysis) necessary to support binding-time analysis;

  • prove the safety of a simple but liberal class of monovariant partial evaluators for a higher-order functional language with recursive types, based on annotations justified by the model.

Keywords

Partial Evaluation Semantic Property Reduction Rule Lambda Calculus Binding Time 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

References

  1. [Amt93]
    T. Amtoft. Minimal thunkification. In Proceedings of the 3rd International Symposium on Static Analysis, number 724 in LNCS. Springer-Verlag, 1993.Google Scholar
  2. [BEJ88]
    D. Bjørner, Ershov, and N. D. Jones, editors. Partial Evaluation and Mixed Computation. Proceedings of the IFIP TC2 Workshop, Gammel Avernæs, Denmark, October 1987. North-Holland, 1988. 625 pages.Google Scholar
  3. [BJMS88]
    Anders Bondorf, Neil D. Jones, Torben Mogensen, and Peter Sestoft. Binding time analysis and the taming of self-application. Draft, 18 pages, DIKU, University of Copenhagen, August 1988.Google Scholar
  4. [Bon91]
    Anders Bondorf. Automatic autoprojection of higher order recursive equations. Science of Computer Programming, 17(1–3):3-34, December 1991. Selected papers of ESOP '90, the 3rd European Symposium on Programming.Google Scholar
  5. [Bon92]
    Anders Bondorf. Improving binding times without explicit cps-conversion. In 1992 ACM Conference on Lisp and Functional Programming. San Francisco, California, pages 1–10, June 1992.Google Scholar
  6. [Bul93]
    Mikhail Bulyonkov. Extracting polyvariant binding time analysis from polyvariant specializer. In Proc. ACM SIGPLAN Symp. on Partial Evaluation and Semantics-Based Program Manipulation (PEPM), Copenhagen, Denmark, pages 59–65. ACM, ACM Press, June 1993.Google Scholar
  7. [CC79]
    P. Cousot and R. Cousot. Systematic design of program analysis frameworks. In ACM 5th Symposium on Principles of Programming Languages, 1979.Google Scholar
  8. [CC94]
    P. Cousot and R. Cousot. Higher-order abstract interpretation (and application to comportment analysis generalizing strictness, termination, projection and PER analysis of functional languages). In Proc. 1994 Int'l Conf. on Computer Languages, Toulouse, France, pages 95–112. IEEE Computer Society Press, May 1994.Google Scholar
  9. [CD91]
    C. Consel and O. Danvy. For a better support of static data flow. In J. Hughes, editor, Proc. 5th ACM Conf. on Functional Programming Languages and Computer Architecture (FPCA), Cambridge, Massachusetts, number 523 in Lecture Notes in Computer Science, pages 496–519. Springer-Verlag, Aug. 1991.Google Scholar
  10. [CJØ94]
    Charles Consel, Pierre Jouvelot, and Peter Ørbæk. Separate polyvariant binding time reconstruction. CRI Report A/261, Ecole des Mines, Oct. 1994.Google Scholar
  11. [CK92]
    Charles Consel and Siau Cheng Khoo. On-line & off-line partial evaluation: Semantic specifications and correctness proofs. Technical Report YALEU/DCS/RR-912, Yale University Department of Computer Science, June 1992.Google Scholar
  12. [Con93]
    Charles Consel. Polyvariant binding-time analysis for applicative languages. In Proc. Symp. on Partial Evaluation and Semantics-Based Program Manipulation (PEPM), Copenhagen, Denmark, pages 66–77, June 1993.Google Scholar
  13. [Dav94]
    K. Davis. Pers from projections for binding-time analysis. In Proceedings of the ACM Workshop on Partial Evaluation and Semantics-Based Program Manipulation, 1994. (Proceedings available as Tech Report 94/9, University of Melbourne).Google Scholar
  14. [EM91]
    C. Ernoult and A. Mycroft. Uniform ideals and strictness analysis. In Proc. 18th Int'l Coll. on Automata, Languages and Programming (ICALP), Madrid, Spain, number 510 in Lecture Notes in Computer Science. Springer-Verlag, 1991.Google Scholar
  15. [GJ91]
    C. Gomard and N. Jones. A partial evaluator for the untyped lambda calculus. J. Functional Programming, 1(1):21–69, 1991.Google Scholar
  16. [Gom92]
    C. Gomard. A self-applicable partial evaluator for the lambda calculus: Correctness and pragmatics. ACM Transactions on Programming Languages and Systems, 14(2):147–172, 1992.Google Scholar
  17. [GR92]
    Marc Gengler and Bernhard Rytz. A polyvariant binding time analysis handling partially known values. In Proc. Workshop on Static Analysis (WSA), Bordeaux, France, pages 322–330, Sept. 1992.Google Scholar
  18. [Gun92]
    Carl Gunter. Semantics of Programming Languages — Structures and Techniques. Foundations of Computing. MIT Press, 1992.Google Scholar
  19. [Hat95]
    J. Hatcliff. A mechanised proof of correctness of off-line partial evaluation. In These proceedings, 1995.Google Scholar
  20. [HM94]
    Fritz Henglein and Christian Mossin. Polymorphic binding-time analysis. In Donald Sannella, editor, Proceedings of European Symposium on Programming, volume 788 of Lecture Notes in Computer Science, pages 287–301. Springer-Verlag, April 1994.Google Scholar
  21. [HS91]
    S. Hunt and D. Sands. Binding Time Analysis: A New PERspective. In Proceedings of the ACM Symposium on Partial Evaluation and Semantics-Based Program Manipulation (PEPM'91), pages 154–164, September 1991. ACM SIGPLAN Notices 26(9).Google Scholar
  22. [Hun90]
    S. Hunt. PERs generalise projections for strictness analysis. In Proceedings of the Third Glasgow Functional Programming Workshop, Ullapool, 1990. Springer Workshops Series.Google Scholar
  23. [Jen92]
    T. Jensen. Abstract interpretation in logical form. PhD thesis, Department of Computing, Imperial College, November 1992. (Available as DIKU tec. report 93/11).Google Scholar
  24. [Jon88]
    N.D. Jones. Automatic program specialization: A re-examination from basic principles. In [BEJ88],, 1988.Google Scholar
  25. [Lau88]
    J. Launchbury. Projections for specialisation. In [BEJ88], 1988.Google Scholar
  26. [Lau89]
    J. Launchbury. Projection Factorisations in Partial Evaluation. PhD thesis, Department of Computing, University of Glasgow, 1989.Google Scholar
  27. [Mog88]
    T. Mogensen. Partially static structures in a self-applicable partial evaluator. In [BEJ88], 1988.Google Scholar
  28. [Mog89]
    T. Mogensen. Binding time analysis for polymorphically typed higher order languages. In J. Diaz and F. Orejas, editors, TAPSOFT '89 (LNCS 352), pages 298–312. Springer-Verlag, 1989.Google Scholar
  29. [Mog92]
    Torben Æ. Mogensen. Self-applicable partial evaluation for pure lambda calculus. In Charles Consel, editor, ACM SIGPLAN Workshop on Partial Evaluation and Semantics-based Program Manipulation, pages 116–121. ACM, Yale University, 1992.Google Scholar
  30. [NBV91]
    A. De Niel, E. Bevers, and K. De Vlamnick. Program bifurcation for polymorphically typed functional languages. In Proceedings of the ACM Symposium on Partial Evaluation and Semantics-Based Program Manipulation (PEPM'91), September 1991. ACM SIGPLAN Notices 26(9).Google Scholar
  31. [Nie85]
    F. Nielson. Program transformation in a denotational setting. ACM Transactions on Programming Languages and Systems, 7(3):359–379, 1985.Google Scholar
  32. [Pal93]
    J. Palsberg. Correctness of binding time analysis. Journal of Functional Programming, 3(3):347–363, 1993.Google Scholar
  33. [Ste94]
    P. Steckler. Correct Higher-Order Program Transformations. PhD thesis, College of Computer Science, Northeastern University, Boston, 1994. Tech Report NU-CCS-94-15.Google Scholar
  34. [Tur86]
    V. F. Turchin. The concept of a supercompiler. ACM Transactions on Programming Languages and Systems, 8:292–325, July 1986.Google Scholar
  35. [Wan93]
    Mitchell Wand. Specifying the correctness of binding-time analysis. Journal of Functional Programming, 3(3):365–387, July 1993. preliminary version appeared in Conf. Rec. 20th ACM Symp. on Principles of Prog. Lang. (1993), 137–143.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1995

Authors and Affiliations

  • Fritz Henglein
    • 1
  • David Sands
    • 1
  1. 1.DIKUUniversity of CopenhagenKøbenhavn Ø

Personalised recommendations