Abstract
We present a method for automatic program inversion of functional programs based on methods of LR parsing. We formalize the transformation and illustrate it with the inversion of a program for run-length encoding. We solve one of the main problems of automatic program inversion—the elimination of nondeterminism—by viewing an inverse program as a context-free grammar and applying to it methods of LR parsing to turn it into a recursive, deterministic inverse program. This improves the efficiency of the inverse programs and greatly expands the application range of our earlier method for program inversion.
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)
Aho, A.V., Sethi, R., Ullman, J.D.: Compilers: Principles, Techniques and Tools. Addison-Wesley, Reading (1986)
Bird, R., de Moor, O.: Algebra of Programming. Prentice Hall International Series in Computer Science. Prentice-Hall, Englewood Cliffs (1997)
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., 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)
Glück, R., Kawada, Y., Hashimoto, T.: Transforming interpreters into inverse interpreters by partial evaluation. In: Proceedings of the ACM SIGPLAN Workshop on Partial Evaluation and Semantics-Based Program Manipulation, pp. 10–19. ACM Press, New York (2003)
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.: The Science of Programming. In: Inverting Programs. Texts and Monographs in Computer Science, ch. 21, pp. 265–274. 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)
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., 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)
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
© 2004 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Glück, R., Kawabe, M. (2004). Derivation of Deterministic Inverse Programs Based on LR Parsing. In: Kameyama, Y., Stuckey, P.J. (eds) Functional and Logic Programming. FLOPS 2004. Lecture Notes in Computer Science, vol 2998. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-24754-8_21
Download citation
DOI: https://doi.org/10.1007/978-3-540-24754-8_21
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-21402-1
Online ISBN: 978-3-540-24754-8
eBook Packages: Springer Book Archive