Abstract
Imperative programs can be inverted directly from their forward-directed program code with the use of logical inference. The relational semantics of imperative computations treats programs as logical relations over the observable state of the environment, which is taken to be the state of the variables in memory. Program relations denote both forward and backward computations, and the direction of the computation depends upon the instantiation pattern of arguments in the relation. This view of inversion has practical applications when the relational semantics is treated as a logic program. Depending on the logic programming inference scheme used, execution of this relational program can compute the inverse of the imperative program. A number of nontrivial imperative computations can be inverted with minimal logic programming tools.
Similar content being viewed by others
References
Bennett, C.H. Logical reversibility of computation.IBM Journal of Research and Development, 17:525–532, 1973.
Bennett, C.H. The thermodynamics of computation — a review.International Journal of Theoretical Physics, 21(12):905–940, 1982.
Brough, D.R. and Hogger, C.J. Grammar-related transformations of logic programs.New Generation Computing, 9:115–134, 1991.
Broy, M. and Krieg-Bruckner, B. Derivation of invariant assertions during program development by transformation.TOPLAS, 2(3):321–337, July 1980.
Clark, K.L. Predicate Logic as a Computational Formalism. Technical Report 79/59, Imperial College, December 1979.
Clocksin, W.F. and Mellish, C.S.Programming in Prolog (3rd ed). Springer-Verlag, 1987.
Chen, W. and Udding, J.T. Program inversion: more than fun!Science of Computer Programming, 15:1–13, 1990.
Clark, K.L. and van Emden, M.H. Consequence verification of flowcharts.IEEE Transactions on Software Engineering, SE-7(1):52–60, January 1981.
Darlington, J. An experimental program transformation and synthesis system.Artificial Intelligence, 16:1–46, 1981.
Dijkstra, E.W. EWD671: Program inversion. InSelected Writings on Computing: A Personal Perspective, pages 351–354. Springer-Verlag, 1982.
Gries, D.The Science of Programming. Springer-Verlag, 1981.
Gries, D. and van de Snepscheut, J.L.A. Inorder traversal of a binary tree and its inversion. In E.W. Dijkstra, editor,Formal Development of Programs and Proofs, pages 37–42. Addison Wesley, 1990.
Harrison, P.G. and Khoshnevisan, H. On the Synthesis of Function Inverses. Technical report, Imperial College, 1986.
Holland, J.H., Holyoak, K.J., Nisbett, R.E. and Thagard, P.R.Induction. MIT Press, Cambridge, Mass., 1986.
Hoare, C. A. R.Communicating Sequential Processes. Prentice-Hall, 1985.
Hogger, C.J. Essentials of Logic Programming. Oxford University Press, 1990.
Hopcroft, J.E. and Ullman, J.D.Introduction to Automata Theory, Languages, and Computation. Addison Wesley, 1979.
Knuth, Donald E.Seminumerical Algorithms. Addison-Wesley, 2nd edition, 1981.
Korf, R.E. Inversion of applicative programs. InIJCAI, pages 1007–1009, 1981.
Leeman, G.B. A formal approach to undo operations in programming languages.Journal of the ACM, 8(1):50–87, January 1986.
Lloyd, J.W.Foundations of Logic Programming (2nd ed). Springer-Verlag, 1987.
McCarthy, J. The inversion of functions defined by turing machines. In C.E. Shannon and J. McCarthy, editors,Automata Studies, pages 177–181. Princeton University Press, 1956.
Ross, B.J. The partial evaluation of imperative programs using prolog. InMetaprogramming in Logic Programming, pages 341–363. MIT Press, 1989.
Sperschneider, V. and Antoniou, G.Logic: A Foundation for Computer Science. Addison Wesley, 1991.
Sickel, S. Invertibility of logic programs. In4th Workshop on Automated Deduction, pages 103–109, Austin, Texas, February 1–3 1979.
Shoham, Y. and McDermott, D.V. Directed relations and inversion of prolog programs. InInternational Conference on Fifth Generation Computer Systems, pages 307–316, 1984.
Vasak, T. and Potter, J. Metalogical control for logic programs.Journal of Logic Programming, 2(3):203–220, October 1985.
Toffoli, T. and Margolus, N. Invertible cellular automata: a review.Physica D, Nonlinear Phenomena, 45(1–3), 1990.
van de Snepscheut, J.L.A.What Computing is All About. Springer-Verlag, New York, 1993.
van Hentenryck, P.Constraint Satisfaction in Logic Programming. MIT Press, 1990.
von Wright, J. Program inversion in the refinement calculus.Information Processing letters, 37:95–100, January 1991.
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
About this article
Cite this article
Ross, B.J. Running programs backwards: The logical inversion of imperative computation. Formal Aspects of Computing 9, 331–348 (1997). https://doi.org/10.1007/BF01211087
Received:
Accepted:
Issue Date:
DOI: https://doi.org/10.1007/BF01211087