Verified Calculations

  • K. Rustan M. Leino
  • Nadia Polikarpova
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8164)


Calculational proofs—proofs by stepwise formula manipulation—are praised for their rigor, readability, and elegance. It seems desirable to reuse this style, often employed on paper, in the context of mechanized reasoning, and in particular, program verification.

This work leverages the power of SMT solvers to machine-check calculational proofs at the level of detail they are usually written by hand. It builds the support for calculations into the programming language and auto-active program verifier Dafny. The paper demonstrates that calculations integrate smoothly with other language constructs, producing concise and readable proofs in a wide range of problem domains: from mathematical theorems to correctness of imperative programs. The examples show that calculational proofs in Dafny compare favorably, in terms of readability and conciseness, with arguments written in other styles and proof languages.


Proof Assistant Declarative Language Calculational Method Imperative Program Transitivity Rule 
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.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Armand, M., Faure, G., Grégoire, B., Keller, C., Théry, L., Werner, B.: A modular integration of SAT/SMT solvers to Coq through proof witnesses. In: Jouannaud, J.-P., Shao, Z. (eds.) CPP 2011. LNCS, vol. 7086, pp. 135–150. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  2. 2.
    Back, R., Grundy, J., von Wright, J.: Structured calculational proof. Formal Aspects of Computing 9(5-6), 469–483 (1997)CrossRefzbMATHGoogle Scholar
  3. 3.
    Back, R.-J.: Structured derivations: a unified proof style for teaching mathematics. Formal Aspects of Computing 22(5), 629–661 (2010)CrossRefzbMATHGoogle Scholar
  4. 4.
    Backhouse, R.: Special issue on the calculational method. Information Processing Letters 53(3), 121–172 (1995)CrossRefMathSciNetGoogle Scholar
  5. 5.
    Backhouse, R., Verhoeven, R., Weber, O.: Math\(\int\)pad: A system for on-line preparation of mathematical documents. Software — Concepts and Tools 18(2), 80 (1997)Google Scholar
  6. 6.
    Barnett, M., Chang, B.-Y.E., DeLine, R., Jacobs, B., Leino, K.R.M.: Boogie: A modular reusable verifier for object-oriented programs. In: de Boer, F.S., Bonsangue, M.M., Graf, S., de Roever, W.-P. (eds.) FMCO 2005. LNCS, vol. 4111, pp. 364–387. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  7. 7.
    Bauer, G., Wenzel, M.T.: Calculational reasoning revisited: an Isabelle/Isar experience. In: Boulton, R.J., Jackson, P.B. (eds.) TPHOLs 2001. LNCS, vol. 2152, pp. 75–90. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  8. 8.
    Bertot, Y., Castéran, P.: Interactive Theorem Proving and Program Development — Coq’Art: The Calculus of Inductive Constructions. Springer (2004)Google Scholar
  9. 9.
    Bobot, F., Filliâtre, J.-C., Marché, C., Paskevich, A.: Why3: Shepherd your herd of provers. In: BOOGIE 2011: Workshop on Intermediate Verification Languages, pp. 53–64 (2011)Google Scholar
  10. 10.
    Böhme, S., Nipkow, T.: Sledgehammer: Judgement day. In: Giesl, J., Hähnle, R. (eds.) IJCAR 2010. LNCS, vol. 6173, pp. 107–121. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  11. 11.
    Chisholm, P.: Calculation by computer. In: Third International Workshop on Software Engineering and its Applications, Toulouse, France, pp. 713–728 (December 1990)Google Scholar
  12. 12.
    Claessen, K., Johansson, M., Rosén, D., Smallbone, N.: Automating inductive proofs using theory exploration. In: Bonacina, M.P. (ed.) CADE 2013. LNCS, vol. 7898, pp. 392–406. Springer, Heidelberg (2013)CrossRefGoogle Scholar
  13. 13.
    Cohen, E., Dahlweid, M., Hillebrand, M.A., Leinenbach, D., Moskal, M., Santen, T., Schulte, W., Tobies, S.: VCC: A practical system for verifying concurrent C. In: Berghofer, S., Nipkow, T., Urban, C., Wenzel, M. (eds.) TPHOLs 2009. LNCS, vol. 5674, pp. 23–42. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  14. 14.
    Corbineau, P.: A declarative language for the Coq proof assistant. In: Miculan, M., Scagnetto, I., Honsell, F. (eds.) TYPES 2007. LNCS, vol. 4941, pp. 69–84. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  15. 15.
    Dijkstra, E.W.: EWD1300: The notational conventions I adopted, and why. Formal Asp. Comput. 14(2), 99–107 (2002)CrossRefzbMATHGoogle Scholar
  16. 16.
    Dijkstra, E.W., Scholten, C.S.: Predicate calculus and program semantics. Texts and monographs in computer science. Springer (1990)Google Scholar
  17. 17.
    Grundy, J.: Transformational hierarchical reasoning. Comput. J. 39(4), 291–302 (1996)CrossRefGoogle Scholar
  18. 18.
    Jacobs, B., Piessens, F.: The VeriFast program verifier. Technical Report CW-520, Department of Computer Science, Katholieke Universiteit Leuven (2008)Google Scholar
  19. 19.
    Jacobs, B., Smans, J., Piessens, F.: VeriFast: Imperative programs as proofs. In: VS-Tools workshop at VSTTE 2010 (2010)Google Scholar
  20. 20.
    Kaufmann, M., Manolios, P., Moore, J.S.: Computer-Aided Reasoning: An Approach. Kluwer Academic Publishers (2000)Google Scholar
  21. 21.
    Koenig, J., Leino, K.R.M.: Getting started with Dafny: A guide. In: Software Safety and Security: Tools for Analysis and Verification, pp. 152–181. IOS Press (2012)Google Scholar
  22. 22.
    Leino, K.R.M.: Dafny: An automatic program verifier for functional correctness. In: Clarke, E.M., Voronkov, A. (eds.) LPAR-16 2010. LNCS, vol. 6355, pp. 348–370. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  23. 23.
    Leino, K.R.M.: Automating induction with an SMT solver. In: Kuncak, V., Rybalchenko, A. (eds.) VMCAI 2012. LNCS, vol. 7148, pp. 315–331. Springer, Heidelberg (2012)CrossRefGoogle Scholar
  24. 24.
    Leino, K.R.M., Moskal, M.: Usable auto-active verification. In: Ball, T., Zuck, L., Shankar, N. (eds.) Usable Verification Workshop (2010),
  25. 25.
    Manolios, P., Moore, J.S.: On the desirability of mechanizing calculational proofs. Inf. Process. Lett. 77(2-4), 173–179 (2001)CrossRefzbMATHMathSciNetGoogle Scholar
  26. 26.
    Nipkow, T.: Programming and Proving in Isabelle/HOL (2012),
  27. 27.
    Owre, S., Rushby, J.M., Shankar, N.: PVS: A prototype verification system. In: Kapur, D. (ed.) CADE 1992. LNCS, vol. 607, pp. 748–752. Springer, Heidelberg (1992)Google Scholar
  28. 28.
    Robinson, P.J., Staples, J.: Formalizing a hierarchical structure of practical mathematical reasoning. J. Log. Comput. 3(1), 47–61 (1993)CrossRefzbMATHMathSciNetGoogle Scholar
  29. 29.
    Rudnicki, P.: An overview of the MIZAR project. In: University of Technology, Bastad, pp. 311–332 (1992)Google Scholar
  30. 30.
    Sonnex, W., Drossopoulou, S., Eisenbach, S.: Zeno: An automated prover for properties of recursive data structures. In: Flanagan, C., König, B. (eds.) TACAS 2012. LNCS, vol. 7214, pp. 407–421. Springer, Heidelberg (2012)CrossRefGoogle Scholar
  31. 31.
    van de Snepscheut, J.L.A.: Proxac: an editor for program transformation. Technical Report CS-TR-93-33, Caltech (1993)Google Scholar
  32. 32.
    van Gasteren, A.J.M., Bijlsma, A.: An extension of the program derivation format. In: PROCOMET 1998, pp. 167–185. IFIP Conference Proceedings (1998)Google Scholar
  33. 33.
    Verhoeven, R., Backhouse, R.: Interfacing program construction and verification. In: World Congress on Formal Methods, pp. 1128–1146 (1999)Google Scholar
  34. 34.
    von Wright, J.: Extending window inference. In: Grundy, J., Newey, M. (eds.) TPHOLs 1998. LNCS, vol. 1479, pp. 17–32. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  35. 35.
    Wenzel, M.: Isabelle/Isar — a versatile environment for human-readable formal proof documents. PhD thesis, Institut für Informatik, Technische Universität München (2002)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2014

Authors and Affiliations

  • K. Rustan M. Leino
    • 1
  • Nadia Polikarpova
    • 2
  1. 1.Microsoft ResearchRedmondUSA
  2. 2.ETH ZurichZurichSwitzerland

Personalised recommendations