Abstract
Kleene algebra with tests (KAT) is a foundational equational framework for reasoning about programs, which has found applications in program transformations, networking and compiler optimizations, among many other areas. In his seminal work, Kozen proved that KAT subsumes propositional Hoare logic, showing that one can reason about the (partial) correctness of while programs by means of the equational theory of KAT.
In this work, we investigate the support that KAT provides for reasoning about incorrectness, instead, as embodied by O'Hearn's recently proposed incorrectness logic. We show that KAT cannot directly express incorrectness logic. The main reason for this limitation can be traced to the fact that KAT cannot express explicitly the notion of codomain, which is essential to express incorrectness triples. To address this issue, we study Kleene Algebra with Top and Tests (TopKAT), an extension of KAT with a top element. We show that TopKAT is powerful enough to express a codomain operation, to express incorrectness triples, and to prove all the rules of incorrectness logic sound. This shows that one can reason about the incorrectness of while-like programs by means of the equational theory of TopKAT.
Supplemental Material
- Carolyn Jane Anderson, Nate Foster, Arjun Guha, Jean-Baptiste Jeannin, Dexter Kozen, Cole Schlesinger, and David Walker. 2014. NetKAT: semantic foundations for networks. ACM SIGPLAN Notices, 49, 1 (2014), Jan., 113–126. issn:0362-1340 https://doi.org/10.1145/2578855.2535862 Google Scholar
Digital Library
- Hajnal Andréka and Szabolcs Mikulás. 2011. Axiomatizability of positive algebras of binary relations. Algebra universalis, 66, 1-2 (2011), Oct., 7–34. issn:0002-5240, 1420-8911 https://doi.org/10.1007/s00012-011-0142-3 Google Scholar
Cross Ref
- Allegra Angus and Dexter Kozen. 2001. Kleene Algebra with Tests and Program Schematology. July, https://ecommons.cornell.edu/handle/1813/5831 Accepted: 2007-04-09T19:56:22Z Publisher: Cornell University.Google Scholar
- Paul Brunet and Damien Pous. 2014. Kleene Algebra with Converse. In Relational and Algebraic Methods in Computer Science, David Hutchison, Takeo Kanade, Josef Kittler, Jon M. Kleinberg, Alfred Kobsa, Friedemann Mattern, John C. Mitchell, Moni Naor, Oscar Nierstrasz, C. Pandu Rangan, Bernhard Steffen, Demetri Terzopoulos, Doug Tygar, Gerhard Weikum, Peter Höfner, Peter Jipsen, Wolfram Kahl, and Martin Eric Müller (Eds.). 8428, Springer International Publishing, Cham. 101–118. isbn:978-3-319-06250-1 978-3-319-06251-8 https://doi.org/10.1007/978-3-319-06251-8_7 Series Title: Lecture Notes in Computer Science. Google Scholar
Cross Ref
- Ernie Cohen, Dexter Kozen, and Frederick Smith. 1999. The Complexity of Kleene Algebra with Tests. July.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.). 7041, Springer Berlin Heidelberg, Berlin, Heidelberg. 155–171. isbn:978-3-642-24689-0 978-3-642-24690-6 https://doi.org/10.1007/978-3-642-24690-6_12 Series Title: Lecture Notes in Computer Science. Google Scholar
- Jules Desharnais, Bernhard Möller, and Georg Struth. 2004. Modal Kleene Algebra and Applications – A Survey. In Journal on Relational Methods in Computer Science. 93–131.Google Scholar
- Jules Desharnais, Bernhard Möller, and Georg Struth. 2006. Kleene algebra with domain. ACM Transactions on Computational Logic, 7, 4 (2006), Oct., 798–833. issn:1529-3785 https://doi.org/10.1145/1183278.1183285 Google Scholar
Digital Library
- Uli Fahrenberg, Christian Johansen, Georg Struth, and Krzysztof Ziemiánski. 2021. Domain Semirings United. arXiv:2011.04704 [cs], March, arxiv:2011.04704 arXiv: 2011.04704.Google Scholar
- Michael J. Fischer and Richard E. Ladner. 1979. Propositional dynamic logic of regular programs. J. Comput. System Sci., 18, 2 (1979), April, 194–211. issn:0022-0000 https://doi.org/10.1016/0022-0000(79)90046-1 Google Scholar
Cross Ref
- Robert W. Floyd. 1967. Assigning Meanings to Programs. In Mathematical Aspects of Computer Science, J. T. Schwartz (Ed.) (Symposia in Applied Mathematics, Vol. 19). American Mathematical Society, Providence, RI. 19–32.Google Scholar
- Victor B. F. Gomes and Georg Struth. 2016. Modal Kleene Algebra Applied to Program Correctness. In FM 2016: Formal Methods, John Fitzgerald, Constance Heitmeyer, Stefania Gnesi, and Anna Philippou (Eds.). 9995, Springer International Publishing, Cham. 310–325. isbn:978-3-319-48988-9 978-3-319-48989-6 https://doi.org/10.1007/978-3-319-48989-6_19 Series Title: Lecture Notes in Computer Science. Google Scholar
Cross Ref
- C. A. R. Hoare. 1969. An Axiomatic Basis for Computer Programming. Commun. ACM, 12, 10 (1969), 576–580. https://doi.org/10.1145/363235.363259 Google Scholar
Digital Library
- D. Kozen. 1994. A Completeness Theorem for Kleene Algebras and the Algebra of Regular Events. Information and Computation, 110, 2 (1994), May, 366–390. issn:08905401 https://doi.org/10.1006/inco.1994.1037 Google Scholar
Digital Library
- Dexter Kozen. 1997. Kleene algebra with tests. ACM Transactions on Programming Languages and Systems, 19, 3 (1997), May, 427–443. issn:0164-0925 https://doi.org/10.1145/256167.256195 Google Scholar
Digital Library
- Dexter Kozen. 2000. On Hoare logic and Kleene algebra with tests. ACM Transactions on Computational Logic, 1, 1 (2000), July, 60–76. issn:1529-3785 https://doi.org/10.1145/343369.343378 Google Scholar
Digital Library
- Dexter Kozen and Maria-Cristina Patron. 2000. Certification of Compiler Optimizations Using Kleene Algebra with Tests. In Computational Logic — CL 2000, John Lloyd, Veronica Dahl, Ulrich Furbach, Manfred Kerber, Kung-Kiu Lau, Catuscia Palamidessi, Luís Moniz Pereira, Yehoshua Sagiv, and Peter J. Stuckey (Eds.) (Lecture Notes in Computer Science). Springer, Berlin, Heidelberg. 568–582. isbn:978-3-540-44957-7 https://doi.org/10.1007/3-540-44957-4_38 Google Scholar
Cross Ref
- Dexter Kozen and Frederick Smith. 1997. Kleene algebra with tests: Completeness and decidability. In Computer Science Logic, Gerhard Goos, Juris Hartmanis, Jan Leeuwen, Dirk Dalen, and Marc Bezem (Eds.). 1258, Springer Berlin Heidelberg, Berlin, Heidelberg. 244–259. isbn:978-3-540-63172-9 978-3-540-69201-0 https://doi.org/10.1007/3-540-63172-0_43 Series Title: Lecture Notes in Computer Science. Google Scholar
Cross Ref
- Roger D. Maddux. 1991. The origin of relation algebras in the development and axiomatization of the calculus of relations. Studia Logica, 50, 3 (1991), Sept., 421–455. issn:1572-8730 https://doi.org/10.1007/BF00370681 Google Scholar
Cross Ref
- Konstantinos Mamouras. 2017. Equational Theories of Abnormal Termination Based on Kleene Algebra. In Foundations of Software Science and Computation Structures, Javier Esparza and Andrzej S. Murawski (Eds.). 10203, Springer Berlin Heidelberg, Berlin, Heidelberg. 88–105. isbn:978-3-662-54457-0 978-3-662-54458-7 https://doi.org/10.1007/978-3-662-54458-7_6 Series Title: Lecture Notes in Computer Science. Google Scholar
Digital Library
- 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, Uli Fahrenberg, Mai Gehrke, Luigi Santocanale, and Michael Winter (Eds.). 13027, Springer International Publishing, Cham. 325–343. isbn:978-3-030-88700-1 978-3-030-88701-8 https://doi.org/10.1007/978-3-030-88701-8_20 Series Title: Lecture Notes in Computer Science. Google Scholar
Digital Library
- Toby Murray. 2020. An Under-Approximate Relational Logic. Archive of Formal Proofs, Mar, issn:2150-914xGoogle Scholar
- Michael J. O’Donnell. 1985. Equational Logic as a Programming Language. The MIT Press.Google Scholar
- Peter W. O’Hearn. 2020. Incorrectness logic. Proceedings of the ACM on Programming Languages, 4, POPL (2020), Jan., 1–32. issn:2475-1421, 2475-1421 https://doi.org/10.1145/3371078 Google Scholar
Digital Library
- Damien Pous. 2013. Kleene Algebra with Tests and Coq Tools for while Programs. In Interactive Theorem Proving, Sandrine Blazy, Christine Paulin-Mohring, and David Pichardie (Eds.) (Lecture Notes in Computer Science). Springer, Berlin, Heidelberg. 180–196. isbn:978-3-642-39634-2 https://doi.org/10.1007/978-3-642-39634-2_15 Google Scholar
Digital Library
- Damien Pous. 2016. Automata for relation algebra and formal proofs. ENS Lyon. https://hal.archives-ouvertes.fr/tel-01445821Google Scholar
- V. R. Pratt. 1980. Dynamic algebras and the nature of induction. In Proceedings of the twelfth annual ACM symposium on Theory of computing (STOC ’80). Association for Computing Machinery, 22–28. isbn:978-0-89791-017-0 https://doi.org/10.1145/800141.804649 Google Scholar
Digital Library
- 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 (Lecture Notes in Computer Science, Vol. 12225). Springer International Publishing, 225–252. isbn:978-3-030-53290-1 https://doi.org/10.1007/978-3-030-53291-8_14 Google Scholar
Digital Library
- Steffen Smolka, Praveen Kumar, Nate Foster, Dexter Kozen, and Alexandra Silva. 2017. Cantor meets Scott: semantic foundations for probabilistic networks. ACM SIGPLAN Notices, 52, 1 (2017), Jan., 557–571. issn:0362-1340 https://doi.org/10.1145/3093333.3009843 Google Scholar
Digital Library
- Walter Taylor. 1979. Equational logic. In Universal Algebra (second ed.), G. Grätzer (Ed.). Springer, New York. 378–400.Google Scholar
- Cheng Zhang, Arthur Azevedo de Amorim, and Marco Gaboardi. 2021. On Incorrectness Logic and Kleene Algebra With Top and Tests. arxiv:2108.07707.Google Scholar
Index Terms
On incorrectness logic and Kleene algebra with top and tests
Recommendations
Embedding Kozen-Tiuryn Logic into Residuated One-Sorted Kleene Algebra with Tests
Logic, Language, Information, and ComputationAbstractKozen and Tiuryn have introduced the substructural logic for reasoning about correctness of while programs (ACM TOCL, 2003). The logic distinguishes between tests and partial correctness assertions, representing the latter by special ...
On Hoare logic and Kleene algebra with tests
We show that Kleene algebra with tests (KAT) subsumes propositional Hoare logic (PHL). Thus the specialized syntax and deductive apparatus of Hoare logic are inessential and can be replaced by simple equational reasoning. In addition, we show that all ...
Local Completeness Logic on Kleene Algebra with Tests
Static AnalysisAbstractLocal Completeness Logic (LCL) has been put forward as a program logic for proving both the correctness and incorrectness of program specifications. LCL is an abstract logic, parameterized by an abstract domain that allows combining over- and ...






Comments