The concept of class invariant in object-oriented programming
Bertrand Meyer, Alisa Arkadova, Alexander Kogtenkov

TL;DR
This paper introduces a new proof rule for verifying class invariants in object-oriented programming, addressing key challenges like callbacks and reference leaks, thus enhancing program correctness verification.
Contribution
It presents a novel, adaptable proof rule that effectively handles complex issues in invariant verification, improving reliability of object-oriented program verification tools.
Findings
Proof rule is sound on simplified models.
Adapted proof rule handles callbacks, leaks, and furtive access.
Successfully verifies challenging examples from literature.
Abstract
Class invariants -- consistency constraints preserved by every operation on objects of a given type -- are fundamental to building, understanding and verifying object-oriented programs. For verification, however, they raise difficulties, which have not yet received a generally accepted solution. The present work introduces a proof rule meant to address these issues and allow verification tools to benefit from invariants. It clarifies the notion of invariant and identifies the three associated problems: callbacks, furtive access and reference leak. As an example, the 2016 Ethereum DAO bug, in which $50 million were stolen, resulted from a callback invalidating an invariant. The discussion starts with a simplified model of computation and an associated proof rule, demonstrating its soundness. It then removes one by one the three simplifying assumptions, each removal raising one of the…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Engineering Research · Logic, programming, and type systems · Formal Methods in Verification
