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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
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)
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)
Bird, R., de Moor, O.: Algebra of Programming. Prentice Hall International Series in Computer Science. Prentice Hall, Englewood Cliffs (1997)
Briggs, J.S.: Generating reversible programs. Software Practice and Experience 17, 439–453 (1987)
Carothers, C.D., Perumalla, K.S., Fujimoto, R.M.: Efficient optimistic parallel simulations using reverse computation. ACM TOMACS 9(3), 224–253 (1999)
Darlington, J.: An experimental program transformation and synthesis system. Artificial Intelligence 16(1), 1–46 (1981)
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)
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)
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)
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)
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)
Gries, D.: Inverting Programs. In: The Science of Programming. Texts and Monographs in Computer Science, ch. 21, Springer, Heidelberg (1981)
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)
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)
Leeman, G.B.: A formal approach to undo operations in programming languages. ACM TOPLAS 8(1), 50–97 (1986)
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)
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)
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)
Sørensen, M.H., Glück, R., Jones, N.D.: A positive supercompiler. Journal of Functional Programming 6(6), 811–838 (1996)
Turchin, V.F.: Program transformation with metasystem transitions. Journal of Functional Programming 3(3), 283–313 (1993)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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