Mechanised Verification Patterns for Dafny

  • Gudmund GrovEmail author
  • Yuhui Lin
  • Vytautas Tumas
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9995)


In Dafny, the program text is used to both specify and implement programs in the same language [24]. It then uses a fully automated theorem prover to verify that the implementation satisfies the specification. However, the prover often needs further guidance from the user, and another role of the language is to provide such necessary hints and guidance. In this paper, we present a set of verification patterns to support this process. In previous work, we have developed a tactic language for Dafny, where users can encode their verification patterns and re-apply them for several proof tasks [16]. We extend this language with new features, implement our patterns in this tactic language and show, through experiments, generality of the patterns, and applicability of the tactic language.


Recursive Function Inductive Logic Programming Loop Body Automate Theorem Prover Program Text 
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.
  2. 2.
    The Tacny project: FM 2016 information. Accessed 29 May 2016
  3. 3.
    Autexier, S., Dietrich, D.: A tactic language for declarative proofs. In: Kaufmann, M., Paulson, L.C. (eds.) ITP 2010. LNCS, vol. 6172, pp. 99–114. Springer, Heidelberg (2010). doi: 10.1007/978-3-642-14052-5_9 CrossRefGoogle Scholar
  4. 4.
    Barnett, M., Chang, B.-Y.E., DeLine, R., Jacobs, B., Leino, K.R.M.: Boogie: a modular reusable verifier for object-oriented programs. In: Boer, F.S., Bonsangue, M.M., Graf, S., Roever, W.-P. (eds.) FMCO 2005. LNCS, vol. 4111, pp. 364–387. Springer, Heidelberg (2006). doi: 10.1007/11804192_17 CrossRefGoogle Scholar
  5. 5.
    Bundy, A.: A science of reasoning. In: Lassez, J.L., Plotkin, G. (eds.) Computational Logic - Essays in Honor of Alan Robinson, pp. 178–198. MIT Press, Cambridge (1991)Google Scholar
  6. 6.
    Bundy, A., Basin, D., Hutter, D., Ireland, A.: Rippling: Meta-level Guidance for Mathematical Reasoning. Cambridge Tracts in Theoretical Computer Science, vol. 56. Cambridge University Press, Cambridge (2005)CrossRefzbMATHGoogle Scholar
  7. 7.
    Rod, M.: Burstall: proving properties of programs by structural induction. Comput. J. 12(1), 41–48 (1969)CrossRefGoogle Scholar
  8. 8.
    Burstall, R.M., Darlington, J.: A transformation system for developing recursive programs. J. ACM (JACM) 24(1), 44–67 (1977)MathSciNetCrossRefzbMATHGoogle Scholar
  9. 9.
    Claessen, K., Johansson, M., Rosén, D., Smallbone, N.: Automating inductive proofs using theory exploration. In: Bonacina, M.P. (ed.) CADE 2013. LNCS (LNAI), vol. 7898, pp. 392–406. Springer, Heidelberg (2013). doi: 10.1007/978-3-642-38574-2_27 CrossRefGoogle Scholar
  10. 10.
    Colón, M.A., Sankaranarayanan, S., Sipma, H.B.: Linear invariant generation using non-linear constraint solving. In: Hunt, W.A., Somenzi, F. (eds.) CAV 2003. LNCS, vol. 2725, pp. 420–432. Springer, Heidelberg (2003). doi: 10.1007/978-3-540-45069-6_39 CrossRefGoogle Scholar
  11. 11.
    Cousot, P., Halbwachs, N.: Automatic discovery of linear restraints among variables of a program. In: Proceedings of the 5th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, pp. 84–96. ACM (1978)Google Scholar
  12. 12.
    Delahaye, D.: A tactic language for the system Coq. In: Parigot, M., Voronkov, A. (eds.) LPAR 2000. LNAI, vol. 1955, pp. 85–95. Springer, Heidelberg (2000). doi: 10.1007/3-540-44404-1_7 CrossRefGoogle Scholar
  13. 13.
    Ernst, M.D., Perkins, J.H., Guo, P.J., McCamant, S., Pacheco, C., Tschantz, A.S., Xiao, C.: The Daikon system for dynamic detection of likely invariants. Sci. Comput. Program. 69(1), 35–45 (2007)MathSciNetCrossRefzbMATHGoogle Scholar
  14. 14.
    Freitas, L., Whiteside, I.: Proof patterns for formal methods. In: Jones, C., Pihlajasaari, P., Sun, J. (eds.) FM 2014. LNCS, vol. 8442, pp. 279–295. Springer, Heidelberg (2014). doi: 10.1007/978-3-319-06410-9_20 CrossRefGoogle Scholar
  15. 15.
    Gries, D.: The Science of Programming, 1st edn. Springer, New York (1987)zbMATHGoogle Scholar
  16. 16.
    Grov, G., Tumas, V.: Tactics for the dafny program verifier. In: Chechik, M., Raskin, J.-F. (eds.) TACAS 2016. LNCS, vol. 9636, pp. 36–53. Springer, Heidelberg (2016). doi: 10.1007/978-3-662-49674-9_3 CrossRefGoogle Scholar
  17. 17.
    Gupta, A., Rybalchenko, A.: InvGen: an efficient invariant generator. In: Bouajjani, A., Maler, O. (eds.) CAV 2009. LNCS, vol. 5643, pp. 634–640. Springer, Heidelberg (2009). doi: 10.1007/978-3-642-02658-4_48 CrossRefGoogle Scholar
  18. 18.
    Hawblitzel, C., Howell, J., Kapritsos, M., Lorch, J.R., Parno, B., Roberts, M.L., Setty, S., Zill, B.: Ironfleet: proving practical distributed systems correct. In: Proceedings of the 25th Symposium on Operating Systems Principles, pp. 1–17. ACM (2015)Google Scholar
  19. 19.
    Hawblitzel, C., Lorch, J., Parno, B.: Personal discussions, December 2015Google Scholar
  20. 20.
    Hoder, K., Kovács, L., Voronkov, A.: Invariant generation in vampire. In: Abdulla, P.A., Leino, K.R.M. (eds.) TACAS 2011. LNCS, vol. 6605, pp. 60–64. Springer, Heidelberg (2011). doi: 10.1007/978-3-642-19835-9_7 CrossRefGoogle Scholar
  21. 21.
    Joshi, M.: Proof Patterns. Springer, New York (2015)CrossRefzbMATHGoogle Scholar
  22. 22.
    Jason Koenig, K., Leino, R.M.: Programming language features for refinement (2015)Google Scholar
  23. 23.
    Leino, K.R.M.: Types in Dafny, 27 February 2015. (Manuscript KRML 243)
  24. 24.
    Leino, K.R.M.: Dafny: an automatic program verifier for functional correctness. In: Clarke, E.M., Voronkov, A. (eds.) LPAR 2010. LNCS (LNAI), vol. 6355, pp. 348–370. Springer, Heidelberg (2010). doi: 10.1007/978-3-642-17511-4_20 CrossRefGoogle Scholar
  25. 25.
    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). doi: 10.1007/978-3-642-27940-9_21 CrossRefGoogle Scholar
  26. 26.
    Leino, K.R.M., Moskal, M.: Co-induction simply. In: Jones, C., Pihlajasaari, P., Sun, J. (eds.) FM 2014. LNCS, vol. 8442, pp. 382–398. Springer, Heidelberg (2014). doi: 10.1007/978-3-319-06410-9_27 CrossRefGoogle Scholar
  27. 27.
    Matichuk, D., Wenzel, M., Murray, T.: An isabelle proof method language. In: Klein, G., Gamboa, R. (eds.) ITP 2014. LNCS, vol. 8558, pp. 390–405. Springer, Heidelberg (2014). doi: 10.1007/978-3-319-08970-6_25 Google Scholar
  28. 28.
    Moura, L., Bjørner, N.: Z3: an efficient SMT solver. In: Ramakrishnan, C.R., Rehof, J. (eds.) TACAS 2008. LNCS, vol. 4963, pp. 337–340. Springer, Heidelberg (2008). doi: 10.1007/978-3-540-78800-3_24 CrossRefGoogle Scholar
  29. 29.
    Srivastava, S., Gulwani, S.: Program verification using templates over predicate abstraction. In: ACM Sigplan Notices, vol. 44, pp. 223–234. ACM (2009)Google Scholar
  30. 30.
    Sterling, L., Bundy, A., Byrd, L., O’Keefe, R., Silver, B.: Solving symbolic equations with press. In: Calmet, J. (ed.) EUROCAM 1982. LNCS, vol. 144, pp. 109–116. Springer, Heidelberg (1982). doi: 10.1007/3-540-11607-9_13 CrossRefGoogle Scholar
  31. 31.
    Tumas, V.: Search space reduction for Tacny tactics. Honours thesis, Heriot-Watt University (2016).
  32. 32.
    van de Snepscheut, J.L.A.: What Computing is All About. Springer, New York (1993)CrossRefzbMATHGoogle Scholar

Copyright information

© Springer International Publishing AG 2016

Authors and Affiliations

  1. 1.Heriot-Watt UniversityEdinburghUK

Personalised recommendations