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 Ohearn'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.
翻译:Kleene 代数与测试( KAT) 是程序推理的基础方程框架, 它发现程序转换、 网络和编译优化中的应用程序, 以及许多其他领域的应用。 Kozen 在他的开创性工作中, Kozen 证明了 KAT 的子虚构的Hoare 逻辑, 表明人们可以通过 KAT 的方程理论来解释程序( 部分) 的正确性。 在这项工作中, 我们调查 KAT 提供的关于不正确性推理的支持, 而正如 Ohearn 最近提出的不正确性逻辑所体现的那样。 我们显示 KAT 不能直接表达不正确性逻辑。 限制的主要原因可以追溯到 KAT 无法明确表达 Codomain 的概念, 这对于表达不正确性至关重要。 为了解决这个问题, 我们用Top & Test (TopKAT) 和 Tests 的公式理论扩展 Kleenebra 。 我们发现TopKAT 的功能足以表达 Codomain 操作, 表达不正确性为三倍, 并证明所有不正确性逻辑性规则, 而Topal- k 的计算方法则不正确。