Functional Big-Step Semantics

  • Scott Owens
  • Magnus O. Myreen
  • Ramana Kumar
  • Yong Kiam Tan
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9632)


When doing an interactive proof about a piece of software, it is important that the underlying programming language’s semantics does not make the proof unnecessarily difficult or unwieldy. Both small-step and big-step semantics are commonly used, and the latter is typically given by an inductively defined relation. In this paper, we consider an alternative: using a recursive function akin to an interpreter for the language. The advantages include a better induction theorem, less duplication, accessibility to ordinary functional programmers, and the ease of doing symbolic simulation in proofs via rewriting. We believe that this style of semantics is well suited for compiler verification, including proofs of divergence preservation. We do not claim the invention of this style of semantics: our contribution here is to clarify its value, and to explain how it supports several language features that might appear to require a relational or small-step approach. We illustrate the technique on a simple imperative language with C-like for-loops and a break statement, and compare it to a variety of other approaches. We also provide ML and lambda-calculus based examples to illustrate its generality.


Relational Semantic Recursive Call Label Transition System Interactive Proof Type Soundness 
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.



We thank Arthur Charguéraud for advice on Coq and pretty-big-step. The first author was supported by the EPSRC [EP/K040561/1]. The second author was partially supported by the Swedish Research Council. NICTA is funded by the Australian Government through the Department of Communications and the Australian Research Council through the ICT Centre of Excellence Program.


  1. 1.
    Ahmed, A.: Step-indexed syntactic logical relations for recursive and quantified types. In: Sestoft, P. (ed.) ESOP 2006. LNCS, vol. 3924, pp. 69–83. Springer, Heidelberg (2006). doi: 10.1007/11693024_6 CrossRefGoogle Scholar
  2. 2.
    Appel, A.W., McAllester, D.A.: An indexed model of recursive types for foundational proof-carrying code. ACM Trans. Program. Lang. Syst. 23(5), 657–683 (2001). doi: 10.1145/504709.504712 CrossRefGoogle Scholar
  3. 3.
    Bach Poulsen, C., Mosses, P.D.: Deriving pretty-big-step semantics from small-step semantics. In: Shao, Z. (ed.) ESOP 2014 (ETAPS). LNCS, vol. 8410, pp. 270–289. Springer, Heidelberg (2014). doi: 10.1007/978-3-642-54833-8_15 CrossRefGoogle Scholar
  4. 4.
    Poulsen, C.B., Mosses, P.D.: Divergence as state in coinductive big-step semantics (extended abstract). In: 26th Nordic Workshop on Programming Theory, NWPT 2014 (2014).
  5. 5.
    Berghofer, S., Bulwahn, L., Haftmann, F.: Turning inductive into equational specifications. In: Berghofer, S., Nipkow, T., Urban, C., Wenzel, M. (eds.) TPHOLs 2009. LNCS, vol. 5674, pp. 131–146. Springer, Heidelberg (2009). doi: 10.1007/978-3-642-03359-9_11 CrossRefGoogle Scholar
  6. 6.
    Blazy, S., Leroy, X.: Mechanized semantics for the Clight subset of the C language. J. Autom. Reasoning 43(3), 263–288 (2009). doi: 10.1007/s10817-009-9148-3 MathSciNetCrossRefzbMATHGoogle Scholar
  7. 7.
    Bodin, M., Charguéraud, A., Filaretti, D., Gardner, P., Maffeis, S., Naudziuniene, D., Schmitt, A., Smith, G.: A trusted mechanised JavaScript specification. In: The 41st Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2014, pp. 87–100 (2014). doi: 10.1145/2535838.2535876
  8. 8.
    Boyer, R., Moore, J.S.: Mechanized formal reasoning about programs and computing machines. In: Automated Reasoning and Its Applications: Essays in Honor of Larry Wos. MIT Press (1996)Google Scholar
  9. 9.
    Chambart, P.: High level OCaml optimisations (2013).
  10. 10.
    Charguéraud, A.: Pretty-big-step semantics. In: Felleisen, M., Gardner, P. (eds.) ESOP 2013. LNCS, vol. 7792, pp. 41–60. Springer, Heidelberg (2013). doi: 10.1007/978-3-642-37036-6_3 CrossRefGoogle Scholar
  11. 11.
    Danielsson, N.A.: Operational semantics using the partiality monad. In: ACM SIGPLAN International Conference on Functional Programming, ICFP 2012, pp. 127–138 (2012). doi: 10.1145/2364527.2364546
  12. 12.
    Dreyer, D., Neis, G., Birkedal, L.: The impact of higher-order state and control effects on local relational reasoning. J. Funct. Program. 22(4–5), 477–528 (2012). doi: 10.1017/S095679681200024X MathSciNetCrossRefzbMATHGoogle Scholar
  13. 13.
    Ellison, C., Rosu, G.: An executable formal semantics of C with applications. In: Proceedings of the 39th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POpPL 2012, pp. 533–544 (2012). doi: 10.1145/2103656.2103719
  14. 14.
    Klein, C., Clements, J., Dimoulas, C., Eastlund, C., Felleisen, M., Flatt, M., McCarthy, J.A., Rafkind, J., Tobin-Hochstadt, S., Findler, R.B.: Run your research: on the effectiveness of lightweight mechanization. In: Proceedings of the 39th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POpPL 2012, pp. 285–296 (2012). doi: 10.1145/2103656.2103691
  15. 15.
    Kumar, R., Myreen, M.O., Norrish, M., Owens, S.: CakeML: a verified implementation of ML. In: Proceedings of the 41st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2014, pp. 179–191. ACM Press (2014). doi: 10.1145/2535838.2535841
  16. 16.
    Leroy, X.: Formal certification of a compiler back-end or: programming a compiler with a proof assistant. In: Proceedings of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POpPL 2006, pp. 42–54 (2006). doi: 10.1145/1111037.1111042
  17. 17.
    Leroy, X.: A formally verified compiler back-end. J. Autom. Reasoning 43(4), 363–446 (2009). doi: 10.1007/s10817-009-9155-4 MathSciNetCrossRefzbMATHGoogle Scholar
  18. 18.
    Leroy, X., Grall, H.: Coinductive big-step operational semantics. Inf. Comput. 207(2), 284–304 (2009). doi: 10.1016/j.ic.2007.12.004 MathSciNetCrossRefzbMATHGoogle Scholar
  19. 19.
    Moore, J.S.: Symbolic simulation: an ACL2 approach. In: Gopalakrishnan, G.C., Windley, P. (eds.) FMCAD 1998. LNCS, vol. 1522, pp. 334–350. Springer, Heidelberg (1998). doi: 10.1007/3-540-49519-3_22 CrossRefGoogle Scholar
  20. 20.
    Nakata, K., Uustalu, T.: Trace-based coinductive operational semantics for while. In: Berghofer, S., Nipkow, T., Urban, C., Wenzel, M. (eds.) TPHOLs 2009. LNCS, vol. 5674, pp. 375–390. Springer, Heidelberg (2009). doi: 10.1007/978-3-642-03359-9_26 CrossRefGoogle Scholar
  21. 21.
    Nipkow, T., Klein, G.: With Isabelle/HOL. Springer, Heidelberg (2014). doi: 10.1007/978-3-319-10542-0 CrossRefzbMATHGoogle Scholar
  22. 22.
    Owens, S.: A sound semantics for OCaml light. In: Drossopoulou, S. (ed.) Programming Languages and Systems. Lecture Notes in Computer Science, vol. 4960, pp. 1–15. Springer, Heidelberg (2008). doi: 10.1007/978-3-540-78739-6_1 CrossRefGoogle Scholar
  23. 23.
    Reynolds, J.C.: Definitional interpreters for higher-order programming languages. Higher-order and Symbolic Comput. 11(4), 363–397 (1998). doi: 10.1023/A:1010027404223 CrossRefzbMATHGoogle Scholar
  24. 24.
    Rompf, T., Amin, N.: From F to DOT: type soundness proofs with definitional interpreters (2015). CoRR abs/1510.05216
  25. 25.
    Siek, J.: Big-step, diverging or stuck? (2012).
  26. 26.
    Siek, J.: Type safety in three easy lemmas (2013).
  27. 27.
    Tofte, M.: Type inference for polymorphic references. Inf. Comput. 89(1), 1–34 (1990). doi: 10.1016/0890-5401(90)90018-D MathSciNetCrossRefzbMATHGoogle Scholar
  28. 28.
    Tollitte, P.-N., Delahaye, D., Dubois, C.: Producing certified functional code from inductive specifications. In: Hawblitzel, C., Miller, D. (eds.) CPP 2012. LNCS, vol. 7679, pp. 76–91. Springer, Heidelberg (2012). doi: 10.1007/978-3-642-35308-6_9 CrossRefGoogle Scholar
  29. 29.
    Wright, A.K., Felleisen, M.: A syntactic approach to type soundness. Inf. Comput. 115(1), 38–94 (1994). doi: 10.1006/inco.1994.1093 MathSciNetCrossRefzbMATHGoogle Scholar
  30. 30.
    Young, W.D.: A mechanically verified code generator. J. Autom. Reasoning 5(4), 493–518 (1989). doi: 10.1007/BF00243134 CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2016

Authors and Affiliations

  • Scott Owens
    • 1
  • Magnus O. Myreen
    • 2
  • Ramana Kumar
    • 3
  • Yong Kiam Tan
    • 4
  1. 1.School of ComputingUniversity of KentCanterburyUK
  2. 2.CSE DepartmentChalmers University of TechnologyGothenburgSweden
  3. 3.NICTASydneyAustralia
  4. 4.IHPC, A*STARSingaporeSingapore

Personalised recommendations