Advertisement

Computing with an SMT Solver

  • Nada Amin
  • K. Rustan M. Leino
  • Tiark Rompf
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8570)

Abstract

Satisfiability modulo theories (SMT) solvers that support quantifier instantiations via matching triggers can be programmed to give practical support for user-defined theories. Care must be taken to avoid so-called matching loops, which may prevent termination of the solver. By design, such avoidance limits the extent to which the SMT solver is able to apply the definitions of user-defined functions. For some inputs to these functions, however, it is instead desireable to allow unadulterated use of the functions; in particular, if it is known that evaluation will terminate.

This paper describes the program verifier Dafny’s SMT encoding of recursive user-defined functions. It then describes a novel encoding that, drawing on ideas from offline partial evaluation systems, lets the SMT solver evaluate “safe” function applications while guarding against matching loops for others.

Keywords

Match Pattern Partial Evaluation Ground Term Proof State Lambda Calculus 
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.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    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
  2. 2.
    Barrett, C.W., Berezin, S.: CVC Lite: A New Implementation of the Cooperating Validity Checker Category B. In: Alur, R., Peled, D.A. (eds.) CAV 2004. LNCS, vol. 3114, pp. 515–518. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  3. 3.
    Barrett, C., Stump, A., Tinelli, C.: The SMT-LIB standard: Version 2.0. In: Gupta, A., Kroening, D. (eds.) Proceedings of the 8th International Workshop on Satisfiability Modulo Theories (2010)Google Scholar
  4. 4.
    Barrett, C.W., Tinelli, C.: CVC3. In: Damm, W., Hermanns, H. (eds.) CAV 2007. LNCS, vol. 4590, pp. 298–302. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  5. 5.
    Berlin, A.A., Weise, D.: Compiling scientific code using partial evaluation. IEEE Computer 23(12), 25–37 (1990)CrossRefGoogle Scholar
  6. 6.
    Bertot, Y., Castéran, P.: Interactive Theorem Proving and Program Development — Coq’Art: The Calculus of Inductive Constructions. In: Texts in Theoretical Computer Science. Springer (2004)Google Scholar
  7. 7.
    Bondorf, A.: Automatic autoprojection of higher order recursive equations. Sci. Comput. Program. 17(1-3), 3–34 (1991)CrossRefzbMATHGoogle Scholar
  8. 8.
    Clavel, M., Durán, F., Eker, S., Lincoln, P., Martí-Oliet, N., Meseguer, J., Quesada, J.F.: Maude: Specification and programming in rewriting logic. Theoretical Computer Science 285(2), 187–243 (2002)CrossRefzbMATHMathSciNetGoogle Scholar
  9. 9.
    Consel, C.: A tour of Schism: A partial evaluation system for higher-order applicative languages. In: Schmidt, D.A. (ed.) Proceedings of the ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation, PEPM 1993, pp. 145–154. ACM (June 1993)Google Scholar
  10. 10.
    de Moura, L., Bjørner, N.S.: Efficient E-Matching for SMT Solvers. In: Pfenning, F. (ed.) CADE 2007. LNCS (LNAI), vol. 4603, pp. 183–198. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  11. 11.
    de Moura, L., Bjørner, N.S.: Z3: An Efficient SMT Solver. In: Ramakrishnan, C.R., Rehof, J. (eds.) TACAS 2008. LNCS, vol. 4963, pp. 337–340. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  12. 12.
    Detlefs, D., Nelson, G., Saxe, J.B.: Simplify: a theorem prover for program checking. Journal of the ACM 52(3), 365–473 (2005)CrossRefMathSciNetGoogle Scholar
  13. 13.
    Dross, C., Conchon, S., Kanig, J., Paskevich, A.: Reasoning with triggers. In: Fontaine, P., Goel, A. (eds.) 10th International Workshop on Satisfiability Modulo Theories, SMT 2012. EasyChair 2013 EPiC Series, pp. 22–31 (2012)Google Scholar
  14. 14.
    Flanagan, C., Joshi, R., Ou, X., Saxe, J.B.: Theorem proving using lazy proof explication. In: Hunt Jr., W.A., Somenzi, F. (eds.) CAV 2003. LNCS, vol. 2725, pp. 355–367. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  15. 15.
    Gomard, C.K., Jones, N.D.: Compiler generation by partial evaluation: A case study. Structured Programming 12(3), 123–144 (1991)MathSciNetGoogle Scholar
  16. 16.
    Gomard, C.K., Jones, N.D.: A partial evaluator for the untyped lambda-calculus. J. Funct. Program. 1(1), 21–69 (1991)CrossRefzbMATHMathSciNetGoogle Scholar
  17. 17.
    Jacobs, B., Piessens, F.: The VeriFast program verifier. Technical Report CW-520, Department of Computer Science, Katholieke Universiteit Leuven (August 2008)Google Scholar
  18. 18.
    Jones, N.D., Gomard, C.K., Sestoft, P.: Partial evaluation and automatic program generation. Prentice-Hall, Inc. (1993)Google Scholar
  19. 19.
    Kneuss, E., Kuraj, I., Kuncak, V., Suter, P.: Synthesis modulo recursive functions. In: Hosking, A.L., Eugster, P.T., Lopes, C.V. (eds.) Proceedings of the 2013 ACM SIGPLAN International Conference on Object Oriented Programming Systems Languages & Applications, OOPSLA 2013, pp. 407–426. ACM (October 2013)Google Scholar
  20. 20.
    Rustan, K., Leino, M.: Specification and verification of object-oriented software. In: Broy, M., Sitou, W., Hoare, T. (eds.) Engineering Methods and Tools for Software Safety and Security. NATO Science for Peace and Security Series D: Information and Communication Security, vol. 22, pp. 231–266. IOS Press (2009), Summer School Marktoberdorf 2008 lecture notes. Google Scholar
  21. 21.
    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
  22. 22.
    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
  23. 23.
    Rustan, K., Leino, M., Monahan, R.: Reasoning about comprehensions with first-order SMT solvers. In: Shin, S.Y., Ossowski, S. (eds.) Proceedings of the 2009 ACM Symposium on Applied Computing (SAC), pp. 615–622. ACM (March 2009)Google Scholar
  24. 24.
    Leino, K.R.M., Musuvathi, M., Ou, X.: A Two-Tier Technique for Supporting Quantifiers in a Lazily Proof-Explicating Theorem Prover. In: Halbwachs, N., Zuck, L.D. (eds.) TACAS 2005. LNCS, vol. 3440, pp. 334–348. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  25. 25.
    Moskal, M.J.: Satisfiability Modulo Software. PhD thesis, Institute of Computer Science, University of Wrocław (2009)Google Scholar
  26. 26.
    Nelson, C.G.: Techniques for program verification. Technical Report CSL-81-10, Xerox PARC (June 1981)Google Scholar
  27. 27.
    Owre, S., Rajan, S., Rushby, J.M., Shankar, N., Srivas, M.K.: PVS: Combining specification, proof checking, and model checking. In: Alur, R., Henzinger, T.A. (eds.) CAV 1996. LNCS, vol. 1102, pp. 411–414. Springer, Heidelberg (1996)CrossRefGoogle Scholar
  28. 28.
    Pierce, B.C., Casinghino, C., Gaboardi, M., Greenberg, M., Hriţcu, C., Sjöberg, V., Yorgey, B.: Software Foundations. In: Electronic textbook (2013), http://www.cis.upenn.edu/~bcpierce/sf
  29. 29.
    Sahlin, D.: The mixtus approach to automatic partial evaluation of full Prolog. In: Debray, S.K., Hermenegildo, M.V. (eds.) Proceedings of the 1990 North American Conference on Logic Programming, NACLP, October–November 1990, pp. 377–398. MIT Press (1990)Google Scholar
  30. 30.
    Weise, D., Conybeare, R., Ruf, E., Seligman, S.: Automatic online partial evaluation. In: Hughes, J. (ed.) FPCA 1991. LNCS, vol. 523, pp. 165–191. Springer, Heidelberg (1991)CrossRefGoogle Scholar

Copyright information

© Springer International Publishing Switzerland 2014

Authors and Affiliations

  • Nada Amin
    • 1
  • K. Rustan M. Leino
    • 2
  • Tiark Rompf
    • 1
    • 3
  1. 1.EPFLLausanneSwitzerland
  2. 2.Microsoft ResearchRedmondUSA
  3. 3.Oracle LabsLausanneSwitzerland

Personalised recommendations