Skip to main content
Log in

Running programs backwards: The logical inversion of imperative computation

  • Published:
Formal Aspects of Computing

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.

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

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Bennett, C.H. Logical reversibility of computation.IBM Journal of Research and Development, 17:525–532, 1973.

    Google Scholar 

  2. Bennett, C.H. The thermodynamics of computation — a review.International Journal of Theoretical Physics, 21(12):905–940, 1982.

    Google Scholar 

  3. Brough, D.R. and Hogger, C.J. Grammar-related transformations of logic programs.New Generation Computing, 9:115–134, 1991.

    Google Scholar 

  4. Broy, M. and Krieg-Bruckner, B. Derivation of invariant assertions during program development by transformation.TOPLAS, 2(3):321–337, July 1980.

    Google Scholar 

  5. Clark, K.L. Predicate Logic as a Computational Formalism. Technical Report 79/59, Imperial College, December 1979.

  6. Clocksin, W.F. and Mellish, C.S.Programming in Prolog (3rd ed). Springer-Verlag, 1987.

  7. Chen, W. and Udding, J.T. Program inversion: more than fun!Science of Computer Programming, 15:1–13, 1990.

    Google Scholar 

  8. Clark, K.L. and van Emden, M.H. Consequence verification of flowcharts.IEEE Transactions on Software Engineering, SE-7(1):52–60, January 1981.

    Google Scholar 

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

    Google Scholar 

  10. Dijkstra, E.W. EWD671: Program inversion. InSelected Writings on Computing: A Personal Perspective, pages 351–354. Springer-Verlag, 1982.

  11. Gries, D.The Science of Programming. Springer-Verlag, 1981.

  12. 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.

  13. Harrison, P.G. and Khoshnevisan, H. On the Synthesis of Function Inverses. Technical report, Imperial College, 1986.

  14. Holland, J.H., Holyoak, K.J., Nisbett, R.E. and Thagard, P.R.Induction. MIT Press, Cambridge, Mass., 1986.

    Google Scholar 

  15. Hoare, C. A. R.Communicating Sequential Processes. Prentice-Hall, 1985.

  16. Hogger, C.J. Essentials of Logic Programming. Oxford University Press, 1990.

  17. Hopcroft, J.E. and Ullman, J.D.Introduction to Automata Theory, Languages, and Computation. Addison Wesley, 1979.

  18. Knuth, Donald E.Seminumerical Algorithms. Addison-Wesley, 2nd edition, 1981.

  19. Korf, R.E. Inversion of applicative programs. InIJCAI, pages 1007–1009, 1981.

  20. Leeman, G.B. A formal approach to undo operations in programming languages.Journal of the ACM, 8(1):50–87, January 1986.

    Google Scholar 

  21. Lloyd, J.W.Foundations of Logic Programming (2nd ed). Springer-Verlag, 1987.

  22. 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.

  23. Ross, B.J. The partial evaluation of imperative programs using prolog. InMetaprogramming in Logic Programming, pages 341–363. MIT Press, 1989.

  24. Sperschneider, V. and Antoniou, G.Logic: A Foundation for Computer Science. Addison Wesley, 1991.

  25. Sickel, S. Invertibility of logic programs. In4th Workshop on Automated Deduction, pages 103–109, Austin, Texas, February 1–3 1979.

  26. Shoham, Y. and McDermott, D.V. Directed relations and inversion of prolog programs. InInternational Conference on Fifth Generation Computer Systems, pages 307–316, 1984.

  27. Vasak, T. and Potter, J. Metalogical control for logic programs.Journal of Logic Programming, 2(3):203–220, October 1985.

    Google Scholar 

  28. Toffoli, T. and Margolus, N. Invertible cellular automata: a review.Physica D, Nonlinear Phenomena, 45(1–3), 1990.

  29. van de Snepscheut, J.L.A.What Computing is All About. Springer-Verlag, New York, 1993.

    Google Scholar 

  30. van Hentenryck, P.Constraint Satisfaction in Logic Programming. MIT Press, 1990.

  31. von Wright, J. Program inversion in the refinement calculus.Information Processing letters, 37:95–100, January 1991.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Brian J. Ross.

Rights and permissions

Reprints 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

Download citation

  • Received:

  • Accepted:

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF01211087

Keywords

Navigation