Hoare Logic for NanoJava: Auxiliary Variables, Side Effects, and Virtual Methods Revisited

  • David von Oheimb
  • Tobias Nipkow
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2391)


We define NanoJava, a kernel of Java tailored to the investigation of Hoare logics. We then introduce a Hoare logic for this language featuring an elegant approach for expressing auxiliary variables: by universal quantification on the outer logical level. Furthermore, we give simple means of handling side-effecting expressions and dynamic binding within method calls. The logic is proved sound and (relatively) complete using Isabelle/HOL.


Hoare logic Java Isabelle/HOL auxiliary variables side effects dynamic binding 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    M. Abadi and K. R. M. Leino. A logic of object-oriented programs. In Theory and Practice of Software Development, volume 1214 of Lect. Notes in Comp. Sci., pages 682–696. Springer-Verlag, 1997.Google Scholar
  2. 2.
    P. America and F. de Boer. Proving total correctness of recursive procedures. Information and Computation, 84:129–162, 1990.zbMATHCrossRefMathSciNetGoogle Scholar
  3. 3.
    K. R. Apt. Ten years of Hoare logic: A survey — part I. ACM Trans. on Prog. Languages and Systems, 3:431–483, 1981.zbMATHCrossRefGoogle Scholar
  4. 4.
    S.A. Cook. Soundness and completeness of an axiom system for program verification. SIAM Journal on Computing, 7(1):70–90, 1978.zbMATHCrossRefMathSciNetGoogle Scholar
  5. 5.
    G. A. Gorelick. A complete axiomatic system for proving assertions about recursive and non-recursive programs. Technical Report 75, Department of Computer Science, University of Toronto, 1975.Google Scholar
  6. 6.
    M. Huisman. Java program verification in Higher-order logic with PVS and Isabelle. PhD thesis, University of Nijmegen, 2001.Google Scholar
  7. 7.
    M. Huisman and B. Jacobs. Java program verification via a Hoare logic with abrupt termination. In Fundamental Approaches to Software Engineering, volume 1783 of Lect. Notes in Comp. Sci., pages 284–303. Springer-Verlag, 2000.Google Scholar
  8. 8.
    A. Igarashi, B. Pierce, and P. Wadler. Featherweight Java: A minimal core calculus for Java and GJ. In ACM Symposium on Object Oriented Programming: Systems, Languages, and Applications (OOPSLA), Oct. 1999. Full version in ACM Transactions on Programming Languages and Systems (TOPLAS), 2001.Google Scholar
  9. 9.
    B. Jacobs and E. Poll. A logic for the Java Modeling Language JML. In H. Hussmann, editor, Fundamental Approaches to Software Engineering, volume 2029 of Lect. Notes in Comp. Sci., pages 284–299. Springer-Verlag, 2001.Google Scholar
  10. 10.
    T. Kleymann. Hoare logic and VDM: Machine-checked soundness and completeness proofs. Ph.D. Thesis, ECS-LFCS-98-392, LFCS, 1998.Google Scholar
  11. 11.
    T. Kleymann. Hoare logic and auxiliary variables. Formal Aspects of Computing, 11:541–566, 1999.zbMATHCrossRefGoogle Scholar
  12. 12.
    T. Kowaltowski. Axiomatic approach to side effects and general jumps. Acta Informatica, 7:357–360, 1977.zbMATHCrossRefMathSciNetGoogle Scholar
  13. 13.
    K. R. M. Leino. Ecstatic: An object-oriented programming language with an axiomatic semantics. In Fourth International Workshop on Foundations of Object-Oriented Programming (FOOL 4), 1997.Google Scholar
  14. 14.
    J. Morris. Comments on “procedures and parameters”. Undated and unpublished.Google Scholar
  15. 15.
    T. Nipkow. Winskel is (almost) right: Towards a mechanized semantics textbook. In V. Chandru and V. Vinay, editors, Foundations of Software Technology and Theoretical Computer Science, volume 1180 of Lect. Notes in Comp. Sci., pages 180–192. Springer-Verlag, 1996.Google Scholar
  16. 16.
    T. Nipkow. Hoare logics for recursive procedures and unbounded nondeterminism. Draft, 2001.Google Scholar
  17. 17.
    T. Nipkow. Hoare logics in Isabelle/HOL. In Proof and System-Reliability, 2002.Google Scholar
  18. 18.
    T. Nipkow, D. v. Oheimb, and C. Pusch. μJava: Embedding a programming language in a theorem prover. In F. Bauer and R. Steinbrüggen, editors, Foundations of Secure Computation, pages 117–144. IOS Press, 2000.
  19. 19.
    T. Nipkow, L. C. Paulson, and M. Wenzel. Isabelle/HOL — A Proof Assistant for Higher-Order Logic, volume 2283 of LNCS. Springer, 2002. Scholar
  20. 20.
    D. v. Oheimb. Hoare logic for mutual recursion and local variables. In C. P. Rangan, V. Raman, and R. Ramanujam, editors, Foundations of Software Technology and Theoretical Computer Science, volume 1738 of Lect. Notes in Comp. Sci., pages 168–180. Springer-Verlag, 1999.
  21. 21.
    D. v. Oheimb. Analyzing Java in Isabelle/HOL: Formalization, Type Safety and Hoare Logic. PhD thesis, Technische Universität München, 2001.
  22. 22.
    D. v. Oheimb. Hoare logic for Java in Isabelle/HOL. Concurrency and Computation: Practice and Experience, 13(13), 2001.
  23. 23.
    A. Poetzsch-Heffter. Personal communication, Aug. 2001.Google Scholar
  24. 24.
    A. Poetzsch-Heffter and P. Müller. A programming logic for sequential Java. In S. Swierstra, editor, Programming Languages and Systems (ESOP’ 99), volume 1576 of Lect. Notes in Comp. Sci., pages 162–176. Springer-Verlag, 1999.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2002

Authors and Affiliations

  • David von Oheimb
    • 1
  • Tobias Nipkow
    • 1
  1. 1.Fakultät für InformatikTechnische Universität MünchenGermany

Personalised recommendations