Abstract
It is possible, but difficult, to reason in Hoare logic about programs which address and modify data structures defined by pointers. The challenge is to approach the simplicity of Hoare logic’s treatment of variable assignment, where substitution affects only relevant assertion formula. The axiom of assignment to object components treats each component name as a pointer-indexed array. This permits a formal treatment of inductively defined data structures in the heap but tends to produce instances of modified component mappings in arguments to inductively defined assertions. The major weapons against these troublesome mappings are assertions which describe spatial separation of data structures. Three example proofs are sketched.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Appel, A.W., Felty, A.P.: A Semantic Model of Types and Machine Instructions for Proof- Carrying Code. In: 27th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2000), January 2000, pp. 243–253 (2000)
Arnold, K., Gosling, J.: The Java programming language. Addison-Wesley, Reading (1997)
Bijlsma, A.: Calculating with Pointers. Science of Computer Programming 12, 191–205 (1989)
Bornat, R.: Machine-checked proofs of list reversal, list merge, Schorr-Waite, Available from http://www.dcs.qmw.ac.uk/~richard/pointers
Bornat, R., Sufrin, B.A.: Animating formal proof at the surface: the Jape proof calculator. The Computer Journal 43(3), 177–192 (1999)
Burstall, R.M.: Some techniques for proving correctness of programs which alter data structures. In: Michie, D. (ed.) Machine Intelligence 7, pp. 23–50. American Elsevier, New York (1972)
Cousot, P.: Methods and Logics for Proving Programs. In: van Leeuwen, J. (ed.) Formal Models and Semantics. Handbook of Theoretical Computer Science, vol. B, pp. 843–993. Elsevier, Amsterdam (1990)
Floyd, R.W.: Assigning meaning to programs. In: Proc. Symp. in App. Math., American Mathematical Society, vol. 19, pp. 19–32 (1967)
Gries, D.: The Schorr-Waite graph marking algorithm. Acta Informatica 11, 223–232 (1979)
Gries, D., Levin, G.M.: Assignment and procedure call proof rules. ACM Transactions on Programming Languages and Systems 2, 564–579 (1980)
Hoare, C.A.R.: An axiomatic basis for computer programming. Comm. ACM 12(10), 576–580 and 583 (1969)
Hoare, C.A.R., Jifeng, H.: A Trace Model for Pointers and Objects. In: Guerraoui, R. (ed.) ECOOP 1999. LNCS, vol. 1628, pp. 1–17. Springer, Heidelberg (1999)
Hoare, C.A.R., Wirth, N.: An Axiomatic Definition of the Programming Language Pascal. Acta Informatica 2, 335–355 (1973)
Jensen, K., Wirth, N.: Pascal user manual and report. Springer, Heidelberg (1975)
Kernighan, B.W., Ritchie, D.M.: The C programming language. Prentice-Hall, Englewood Cliffs (1978)
Kowaltowski, T.: Data Structures and Correctness of Programs. Journal of the ACM 2, 283–301 (1979)
Kowaltowski, T.: Examples of Informal but Rigorous Correctness Proofs for Tree Traversing Algorithms. Technical report TR-DCC-92-10, University of Campinas, Brazil
Leino, R.: Toward Reliable Modular Programs. PhD Thesis, California Institute of Technology (1995)
Luckham, D.C., Suzuki, N.: Verification of Array, Record, and Pointer Operations in Pascal. ACM Transactions on Programming Languages and Systems, Examples of Informal but Rigorous Correctness Proofs for Tree Traversing Algorithms 1, 226–244 (1979)
McCarthy, J., Painter, J.A.: Correctness of a Compiler for Arithmetic Expressions. In: Proceedings Symposium in Applied Mathematics, Mathematical Aspects of Computer Science, vol. 19, pp. 33–41 (1967)
Morris, J.M.: A general axiom of assignment. Assignment and linked data structure. A proof of the Schorr-Waite algorithm. In: Broy, M., Schmidt, G. (eds.) Theoretical Foundations of Programming Methodology (Proceedings of the 1981 Marktoberdorf Summer School), pp. 25–51. Reidel (1982)
Necula, G., Lee, P.: Safe, Untrusted Agents using Proof-Carrying Code. In: Vigna, G. (ed.) Mobile Agents and Security. LNCS, vol. 1419, pp. 61–91. Springer, Heidelberg (1998)
Reynolds, J.C.: The Craft of Programming. Prentice-Hall International, Englewood Cliffs (1981)
Reynolds, J.C.: Reasoning about Shared Mutable Data Structure, given at the symposium in celebration of the work of C.A.R. Hoare, Oxford (September 1999)
Schorr, H., Waite, W.M.: An efficient machine-independent procedure for garbage collection in various list structures. Comm. ACM 10, 501–506 (1967)
Strachey, C.: Towards a Formal Semantics. In: Steel Jr., T.B. (ed.) Formal Language Description Languages for Computer Programming. North-Holland, Amsterdam (1964)
Suzuki, N.: Automatic verification of programs with complex data structure. PhD Thesis, Stanford U (1976)
Topor, R.W.: The correctness of the Schorr-Waite list marking algorithm. Acta Informatica 11, 211–221 (1979)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2000 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Bornat, R. (2000). Proving Pointer Programs in Hoare Logic. In: Backhouse, R., Oliveira, J.N. (eds) Mathematics of Program Construction. MPC 2000. Lecture Notes in Computer Science, vol 1837. Springer, Berlin, Heidelberg. https://doi.org/10.1007/10722010_8
Download citation
DOI: https://doi.org/10.1007/10722010_8
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-67727-7
Online ISBN: 978-3-540-45025-2
eBook Packages: Springer Book Archive