Towards a Reversible Functional Language

  • Tetsuo Yokoyama
  • Holger Bock Axelsen
  • Robert Glück
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7165)

Abstract

We identify concepts of reversibility for a functional language by means of a set of semantic rules with specific properties. These properties include injectivity along with local backward determinism, an important operational property for an efficient reversible language. We define a concise reversible first-order functional language in which access to the backward semantics is provided to the programmer by inverse function calls. Reversibility guarantees that in this language a backward run (inverse interpretation) is as fast as the corresponding forward run itself. By adopting a symmetric first-match policy for case expressions, we can write overlapping patterns in case branches, as is customary in ordinary functional languages, and also in leaf expressions, unlike existing inverse interpreter methods, which enables concise programs. In patterns, the use of a duplication/equality operator also simplifies inverse computation and program inversion. We discuss the advantages of a reversible functional language using example programs, including run-length encoding. Program inversion is seen to be as lightweight as for imperative reversible languages and realized by recursive descent. Finally, we show that the proposed language is r-Turing complete.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Abramov, S.M., Glück, R.: Principles of Inverse Computation and the Universal Resolving Algorithm. In: Mogensen, T.Æ., Schmidt, D.A., Sudborough, I.H. (eds.) The Essence of Computation. LNCS, vol. 2566, pp. 269–295. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  2. 2.
    Axelsen, H.B.: Clean Translation of an Imperative Reversible Programming Language. In: Knoop, J. (ed.) CC 2011. LNCS, vol. 6601, pp. 144–163. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  3. 3.
    Axelsen, H.B., Glück, R.: What Do Reversible Programs Compute? In: Hofmann, M. (ed.) FOSSACS 2011. LNCS, vol. 6604, pp. 42–56. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  4. 4.
    Baker, H.G.: NREVERSAL of Fortune — The Thermodynamics of Garbage Collection. In: Bekkers, Y., Cohen, J. (eds.) IWMM 1992. LNCS, vol. 637, pp. 507–524. Springer, Heidelberg (1992)CrossRefGoogle Scholar
  5. 5.
    Bennett, C.H.: Logical reversibility of computation. IBM Journal of Research and Development 17(6), 525–532 (1973)MATHCrossRefGoogle Scholar
  6. 6.
    Bowman, W.J., James, R.P., Sabry, A.: Dagger traced symmetric monoidal categories and reversible programming. In: De Vos, A., Wille, R. (eds.) 3rd Workshop on Reversible Computation, pp. 51–56. University of Gent. (2011)Google Scholar
  7. 7.
    De Vos, A.: Reversible Computing: Fundamentals, Quantum Computing, and Applications. Wiley-VCH (2010)Google Scholar
  8. 8.
    Frank, M.P.: Reversibility for efficient computing. Ph.D. thesis, EECS Dept. MIT, Cambridge, Massachusetts (1999)Google Scholar
  9. 9.
    Glück, R., Kawabe, M.: A Program Inverter for a Functional Language with Equality and Constructors. In: Ohori, A. (ed.) APLAS 2003. LNCS, vol. 2895, pp. 246–264. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  10. 10.
    Glück, R., Kawabe, M.: A method for automatic program inversion based on LR(0) parsing. Fundamenta Informaticae 66(4), 367–395 (2005)MathSciNetMATHGoogle Scholar
  11. 11.
    Gries, D.: Inverting Programs. In: The Science of Programming. Texts and Monographs in Computer Science, ch. 21, pp. 265–274. Springer, Heidelberg (1981)Google Scholar
  12. 12.
    Lutz, C.: Janus: a time-reversible language. Letter to R. Landauer (1986), http://www.tetsuo.jp/ref/janus.html
  13. 13.
    McCarthy, J.: The inversion of functions defined by Turing machines. In: Shannon, C.E., McCarthy, J. (eds.) Automata Studies, pp. 177–181. Princeton University Press (1956)Google Scholar
  14. 14.
    Mogensen, T.Æ.: Partial evaluation of the reversible language Janus. In: Proceedings of Partial Evaluation and Program Manipulation, pp. 23–32. ACM Press (2011)Google Scholar
  15. 15.
    Morita, K.: Reversible computing and cellular automata — A survey. Theoretical Computer Science 395(1), 101–131 (2008)MathSciNetMATHCrossRefGoogle Scholar
  16. 16.
    Mu, S.C., Hu, Z., Takeichi, M.: An Injective Language for Reversible Computation. In: Kozen, D. (ed.) MPC 2004. LNCS, vol. 3125, pp. 289–313. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  17. 17.
    Wille, R., Drechsler, R.: Towards a Design Flow for Reversible Logic. Springer, Heidelberg (2010)MATHCrossRefGoogle Scholar
  18. 18.
    Yokoyama, T., Axelsen, H., Glück, R.: Principles of a reversible programming language. In: Proceedings of Computing Frontiers, pp. 43–54. ACM Press (2008)Google Scholar
  19. 19.
    Yokoyama, T., Axelsen, H.B., Glück, R.: Optimizing clean reversible simulation of injective functions. Journal of Multiple-Valued Logic and Soft Computing 18(1), 5–24 (2012)MathSciNetGoogle Scholar
  20. 20.
    Yokoyama, T., Glück, R.: A reversible programming language and its invertible self-interpreter. In: Proceedings of Partial Evaluation and Semantics-Based Program Manipulation, pp. 144–153. ACM Press (2007)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Tetsuo Yokoyama
    • 1
  • Holger Bock Axelsen
    • 2
  • Robert Glück
    • 2
  1. 1.Department of Software EngineeringNanzan UniversityJapan
  2. 2.DIKU, Department of Computer ScienceUniversity of CopenhagenDenmark

Personalised recommendations