https://arxiv.org/abs/2109.06557 close this message arXiv smileybones icon Global Survey In just 3 minutes help us understand how you see arXiv. TAKE SURVEY Skip to main content Cornell University We gratefully acknowledge support from the Simons Foundation and member institutions. arxiv logo > cs > arXiv:2109.06557 [ ] Help | Advanced Search [All fields ] Search arXiv logo Cornell University Logo [ ] GO quick links * Login * Help Pages * About Computer Science > Programming Languages arXiv:2109.06557 (cs) [Submitted on 14 Sep 2021 (v1), last revised 31 Dec 2022 (this version, v6)] Title:The concept of class invariant in object-oriented programming Authors:Bertrand Meyer, Alisa Arkadova, Alexander Kogtenkov Download PDF 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 three issues, and leading to a corresponding adaptation to the proof rule. The final version of the rule can tackle tricky examples, including "challenge problems" listed in the literature. Comments: Revised version following refereeing Subjects: Programming Languages (cs.PL); Software Engineering (cs.SE) ACM classes: D.1; D.2; D.3; F.3 Cite as: arXiv:2109.06557 [cs.PL] (or arXiv:2109.06557v6 [cs.PL] for this version) https://doi.org/10.48550/arXiv.2109.06557 Focus to learn more arXiv-issued DOI via DataCite Submission history From: Bertrand Meyer [view email] [v1] Tue, 14 Sep 2021 09:59:33 UTC (1,318 KB) [v2] Wed, 22 Sep 2021 16:19:19 UTC (1,318 KB) [v3] Sat, 9 Oct 2021 10:33:12 UTC (1,318 KB) [v4] Sun, 21 Aug 2022 11:39:11 UTC (1,815 KB) [v5] Tue, 30 Aug 2022 11:34:37 UTC (1,814 KB) [v6] Sat, 31 Dec 2022 22:39:27 UTC (2,174 KB) Full-text links: Download: * PDF * Other formats [by-4] Current browse context: cs.PL < prev | next > new | recent | 2109 Change to browse by: cs cs.SE References & Citations * NASA ADS * Google Scholar * Semantic Scholar DBLP - CS Bibliography listing | bibtex Bertrand Meyer Alexander Kogtenkov Alexandr Naumchev a export bibtex citation Loading... Bibtex formatted citation x [loading... ] Data provided by: Bookmark BibSonomy logo Mendeley logo Reddit logo ScienceWISE logo (*) Bibliographic Tools Bibliographic and Citation Tools [ ] Bibliographic Explorer Toggle Bibliographic Explorer (What is the Explorer?) [ ] Litmaps Toggle Litmaps (What is Litmaps?) [ ] scite.ai Toggle scite Smart Citations (What are Smart Citations?) ( ) Code, Data, Media Code, Data and Media Associated with this Article [ ] Links to Code Toggle Papers with Code (What is Papers with Code?) [ ] ScienceCast Toggle ScienceCast (What is ScienceCast?) ( ) Demos Demos [ ] Replicate Toggle Replicate (What is Replicate?) [ ] Spaces Toggle Hugging Face Spaces (What is Spaces?) ( ) Related Papers Recommenders and Search Tools [ ] Connected Papers Toggle Connected Papers (What is Connected Papers?) [ ] Core recommender toggle CORE Recommender (What is CORE?) ( ) About arXivLabs arXivLabs: experimental projects with community collaborators arXivLabs is a framework that allows collaborators to develop and share new arXiv features directly on our website. Both individuals and organizations that work with arXivLabs have embraced and accepted our values of openness, community, excellence, and user data privacy. arXiv is committed to these values and only works with partners that adhere to them. Have an idea for a project that will add value for arXiv's community? Learn more about arXivLabs and how to get involved. Which authors of this paper are endorsers? | Disable MathJax (What is MathJax?) * About * Help * Click here to contact arXiv Contact * Click here to subscribe Subscribe * Copyright * Privacy Policy * Web Accessibility Assistance * arXiv Operational Status Get status notifications via email or slack