Skip to main content
Top

2015 | OriginalPaper | Chapter

Programming Techniques for Reversible Comparison Sorts

Authors : Holger Bock Axelsen, Tetsuo Yokoyama

Published in: Programming Languages and Systems

Publisher: Springer International Publishing

Activate our intelligent search to find suitable subject content or patents.

search-config
loading …

Abstract

A common approach to reversible programming is to reversibly simulate an irreversible program with the desired functionality, which in general puts additional pressure on the computational resources (time, space.) If the same running time is required, ensuring a minimal space overhead is a significant programming challenge.
We introduce criteria for the optimality of reversible simulation: A reversible simulation is faithful if it incurs no asymptotic time overhead and bounds the space overhead (the garbage) by some function g(n), and hygienic if g is (asymptotically) optimal for faithful simulation.
We demonstrate the programming techniques used to develop faithful and hygienic reversible simulations of several well-known comparison sorts, e.g. insertion sort and quicksort, using representations of permutations in both the output and intermediate additional space required.

Dont have a licence yet? Then find out more about our products and how to get one now:

Springer Professional "Wirtschaft+Technik"

Online-Abonnement

Mit Springer Professional "Wirtschaft+Technik" erhalten Sie Zugriff auf:

  • über 102.000 Bücher
  • über 537 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Maschinenbau + Werkstoffe
  • Versicherung + Risiko

Jetzt Wissensvorsprung sichern!

Springer Professional "Technik"

Online-Abonnement

Mit Springer Professional "Technik" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 390 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Maschinenbau + Werkstoffe




 

Jetzt Wissensvorsprung sichern!

Springer Professional "Wirtschaft"

Online-Abonnement

Mit Springer Professional "Wirtschaft" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 340 Zeitschriften

aus folgenden Fachgebieten:

  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Versicherung + Risiko




Jetzt Wissensvorsprung sichern!

Appendix
Available only for authorised users
Footnotes
1
This bound can depend significantly on the data structures used. For list sorting, which returns a redundant representation of the sorted array, no garbage is needed.
 
2
If i=n holds at line 9, the loop terminates without evaluating expression https://static-content.springer.com/image/chp%3A10.1007%2F978-3-319-26529-2_22/393248_1_En_22_IEq111_HTML.gif with the out-of-bounds index n, by using short-circuit evaluation.
 
3
The non-variable actual argument n-1 is syntactic sugar for a fresh variable allocated with value \(n-1\) before the call, and deallocated with value \(n-1\) afterwards.
 
4
We remark that Hall’s instruction set is only reversible when programmer discipline is employed, and in fact contains a number of irreversible instructions.
 
5
The size of the auxiliary arrays in merge is not optimized, in order to make the indexing clearer in the presentation.
 
Literature
1.
go back to reference 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) CrossRef 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) CrossRef
2.
go back to reference Axelsen, H.B., Thomsen, M.K.: Garbage-free reversible integer multiplication with constants of the form 2\(^{k}\pm \)2\(^l\pm \)1. In: Glück, R., Yokoyama, T. (eds.) RC 2012. LNCS, vol. 7581, pp. 171–182. Springer, Heidelberg (2013)CrossRef Axelsen, H.B., Thomsen, M.K.: Garbage-free reversible integer multiplication with constants of the form 2\(^{k}\pm \)2\(^l\pm \)1. In: Glück, R., Yokoyama, T. (eds.) RC 2012. LNCS, vol. 7581, pp. 171–182. Springer, Heidelberg (2013)CrossRef
4.
go back to reference Bonet, B.: Efficient algorithms to rank and unrank permutations in lexicographic order. In: Workshop on Search in Artificial Intelligence and Robotics. AAAI (2008) Bonet, B.: Efficient algorithms to rank and unrank permutations in lexicographic order. In: Workshop on Search in Artificial Intelligence and Robotics. AAAI (2008)
5.
go back to reference Dijkstra, E.W.: Program inversion. In: Bauer, F.L., Broy, M. (eds.) Program Construction: International Summer School. LNCS, vol. 69, pp. 54–57. Springer, Heidelberg (1979)CrossRef Dijkstra, E.W.: Program inversion. In: Bauer, F.L., Broy, M. (eds.) Program Construction: International Summer School. LNCS, vol. 69, pp. 54–57. Springer, Heidelberg (1979)CrossRef
6.
go back to reference Early, D., Gao, A., Schellekens, M.: Frugal encoding in reversible \({\cal MOQA}\): a case study for quicksort. In: Glück, R., Yokoyama, T. (eds.) RC 2012. LNCS, vol. 7581, pp. 85–96. Springer, Heidelberg (2013)CrossRef Early, D., Gao, A., Schellekens, M.: Frugal encoding in reversible \({\cal MOQA}\): a case study for quicksort. In: Glück, R., Yokoyama, T. (eds.) RC 2012. LNCS, vol. 7581, pp. 85–96. Springer, Heidelberg (2013)CrossRef
7.
go back to reference Hall, J.S.: A reversible instruction set architecture and algorithms. In: Proceedings of Physics and Computation, pp. 128–134. IEEE Press, New York (1994) Hall, J.S.: A reversible instruction set architecture and algorithms. In: Proceedings of Physics and Computation, pp. 128–134. IEEE Press, New York (1994)
8.
go back to reference Knuth, D.E.: The Art of Computer Programming, Volume 3: Sorting and Searching, 2nd edn. Addison Wesley Longman Publishing Co. Inc., Boston (1998) Knuth, D.E.: The Art of Computer Programming, Volume 3: Sorting and Searching, 2nd edn. Addison Wesley Longman Publishing Co. Inc., Boston (1998)
9.
go back to reference Lutz, C.: Janus: A time-reversible language. Letter to R. Landauer (1986) Lutz, C.: Janus: A time-reversible language. Letter to R. Landauer (1986)
11.
go back to reference Nishida, N., Vidal, G.: Program inversion for tail recursive functions. In: Schmidt-Schauß, M. (ed.) RTA. LIPIcs, vol. 10, pp. 283–298. Schloss Dagstuhl–Leibniz-Zentrum für Informatik, Dagstuhl (2011) Nishida, N., Vidal, G.: Program inversion for tail recursive functions. In: Schmidt-Schauß, M. (ed.) RTA. LIPIcs, vol. 10, pp. 283–298. Schloss Dagstuhl–Leibniz-Zentrum für Informatik, Dagstuhl (2011)
12.
go back to reference Perumalla, K.S.: Introduction to Reversible Computing. CRC Press, Boca Raton (2013) Perumalla, K.S.: Introduction to Reversible Computing. CRC Press, Boca Raton (2013)
13.
go back to reference Wille, R., Drechsler, R.: Towards a Design Flow for Reversible Logic. Springer, Heidelberg (2010)CrossRefMATH Wille, R., Drechsler, R.: Towards a Design Flow for Reversible Logic. Springer, Heidelberg (2010)CrossRefMATH
14.
go back to reference Yokoyama, T., Axelsen, H.B., Glück, R.: Principles of a reversible programming language. In: Proceedings of Computing Frontiers, pp. 43–54. ACM Press, New York (2008) Yokoyama, T., Axelsen, H.B., Glück, R.: Principles of a reversible programming language. In: Proceedings of Computing Frontiers, pp. 43–54. ACM Press, New York (2008)
15.
go back to reference Yokoyama, T., Axelsen, H.B., Glück, R.: Minimizing garbage size by generating reversible simulations. In: Proceedings of Networking and Computing, pp. 379–387. IEEE Press, New York (2012) Yokoyama, T., Axelsen, H.B., Glück, R.: Minimizing garbage size by generating reversible simulations. In: Proceedings of Networking and Computing, pp. 379–387. IEEE Press, New York (2012)
Metadata
Title
Programming Techniques for Reversible Comparison Sorts
Authors
Holger Bock Axelsen
Tetsuo Yokoyama
Copyright Year
2015
DOI
https://doi.org/10.1007/978-3-319-26529-2_22

Premium Partner