Title: Checking correctness properties of object-oriented programs
1Checking correctness properties of
object-oriented programs
- K. Rustan M. LeinoMicrosoft Research, Redmond, WA
Lecture 1EEF summer school on Specification,
Refinement, and Verification20 Aug 2002, Turku,
Finland
2Exercise
- Implement a union-find class in Java and check it
with ESC/Java
class UnionFind // creates a union-find data
structure with size elements, // each in a
separate equivalence class public UnionFind(int
size) // returns the representative for
the equivalence class containing c public int
find(int c) // merges the equivalence
classes containing elements c and d public
void union(int c, int d)
3(No Transcript)
4Commands
- A command may
- terminate normally
- go wrong (crash the computer)
- diverge (fail to terminate, infinite recursion)
- block (fail to start, also called miraculous
termination)
5(No Transcript)
6(No Transcript)
7(No Transcript)
8(No Transcript)
9(No Transcript)
10(No Transcript)
11(No Transcript)
12(No Transcript)
13(No Transcript)
14(No Transcript)
15Exercise
- Define specification statement where
postcondition mentions x,x instead of x0,x - Example xtrue, xltx
16Exercise
- Define while inv J B do w S end where
w is the list of targets in Sin terms of the
commands seen so far.
17Answer
18References
- Edsger W. Dijkstra. A Discipline of Programming.
Prentice Hall, 1976. - Greg Nelson. A Generalization of Dijkstra's
Calculus. TOPLAS 11(4), pp. 517-561, ACM, 1989. - Ralph-Johan Back and Joakim von Wright.
Refinement Calculus A Systematic Introduction.
Graduate Texts in Computer Science,
Springer-Verlag, 1998. - C.A.R. Hoare. An axiomatic basis for computer
programming. CACM 12(10), pp. 576-580,583, Oct.
1969. - Carroll Morgan. The specification statement.
TOPLAS 10(3), pp. 403-419, ACM, Jul. 1988. - John McCarthy and James Painter. Correctness of
a compiler for arithmetic expressions. In J.-T.
Schwartz, ed., Proceedings of Symposia in Applied
Mathematics, American Mathematical Society, 1967.
19References
- O.-J. Dahl, E.W. Dijkstra, and C.A.R. Hoare.
Structured Programming. Academic Press, 1972. - C.A.R. Hoare and Niklaus Wirth. An axiomatic
definition of the programming language PASCAL.
In Acta Informatica 2, Springer, 1973. - G. Birkhoff. Lattice Theory. Volume 25 of
Colloquium Publications 25. American
Mathematical Society, 1967. - David L. Parnas. A Technique for Software
Module Specification with Examples. CACM 15(5),
pp. 330-336, ACM, May 1972. - K. Rustan M. Leino, James B. Saxe, and Raymie
Stata. Checking Java programs via guarded
commands. In Bart Jacobs, et al., eds., Formal
Techniques for Java Programs, Technical Report
251, FernUniversität Hagen, May 1999.