skip to main content
research-article

From program verification to program synthesis

Published:17 January 2010Publication History
Skip Abstract Section

Abstract

This paper describes a novel technique for the synthesis of imperative programs. Automated program synthesis has the potential to make programming and the design of systems easier by allowing programs to be specified at a higher-level than executable code. In our approach, which we call proof-theoretic synthesis, the user provides an input-output functional specification, a description of the atomic operations in the programming language, and a specification of the synthesized program's looping structure, allowed stack space, and bound on usage of certain operations. Our technique synthesizes a program, if there exists one, that meets the input-output specification and uses only the given resources.

The insight behind our approach is to interpret program synthesis as generalized program verification, which allows us to bring verification tools and techniques to program synthesis. Our synthesis algorithm works by creating a program with unknown statements, guards, inductive invariants, and ranking functions. It then generates constraints that relate the unknowns and enforces three kinds of requirements: partial correctness, loop termination, and well-formedness conditions on program guards. We formalize the requirements that program verification tools must meet to solve these constraint and use tools from prior work as our synthesizers.

We demonstrate the feasibility of the proposed approach by synthesizing programs in three different domains: arithmetic, sorting, and dynamic programming. Using verification tools that we previously built in the VS3 project we are able to synthesize programs for complicated arithmetic algorithms including Strassen's matrix multiplication and Bresenham's line drawing; several sorting algorithms; and several dynamic programming algorithms. For these programs, the median time for synthesis is 14 seconds, and the ratio of synthesis to verification time ranges between 1x to 92x (with an median of 7x), illustrating the potential of the approach.

References

  1. D. Basin, Y. DeVille, P. Flener, A. Hamfelt, and J.F. NIlsson. Synthesis of programs in computational logic. In LNCS 3049.Google ScholarGoogle Scholar
  2. Yves Bertot and Pierre Casteran. Interactive Theorem Proving and Program Development. SpringerVerlag, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Edmund M. Clarke and E. Allen Emerson. Design and synthesis of synchronization skeletons using branching-time temporal logic. In Logic of Programs, pages 52--71. Springer-Verlag, 1982. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Edmund M. Clarke, Orna Grumberg, Somesh Jha, Yuan Lu, and Helmut Veith. Counterexample-guided abstraction refinement. In CAV'00, pages 154--169, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Michael Colon. Schema-guided synthesis of imperative programs by constraint solving. In LOPSTR, pages 166--181, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Michael Colon, Sriram Sankaranarayanan, and Henny Sipma. Linear invariant generation using non-linear constraint solving. In CAV'03.Google ScholarGoogle Scholar
  7. Byron Cook, Andreas Podelski, and Andrey Rybalchenko. Termination proofs for systems code. In PLDI'06, pages 415--426, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. T. Cormen, C. Leiserson, and R. Rivest. Introduction to Algorithms. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. P. Cousot and R. Cousot. Abstract interpretation a unified lattice model for static analysis of programs by construction or approximation of fixpoints. In POPL'77. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Leonardo de Moura and Nikolaj Bjorner. Z3, 2008. http://research.microsoft.com/projects/Z3/.Google ScholarGoogle Scholar
  11. Edsger W. Dijkstra. Guarded commands, nondeterminacy and formal derivation of programs. Communications of the ACM, 18(8):453--457. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Edsger W. Dijkstra. A constructive approach to the problem of program correctness. BIT Numerical Math., 8(3):174--186, 1968.Google ScholarGoogle ScholarCross RefCross Ref
  13. Edsger W. Dijkstra and Carel S. Scholten. Predicate Calculus and Program Semantics. Texts and Monographs in CS. 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Edsger Wybe Dijkstra. A Discipline of Programming. 1976.Google ScholarGoogle Scholar
  15. Joe W. Duran. Heuristics for program synthesis using loop invariants. In ACM'78, pages 891--900, New York, NY, USA. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Jean-Christophe Filliatre. Using SMT solvers for deductive verification of C and Java programs. In SMT'08.Google ScholarGoogle Scholar
  17. Pierre Flener, Kung-Kiu Lau, Mario Ornaghi, and Julian Richardson. An abstract formalization of correct schemas for program synthesis. J. Symb. Comput., 30(1):93--127, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. David Gries. The Science of Programming. 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Andreas Griesmayer, Paul Bloem Roderick, and Byron Cook. Repair of boolean programs with an application to C. In CAV'06. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Sumit Gulwani, Saurabh Srivastava, and Ramarathnam Venkatesan. Constraint-based invariant inference over predicate abstraction. In VMCAI'09. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Sumit Gulwani, Saurabh Srivastava, and Ramarathnam Venkatesan. Program analysis as constraint solving. In PLDI'08, pages 281--292. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Matthew S. Hecht and Jeffrey D. Ullman. Flow graph reducibility. In STOC'72, pages 238--250, New York, NY, USA, 1972. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Thomas A. Henzinger, Ranjit Jhala, Rupak Majumdar, and Kenneth L. McMillan. Abstractions from proofs. In POPL'04, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Barbara Jobstmann and Roderick Bloem. Optimizations for LTL synthesis. In FMCAD'06, pages 117--124. IEEE Computer Society. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Barbara Jobstmann, Andreas Griesmayer, and Roderick Paul Bloem. Program repair as a game. In CAV'05, pages 226--238. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Shuvendu Lahiri and Shaz Qadeer. Back to the future: revisiting precise program verification using SMT solvers. In POPL'08. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Zohar Manna and Richard J. Waldinger. Toward automatic program synthesis. Communications of the ACM, 14(3):151--165, 1971. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. A. Pnueli and R. Rosner. On the synthesis of a reactive module. In POPL'89, pages 179--190, New York, NY, USA. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Armando Solar-Lezama, Gilad Arnold, Liviu Tancau, Rastislav Bodik, Vijay Saraswat, and Sanjit Seshia. Sketching stencils. In PLDI'07, pages 167--178, New York, NY, USA. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Armando Solar-Lezama, Christopher Grant Jones, and Rastislav Bodik. Sketching concurrent data structures. In PLDI'08. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Armando Solar-Lezama, Rodric Rabbah, Rastislav Bodik, and Kemal Ebcioglu. Programming by sketching for bit-streaming programs. In PLDI'05. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Saurabh Srivastava and Sumit Gulwani. Program verification using templates over predicate abstraction. In PLDI'09. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Saurabh Srivastava, Sumit Gulwani, and Jeffrey S. Foster. VS3 . http://www.cs.umd.edu/~saurabhs/pacs/.Google ScholarGoogle Scholar
  34. Saurabh Srivastava, Sumit Gulwani, and Jeffrey S. Foster. VS3: SMT solvers for program verification. In CAV'09. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Saurabh Srivastava, Sumit Gulwani, and Jeffrey S. Foster. Proof-theoretic program synthesis: From program verification to program synthesis. Technical report, Microsoft Research, Redmond, 2009.Google ScholarGoogle Scholar
  36. Martin Vechev, Eran Yahav, and Greta Yorsh. Inferring synchronization under limited observability. In TACAS'09, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Martin Vechev, Eran Yahav, and Greta Yorsh. Abstraction-guided synthesis. In POPL'10, 2010.Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Nicholas Wirth. Systematic Programming: An Introduction. 1973. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. From program verification to program synthesis

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 45, Issue 1
        POPL '10
        January 2010
        500 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/1707801
        Issue’s Table of Contents
        • cover image ACM Conferences
          POPL '10: Proceedings of the 37th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
          January 2010
          520 pages
          ISBN:9781605584799
          DOI:10.1145/1706299

        Copyright © 2010 ACM

        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 17 January 2010

        Check for updates

        Qualifiers

        • research-article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader