Abstract
Program logics for bug-finding (such as the recently introduced Incorrectness Logic) have framed correctness and incorrectness as dual concepts requiring different logical foundations. In this paper, we argue that a single unified theory can be used for both correctness and incorrectness reasoning. We present Outcome Logic (OL), a novel generalization of Hoare Logic that is both monadic (to capture computational effects) and monoidal (to reason about outcomes and reachability). OL expresses true positive bugs, while retaining correctness reasoning abilities as well. To formalize the applicability of OL to both correctness and incorrectness, we prove that any false OL specification can be disproven in OL itself. We also use our framework to reason about new types of incorrectness in nondeterministic and probabilistic programs. Given these advances, we advocate for OL as a new foundational theory of correctness and incorrectness.
- Krzysztof R. Apt. 1981. Ten Years of Hoare’s Logic: A Survey–Part I. ACM Trans. Program. Lang. Syst., 3, 4 (1981), oct, 431–483. issn:0164-0925 https://doi.org/10.1145/357146.357150
Google Scholar
Digital Library
- Flavio Ascari, Roberto Bruni, and Roberta Gori. 2022. Limits and difficulties in the design of under-approximation abstract domains. In Foundations of Software Science and Computation Structures, Patricia Bouyer and Lutz Schröder (Eds.). Springer International Publishing, Cham. 21–39. isbn:978-3-030-99253-8 https://doi.org/10.1007/978-3-030-99253-8_2
Google Scholar
Digital Library
- Gilles Barthe, Thomas Espitau, Marco Gaboardi, Benjamin Grégoire, Justin Hsu, and Pierre-Yves Strub. 2018. An Assertion-Based Program Logic for Probabilistic Programs. In Programming Languages and Systems, Amal Ahmed (Ed.). Springer International Publishing, Cham. 117–144. isbn:978-3-319-89884-1 https://doi.org/10.1007/978-3-319-89884-1_5
Google Scholar
Cross Ref
- Gilles Barthe, Justin Hsu, and Kevin Liao. 2019. A Probabilistic Separation Logic. Proc. ACM Program. Lang., 4, POPL (2019), Article 55, Dec., 30 pages. https://doi.org/10.1145/3371123
Google Scholar
Digital Library
- Kevin Batz, Benjamin Lucien Kaminski, Joost-Pieter Katoen, Christoph Matheja, and Thomas Noll. 2019. Quantitative Separation Logic: A Logic for Reasoning about Probabilistic Pointer Programs. Proc. ACM Program. Lang., 3, POPL (2019), Article 34, Jan, 29 pages. https://doi.org/10.1145/3290347
Google Scholar
Digital Library
- Roberto Bruni, Roberto Giacobazzi, Roberta Gori, and Francesco Ranzato. 2021. A Logic for Locally Complete Abstract Interpretations. In 2021 36th Annual ACM/IEEE Symposium on Logic in Computer Science (LICS). 1–13. https://doi.org/10.1109/LICS52264.2021.9470608
Google Scholar
Digital Library
- Roberto Bruni, Roberto Giacobazzi, Roberta Gori, and Francesco Ranzato. 2023. A Correctness and Incorrectness Program Logic. J. ACM, feb, issn:0004-5411 https://doi.org/10.1145/3582267 Just Accepted.
Google Scholar
Digital Library
- Cristiano Calcagno, Dino Distefano, Peter O’Hearn, and Hongseok Yang. 2009. Compositional Shape Analysis by Means of Bi-Abduction. In Proceedings of the 36th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’09). Association for Computing Machinery, New York, NY, USA. 289–300. https://doi.org/10.1145/1480881.1480917
Google Scholar
Digital Library
- Cristiano Calcagno, Dino Distefano, Peter W. O’Hearn, and Hongseok Yang. 2011. Compositional Shape Analysis by Means of Bi-Abduction. J. ACM, 58, 6 (2011), Article 26, Dec, 66 pages. issn:0004-5411 https://doi.org/10.1145/2049697.2049700
Google Scholar
Digital Library
- Cristiano Calcagno, Peter W. O’Hearn, and Hongseok Yang. 2007. Local Action and Abstract Separation Logic. In 22nd Annual IEEE Symposium on Logic in Computer Science (LICS 2007). 366–378. https://doi.org/10.1109/LICS.2007.30
Google Scholar
Digital Library
- Thibault Dardinier and Peter Müller. 2023. Hyper Hoare Logic: (Dis-)Proving Program Hyperproperties (extended version). https://doi.org/10.48550/ARXIV.2301.10037
Google Scholar
- Edsko de Vries and Vasileios Koutavas. 2011. Reverse Hoare Logic. In Software Engineering and Formal Methods, Gilles Barthe, Alberto Pardo, and Gerardo Schneider (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg. 155–171. isbn:978-3-642-24690-6 https://doi.org/10.1007/978-3-642-24690-6_12
Google Scholar
Cross Ref
- Jerry den Hartog. 2002. Probabilistic Extensions of Semantical Models. Ph.D. Dissertation. Vrije Universiteit Amsterdam. https://core.ac.uk/reader/15452110
Google Scholar
- Edsger W. Dijkstra. 1975. Guarded Commands, Nondeterminacy and Formal Derivation of Programs. Commun. ACM, 18, 8 (1975), Aug, 453–457. issn:0001-0782 https://doi.org/10.1145/360933.360975
Google Scholar
Digital Library
- Edsger W. Dijkstra. 1976. A Discipline of Programming.. Prentice-Hall. isbn:013215871X
Google Scholar
Digital Library
- Simon Docherty. 2019. Bunched logics: a uniform approach. Ph.D. Dissertation. University College London. https://discovery.ucl.ac.uk/id/eprint/10073115/
Google Scholar
- Michèle Giry. 1982. A categorical approach to probability theory. In Categorical Aspects of Topology and Analysis, B. Banaschewski (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg. 68–85. isbn:978-3-540-39041-1 https://doi.org/10.1007/BFb0092872
Google Scholar
Cross Ref
- C. A. R. Hoare. 1969. An Axiomatic Basis for Computer Programming. Commun. ACM, 12, 10 (1969), Oct., 576–580. issn:0001-0782 https://doi.org/10.1145/363235.363259
Google Scholar
Digital Library
- C. A. R. Hoare. 1978. Some Properties of Predicate Transformers. J. ACM, 25, 3 (1978), Jul, 461–480. issn:0004-5411 https://doi.org/10.1145/322077.322088
Google Scholar
Digital Library
- Ralf Jung, Robbert Krebbers, Jacques-Henri Jourdan, Aleš Bizjak, Lars Birkedal, and Derek Dreyer. 2018. Iris from the ground up: A modular foundation for higher-order concurrent separation logic. Journal of Functional Programming, 28 (2018), https://doi.org/10.1017/S0956796818000151
Google Scholar
Cross Ref
- Ralf Jung, David Swasey, Filip Sieczkowski, Kasper Svendsen, Aaron Turon, Lars Birkedal, and Derek Dreyer. 2015. Iris: Monoids and Invariants as an Orthogonal Basis for Concurrent Reasoning. In Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’15). Association for Computing Machinery, New York, NY, USA. 637–650. isbn:9781450333009 https://doi.org/10.1145/2676726.2676980
Google Scholar
Digital Library
- Benjamin Lucien Kaminski. 2019. Advanced weakest precondition calculi for probabilistic programs. RWTH Aachen University. Aachen. https://doi.org/10.18154/RWTH-2019-01829 Veröffentlicht auf dem Publikationsserver der RWTH Aachen University; Dissertation, RWTH Aachen University, 2019.
Google Scholar
Cross Ref
- Michael J. Kearns and Umesh V. Vazirani. 1994. An Introduction to Computational Learning Theory. MIT Press, Cambridge, MA, USA. isbn:0262111934
Google Scholar
Digital Library
- Dexter Kozen. 1979. Semantics of probabilistic programs. In 20th Annual Symposium on Foundations of Computer Science (SFCS ’79). 101–114. https://doi.org/10.1109/SFCS.1979.38
Google Scholar
Digital Library
- Dexter Kozen. 1983. A Probabilistic PDL. In Proceedings of the Fifteenth Annual ACM Symposium on Theory of Computing (STOC ’83). Association for Computing Machinery, New York, NY, USA. 291–297. isbn:0897910990 https://doi.org/10.1145/800061.808758
Google Scholar
Digital Library
- Dexter Kozen. 1997. Kleene Algebra with Tests. ACM Trans. Program. Lang. Syst., 19, 3 (1997), May, 427–443. issn:0164-0925 https://doi.org/10.1145/256167.256195
Google Scholar
Digital Library
- 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. Proc. ACM Program. Lang., 6, OOPSLA1 (2022), Article 81, Apr, 27 pages. https://doi.org/10.1145/3527325
Google Scholar
Digital Library
- Sheng Liang, Paul Hudak, and Mark Jones. 1995. Monad Transformers and Modular Interpreters. In Proceedings of the 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’95). Association for Computing Machinery, New York, NY, USA. 333–343. isbn:0897916921 https://doi.org/10.1145/199448.199528
Google Scholar
Digital Library
- Christoph Lüth and Neil Ghani. 2002. Composing Monads Using Coproducts. In Proceedings of the Seventh ACM SIGPLAN International Conference on Functional Programming (ICFP ’02). Association for Computing Machinery, New York, NY, USA. 133–144. isbn:1581134878 https://doi.org/10.1145/581478.581492
Google Scholar
Digital Library
- Petar Maksimović, Caroline Cronjäger, Julian Sutherland, Andreas Lööw, Sacha-Élie Ayoun, and Philippa Gardner. 2022. Exact Separation Logic. https://doi.org/10.48550/ARXIV.2208.07200
Google Scholar
- Bernhard Möller, Peter O’Hearn, and Tony Hoare. 2021. On Algebra of Program Correctness and & Incorrectness. In Relational and Algebraic Methods in Computer Science: 19th International Conference, RAMiCS 2021, Marseille, France, November 2–5, 2021, Proceedings. Springer-Verlag, Berlin, Heidelberg. 325–343. isbn:978-3-030-88700-1 https://doi.org/10.1007/978-3-030-88701-8_20
Google Scholar
Digital Library
- Carroll Morgan, Annabelle McIver, and Karen Seidel. 1996. Probabilistic Predicate Transformers. ACM Trans. Program. Lang. Syst., 18, 3 (1996), may, 325–353. issn:0164-0925 https://doi.org/10.1145/229542.229547
Google Scholar
Digital Library
- Peter W. O’Hearn. 2004. Resources, Concurrency and Local Reasoning. In CONCUR 2004 - Concurrency Theory, Philippa Gardner and Nobuko Yoshida (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg. 49–67. isbn:978-3-540-28644-8 https://doi.org/10.1016/j.tcs.2006.12.035
Google Scholar
Digital Library
- Peter W. O’Hearn. 2019. Incorrectness Logic. Proc. ACM Program. Lang., 4, POPL (2019), Article 10, Dec., 32 pages. https://doi.org/10.1145/3371078
Google Scholar
Digital Library
- Peter W. O’Hearn and David J. Pym. 1999. The Logic of Bunched Implications. The Bulletin of Symbolic Logic, 5, 2 (1999), 215–244. issn:10798986 http://www.jstor.org/stable/421090
Google Scholar
Cross Ref
- Peter W. O’Hearn, John C. Reynolds, and Hongseok Yang. 2001. Local Reasoning about Programs That Alter Data Structures. In Proceedings of the 15th International Workshop on Computer Science Logic (CSL ’01). Springer-Verlag, Berlin, Heidelberg. 1–19. isbn:3540425543 https://doi.org/10.1007/3-540-44802-0_1
Google Scholar
Cross Ref
- Benjamin C. Pierce. 1991. Basic Category Theory for Computer Scientists. MIT Press. https://doi.org/10.7551/mitpress/1524.001.0001
Google Scholar
Cross Ref
- Azalea Raad, Josh Berdine, Hoang-Hai Dang, Derek Dreyer, Peter O’Hearn, and Jules Villard. 2020. Local Reasoning About the Presence of Bugs: Incorrectness Separation Logic. In Computer Aided Verification, Shuvendu K. Lahiri and Chao Wang (Eds.). Springer International Publishing, Cham. 225–252. isbn:978-3-030-53291-8 https://doi.org/10.1007/978-3-030-53291-8_14
Google Scholar
Digital Library
- Azalea Raad, Josh Berdine, Derek Dreyer, and Peter W. O’Hearn. 2022. Concurrent Incorrectness Separation Logic. Proc. ACM Program. Lang., 6, POPL (2022), Article 34, Jan, 29 pages. https://doi.org/10.1145/3498695
Google Scholar
Digital Library
- Robert Rand and Steve Zdancewic. 2015. VPHL: A Verified Partial-Correctness Logic for Probabilistic Programs. In Electronic Notes in Theoretical Computer Science. 319, 351–367. issn:1571-0661 https://doi.org/10.1016/j.entcs.2015.12.021 The 31st Conference on the Mathematical Foundations of Programming Semantics (MFPS XXXI).
Google Scholar
Digital Library
- J.C. Reynolds. 2002. Separation logic: a logic for shared mutable data structures. In Proceedings 17th Annual IEEE Symposium on Logic in Computer Science. 55–74. https://doi.org/10.1109/LICS.2002.1029817
Google Scholar
Cross Ref
- Joseph Tassarotti and Robert Harper. 2019. A Separation Logic for Concurrent Randomized Programs. Proc. ACM Program. Lang., 3, POPL (2019), Article 64, Jan, 30 pages. https://doi.org/10.1145/3290377
Google Scholar
Digital Library
- Hongseok Yang. 2001. Local Reasoning for Stateful Programs. Ph.D. Dissertation. USA. isbn:049335008X https://dl.acm.org/doi/10.5555/933728
Google Scholar
- Cheng Zhang, Arthur Azevedo de Amorim, and Marco Gaboardi. 2022. On Incorrectness Logic and Kleene Algebra with Top and Tests. Proc. ACM Program. Lang., 6, POPL (2022), Article 29, jan, 30 pages. https://doi.org/10.1145/3498690
Google Scholar
Digital Library
- Linpeng Zhang and Benjamin Lucien Kaminski. 2022. Quantitative Strongest Post: A Calculus for Reasoning about the Flow of Quantitative Information. Proc. ACM Program. Lang., 6, OOPSLA1 (2022), Article 87, apr, 29 pages. https://doi.org/10.1145/3527331
Google Scholar
Digital Library
- Noam Zilberstein, Derek Dreyer, and Alexandra Silva. 2023. Outcome Logic: A Unifying Foundation of Correctness and Incorrectness Reasoning (Full Version). https://doi.org/10.48550/arXiv.2303.03111
Google Scholar
Index Terms
Outcome Logic: A Unifying Foundation for Correctness and Incorrectness Reasoning
Recommendations
A Correctness and Incorrectness Program Logic
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. ...
Substructural logic and partial correctness
We formulate a noncommutative sequent calculus for partial correctness that subsumes propositional Hoare Logic. Partial correctness assertions are represented by intuitionistic linear implication. We prove soundness and completeness over relational and ...
Incorrectness Logic for Graph Programs
Graph TransformationAbstractProgram logics typically reason about an over-approximation of program behaviour to prove the absence of bugs. Recently, program logics have been proposed that instead prove the presence of bugs by means of under-approximate reasoning, which has ...






Comments