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
- D. Basin, Y. DeVille, P. Flener, A. Hamfelt, and J.F. NIlsson. Synthesis of programs in computational logic. In LNCS 3049.Google Scholar
- Yves Bertot and Pierre Casteran. Interactive Theorem Proving and Program Development. SpringerVerlag, 2004. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- Edmund M. Clarke, Orna Grumberg, Somesh Jha, Yuan Lu, and Helmut Veith. Counterexample-guided abstraction refinement. In CAV'00, pages 154--169, 2000. Google Scholar
Digital Library
- Michael Colon. Schema-guided synthesis of imperative programs by constraint solving. In LOPSTR, pages 166--181, 2004. Google Scholar
Digital Library
- Michael Colon, Sriram Sankaranarayanan, and Henny Sipma. Linear invariant generation using non-linear constraint solving. In CAV'03.Google Scholar
- Byron Cook, Andreas Podelski, and Andrey Rybalchenko. Termination proofs for systems code. In PLDI'06, pages 415--426, 2006. Google Scholar
Digital Library
- T. Cormen, C. Leiserson, and R. Rivest. Introduction to Algorithms. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- Leonardo de Moura and Nikolaj Bjorner. Z3, 2008. http://research.microsoft.com/projects/Z3/.Google Scholar
- Edsger W. Dijkstra. Guarded commands, nondeterminacy and formal derivation of programs. Communications of the ACM, 18(8):453--457. Google Scholar
Digital Library
- Edsger W. Dijkstra. A constructive approach to the problem of program correctness. BIT Numerical Math., 8(3):174--186, 1968.Google Scholar
Cross Ref
- Edsger W. Dijkstra and Carel S. Scholten. Predicate Calculus and Program Semantics. Texts and Monographs in CS. 1990. Google Scholar
Digital Library
- Edsger Wybe Dijkstra. A Discipline of Programming. 1976.Google Scholar
- Joe W. Duran. Heuristics for program synthesis using loop invariants. In ACM'78, pages 891--900, New York, NY, USA. ACM. Google Scholar
Digital Library
- Jean-Christophe Filliatre. Using SMT solvers for deductive verification of C and Java programs. In SMT'08.Google Scholar
- 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 Scholar
Digital Library
- David Gries. The Science of Programming. 1987. Google Scholar
Digital Library
- Andreas Griesmayer, Paul Bloem Roderick, and Byron Cook. Repair of boolean programs with an application to C. In CAV'06. Google Scholar
Digital Library
- Sumit Gulwani, Saurabh Srivastava, and Ramarathnam Venkatesan. Constraint-based invariant inference over predicate abstraction. In VMCAI'09. Google Scholar
Digital Library
- Sumit Gulwani, Saurabh Srivastava, and Ramarathnam Venkatesan. Program analysis as constraint solving. In PLDI'08, pages 281--292. Google Scholar
Digital Library
- Matthew S. Hecht and Jeffrey D. Ullman. Flow graph reducibility. In STOC'72, pages 238--250, New York, NY, USA, 1972. ACM. Google Scholar
Digital Library
- Thomas A. Henzinger, Ranjit Jhala, Rupak Majumdar, and Kenneth L. McMillan. Abstractions from proofs. In POPL'04, 2004. Google Scholar
Digital Library
- Barbara Jobstmann and Roderick Bloem. Optimizations for LTL synthesis. In FMCAD'06, pages 117--124. IEEE Computer Society. Google Scholar
Digital Library
- Barbara Jobstmann, Andreas Griesmayer, and Roderick Paul Bloem. Program repair as a game. In CAV'05, pages 226--238. Google Scholar
Digital Library
- Shuvendu Lahiri and Shaz Qadeer. Back to the future: revisiting precise program verification using SMT solvers. In POPL'08. Google Scholar
Digital Library
- Zohar Manna and Richard J. Waldinger. Toward automatic program synthesis. Communications of the ACM, 14(3):151--165, 1971. Google Scholar
Digital Library
- A. Pnueli and R. Rosner. On the synthesis of a reactive module. In POPL'89, pages 179--190, New York, NY, USA. ACM. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- Armando Solar-Lezama, Christopher Grant Jones, and Rastislav Bodik. Sketching concurrent data structures. In PLDI'08. Google Scholar
Digital Library
- Armando Solar-Lezama, Rodric Rabbah, Rastislav Bodik, and Kemal Ebcioglu. Programming by sketching for bit-streaming programs. In PLDI'05. Google Scholar
Digital Library
- Saurabh Srivastava and Sumit Gulwani. Program verification using templates over predicate abstraction. In PLDI'09. Google Scholar
Digital Library
- Saurabh Srivastava, Sumit Gulwani, and Jeffrey S. Foster. VS3 . http://www.cs.umd.edu/~saurabhs/pacs/.Google Scholar
- Saurabh Srivastava, Sumit Gulwani, and Jeffrey S. Foster. VS3: SMT solvers for program verification. In CAV'09. Google Scholar
Digital Library
- 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 Scholar
- Martin Vechev, Eran Yahav, and Greta Yorsh. Inferring synchronization under limited observability. In TACAS'09, 2009. Google Scholar
Digital Library
- Martin Vechev, Eran Yahav, and Greta Yorsh. Abstraction-guided synthesis. In POPL'10, 2010.Google Scholar
Digital Library
- Nicholas Wirth. Systematic Programming: An Introduction. 1973. Google Scholar
Digital Library
Index Terms
From program verification to program synthesis






Comments