Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article

A Correctness and Incorrectness Program Logic

Published: 25 March 2023 Publication History

Abstract

Abstract interpretation is a well-known and extensively used method to extract over-approximate program invariants by a sound program analysis algorithm. Soundness means that no program errors are lost and it is, in principle, guaranteed by construction. Completeness means that the abstract interpreter reports no false alarms for all possible inputs, but this is extremely rare because it needs a very precise analysis. We introduce a weaker notion of completeness, called local completeness, which requires that no false alarms are produced only relatively to some fixed program inputs. Based on this idea, we introduce a program logic, called Local Completeness Logic for an abstract domain A, for proving both the correctness and incorrectness of program specifications. Our proof system, which is parameterized by an abstract domain A, combines over- and under-approximating reasoning. In a provable triple ⊦A [p] 𝖼 [q], 𝖼 is a program, q is an under-approximation of the strongest post-condition of 𝖼 on input p such that their abstractions in A coincide. This means that q is never too coarse, namely, under some mild assumptions, the abstract interpretation of 𝖼 does not yield false alarms for the input p iff q has no alarm. Therefore, proving ⊦A [p] 𝖼 [q] not only ensures that all the alarms raised in q are true ones, but also that if q does not raise alarms, then 𝖼 is correct. We also prove that if A is the straightforward abstraction making all program properties equivalent, then our program logic coincides with O’Hearn’s incorrectness logic, while for any other abstraction, contrary to the case of incorrectness logic, our logic can also establish program correctness.

References

[1]
Flavio Ascari, Roberto Bruni, and Roberta Gori. 2022. Limits and difficulties in the design of under-approximation abstract domains. In Proceedings of 25th International Conference on Foundations of Software Science and Computation Structures, (FOSSACS’22),Lecture Notes in Computer Science, Patricia Bouyer and Lutz Schröder (Eds.), Vol. 13242. Springer, 21–39. DOI:
[2]
Thomas Ball, Todd D. Millstein, and Sriram K. Rajamani. 2005. Polymorphic predicate abstraction. ACM Trans. Program. Lang. Syst. 27, 2 (2005), 314–343. DOI:
[3]
François Bourdoncle. 1993. Abstract debugging of higher-order imperative languages. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’93). ACM, 46–55. DOI:
[4]
Roberto Bruni, Roberto Giacobazzi, Roberta Gori, Isabel Garcia-Contreras, and Dusko Pavlovic. 2020. Abstract extensionality: On the properties of incomplete abstract interpretations. In Proceedings of the ACM Symposium on Principles of Programming Languages. 28:1–28:28. DOI:
[5]
Roberto Bruni, Roberto Giacobazzi, Roberta Gori, and Francesco Ranzato. 2021. A logic for locally complete abstract interpretations. In Proceedings of the 36th Annual ACM/IEEE Symposium on Logic in Computer Science (LICS’21), Distinguished Paper. IEEE, 1–13. DOI:
[6]
Roberto Bruni, Roberto Giacobazzi, Roberta Gori, and Francesco Ranzato. 2022. Abstract interpretation repair. In Proceedings of the 43rd ACM SIGPLAN International Conference on Programming Language Design and Implementation (PLDI’22), Ranjit Jhala and Isil Dillig (Eds.). ACM, 426–441. DOI:
[7]
Cristiano Calcagno, Dino Distefano, Jérémy Dubreil, Dominik Gabi, Pieter Hooimeijer, Martino Luca, Peter W. O’Hearn, Irene Papakonstantinou, Jim Purbrick, and Dulma Rodriguez. 2015. Moving fast with software verification. In Proceedings of the NASA Formal Methods Symposium (NFM’15),LNCS, Vol. 9058. Springer, 3–11. DOI:
[8]
Patrick Cousot. 2021. Principles of Abstract Interpretation. MIT Press.
[9]
Patrick Cousot and Radhia Cousot. 1977. Abstract interpretation: A unified lattice model for static analysis of programs by construction or approximation of fixpoints. In Proceedings of the ACM Symposium on Principles of Programming Languages (POPL’77). ACM, 238–252. DOI:
[10]
Patrick Cousot and Radhia Cousot. 1979. Systematic design of program analysis frameworks. In Proceedings of the ACM Symposium on Principles of Programming Languages (POPL’79). ACM, 269–282. DOI:
[11]
Patrick Cousot and Radhia Cousot. 1992. Abstract interpretation frameworks. J. Logic Comput. 2, 4 (1992), 511–547. DOI:
[12]
Patrick Cousot, Roberto Giacobazzi, and Francesco Ranzato. 2018. Program analysis is harder than verification: A computability perspective. In Proceedings of the 30th International Conference on Computer Aided Verification (CAV’18)Lecture Notes in Computer Science, Vol. 10982. Springer, 75–95. DOI:
[13]
Edsko de Vries and Vasileios Koutavas. 2011. Reverse Hoare logic. In Proceedings of the International Conference on Software Engineering and Formal Methods (SEFM’11). Springer, 155–171. DOI:
[14]
Edsger W. Dijkstra. 1972a. Chapter I: Notes on Structured Programming. Academic Press Ltd., GBR, 1–82.
[15]
Edsger W. Dijkstra. 1972b. The humble programmer. Commun. ACM 15, 10 (1972), 859–866. DOI:
[16]
Edsger W. Dijkstra. 1972c. Turing Award Lecture. Retrieved from https://www.youtube.com/watch?v=6sIlKP2LzbA.
[17]
Dino Distefano, Manuel Fähndrich, Francesco Logozzo, and Peter W. O’Hearn. 2019. Scaling static analyses at Facebook. Commun. ACM 62, 8 (2019), 62–70. DOI:
[18]
G. Filé, R. Giacobazzi, and F. Ranzato. 1996. A unifying view of abstract domain design. ACM Comput. Surv. 28, 2 (1996), 333–336. DOI:
[19]
Robert W. Floyd. 1967. Assigning meanings to programs. In Proceedings of the Symposium on Applied Mathematics, Vol. 19, 19–32.
[20]
Roberto Giacobazzi, Francesco Logozzo, and Francesco Ranzato. 2015. Analyzing program analyses. In Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’15). 261–273. DOI:
[21]
Roberto Giacobazzi and Francesco Ranzato. 1996. Compositional optimization of disjunctive abstract interpretations. In Proceedings of 6th European Symposium on Programming (ESOP’96),Lecture Notes in Computer Science, Vol. 1058. Springer, 141–155. DOI:
[22]
Roberto Giacobazzi and Francesco Ranzato. 1997. Completeness in abstract interpretation: A domain perspective. In Proceedings of the 6th International Conference on Algebraic Methodology and Software Technology (AMAST’97),Lecture Notes in Computer Science, Vol. 1349. Springer, 231–245. DOI:
[23]
Roberto Giacobazzi and Francesco Ranzato. 1998. Optimal domains for disjunctive abstract intepretation. Sci. Comput. Program. 32, 1-3 (1998), 177–210. DOI:
[24]
Roberto Giacobazzi and Francesco Ranzato. 2022. History of abstract interpretation. IEEE Ann. Hist. Comput. 44, 2 (2022), 33–43. DOI:
[25]
Roberto Giacobazzi, Francesco Ranzato, and Francesca Scozzari. 1998. Complete abstract interpretations made constructive. In Proceedings of the 23rd International Symposium on Mathematical Foundations of Computer Science (MFCS’98),Lecture Notes in Computer Science, Vol. 1450. Springer, 366–377. DOI:
[26]
Roberto Giacobazzi, Francesco Ranzato, and Francesca Scozzari.2000. Making abstract interpretation complete. J. ACM 47, 2 (March2000), 361–416. DOI:
[27]
Charles A. R. Hoare. 1969. An axiomatic basis for computer programming. Commun. ACM 12, 10 (1969), 576–580. DOI:
[28]
Charles A. R. Hoare. 2003. The verifying compiler: A grand challenge for computing research. J. ACM 50, 1 (2003), 63–69. DOI:
[29]
Cliff Jones, Peter O’Hearn, and Jim Woodcock. 2006. Verified software: A grand challenge. IEEE Comput. 39, 04 (2006), 93–95. DOI:
[30]
Jacques-Henri Jourdan, Vincent Laporte, Sandrine Blazy, Xavier Leroy, and David Pichardie. 2015. A formally-verified C static analyzer. In Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’15). 247–259. DOI:
[31]
Dexter Kozen. 1997. Kleene algebra with tests. ACM Trans. Program. Lang. Syst. 19, 3 (May1997), 427–443. DOI:
[32]
Quang Loc Le, Azalea Raad, Jules Villard, Josh Berdine, Derek Dreyer, and Peter W. O’Hearn. 2022. Finding real bugs in big programs with incorrectness logic. In Proceedgins of the ACM SIGPLAN International Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA’22), Vol. 6, 1–27. DOI:
[33]
Xavier Leroy. 2006. Formal certification of a compiler back-end or: Programming a compiler with a proof assistant. In Proceedings of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’06). 42–54. DOI:
[34]
Petar Maksimovic, Caroline Cronjäger, Julian Sutherland, Andreas Lööw, Sacha-Élie Ayoun, and Philippa Gardner. 2022. Exact separation logic. DOI:. Retrieved from https://arxiv.org/abs/2208.07200.
[35]
John McCarthy. 1962. Towards a mathematical science of computation. In IFIP Congress. 21–28.
[36]
Marco Milanese and Francesco Ranzato. 2022. Local completeness logic on Kleene algebra with tests. In Proceedings of the 29th International Static Analysis Symposium (SAS’22),LNCS, Vol. 13790. 350–371. DOI:
[37]
Antoine Miné. 2006. The octagon abstract domain. High. Order Symb. Comput. 19, 1 (2006), 31–100. DOI:
[38]
Antoine Miné. 2017. Tutorial on static inference of numeric invariants by abstract interpretation. Found. Trends Program. Lang. 4, 3-4 (2017), 120–372. DOI:
[39]
Antoine Miné. 2014. Backward under-approximations in numeric abstract domains to automatically infer sufficient program conditions. Sci. Comput. Program. 93 (2014), 154–182. DOI:
[40]
Bernhard Möller, Peter W. O’Hearn, and Charles A. R. Hoare. 2021. On algebra of program correctness and incorrectness. In Proceedings of the 19th International Conference on Relational and Algebraic Methods in Computer Science (RAMiCS’21),Lecture Notes in Computer Science, Uli Fahrenberg, Mai Gehrke, Luigi Santocanale, and Michael Winter (Eds.), Vol. 13027. Springer, 325–343. DOI:
[41]
Bernhard Möller and Georg Struth. 2006. Algebras of modal operators and partial correctness. Theor. Comput. Sci. 351, 2 (2006), 221–239. DOI:
[42]
Peter W. O’Hearn. 2018. Continuous reasoning: Scaling the impact of formal methods. In Proceedings of the ACM/IEEE Symposium on Logic in Computer Science (LICS’18). ACM, 13–25. DOI:
[43]
Peter W. O’Hearn. 2020. Incorrectness logic. In Proceedings of the ACM Annual Symposium on Principles of Programming Languages, Vol. 4, 10:1–10:32. DOI:
[44]
Benjamin Pierce. 2002. Types and Programming Languages. MIT Press.
[45]
Christopher M. Poskitt. 2021. Incorrectness logic for graph programs. In Proceedings of the 14th International Conference on Graph Transformation (ICGT’21),Lecture Notes in Computer Science, Vol. 12741. Springer, 81–101. DOI:
[46]
Christopher M. Poskitt and Detlef Plump. 2023. Monadic second-order incorrectness logic for GP 2. J. Log. Algebr. Methods Program. 130 (2023), 100825. DOI:
[47]
Azalea Raad, Josh Berdine, Hoang-Hai Dang, Derek Dreyer, Peter W. O’Hearn, and Jules Villard. 2020. Local reasoning about the presence of bugs: Incorrectness separation logic. In Proceedings of the International Conference on Computer-Aided Verification (CAV’20), Part II,LNCS, Vol. 12225. Springer, 225–252. DOI:
[48]
Azalea Raad, Josh Berdine, Derek Dreyer, and Peter W. O’Hearn. 2022. Concurrent incorrectness separation logic. In Proceedings of the ACM Annual Symposium on Principles of Programming Languages, Vol. 6 (2022), 1–29. DOI:
[49]
Francesco Ranzato. 2020. Decidability and synthesis of abstract inductive invariants. In Proceedings of the 31st International Conference on Concurrency Theory (CONCUR’20),LIPIcs, Vol. 171. Schloss Dagstuhl–Leibniz-Zentrum für Informatik, 30:1–30:21. DOI:
[50]
Thomas W. Reps, Shmuel Sagiv, and Greta Yorsh. 2004. Symbolic implementation of the best transformer. In Proceedings of the 24th International Conference on Verification, Model Checking, and Abstract Interpretation (VMCAI’04),LNCS, Vol. 2937. Springer, 252–266. DOI:
[51]
Henry G. Rice. 1953. Classes of recursively enumerable sets and their decision problems. Trans. Am. Math. Soc. 74 (1953), 358–366.
[52]
Xavier Rival and Kwang Yi. 2020. Introduction to Static Analysis—An Abstract Interpretation Perspective. MIT Press.
[53]
Caitlin Sadowski, Edward Aftandilian, Alex Eagle, Liam Miller-Cushon, and Ciera Jaspan. 2018. Lessons from building static analysis tools at Google. Commun. ACM 61, 4 (March2018), 58–66. DOI:
[54]
Alan M. Turing. 1989. Checking a large routine. In The Early British Computer Conferences, Martin Campbell-Kelly (Ed.). MIT Press, Cambridge, MA, 70–72.
[55]
Glynn Winskel. 1993. The Formal Semantics of Programming Languages: An Introduction. MIT Press.
[56]
Peng Yan, Hanru Jiang, and Nengkun Yu. 2022. On incorrectness logic for Quantum programs. In Proceedings of the ACM SIGPLAN International Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA’22), 1–28. DOI:
[57]
Greta Yorsh, Thomas W. Reps, and Shmuel Sagiv. 2004. Symbolically computing most-precise abstract operations for shape analysis. In Proceedings of the International Conference on Tools and Algorithms for the Construction and Analysis of Systems (TACAS’04),LNCS, Vol. 2988. Springer, 530–545. DOI:
[58]
Cheng Zhang, Arthur Azevedo de Amorim, and Marco Gaboardi. 2022. On incorrectness logic and Kleene algebra with top and tests. In Proceedings of the ACM Annual Symposium on Principles of Programming Languages (POPL’22). DOI:
[59]
Noam Zilberstein, Derek Dreyer, and Alexandra Silva. 2023. Outcome logic: A unifying foundation for correctness and incorrectness reasoning. Proceedings of the ACM SIGPLAN International Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA’23), To appear.

Cited By

View all
  • (2024)Limits and Difficulties in the Design of Under-Approximation Abstract DomainsACM Transactions on Programming Languages and Systems10.1145/366601446:3(1-31)Online publication date: 10-Oct-2024
  • (2024)Hyper Hoare Logic: (Dis-)Proving Program HyperpropertiesProceedings of the ACM on Programming Languages10.1145/36564378:PLDI(1485-1509)Online publication date: 20-Jun-2024
  • (2024)Outcome Separation Logic: Local Reasoning for Correctness and Incorrectness with Computational EffectsProceedings of the ACM on Programming Languages10.1145/36498218:OOPSLA1(276-304)Online publication date: 29-Apr-2024
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image Journal of the ACM
Journal of the ACM  Volume 70, Issue 2
April 2023
329 pages
ISSN:0004-5411
EISSN:1557-735X
DOI:10.1145/3587260
Issue’s Table of Contents

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 25 March 2023
Online AM: 06 February 2023
Accepted: 04 January 2023
Revised: 26 October 2022
Received: 26 January 2022
Published in JACM Volume 70, Issue 2

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Abstract interpretation
  2. abstract domain
  3. program analysis
  4. program verification
  5. program logic
  6. local completeness
  7. best correct approximation
  8. incorrectness logic

Qualifiers

  • Research-article

Funding Sources

  • Italian MIUR
  • Facebook Research
  • Amazon Research Award
  • WhatsApp Research Award

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)509
  • Downloads (Last 6 weeks)64
Reflects downloads up to 15 Oct 2024

Other Metrics

Citations

Cited By

View all
  • (2024)Limits and Difficulties in the Design of Under-Approximation Abstract DomainsACM Transactions on Programming Languages and Systems10.1145/366601446:3(1-31)Online publication date: 10-Oct-2024
  • (2024)Hyper Hoare Logic: (Dis-)Proving Program HyperpropertiesProceedings of the ACM on Programming Languages10.1145/36564378:PLDI(1485-1509)Online publication date: 20-Jun-2024
  • (2024)Outcome Separation Logic: Local Reasoning for Correctness and Incorrectness with Computational EffectsProceedings of the ACM on Programming Languages10.1145/36498218:OOPSLA1(276-304)Online publication date: 29-Apr-2024
  • (2024)Adversities in Abstract Interpretation - Accommodating Robustness by Abstract InterpretationACM Transactions on Programming Languages and Systems10.1145/364930946:2(1-31)Online publication date: 24-Feb-2024
  • (2024)Monotonicity and the Precision of Program AnalysisProceedings of the ACM on Programming Languages10.1145/36328978:POPL(1629-1662)Online publication date: 5-Jan-2024
  • (2024)Calculational Design of [In]Correctness Transformational Program Logics by Abstract InterpretationProceedings of the ACM on Programming Languages10.1145/36328498:POPL(175-208)Online publication date: 5-Jan-2024
  • (2024)Real-Time Validation of Enhanced Permanent Magnet Synchronous Motor Drive Using Dense-Neural-Network-Based ControlIEEE Access10.1109/ACCESS.2024.340307112(73323-73339)Online publication date: 2024
  • (2024)Automated Software Verification of HyperlivenessTools and Algorithms for the Construction and Analysis of Systems10.1007/978-3-031-57249-4_10(196-216)Online publication date: 6-Apr-2024
  • (2023)Logic for reasoning about bugs in loops over data sequences (IFIL)Modeling and Analysis of Information Systems10.18255/1818-1015-2023-3-214-23330:3(214-233)Online publication date: 17-Sep-2023
  • (2023)Outcome Logic: A Unifying Foundation for Correctness and Incorrectness ReasoningProceedings of the ACM on Programming Languages10.1145/35860457:OOPSLA1(522-550)Online publication date: 6-Apr-2023

View Options

Get Access

Login options

Full Access

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Full Text

View this article in Full Text.

Full Text

HTML Format

View this article in HTML Format.

HTML Format

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media