A Hoare Logic for the Coinductive Trace-Based Big-Step Semantics of While
In search for a foundational framework for reasoning about observable behavior of programs that may not terminate, we have previously devised a trace-based big-step semantics for While. In this semantics, both traces and evaluation (relating initial states of program runs to traces they produce) are defined coinductively. On terminating runs, it agrees with the standard inductive state-based semantics. Here we present a Hoare logic counterpart of our coinductive trace-based semantics and prove it sound and complete. Our logic subsumes both the partial correctness Hoare logic and the total correctness Hoare logic: they are embeddable. Since we work with a constructive underlying logic, the range of expressible program properties has a rich structure; in particular, we can distinguish between termination and nondivergence, e.g., unbounded total search fails to be terminating but is nonetheless nondivergent. Our metatheory is entirely constructive as well, and we have formalized it in Coq.
KeywordsInduction Hypothesis Inference Rule Total Correctness Sequence Rule State Predicate
- 2.Capretta, V.: General recursion via coinductive types. Logical Methods in Computer Science 1(2), article 1 (2005) Google Scholar
- 5.Danielsson, N.A., Altenkirch, T.: Mixing induction and coinduction. Draft (2009), http://www.cs.nott.ac.uk/~nad/publications/
- 6.Glesner, S.: A proof calculus for natural semantics based on greatest fixed point semantics. In: Knoop, J., Necula, G.C., Zimmermann, W. (eds.) Proc. of 3rd Int. Wksh. on Compiler Optimization Meets Compiler Verification, COCV 2004, Barcelona, April 2004. Electron. Notes in Theor. Comput. Sci., vol. 132(1), pp. 73–93. Elsevier, Amsterdam (2004)Google Scholar
- 8.Hasuo, I., Jacobs, B., Sokolova, A.: Generic trace semantics via coinduction. Logical Methods in Computer Science 3(4), article 11 (2007) Google Scholar
- 14.Nakata, K., Uustalu, T.: Trace-based coinductive operational semantics for While: big-step and small-step, relational and functional styles. In: Berghofer, S., Nipkow, T., Urban, C., Wenzel, M. (eds.) TPHOLs 2009. LNCS, vol. 5674, pp. 375–390. Springer, Heidelberg (2009)Google Scholar