Proving the Correctness of Unfold/Fold Program Transformations Using Bisimulation

  • Geoff W. Hamilton
  • Neil D. Jones
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7162)

Abstract

This paper shows that a bisimulation approach can be used to prove the correctness of unfold/fold program transformation algorithms. As an illustration, we show how our approach can be use to prove the correctness of positive supercompilation (due to Sørensen et al). Traditional program equivalence proofs show the original and transformed programs are contextually equivalent, i.e., have the same termination behaviour in all closed contexts. Contextual equivalence can, however, be difficult to establish directly.

Gordon and Howe use an alternative approach: to represent a program’s behaviour by a labelled transition system whose bisimilarity relation is a congruence that coincides with contextual equivalence. Labelled transition systems are well-suited to represent global program behaviour.

On the other hand, unfold/fold program transformations use generalization and folding, and neither is easy to describe contextually, due to use of non-local information. We show that weak bisimulation on labelled transition systems gives an elegant framework to prove contextual equivalence of original and transformed programs. One reason is that folds can be seen in the context of corresponding unfolds.

Keywords

Free Variable Label Transition System Program Transformation Case Expression Silent Transition 
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.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Abramsky, S.: The lazy lambda calculus. In: Research Topics in Functional Programming, pp. 65–116. Addison-Wesley (1990)Google Scholar
  2. 2.
    Bol, R.: Loop Checking in Partial Deduction. Journal of Logic Programming 16(1-2), 25–46 (1993)MathSciNetMATHCrossRefGoogle Scholar
  3. 3.
    Burstall, R., Darlington, J.: A transformation system for developing recursive programs. Journal of the ACM 24(1), 44–67 (1977)MathSciNetMATHCrossRefGoogle Scholar
  4. 4.
    Dershowitz, N., Jouannaud, J.P.: Rewrite Systems. In: van Leeuwen, J. (ed.) Handbook of Theoretical Computer Science, pp. 243–320. Elsevier, MIT Press (1990)Google Scholar
  5. 5.
    Gordon, A.D.: Bisimilarity as a theory of functional programming. Theoretical Computer Science 228(1-2), 5–47 (1999)MathSciNetMATHCrossRefGoogle Scholar
  6. 6.
    Hamilton, G.: Distillation: Extracting the Essence of Programs. In: Proceedings of the ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation, pp. 61–70 (2007)Google Scholar
  7. 7.
    Higman, G.: Ordering by Divisibility in Abstract Algebras. Proceedings of the London Mathematical Society 2, 326–336 (1952)MathSciNetMATHCrossRefGoogle Scholar
  8. 8.
    Howe, D.J.: Proving congruence of bisimulation in functional programming languages. Information and Computation 124(2), 103–112 (1996)MathSciNetMATHCrossRefGoogle Scholar
  9. 9.
    Jones, N., Gomard, C., Sestoft, P.: Partial Evaluation and Automatic Program Generation. Prentice Hall (1993)Google Scholar
  10. 10.
    Kruskal, J.: Well-Quasi Ordering, the Tree Theorem, and Vazsonyi’s Conjecture. Transactions of the American Mathematical Society 95, 210–225 (1960)MathSciNetMATHGoogle Scholar
  11. 11.
    Lacey, D., Jones, N.D., Wyk, E.V., Frederiksen, C.C.: Compiler optimization correctness by temporal logic. Higher-Order and Symbolic Computation 17(3), 173–206 (2004)MATHCrossRefGoogle Scholar
  12. 12.
    Leuschel, M.: On the Power of Homeomorphic Embedding for Online Termination. In: Proceedings of the International Static Analysis Symposium, Pisa, Italy, pp. 230–245 (1998)Google Scholar
  13. 13.
    Marlet, R.: Vers une Formalisation de l’Évaluation Partielle. Ph.D. thesis, Université de Nice - Sophia Antipolis (1994)Google Scholar
  14. 14.
    Sands, D.: Proving the Correctness of Recursion-Based Automatic Program Transformations. Theoretical Computer Science 167(1-2), 193–233 (1996)MathSciNetMATHCrossRefGoogle Scholar
  15. 15.
    Sørensen, M.H., Glück, R.: An Algorithm of Generalization in Positive Supercompilation. In: Tison, S. (ed.) CAAP 1994. LNCS, vol. 787, pp. 335–351. Springer, Heidelberg (1994)CrossRefGoogle Scholar
  16. 16.
    Sørensen, M.H., Glück, R., Jones, N.: A Positive Supercompiler. Journal of Functional Programming 6(6), 811–838 (1996)CrossRefGoogle Scholar
  17. 17.
    Turchin, V.: Program Transformation by Supercompilation. In: Ganzinger, H., Jones, N.D. (eds.) Programs as Data Objects. LNCS, vol. 217, pp. 257–281. Springer, Heidelberg (1986)CrossRefGoogle Scholar
  18. 18.
    Wadler, P.: Deforestation: Transforming Programs to Eliminate Trees. In: Ganzinger, H. (ed.) ESOP 1988. LNCS, vol. 300, pp. 344–358. Springer, Heidelberg (1988)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Geoff W. Hamilton
    • 1
  • Neil D. Jones
    • 2
  1. 1.School of ComputingDublin City UniversityDublinIreland
  2. 2.Computer Science DepartmentUniversity of CopenhagenCopenhagenDenmark

Personalised recommendations