Hoare Logic for NanoJava: Auxiliary Variables, Side Effects, and Virtual Methods Revisited
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.
KeywordsHoare logic Java Isabelle/HOL auxiliary variables side effects dynamic binding
Unable to display preview. Download preview PDF.
- 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
- 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.M. Huisman. Java program verification in Higher-order logic with PVS and Isabelle. PhD thesis, University of Nijmegen, 2001.Google Scholar
- 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.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.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.T. Kleymann. Hoare logic and VDM: Machine-checked soundness and completeness proofs. Ph.D. Thesis, ECS-LFCS-98-392, LFCS, 1998.Google Scholar
- 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.J. Morris. Comments on “procedures and parameters”. Undated and unpublished.Google Scholar
- 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.T. Nipkow. Hoare logics for recursive procedures and unbounded nondeterminism. Draft, 2001.Google Scholar
- 17.T. Nipkow. Hoare logics in Isabelle/HOL. In Proof and System-Reliability, 2002.Google Scholar
- 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. http://isabelle.in.tum.de/Bali/papers/MOD99.html.
- 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. http://isabelle.in.tum.de/Bali/papers/FSTTCS99.html.
- 21.D. v. Oheimb. Analyzing Java in Isabelle/HOL: Formalization, Type Safety and Hoare Logic. PhD thesis, Technische Universität München, 2001. http://www4.in.tum.de/~oheimb/diss/.
- 22.D. v. Oheimb. Hoare logic for Java in Isabelle/HOL. Concurrency and Computation: Practice and Experience, 13(13), 2001. http://isabelle.in.tum.de/Bali/papers/CPE01.html.
- 23.A. Poetzsch-Heffter. Personal communication, Aug. 2001.Google Scholar
- 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