Skip to main content

A Program Inverter for a Functional Language with Equality and Constructors

  • Conference paper

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 2895))

Abstract

We present a method for automatic program inversion in a first-order functional programming language. We formalize the transformation and illustrate it with several examples including the automatic derivation of a program for run-length decoding from a program for run-length encoding. This derivation is not possible with other automatic program inversion methods. One of our key observations is that the duplication of values and testing of their equality are two sides of the same coin in program inversion. This leads us to the design of a new self-inverse primitive function that considerably simplifies the automatic inversion of programs.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  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)

    Chapter  Google Scholar 

  2. Abramov, S.M., Glück, R.: The universal resolving algorithm and its correctness: inverse computation in a functional language. Science of Computer Programming 43(2-3), 193–229 (2002)

    Article  MATH  MathSciNet  Google Scholar 

  3. Bird, R., de Moor, O.: Algebra of Programming. Prentice Hall International Series in Computer Science. Prentice Hall, Englewood Cliffs (1997)

    MATH  Google Scholar 

  4. Briggs, J.S.: Generating reversible programs. Software Practice and Experience 17, 439–453 (1987)

    Article  Google Scholar 

  5. Carothers, C.D., Perumalla, K.S., Fujimoto, R.M.: Efficient optimistic parallel simulations using reverse computation. ACM TOMACS 9(3), 224–253 (1999)

    Article  Google Scholar 

  6. Darlington, J.: An experimental program transformation and synthesis system. Artificial Intelligence 16(1), 1–46 (1981)

    Article  Google Scholar 

  7. Dijkstra, E.W.: Program inversion. In: Gerhart, S.L., Pair, C., Pepper, P.A., Wössner, H., Dijkstra, E.W., Guttag, J.V., Owicki, S.S., Partsch, H., Bauer, F.L., Gries, D., Griffiths, M., Horning, J.J., Wirsing, M. (eds.) Program Construction. LNCS, vol. 69, pp. 54–57. Springer, Heidelberg (1979)

    Chapter  Google Scholar 

  8. Eppstein, D.: A heuristic approach to program inversion. In: Int. Joint Conference on Artificial Intelligence (IJCAI 1985), pp. 219–221. Morgan Kaufmann, Inc., San Francisco (1985)

    Google Scholar 

  9. Glück, R., Kawada, Y., Hashimoto, T.: Transforming interpreters into inverse interpreters by partial evaluation. In: Proceedings of the ACM Workshop on Partial Evaluation and Semantics-Based Program Manipulation, pp. 10–19. ACM Press, New York (2003)

    Chapter  Google Scholar 

  10. Glück, R., Klimov, A.V.: Metacomputation as a tool for formal linguistic modeling. In: Trappl, R. (ed.) Cybernetics and Systems 1994, vol. 2, pp. 1563–1570. World Scientific, Singapore (1994)

    Google Scholar 

  11. Glück, R., Turchin, V.F.: Application of metasystem transition to function inversion and transformation. In: Proceedings of the Int. Symposium on Symbolic and Algebraic Computation (ISSAC 1990), pp. 286–287. ACM Press, New York (1990)

    Chapter  Google Scholar 

  12. Gries, D.: Inverting Programs. In: The Science of Programming. Texts and Monographs in Computer Science, ch. 21, Springer, Heidelberg (1981)

    Google Scholar 

  13. Khoshnevisan, H., Sephton, K.M.: InvX: An automatic function inverter. In: Dershowitz, N. (ed.) RTA 1989. LNCS, vol. 355, pp. 564–568. Springer, Heidelberg (1989)

    Google Scholar 

  14. Korf, R.E.: Inversion of applicative programs. In: Int. Joint Conference on Artificial Intelligence (IJCAI 1981), pp. 1007–1009. William Kaufmann, Inc., San Francisco (1981)

    Google Scholar 

  15. Leeman, G.B.: A formal approach to undo operations in programming languages. ACM TOPLAS 8(1), 50–97 (1986)

    Article  MATH  Google Scholar 

  16. Mu, S.-C., Bird, R.: Inverting functions as folds. In: Boiten, E.A., Möller, B. (eds.) MPC 2002. LNCS, vol. 2386, pp. 209–232. Springer, Heidelberg (2002)

    Chapter  Google Scholar 

  17. Nemytykh, P.A., Pinchuk, V.A.: Program transformation with metasystem transitions: experiments with a supercompiler. In: Bjorner, D., Broy, M., Pottosin, I.V. (eds.) PSI 1996. LNCS, vol. 1181, pp. 249–260. Springer, Heidelberg (1996)

    Google Scholar 

  18. Romanenko, Y.: Inversion and metacomputation. In: Proceedings of the ACM Symposium on Partial Evaluation and Semantics-Based Program Manipulation, pp. 12–22. ACM Press, New York (1991)

    Google Scholar 

  19. Sørensen, M.H., Glück, R., Jones, N.D.: A positive supercompiler. Journal of Functional Programming 6(6), 811–838 (1996)

    Article  Google Scholar 

  20. Turchin, V.F.: Program transformation with metasystem transitions. Journal of Functional Programming 3(3), 283–313 (1993)

    Article  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2003 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Glück, R., Kawabe, M. (2003). A Program Inverter for a Functional Language with Equality and Constructors. In: Ohori, A. (eds) Programming Languages and Systems. APLAS 2003. Lecture Notes in Computer Science, vol 2895. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-40018-9_17

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-40018-9_17

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-20536-4

  • Online ISBN: 978-3-540-40018-9

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics