Local Reasoning about Programs that Alter Data Structures

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.

[1]  Peter W. O'Hearn,et al.  BI as an assertion language for mutable data structures , 2001, POPL '01.

[2]  C. A. R. Hoare,et al.  A Trace Model for Pointers and Objects , 1999, ECOOP.

[3]  Peter W. O'Hearn,et al.  Semantic analysis of pointer aliasing, allocation and disposal in Hoare logic , 2000, PPDP '00.

[4]  K. Rustan M. Leino,et al.  Data abstraction and information hiding , 2002, TOPL.

[5]  Hongseok Yang,et al.  Local reasoning for stateful programs , 2001 .

[6]  Patrick Coust,et al.  Methods and logics for proving programs , 1991 .

[7]  John McCarthy,et al.  SOME PHILOSOPHICAL PROBLEMS FROM THE STANDPOINT OF ARTI CIAL INTELLIGENCE , 1987 .

[8]  Richard Bornat,et al.  Proving Pointer Programs in Hoare Logic , 2000, MPC.

[9]  Peter W. O'Hearn,et al.  Algol-Like Languages: v. 2 , 1996 .

[10]  J. Van Leeuwen,et al.  Handbook of theoretical computer science - Part A: Algorithms and complexity; Part B: Formal models and semantics , 1990 .

[11]  John C. Reynolds,et al.  The essence of ALGOL , 1997 .

[12]  Peter W. O'Hearn,et al.  Resource Interpretations, Bunched Implications and the alpha lambda-Calculus , 1999, TLCA.

[13]  Murray Shanahan Solving the frame problem - a mathematical investigation of the common sense law of inertia , 1997 .

[14]  Peter W. O'Hearn,et al.  Algol-like Languages , 1997, Progress in Theoretical Computer Science.

[15]  Frank J. Oles Functor Categories and Store Shapes , 1997 .

[16]  Frank J. Oles,et al.  A category-theoretic approach to the semantics of programming languages , 1982 .

[17]  P. W. O'hearn Resource interpretations, bunched implications and the αλ-calculus , 1999 .

[18]  Jim Davies,et al.  Millennial Perspectives in Computer Science , 2000 .

[19]  Peter W. O'Hearn,et al.  The Logic of Bunched Implications , 1999, Bulletin of Symbolic Logic.

[20]  Peter W. O'Hearn,et al.  From Algol to polymorphic linear lambda-calculus , 2000, JACM.

[21]  John C. Reynolds,et al.  Intuitionistic reasoning about shared mutable data structure , 1999 .

[22]  Hongseok Yang,et al.  An Example of Local Reasoning in BI Pointer Logic: the Schorr−Waite Graph Marking Algorithm , 2001 .

[23]  John Mylopoulos,et al.  On the Frame Problem in Procedure Specifications , 1995, IEEE Trans. Software Eng..

[24]  John C. Reynolds,et al.  Syntactic control of interference , 1978, POPL.

[25]  Peter W. O'Hearn,et al.  Parametricity and local variables , 1995, JACM.