Affiliation:
1. University of Cambridge, Cambridge, United Kingdom
2. Microsoft Research, Cambridge, United Kingdom
Abstract
Inheritance is a fundamental concept in object-oriented programming, allowing new classes to be defined in terms of old classes. When used with care, inheritance is an essential tool for object-oriented programmers. Thus, for those interested in developing formal verification techniques, the treatment of inheritance is of paramount importance. Unfortunately, inheritance comes in a number of guises, all requiring subtle techniques.To address these subtleties, most existing verification methodologies typically adopt one of two restrictions to handle inheritance: either (1) they prevent a derived class from restricting the behaviour of its base class (typically by syntactic means) to trivialize the proof obligations; or (2) they allow a derived class to restrict the behaviour of its base class, but require that every inherited method must be reverified. Unfortunately, this means that typical inheritance-rich code either cannot be verified or results in an unreasonable number of proof obligations.In this paper, we develop a separation logic for a core object-oriented language. It allows derived classes which override the behaviour of their base class, yet supports the inheritance of methods without reverification where this is safe. For each method, we require two specifications: astaticspecification that is used to verify the implementation and direct method calls (in Java this would be with a super call); and adynamicspecification that is used for calls that are dynamically dispatched; along with a simple relationship between the two specifications. Only the dynamic specification is involved with behavioural subtyping. This simple separation of concerns leads to a powerful system that supports all forms of inheritance with low proof-obligation overheads. We both formalize our methodology and demonstrate its power with a series of inheritance examples.
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Cited by
25 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Verifying C++ Dynamic Binding;Proceedings of the 25th ACM International Workshop on Formal Techniques for Java-like Programs;2023-07-18
2. Incorrectness Proofs for Object-Oriented Programs via Subclass Reflection;Programming Languages and Systems;2023
3. A fully verified container library;Formal Aspects of Computing;2018-09
4. Fragile base-class problem, problem?;Empirical Software Engineering;2016-08-08
5. Bibliography;From Action Systems to Distributed Systems;2016-04-20