Skip to main content

Advertisement

Log in

Template-based program verification and program synthesis

  • Synthesis
  • Published:
International Journal on Software Tools for Technology Transfer Aims and scope Submit manuscript

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.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Similar content being viewed by others

References

  1. Bauer, F.L., Ehler, H., Horsch, A., Moeller, B., Partsch, H., Paukner, O., Pepper, P.: The/Munich project CIP (1988)

  2. Beucher, O.: MATLAB und simulink (scientific computing). Pearson Studium, 08 (2006)

  3. Beyer, D., Henzinger, T. Majumdar, R., Rybalchenko, A.: Path invariants. In: PLDI (2007)

  4. Colón, M.: Schema-guided synthesis of imperative programs by constraint solving. In: LOPSTR, pp. 166–181. (2004)

  5. Colón, M., Sankaranarayanan, S., Sipma, H.: Linear invariant generation using non-linear constraint solving. In: CAV, pp. 420–432. (2003)

  6. Constable R.L.: Implementing Mathematics with the Nuprl Proof Development System. Prentice-Hall, Upper Saddle River, NJ (1986)

    Google Scholar 

  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)

  8. Cormen T., Leiserson C., Rivest R.: Introduction to Algorithms. The MIT Press, Cambridge, MA (1990)

    MATH  Google Scholar 

  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)

  10. Cousot P., Cousot R.: Abstract interpretation and application to logic programs. J. Log. Program. 13(2&3), 103–179 (1992)

    Article  MathSciNet  MATH  Google Scholar 

  11. Das, S., Dill, D.L.: Counter-example based predicate discovery in predicate abstraction. In: FMCAD, pp. 19–32. (2002)

  12. de Moura, L., Bjørner, N.: Efficient E-matching for smt solvers. In: CADE-21, pp. 183–198. (2007)

  13. de Moura, L., Bjørner, N.: Z3. http://research.microsoft.com/projects/Z3/ (2008)

  14. Denney, E.: A theory of program refinement. PhD thesis, University of Edinburgh (1999)

  15. Duran, J.W.: Heuristics for program synthesis using loop invariants. In: ACM, pp. 891–900. (1978)

  16. Emerson, T., Burstein, M.H.: Development of a constraint-based airlift scheduler by program synthesis from formal specifications. In: ASE, p. 267. (1999)

  17. Fischer B., Schumann J.: Autobayes: a system for generating data analysis programs from statistical models. J. Funct. Program. 13(3), 483–508 (2003)

    Article  MathSciNet  MATH  Google Scholar 

  18. Flanagan, C., Qadeer, S.: Predicate abstraction for software verification. In: POPL, pp. 191–202. (2002)

  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)

    Article  MathSciNet  MATH  Google Scholar 

  20. Gopan, D., Reps, T.W.: Lookahead widening. In: CAV, pp. 452–466. (2006)

  21. Gopan, D., Reps, T.W.: Guided static analysis. In: SAS, pp. 349–365. (2007)

  22. Green, C.: Application of theorem proving to problem solving. In: IJCAI, pp. 219–239. (1969)

  23. Gulwani, S.: Dimensions in program synthesis. In: FMCAD, p. 1. (2010)

  24. Gulwani, S.: Automating string processing in spreadsheets using input-output examples. In: POPL, pp. 317–330. (2011)

  25. Gulavani, B.S., Chakraborty, S., Nori, A.V., Rajamani, S.K.: Automatically refining abstract interpretations. TR-07-23 (2007)

  26. Gulwani, S., McCloskey, B., Tiwari, A.: Lifting abstract interpreters to quantified logical domains. In: POPL, pp. 235–246. (2008)

  27. Gulwani, S., Srivastava, S., Venkatesan, R.: Program analysis as constraint solving. In: PLDI. (2008)

  28. Gulwani, S., Srivastava, S., Venkatesan, R.: Constraint-based invariant inference over predicate abstraction. In: VMCAI (2009)

  29. Gulwani, S., Jha, S., Tiwari, A., Venkatesan, R.: Synthesis of loop-free programs. In: PLDI, pp. 62–73. (2011)

  30. Gulwani, S., Korthikanti, V.A., Tiwari, A.: Synthesizing geometry constructions. In: PLDI, pp. 50–61. (2011)

  31. Gupta, A., Majumdar, R., Rybalchenko, A.: From tests to proofs. In: TACAS, pp. 262–276. (2009)

  32. Gupta, A., Rybalchenko, A.: Invgen: an efficient invariant generator. In: CAV, pp. 634–640. (2009)

  33. Harris, W.R., Gulwani, S.: Spreadsheet table transformations from examples. In: PLDI, pp. 317–328. (2011)

  34. Henzinger, T.A., Jhala, R., Majumdar, R., McMillan, K.L.: Abstractions from proofs. In: POPL, pp. 232–244. (2004)

  35. Itzhaky, S., Gulwani, S., Immerman, N., Sagiv, M.: A simple inductive synthesis methodology and its applications. In: OOPSLA, pp. 36–46. (2010)

  36. Jha, S., Gulwani, S., Seshia, S., Tiwari, A.: Oracle-guided component-based program synthesis. In: ICSE (2010)

  37. Jhala, R., McMillan, K.: Array abstractions from proofs. In: CAV (2007)

  38. Kahrs S., Sannella D., Tarlecki A.: The definition of extended ML: a gentle introduction. Theor. Comput. Sci. 173, 445–484 (1997)

    Article  MathSciNet  MATH  Google Scholar 

  39. Kuncak, V., Mayer, M., Piskac, R., Suter, P.: Complete functional synthesis. In: PLDI (2010)

  40. Lahiri, S.K., Bryant, R.E.: Constructing quantified invariants via predicate abstraction. In: VMCAI, pp. 331–353. (2004)

  41. Lahiri, S.K., Bryant, R.E.: Indexed predicate discovery for unbounded system verification. In: CAV, pp. 135–147. (2004)

  42. Lahiri S.K., Bryant R.E.: Predicate abstraction with indexed predicates. ACM Trans. Comput. Log. 9(1), 4 (2007)

    Article  MathSciNet  Google Scholar 

  43. Manna Z., Waldinger R.J.: Toward automatic program synthesis. Commun. ACM 14(3), 151–165 (1971)

    Article  MATH  Google Scholar 

  44. Manna Z., Waldinger R.J.: A deductive approach to program synthesis. ACM Trans. Program. Lang. Syst. 2(1), 90–121 (1980)

    Article  MATH  Google Scholar 

  45. Mayer, M., Suter, P., Piskac, R., Kuncak, V.: Comfusy: complete functional synthesis (tool presentation). In: CAV (2010)

  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)

  47. McDonald, J., Anton, J.: SPECWARE—producing software correct by construction. Technical report KES.U.01.3. (2001)

  48. Morris J.M., Bunkenburg A.: Specificational functions. ACM Trans. Program. Lang. Syst. 21, 677–701 (1999)

    Article  Google Scholar 

  49. Rondon, P.M., Kawaguci, M., Jhala, R.: Liquid types. In: PLDI, pp. 159–169. (2008)

  50. Sankaranarayanan, S., Sipma, H.B., Manna, Z.: Constraint-based linear-relations analysis. In: SAS, pp. 53–68. (2004)

  51. Sankaranarayanan, S., Sipma, H.B., Manna, Z.: Scalable analysis of linear systems using mathematical programming. In: VMCAI, pp. 25–41. (2005)

  52. Schrijver A.: Theory of Linear and Integer Programming. Wiley, New York, NY (1986)

    MATH  Google Scholar 

  53. Smith D.R.: Kids: a semiautomatic program development system. IEEE Trans. Softw. Eng. 16(9), 1024–1043 (1990)

    Article  Google Scholar 

  54. Smith, D.R.: Designware: Software Development by Refinement, Invited talk CTCS’99, Edinburgh, Scotland, pp. 3–21. (2001)

  55. Solar-Lezama, A., Arnold, G., Tancau, L., Bodik, R., Saraswat, V., Seshia, S.: Sketching stencils. In: PLDI, pp. 167–178. (2007)

  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. Srivastava, S., Gulwani, S.: Program verification using templates over predicate abstraction. In: PLDI (2009)

  58. Srivastava, S., Gulwani, S., Foster, J.S.: VS3: SMT solvers for program verification. In: CAV (2009)

  59. Srivastava, S., Gulwani, S., Foster, J.S.: From program verification to program synthesis. In: POPL (2010)

  60. Thies, W., Karczmarek, M., Amarasinghe, S.P.: Streamit: a language for streaming applications. In: CC, pages 179–196. (2002)

  61. Vechev, M., Yahav, E., Yorsh, G.: Abstraction-guided synthesis of synchronization. In: POPL, pp. 327–338. (2010)

  62. Waldinger, R.J., Lee, R.C.T.: Prow: a step toward automatic program writing. In: IJCAI, pp. 241–252. (1969)

  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)

  64. Xie, Y., Aiken, A.: Saturn: a sat-based tool for bug detection. In: CAV, pp. 139–143. (2005)

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Saurabh Srivastava.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Srivastava, S., Gulwani, S. & Foster, J.S. Template-based program verification and program synthesis. Int J Softw Tools Technol Transfer 15, 497–518 (2013). https://doi.org/10.1007/s10009-012-0223-4

Download citation

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10009-012-0223-4

Keywords

Navigation