Template-based program verification and program synthesis

  • Saurabh Srivastava
  • Sumit Gulwani
  • Jeffrey S. Foster
Synthesis

Abstract

Program verification is the task of automatically generating proofs for a program’s compliance with a given specification. Program synthesis is the task of automatically generating a program that meets a given specification. Both program verification and program synthesis can be viewed as search problems, for proofs and programs, respectively. For these search problems, we present approaches based on user-provided insights in the form of templates. Templates are hints about the syntactic forms of the invariants and programs, and help guide the search for solutions. We show how to reduce the template-based search problem to satisfiability solving, which permits the use of off-the-shelf solvers to efficiently explore the search space. Template-based approaches have allowed us to verify and synthesize programs outside the abilities of previous verifiers and synthesizers. Our approach can verify and synthesize difficult algorithmic textbook programs (e.g., sorting and dynamic programming-based algorithms) and difficult arithmetic programs.

Keywords

Synthesis Verification Template-based program analyses SMT solvers Pre-and postcondition inference Static analysis Predicate abstraction Human guided verification and synthesis 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Bauer, F.L., Ehler, H., Horsch, A., Moeller, B., Partsch, H., Paukner, O., Pepper, P.: The/Munich project CIP (1988)Google Scholar
  2. 2.
    Beucher, O.: MATLAB und simulink (scientific computing). Pearson Studium, 08 (2006)Google Scholar
  3. 3.
    Beyer, D., Henzinger, T. Majumdar, R., Rybalchenko, A.: Path invariants. In: PLDI (2007)Google Scholar
  4. 4.
    Colón, M.: Schema-guided synthesis of imperative programs by constraint solving. In: LOPSTR, pp. 166–181. (2004)Google Scholar
  5. 5.
    Colón, M., Sankaranarayanan, S., Sipma, H.: Linear invariant generation using non-linear constraint solving. In: CAV, pp. 420–432. (2003)Google Scholar
  6. 6.
    Constable R.L.: Implementing Mathematics with the Nuprl Proof Development System. Prentice-Hall, Upper Saddle River, NJ (1986)Google Scholar
  7. 7.
    Cook, B., Gupta, A., Magill, S., Rybalchenko, A., Simsa, J., Singh, S., Vafeiadis, V.: Finding heap-bounds for hardware synthesis. In: FMCAD, pp. 205–212. (2009)Google Scholar
  8. 8.
    Cormen T., Leiserson C., Rivest R.: Introduction to Algorithms. The MIT Press, Cambridge, MA (1990)MATHGoogle Scholar
  9. 9.
    Cousot, P., Cousot, R.: Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints. In: POPL, pp. 238–252. (1977)Google Scholar
  10. 10.
    Cousot P., Cousot R.: Abstract interpretation and application to logic programs. J. Log. Program. 13(2&3), 103–179 (1992)MathSciNetCrossRefMATHGoogle Scholar
  11. 11.
    Das, S., Dill, D.L.: Counter-example based predicate discovery in predicate abstraction. In: FMCAD, pp. 19–32. (2002)Google Scholar
  12. 12.
    de Moura, L., Bjørner, N.: Efficient E-matching for smt solvers. In: CADE-21, pp. 183–198. (2007)Google Scholar
  13. 13.
    de Moura, L., Bjørner, N.: Z3. http://research.microsoft.com/projects/Z3/ (2008)
  14. 14.
    Denney, E.: A theory of program refinement. PhD thesis, University of Edinburgh (1999)Google Scholar
  15. 15.
    Duran, J.W.: Heuristics for program synthesis using loop invariants. In: ACM, pp. 891–900. (1978)Google Scholar
  16. 16.
    Emerson, T., Burstein, M.H.: Development of a constraint-based airlift scheduler by program synthesis from formal specifications. In: ASE, p. 267. (1999)Google Scholar
  17. 17.
    Fischer B., Schumann J.: Autobayes: a system for generating data analysis programs from statistical models. J. Funct. Program. 13(3), 483–508 (2003)MathSciNetCrossRefMATHGoogle Scholar
  18. 18.
    Flanagan, C., Qadeer, S.: Predicate abstraction for software verification. In: POPL, pp. 191–202. (2002)Google Scholar
  19. 19.
    Flener P., Lau K.-K., Ornaghi M., Richardson J.: An abstract formalization of correct schemas for program synthesis. J. Symb. Comput. 30(1), 93–127 (2000)MathSciNetCrossRefMATHGoogle Scholar
  20. 20.
    Gopan, D., Reps, T.W.: Lookahead widening. In: CAV, pp. 452–466. (2006)Google Scholar
  21. 21.
    Gopan, D., Reps, T.W.: Guided static analysis. In: SAS, pp. 349–365. (2007)Google Scholar
  22. 22.
    Green, C.: Application of theorem proving to problem solving. In: IJCAI, pp. 219–239. (1969)Google Scholar
  23. 23.
    Gulwani, S.: Dimensions in program synthesis. In: FMCAD, p. 1. (2010)Google Scholar
  24. 24.
    Gulwani, S.: Automating string processing in spreadsheets using input-output examples. In: POPL, pp. 317–330. (2011)Google Scholar
  25. 25.
    Gulavani, B.S., Chakraborty, S., Nori, A.V., Rajamani, S.K.: Automatically refining abstract interpretations. TR-07-23 (2007)Google Scholar
  26. 26.
    Gulwani, S., McCloskey, B., Tiwari, A.: Lifting abstract interpreters to quantified logical domains. In: POPL, pp. 235–246. (2008)Google Scholar
  27. 27.
    Gulwani, S., Srivastava, S., Venkatesan, R.: Program analysis as constraint solving. In: PLDI. (2008)Google Scholar
  28. 28.
    Gulwani, S., Srivastava, S., Venkatesan, R.: Constraint-based invariant inference over predicate abstraction. In: VMCAI (2009)Google Scholar
  29. 29.
    Gulwani, S., Jha, S., Tiwari, A., Venkatesan, R.: Synthesis of loop-free programs. In: PLDI, pp. 62–73. (2011)Google Scholar
  30. 30.
    Gulwani, S., Korthikanti, V.A., Tiwari, A.: Synthesizing geometry constructions. In: PLDI, pp. 50–61. (2011)Google Scholar
  31. 31.
    Gupta, A., Majumdar, R., Rybalchenko, A.: From tests to proofs. In: TACAS, pp. 262–276. (2009)Google Scholar
  32. 32.
    Gupta, A., Rybalchenko, A.: Invgen: an efficient invariant generator. In: CAV, pp. 634–640. (2009)Google Scholar
  33. 33.
    Harris, W.R., Gulwani, S.: Spreadsheet table transformations from examples. In: PLDI, pp. 317–328. (2011)Google Scholar
  34. 34.
    Henzinger, T.A., Jhala, R., Majumdar, R., McMillan, K.L.: Abstractions from proofs. In: POPL, pp. 232–244. (2004)Google Scholar
  35. 35.
    Itzhaky, S., Gulwani, S., Immerman, N., Sagiv, M.: A simple inductive synthesis methodology and its applications. In: OOPSLA, pp. 36–46. (2010)Google Scholar
  36. 36.
    Jha, S., Gulwani, S., Seshia, S., Tiwari, A.: Oracle-guided component-based program synthesis. In: ICSE (2010)Google Scholar
  37. 37.
    Jhala, R., McMillan, K.: Array abstractions from proofs. In: CAV (2007)Google Scholar
  38. 38.
    Kahrs S., Sannella D., Tarlecki A.: The definition of extended ML: a gentle introduction. Theor. Comput. Sci. 173, 445–484 (1997)MathSciNetCrossRefMATHGoogle Scholar
  39. 39.
    Kuncak, V., Mayer, M., Piskac, R., Suter, P.: Complete functional synthesis. In: PLDI (2010)Google Scholar
  40. 40.
    Lahiri, S.K., Bryant, R.E.: Constructing quantified invariants via predicate abstraction. In: VMCAI, pp. 331–353. (2004)Google Scholar
  41. 41.
    Lahiri, S.K., Bryant, R.E.: Indexed predicate discovery for unbounded system verification. In: CAV, pp. 135–147. (2004)Google Scholar
  42. 42.
    Lahiri S.K., Bryant R.E.: Predicate abstraction with indexed predicates. ACM Trans. Comput. Log. 9(1), 4 (2007)MathSciNetCrossRefGoogle Scholar
  43. 43.
    Manna Z., Waldinger R.J.: Toward automatic program synthesis. Commun. ACM 14(3), 151–165 (1971)CrossRefMATHGoogle Scholar
  44. 44.
    Manna Z., Waldinger R.J.: A deductive approach to program synthesis. ACM Trans. Program. Lang. Syst. 2(1), 90–121 (1980)CrossRefMATHGoogle Scholar
  45. 45.
    Mayer, M., Suter, P., Piskac, R., Kuncak, V.: Comfusy: complete functional synthesis (tool presentation). In: CAV (2010)Google Scholar
  46. 46.
    McCarthy, J., Painter, J.: Correctness of a compiler for arithmetic expressions. In: Proceedings of Symposia in Applied Mathematics. American Mathematical Society, pp. 33–41. (1967)Google Scholar
  47. 47.
    McDonald, J., Anton, J.: SPECWARE—producing software correct by construction. Technical report KES.U.01.3. (2001)Google Scholar
  48. 48.
    Morris J.M., Bunkenburg A.: Specificational functions. ACM Trans. Program. Lang. Syst. 21, 677–701 (1999)CrossRefGoogle Scholar
  49. 49.
    Rondon, P.M., Kawaguci, M., Jhala, R.: Liquid types. In: PLDI, pp. 159–169. (2008)Google Scholar
  50. 50.
    Sankaranarayanan, S., Sipma, H.B., Manna, Z.: Constraint-based linear-relations analysis. In: SAS, pp. 53–68. (2004)Google Scholar
  51. 51.
    Sankaranarayanan, S., Sipma, H.B., Manna, Z.: Scalable analysis of linear systems using mathematical programming. In: VMCAI, pp. 25–41. (2005)Google Scholar
  52. 52.
    Schrijver A.: Theory of Linear and Integer Programming. Wiley, New York, NY (1986)MATHGoogle Scholar
  53. 53.
    Smith D.R.: Kids: a semiautomatic program development system. IEEE Trans. Softw. Eng. 16(9), 1024–1043 (1990)CrossRefGoogle Scholar
  54. 54.
    Smith, D.R.: Designware: Software Development by Refinement, Invited talk CTCS’99, Edinburgh, Scotland, pp. 3–21. (2001)Google Scholar
  55. 55.
    Solar-Lezama, A., Arnold, G., Tancau, L., Bodik, R., Saraswat, V., Seshia, S.: Sketching stencils. In: PLDI, pp. 167–178. (2007)Google Scholar
  56. 56.
    Srivastava, S.: Satisfiability-based program reasoning and program synthesis. PhD thesis, University of Maryland, College Park. http://www.cs.umd.edu/~saurabhs/pubs/saurabh-srivastava-thesis-9pt.pdf (2010)
  57. 57.
    Srivastava, S., Gulwani, S.: Program verification using templates over predicate abstraction. In: PLDI (2009)Google Scholar
  58. 58.
    Srivastava, S., Gulwani, S., Foster, J.S.: VS3: SMT solvers for program verification. In: CAV (2009)Google Scholar
  59. 59.
    Srivastava, S., Gulwani, S., Foster, J.S.: From program verification to program synthesis. In: POPL (2010)Google Scholar
  60. 60.
    Thies, W., Karczmarek, M., Amarasinghe, S.P.: Streamit: a language for streaming applications. In: CC, pages 179–196. (2002)Google Scholar
  61. 61.
    Vechev, M., Yahav, E., Yorsh, G.: Abstraction-guided synthesis of synchronization. In: POPL, pp. 327–338. (2010)Google Scholar
  62. 62.
    Waldinger, R.J., Lee, R.C.T.: Prow: a step toward automatic program writing. In: IJCAI, pp. 241–252. (1969)Google Scholar
  63. 63.
    Wang, C., Yang, Z., Gupta, A., Ivancic, F.: Using counterexamples for improving the precision of reachability computation with polyhedra. In: CAV, pp. 352–365. (2007)Google Scholar
  64. 64.
    Xie, Y., Aiken, A.: Saturn: a sat-based tool for bug detection. In: CAV, pp. 139–143. (2005)Google Scholar

Copyright information

© Springer-Verlag 2012

Authors and Affiliations

  • Saurabh Srivastava
    • 1
  • Sumit Gulwani
    • 2
  • Jeffrey S. Foster
    • 3
  1. 1.University of CaliforniaBerkeleyUSA
  2. 2.Microsoft ResearchRedmondUSA
  3. 3.University of MarylandCollege ParkUSA

Personalised recommendations