Java Program Verification via a Hoare Logic with Abrupt Termination

  • Marieke Huisman
  • Bart Jacobs
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1783)


This paper formalises a semantics for statements and expressions (in sequential imperative languages) which includes non-termination, normal termination and abrupt termination (e.g. because of an exception, break, return or continue). This extends the traditional semantics underlying e.g. Hoare logic, which only distinguishes termination and non-termination. An extension of Hoare logic is elaborated that includes means for reasoning about abrupt termination (and side-effects). It prominently involves rules for reasoning about while loops, which may contain exceptions, breaks, continues and returns. This extension applies in particular to Java. As an example, a standard pattern search algorithm in Java (involving a while loop with returns) is proven correct using the proof-tool PVS.


Programming Logic Return Abnormality Type Theory Java Program Abnormal State 
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.


  1. [1]
    M. Abadi and K.R.M. Leino. A logic of object-oriented programs. In M. Bidoit and M. Dauchet, editors, TAPSOFT’97: Theory and Practice of Software Development, volume 1214 of LNCS, pages 682–696. Springer-Verlag, 1997.CrossRefGoogle Scholar
  2. [2]
    K.R. Apt. Ten years of Hoare’s logic: A survey—part I. ACM Trans. on Progr. Lang. and Systems, 3(4):431–483, 1981.zbMATHCrossRefGoogle Scholar
  3. [3]
    K.R. Apt and E.-R. Olderog. Verification of Sequential and Concurrent Programs. Springer, 2nd rev. edition, 1997.Google Scholar
  4. [4]
    K. Arnold and J. Gosling. The Java Programming Language. Addison-Wesley, 2nd edition, 1997.Google Scholar
  5. [5]
    E.A. Ashcroft, M. Clint, and C.A.R. Hoare. Remarks on “Program proving: jumps and functions by M. Clint and C.A.R. Hoare”. Acta Informatica, 6:317–318, 1976.zbMATHCrossRefGoogle Scholar
  6. [6]
    J.W. de Bakker. Mathematical Theory of Program Correctness. Prentice Hall, 1980.Google Scholar
  7. [7]
    J. van den Berg, M. Huisman, B. Jacobs, and E. Poll. A type-theoretic memory model for verification of sequential Java programs. Techn. Rep. CSI-R9924, Comput. Sci. Inst., Univ. of Nijmegen, 1999.Google Scholar
  8. [8]
    F.S. de Boer. A WP-calculus for OO. In W. Thomas, editor, Foundations of Software Science and Computation Structures, number 1578 in LNCS, pages 135–149. Springer, Berlin, 1999.CrossRefGoogle Scholar
  9. [9]
    F. Christian. Correct and robust programs. IEEE Trans. on Software Eng., 10(2):163–174, 1984.CrossRefGoogle Scholar
  10. [10]
    M. Clint and C.A.R. Hoare. Program proving: jumps and functions. Acta Informatica, 1:214–224, 1972.CrossRefGoogle Scholar
  11. [11]
    M.J.C. Gordon. Programming Language Theory and its Implementation. Prentice Hall, 1988.Google Scholar
  12. [12]
    M.J.C. Gordon. Mechanizing programming logics in higher order logic. In Current Trends in Hardware Verification and Automated Theorem Proving. Springer-Verlag, 1989.Google Scholar
  13. [13]
    J. Gosling, B. Joy, and G. Steele. The Java Language Specification. Addison-Wesley, 1996.Google Scholar
  14. [14]
    D. Gries. The Science of Programming. Springer, 1981.Google Scholar
  15. [15]
    W.O.D. Griffioen and M. Huisman. A comparison of PVS and Isabelle/HOL. In J. Grundy and M. Newey, editors, Proceedings of the 12 International Workshop on Theorem Proving in Higher Order Logics (TPHOLs’ 98), volume 1479 of LNCS, September 1998.CrossRefGoogle Scholar
  16. [16]
    U. Hensel, M. Huisman, B. Jacobs, and H. Tews. Reasoning about classes in object-oriented languages: Logical models and tools. In Proceedings of European Symposium on Programming (ESOP), volume 1381 of LNCS, pages 105–121. Springer-Verlag, March 1998.Google Scholar
  17. [17]
    M. Huisman, B. Jacobs, and J. van den Berg. A case study in class library verification: Java’s Vector class (abstract). In B. Jacobs, G.T. Leavens, P. Müller, and A. Poetzsch-Heffter, editors, Formal Techniques for Java Programs, volume 251-5/1999 of Informatik berichte FernUniversität Hagen, 1999.Google Scholar
  18. [18]
    B. Jacobs and E. Poll. A monad for basic Java semantics. Techn. Rep. CSI-R9926, Comput. Sci. Inst., Univ. of Nijmegen, 1999.Google Scholar
  19. [19]
    B. Jacobs, J. van den Berg, M. Huisman, M. van Berkum, U. Hensel, and H. Tews. Reasoning about classes in Java (preliminary report). In Object-Oriented Programming, Systems, Languages and Applications (OOPSLA), pages 329–340. ACM Press, 1998.Google Scholar
  20. [20]
    G.T. Leavens, A.L. Baker, and C. Ruby. Preliminary design of JML: A behavioral interface specification language for Java. Technical Report 98-06c, Iowa State University, Department of Computer Science, January 1999.Google Scholar
  21. [21]
    K.R.M. Leino. Toward Reliable Modular Programs. PhD thesis, California Inst. of Techn., 1995.Google Scholar
  22. [22]
    R. Leino and J. van de Snepscheut. Semantics of exceptions. In E.-R. Olderog, editor, Programming Concepts, Methods and Calculi, pages 447–466. North-Holland, 1994.Google Scholar
  23. [23]
    S. Owre, S. Rajan, J.M. Rushby, N. Shankar, and M.K. Srivas. PVS: Combining specification, proof checking, and model checking. In R. Alur and T.A. Henzinger, editors, Computer-Aided Verification (CAV’ 96), volume 1102 of LNCS, pages 411–414, New Brunswick, NJ, July/August 1996. Springer-Verlag.Google Scholar
  24. [24]
    S. Owre, J. Rushby, N. Shankar, and F. von Henke. Formal verification for fault tolerant architectures: Prolegomena to the design of PVS. IEEE Transactions on Software Engineering, 21(2):107–125, February 1995.CrossRefGoogle Scholar
  25. [25]
    D. Parnas. A generalized control structure and its formal definition. Communications of the ACM, 26(8):572–581, 1983.zbMATHCrossRefGoogle Scholar
  26. [26]
    L.C. Paulson. Isabelle-a generic theorem prover, volume 828 of LNCS. Springer-Verlag, 1994. With contributions by Tobias Nipkow.zbMATHGoogle Scholar
  27. [27]
    A. Poetzsch-Heffter and P. Müller. A programming logic for sequential Java. In S.D. Swierstra, editor, Programming Languages and Systems, LNCS, pages 162–176. Springer, Berlin, 1999.CrossRefGoogle Scholar
  28. [28]
    J.C. Reynolds. Theories of Programming Languages. Cambridge University Press, 1998.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2000

Authors and Affiliations

  • Marieke Huisman
    • 1
  • Bart Jacobs
    • 1
  1. 1.Computing Science InstituteUniversity of NijmegenNijmegenThe Netherlands

Personalised recommendations