Reverse Hoare Logic

  • Edsko de Vries
  • Vasileios Koutavas
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7041)

Abstract

We present a novel Hoare-style logic, called Reverse Hoare Logic, which can be used to reason about state reachability of imperative programs. This enables us to give natural specifications to randomized (deterministic or nondeterministic) algorithms. We give a proof system for the logic and use this to give simple formal proofs for a number of illustrative examples. We define a weakest postcondition calculus and use this to show that the proof system is sound and complete.

Keywords

Program Logic Proof System Loop Variant Logic Variable Dynamic Logic 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Apt, K.R.: Ten years of Hoare’s logic: A survey—part I. ACM Trans. Program. Lang. Syst. 3, 431–483 (1981)MATHCrossRefGoogle Scholar
  2. 2.
    Apt, K.R.: Ten years of Hoare’s logic: A survey—part II: Nondeterminism. Theoretical Computer Science 28(1-2), 83–109 (1983)MATHCrossRefGoogle Scholar
  3. 3.
    Bacchus, F., Yang, Q.: Downward refinement and the efficiency of hierarchical problem solving. Artificial Intelligence 71(1), 43–100 (1994)MATHCrossRefGoogle Scholar
  4. 4.
    Barnett, M., DeLine, R., Fähndrich, M., Jacobs, B., Leino, K.R.M., Schulte, W., Venter, H.S.: The spec# programming system: Challenges and directions. In: Meyer, B., Woodcock, J. (eds.) VSTTE 2005. LNCS, vol. 4171, pp. 144–152. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  5. 5.
    Chadha, R., Cruz-Filipe, L., Mateus, P., Sernadas, A.: Reasoning about probabilistic sequential programs. Theor. Comput. Sci. 379, 142–165 (2007)MATHCrossRefGoogle Scholar
  6. 6.
    Chen, W., Udding, J.T.: Program inversion: more than fun! Sci. Comput. Program. 15, 1–13 (1990)MATHCrossRefGoogle Scholar
  7. 7.
    Cok, D., Kiniry, J.: ESC/Java2: Uniting ESC/Java and JML. In: Barthe, G., Burdy, L., Huisman, M., Lanet, J.-L., Muntean, T. (eds.) CASSIS 2004. LNCS, vol. 3362, pp. 108–128. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  8. 8.
    Goldblatt, R.: Logics of time and computation. Center for the Study of Language and Information, Stanford, CA, USA (1987)Google Scholar
  9. 9.
    Harel, D.: Logics of programs: Axiomatics and descriptive power. Tech. rep., Massachusetts Institute of Technology, Cambridge, MA, USA (1978)Google Scholar
  10. 10.
    den Hartog, J.: Verifying probabilistic programs using a Hoare like logic. In: Thiagarajan, P., Yap, R. (eds.) ASIAN 1999. LNCS, vol. 1742, pp. 790–790. Springer, Heidelberg (1999)Google Scholar
  11. 11.
    Heyer, T.: Semantic Inspection of Software Artifacts From Theory to Practice. Ph.D. thesis, Linköping University (2001)Google Scholar
  12. 12.
    Hoare, C.A.R.: An axiomatic basis for computer programming. Commun. ACM 12, 576–580 (1969)MATHCrossRefGoogle Scholar
  13. 13.
    Hoare, C.A.R., Wirth, N.: An axiomatic definition of the programming language PASCAL. Acta Informatica 2, 335–355 (1973)MATHCrossRefGoogle Scholar
  14. 14.
    Hofmann, M., Pavlova, M.: Elimination of ghost variables in program logics. In: Barthe, G., Fournet, C. (eds.) TGC 2007. LNCS, vol. 4912, pp. 1–20. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  15. 15.
    Honda, K., Yoshida, N., Berger, M.: An observationally complete program logic for imperative higher-order functions. In: LICS, pp. 270–279. IEEE, Los Alamitos (2005)Google Scholar
  16. 16.
    Kanig, J., Filliâtre, J.C.: Who: a verifier for effectful higher-order programs. In: ACM SIGPLAN Workshop on ML, pp. 39–48. ACM, New York (2009)Google Scholar
  17. 17.
    Kleymann, T.: Hoare logic and auxiliary variables. Formal Aspects of Computing 11, 541–566 (1999), http://dx.doi.org/10.1007/s001650050057, doi:10.1007/s001650050057MATHCrossRefGoogle Scholar
  18. 18.
    Kozen, D.: A probabilistic PDL. J. Comp. and Sys. Sc. 30(2), 162–178 (1985)MATHCrossRefGoogle Scholar
  19. 19.
    Kumar, A., Srivastava, B., Mittal, S.: Information modeling for end to end composition of semantic web services. In: Gil, Y., Motta, E., Benjamins, V.R., Musen, M.A. (eds.) ISWC 2005. LNCS, vol. 3729, pp. 476–490. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  20. 20.
    Meyer, B.: Object-oriented software construction, 2nd edn. Prentice-Hall, Inc., Upper Saddle River (1997)MATHGoogle Scholar
  21. 21.
    Morgan, C., McIver, A., Seidel, K.: Probabilistic predicate transformers. ACM Trans. Program. Lang. Syst., 325–353 (1996)Google Scholar
  22. 22.
    Nanevski, A., Morrisett, G., Birkedal, L.: Polymorphism and separation in Hoare Type Theory. SIGPLAN Not. 41, 62–73 (2006)MATHCrossRefGoogle Scholar
  23. 23.
    Ramshaw, L.H.: Formalizing the analysis of algorithms. Ph.D. thesis, Stanford University (1979)Google Scholar
  24. 24.
    Reussner, R., Poernomo, I., Schmidt, H.: Reasoning about software architectures with contractually specified components. In: Cechich, A., Piattini, M., Vallecillo, A. (eds.) CBSQ 2003. LNCS, vol. 2693, pp. 287–325. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  25. 25.
    Reynolds, J.C.: Separation logic: A logic for shared mutable data structures. In: LICS, pp. 55–74. IEEE Computer Society, Washington, DC, USA (2002)Google Scholar
  26. 26.
    ten Teije, A., van Harmelen, F.: Characterising approximate problem solving: by partially fulfilled pre- and postconditions. In: ECAI 1998. CEUR-WS, vol. 16, pp. 78–82 (1998)Google Scholar
  27. 27.
    Woodcock, J., Cavalcanti, A.: A Tutorial Introduction to Designs in Unifying Theories of Programming. In: Boiten, E.A., Derrick, J., Smith, G.P. (eds.) IFM 2004. LNCS, vol. 2999, pp. 40–66. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  28. 28.
    von Wright, J.: Program inversion in the refinement calculus. Information Processing Letters 37(2), 95–100 (1991)MATHCrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2011

Authors and Affiliations

  • Edsko de Vries
    • 1
  • Vasileios Koutavas
    • 1
  1. 1.Trinity CollegeDublinIreland

Personalised recommendations