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]
Gopalan Nadathur,et al.
Higher-Order Logic Programming
,
1986,
ICLP.
[2]
A. Troelstra.
Metamathematical investigation of intuitionistic arithmetic and analysis
,
1973
.
[3]
Dale Miller.
A Logic Programming Language with Lambda-Abstraction, Function Variables, and Simple Unification
,
1991,
J. Log. Comput..
[4]
Krzysztof R. Apt,et al.
Logic Programming
,
1990,
Handbook of Theoretical Computer Science, Volume B: Formal Models and Sematics.
[5]
Danny De Schreye.
Extensionality of Simply Typed Logic Programs
,
1999
.
[6]
G.D. Plotkin,et al.
LCF Considered as a Programming Language
,
1977,
Theor. Comput. Sci..
[7]
R. Hindley.
The Principal Type-Scheme of an Object in Combinatory Logic
,
1969
.
[8]
Leon Henkin,et al.
Completeness in the theory of types
,
1950,
Journal of Symbolic Logic.