Synthesis of Loop-Free Programs


Gulwani, S., Jha, S., Tiwari, A., & Venkatesan, R. (2011). Synthesis of loop-free programs. ACM SIGPLAN Notices, 46(6), 62-73.


We consider the problem of synthesizing loop-free programs that implement a desired functionality using components from a given library. Specifications of the desired functionality and the library components are provided as logical relations between their respective input and output variables. The library components can be used at most once, and hence the library is required to contain a reasonable overapproximation of the multiset of the components required.

We solve the above component-based synthesis problem using a constraint-based approach that involves first generating a synthesis constraint, and then solving the constraint. The synthesis constraint is a first-order ∃∀ logic formula whose size is quadratic in the number of components. We present a novel algorithm for solving such constraints. Our algorithm is based on counterexample guided iterative synthesis paradigm and uses off-the-shelf SMT solvers.

We present experimental results that show that our tool Brahma can efficiently synthesize highly nontrivial 10-20 line loop-free bit vector programs. These programs represent a state space of approximately 2010 programs, and are beyond the reach of the other tools based on sketching and super-optimization.

Read more from SRI