Abstract
Component-based approaches to program synthesis assemble programs from a database of existing components, such as methods provided by an API. In this paper, we present a novel type-directed algorithm for component-based synthesis. The key novelty of our approach is the use of a compact Petri-net representation to model relationships between methods in an API. Given a target method signature S, our approach performs reachability analysis on the underlying Petri-net model to identify sequences of method calls that could be used to synthesize an implementation of S. The programs synthesized by our algorithm are guaranteed to type check and pass all test cases provided by the user.
We have implemented this approach in a tool called SyPet, and used it to successfully synthesize real-world programming tasks extracted from on-line forums and existing code repositories. We also compare SyPet with two state-of-the-art synthesis tools, namely InSynth and CodeHint, and demonstrate that SyPet can synthesize more programs in less time. Finally, we compare our approach with an alternative solution based on hypergraphs and demonstrate its advantages.
- SyPet. http://fredfeng.github.io/sypet/.Google Scholar
- A. Albarghouthi, S. Gulwani, and Z. Kincaid. Recursive program synthesis. In CAV, pages 934–950. Springer-Verlag, 2013.Google Scholar
- R. Alur, R. K. Brayton, T. A. Henzinger, S. Qadeer, and S. K. Rajamani. Partial-order reduction in symbolic state space exploration. In CAV, pages 340–351. Springer, 1997. Google Scholar
Digital Library
- B. Avent, A. Ritz, and T. Murali. halp: Hypergraph Algorithms Package. http://murali-group.github.io/halp/.Google Scholar
- D. L. Berre and A. Parrain. The Sat4j library, release 2.2. Journal on Satisfiability, Boolean Modeling and Computation, pages 59–6, 2010.Google Scholar
- Y. Feng, R. Martins, Y. Wang, I. Dillig, and T. W. Reps. Component-Based Synthesis for Complex APIs. Technical report, University of Texas at Austin, 2016.Google Scholar
- J. K. Feser, S. Chaudhuri, and I. Dillig. Synthesizing data structure transformations from input-output examples. In PLDI, pages 229– 239. ACM, 2015. Google Scholar
Digital Library
- A. Finkel. The minimal coverability graph for Petri nets. Springer, 1993.Google Scholar
Cross Ref
- J. Galenson, P. Reames, R. Bodik, B. Hartmann, and K. Sen. Codehint: Dynamic and interactive synthesis of code snippets. In ICSE, pages 653–663. ACM, 2014. Google Scholar
Digital Library
- G. Gallo, G. Longo, and S. Pallottino. Directed hypergraphs and applications. Discrete Applied Mathematics, 42(2):177–201, 1993. Google Scholar
Digital Library
- S. Gulwani. Automating string processing in spreadsheets using inputoutput examples. In POPL, pages 317–330. ACM, 2011. Google Scholar
Digital Library
- S. Gulwani, S. Jha, A. Tiwari, and R. Venkatesan. Synthesis of loopfree programs. In PLDI, pages 62–73. ACM, 2011. Google Scholar
Digital Library
- S. Gulwani, V. A. Korthikanti, and A. Tiwari. Synthesizing geometry constructions. In PLDI, pages 50–61. ACM, 2011. Google Scholar
Digital Library
- S. Gulwani, W. R. Harris, and R. Singh. Spreadsheet data manipulation using examples. Communications of the ACM, 55(8):97–105, 2012. Google Scholar
Digital Library
- T. Gvero and V. Kuncak. Synthesizing Java expressions from freeform queries. In OOPSLA, pages 416–432, 2015. Google Scholar
Digital Library
- T. Gvero, V. Kuncak, and R. Piskac. Interactive synthesis of code snippets. In CAV, pages 418–423, 2011. Google Scholar
Digital Library
- T. Gvero, V. Kuncak, I. Kuraj, and R. Piskac. Complete completion using types and weights. In PLDI, pages 27–38, 2013. Google Scholar
Digital Library
- W. R. Harris and S. Gulwani. Spreadsheet table transformations from examples. In PLDI, pages 317–328. ACM, 2011. Google Scholar
Digital Library
- K. Heljanko. Using logic programs with stable model semantics to solve deadlock and reachability problems for 1-safe petri nets. Fundamenta Informaticae, pages 247–268, 1999. Google Scholar
Digital Library
- R. Holmes and G. C. Murphy. Using structural context to recommend source code examples. In ICSE, pages 117–125. ACM, 2005. Google Scholar
Digital Library
- J. Jeon, X. Qiu, J. S. Foster, and A. Solar-Lezama. Jsketch: Sketching for Java. In ESEC/FSE, pages 934–937. ACM, 2015. Google Scholar
Digital Library
- S. Jha, S. Gulwani, S. Seshia, and A. Tiwari. Oracle-guided component-based program synthesis. In ICSE, pages 215–224. IEEE, 2010. Google Scholar
Digital Library
- R. Joshi, G. Nelson, and K. H. Randall. Denali: A goal-directed superoptimizer. In PLDI, pages 304–314. ACM, 2002. Google Scholar
Digital Library
- R. M. Karp and R. E. Miller. Parallel program schemata. Journal of Computer and System Sciences, pages 147–195, 1969. Google Scholar
Digital Library
- D. E. Knuth. A generalization of dijkstra’s algorithm. Inf. Process. Lett., 6(1):1–5, 1977.Google Scholar
Cross Ref
- D. Mandelin, L. Xu, R. Bod´ık, and D. Kimelman. Jungloid mining: helping to navigate the API jungle. In PLDI, pages 48–61. ACM, 2005. Google Scholar
Digital Library
- K. L. McMillan. Using unfoldings to avoid the state explosion problem in the verification of asynchronous circuits. In CAV, pages 164– 177. Springer, 1993. Google Scholar
Digital Library
- T. Murata. Petri nets: Properties, analysis and applications. Proceedings of the IEEE, 77(4):541–580, 1989.Google Scholar
Cross Ref
- L. R. Nielsen, K. A. Andersen, and D. Pretolani. Finding the K shortest hyperpaths. Computers & OR, 32:1477–1497, 2005. Google Scholar
Digital Library
- S. Ogata, T. Tsuchiya, and T. Kikuno. SAT-based verification of safe petri nets. In ATVA, pages 79–92. Springer, 2004.Google Scholar
- P.-M. Osera and S. Zdancewic. Type-and-example-directed program synthesis. In PLDI, pages 619–630, 2015. Google Scholar
Digital Library
- D. Peled. Ten years of partial order reduction. In CAV, pages 17–28. Springer, 1998. Google Scholar
Digital Library
- D. Perelman, S. Gulwani, T. Ball, and D. Grossman. Type-directed completion of partial expressions. In PLDI, pages 275–286. ACM, 2012. Google Scholar
Digital Library
- D. Perelman, S. Gulwani, D. Grossman, and P. Provost. Test-driven synthesis. In PLDI, page 43. ACM, 2014. Google Scholar
Digital Library
- V. Raychev, M. T. Vechev, and E. Yahav. Code completion with statistical language models. In PLDI, page 44. ACM, 2014. Google Scholar
Digital Library
- A. Reinking and R. Piskac. A type-directed approach to program repair. In CAV, pages 511–517, 2015.Google Scholar
- N. Sahavechaphan and K. Claypool. Xsnippet: Mining for sample code. In OOPSLA, pages 413–430. ACM, 2006. Google Scholar
Digital Library
- R. Singh and S. Gulwani. Learning semantic string transformations from examples. PVLDB, pages 740–751, 2012. Google Scholar
Digital Library
- R. Singh and S. Gulwani. Synthesizing number transformations from input-output examples. In CAV, pages 634–651. ACM, 2012. Google Scholar
Digital Library
- A. Solar-Lezama. Program Synthesis By Sketching. PhD thesis, EECS Department, University of California, Berkeley, 2008. Google Scholar
Digital Library
- A. Solar-Lezama, R. M. Rabbah, R. Bod´ık, and K. Ebcioglu. Programming by sketching for bit-streaming programs. In PLDI, pages 281–294. ACM, 2005. Google Scholar
Digital Library
- A. Solar-Lezama, L. Tancau, R. Bodik, S. Seshia, and V. Saraswat. Combinatorial sketching for finite programs. In ASPLOS, pages 404– 415. ACM, 2006. Google Scholar
Digital Library
- A. Solar-Lezama, G. Arnold, L. Tancau, R. Bod´ık, V. A. Saraswat, and S. A. Seshia. Sketching stencils. In PLDI, pages 167–178. ACM, 2007. Google Scholar
Digital Library
- S. Thummalapenta and T. Xie. Parseweb: A programmer assistant for reusing open source code on the web. In ASE, pages 204–213. ACM, 2007. Google Scholar
Digital Library
- R. Vallée-Rai, P. Co, E. Gagnon, L. J. Hendren, P. Lam, and V. Sundaresan. Soot - a Java bytecode optimization framework. In CASCON, page 13, 1999. Google Scholar
Digital Library
- W. Vogler. Efficiency of asynchronous systems and read arcs in petri nets. In ICALP, pages 538–548. Springer, 1997. Google Scholar
Digital Library
- Y. Wang, S. Lafortune, T. Kelly, M. Kudlur, and S. A. Mahlke. The theory of deadlock avoidance via discrete control. In POPL, pages 252–263. ACM, 2009. Google Scholar
Digital Library
- K. Yessenov, Z. Xu, and A. Solar-Lezama. Data-driven synthesis for object-oriented frameworks. In OOPSLA, pages 65–82. ACM, 2011. Google Scholar
Digital Library
Index Terms
(auto-classified)Component-based synthesis for complex APIs
Recommendations
Component-based synthesis for complex APIs
POPL '17: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming LanguagesComponent-based approaches to program synthesis assemble programs from a database of existing components, such as methods provided by an API. In this paper, we present a novel type-directed algorithm for component-based synthesis. The key novelty of ...
FrAngel: component-based synthesis with control structures
In component-based program synthesis, the synthesizer generates a program given a library of components (functions). Existing component-based synthesizers have difficulty synthesizing loops and other control structures, and they often require formal ...
Can reactive synthesis and syntax-guided synthesis be friends?
PLDI 2022: Proceedings of the 43rd ACM SIGPLAN International Conference on Programming Language Design and ImplementationWhile reactive synthesis and syntax-guided synthesis (SyGuS) have seen enormous progress in recent years, combining the two approaches has remained a challenge. In this work, we present the synthesis of reactive programs from Temporal Stream Logic ...







Comments