A Hoare Logic for the Coinductive Trace-Based Big-Step Semantics of While

  • Keiko Nakata
  • Tarmo Uustalu
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6012)


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.


Induction Hypothesis Inference Rule Total Correctness Sequence Rule State Predicate 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. 1.
    Blazy, S., Leroy, X.: Mechanized semantics for the Clight subset of the C language. J. of Automated Reasoning 43(3), 263–288 (2009)zbMATHCrossRefGoogle Scholar
  2. 2.
    Capretta, V.: General recursion via coinductive types. Logical Methods in Computer Science 1(2), article 1 (2005) Google Scholar
  3. 3.
    Cousot, P., Cousot, R.: Inductive definitions, semantics and abstract interpretation. In: Conf. Record of 19th ACM SIGPLAN-SIGACT Symp. on Principles of Programming Languages, POPL 1992, Albuquerque, NM, January 1992, pp. 83–94. ACM Press, New York (1992)CrossRefGoogle Scholar
  4. 4.
    Cousot, P., Cousot, R.: Bi-inductive structural semantics. Inform. and Comput. 207(2), 258–283 (2009)zbMATHCrossRefMathSciNetGoogle Scholar
  5. 5.
    Danielsson, N.A., Altenkirch, T.: Mixing induction and coinduction. Draft (2009),
  6. 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
  7. 7.
    Halpern, J., Manna, Z., Moszkowski, B.: A hardware semantics based on temporal intervals. In: Díaz, J. (ed.) ICALP 1983. LNCS, vol. 154, pp. 278–291. Springer, Heidelberg (1983)CrossRefGoogle Scholar
  8. 8.
    Hasuo, I., Jacobs, B., Sokolova, A.: Generic trace semantics via coinduction. Logical Methods in Computer Science 3(4), article 11 (2007) Google Scholar
  9. 9.
    Hofmann, M., Pavlova, M.: Elimination of ghost variables in program logics. In: Barthe, G., Fournet, C. (eds.) TGC 2007. LNCS, vol. 4912, pp. 1–20. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  10. 10.
    Leroy, X.: Coinductive big-step operational semantics. In: Sestoft, P. (ed.) ESOP 2006. LNCS, vol. 3924, pp. 54–68. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  11. 11.
    Leroy, X., Grall, H.: Coinductive big-step operational semantics. Inform. and Comput. 207(2), 285–305 (2009)CrossRefMathSciNetGoogle Scholar
  12. 12.
    Kleymann, T.: Hoare logic and auxiliary variables. Formal Asp. Comput. 11(5), 541–566 (1999)zbMATHCrossRefGoogle Scholar
  13. 13.
    Moszkowski, B.: A temporal logic for reasoning about hardware. Computer 18(2), 10–19 (1985)CrossRefGoogle Scholar
  14. 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
  15. 15.
    Nestra, H.: Fractional semantics. In: Johnson, M., Vene, V. (eds.) AMAST 2006. LNCS, vol. 4019, pp. 278–292. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  16. 16.
    Nestra, H.: Transfinite semantics in the form of greatest fixpoint. J. of Logic and Algebr. Program. 78(7), 574–593 (2009)MathSciNetGoogle Scholar
  17. 17.
    Riis Nielson, H., Nielson, F.: Semantics with Applications: A Formal Introduction. Wiley, Chichester (1992)zbMATHGoogle Scholar
  18. 18.
    Rutten, J.: A note on coinduction and weak bisimilarity for While programs. Theor. Inform. and Appl. 33(4-5), 393–400 (1999)zbMATHCrossRefMathSciNetGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2010

Authors and Affiliations

  • Keiko Nakata
    • 1
  • Tarmo Uustalu
    • 1
  1. 1.Institute of Cybernetics at Tallinn University of TechnologyTallinnEstonia

Personalised recommendations