Abstract
We describe an extension of Hoare’s logic for reasoning about programs that alter data structures. We consider a low-level storage model based on a heap with associated lookup, update, allocation and deallocation operations, and unrestricted address arithmetic. The assertion language is based on a possible worlds model of the logic of bunched implications, and includes spatial conjunction and implication connectives alongside those of classical logic. Heap operations are axiomatized using what we call the “small axioms”, each of which mentions only those cells accessed by a particular command. Through these and a number of examples we show that the formalism supports local reasoning: A specification and proof can concentrate on only those cells in memory that a program accesses.
This paper builds on earlier work by Burstall, Reynolds, Ishtiaq and O’Hearn on reasoning about data structures.
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
A. Borgida, J. Mylopoulos, and R. Reiter. On the frame problem in procedure specifications. IEEE Transactions of Software Engineering, 21:809–838, 1995.
R. Bornat. Proving pointer programs in Hoare logic. Mathematics of Program Construction, 2000.
R.M. Burstall. Some techniques for proving correctness of programs which alter data structures. Machine Intelligence, 7:23–50, 1972.
C. Calcagno, S. Isthiaq, and P. W. O’Hearn. Semantic analysis of pointer aliasing, allocation and disposal in Hoare logic. Proceedings of the Second International ACM SIGPLAN Conference on Principles and Practice of Declarative Programming, 2000.
P. Cousot. Methods and logics for proving programs. In J. van Leeuwen, editor, Handbook of Theoretical Computer Science, volume B, pages 843–993. Elsevier, Amsterdam, and The MIT Press, Cambridge, Mass., 1990.
C. A. R. Hoare and J. He. A trace model for pointers and objects. In Rachid Guerraoui, editor, ECCOP’99-Object-Oriented Programming, 13th European Conference, pages 1–17, 1999. Lecture Notes in Computer Science, Vol. 1628, Springer.
S. Isthiaq and P.W. O’Hearn. BI as an assertion language for mutable data structures. In Conference Record of the Twenty-Eighth Annual ACM Symposium on Principles of Programming Languages, pages 39–46, London, January 2001.
K. R. M. Leino and G. Nelson. Data abstraction and information hiding. Technical Report Reearch Report 160, Compaq Systems Research Center, Palo Alto,CA, November 2000.
J. McCarthy and P. Hayes. Some philosophical problems from the standpoint of artificial intelligence. Machine Intelligence, 4:463–502, 1969.
P. W. O’Hearn. Resource interpretations, bunched implications and the αλ-calculus. In Typed λ-calculus and Applications, J-Y Girard editor, L’Aquila, Italy, April 1999. Lecture Notes in Computer Science 1581.
P. W. O’Hearn and D. J. Pym. The logic of bunched implications. Bulletin of Symbolic Logic, 5(2):215–244, June 99.
P. W. O’Hearn and J. C. Reynolds. From Algol to polymorphic linear lambda-calculus. J. ACM, 47(1):267–223, January 2000.
P. W. O’Hearn and R. D. Tennent. Parametricity and local variables. J. ACM, 42(3):658–709, May 1995. Also in [14], vol 2, pages 109–164.
P. W. O’Hearn and R. D. Tennent, editors. Algol-like Languages. Two volumes, Birkhauser, Boston, 1997.
F. J. Oles. A Category-Theoretic Approach to the Semantics of Programming Languages. Ph.D. thesis, Syracuse University, Syracuse, N.Y., 1982.
F. J. Oles. Functor categories and store shapes. In O’Hearn and Tennent [14], pages 3–12. Vol. 2.
D. J. Pym. The Semantics and Proof Theory of the Logic of Bunched Implications. Monograph to appear, 2001.
J. C. Reynolds. Syntactic control of interference. In Conference Record of the Fifth Annual ACM Symposium on Principles of Programming Languages, pages 39–46, Tucson, Arizona, January 1978. ACM, New York. Also in [14], vol 1.
J. C. Reynolds. The essence of Algol. In J. W. de Bakker and J. C. van Vliet, editors, Algorithmic Languages, pages 345–372, Amsterdam, October 1981. North-Holland, Amsterdam. Also in [14], vol 1, pages 67–88.
J. C. Reynolds. Intuitionistic reasoning about shared mutable data structure. In Jim Davies, Bill Roscoe, and Jim Woodcock, editors, Millennial Perspectives in Computer Science, pages 303–321, Houndsmill, Hampshire, 2000. Palgrave.
J. C. Reynolds. Lectures on reasoning about shared mutable data structure. IFIP Working Group 2.3 School/Seminar on State-of-the-Art Program Design Using Logic. Tandil, Argentina, September 2000.
M. Shanahan. Solving the Frame Problem: A Mathematical Investigation of the Common Sense Law of Inertia. MIT Press, 1997.
H. Yang. An example of local reasoning in BI pointer logic: the Schorr-Waite graph marking algorithm. Manuscript, October 2000.
H. Yang. Local Reasoning for Stateful Programs. Ph.D. thesis, University of Illinois, Urbana-Champaign, Illinois, USA, 2001 (expected).
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2001 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
O’Hearn, P., Reynolds, J., Yang, H. (2001). Local Reasoning about Programs that Alter Data Structures. In: Fribourg, L. (eds) Computer Science Logic. CSL 2001. Lecture Notes in Computer Science, vol 2142. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-44802-0_1
Download citation
DOI: https://doi.org/10.1007/3-540-44802-0_1
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-42554-0
Online ISBN: 978-3-540-44802-0
eBook Packages: Springer Book Archive