skip to main content
10.1145/3009837.3009851acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
research-article
Public Access

Component-based synthesis for complex APIs

Published:01 January 2017Publication History

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.

References

  1. SyPet. http://fredfeng.github.io/sypet/.Google ScholarGoogle Scholar
  2. A. Albarghouthi, S. Gulwani, and Z. Kincaid. Recursive program synthesis. In CAV, pages 934–950. Springer-Verlag, 2013.Google ScholarGoogle Scholar
  3. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  4. B. Avent, A. Ritz, and T. Murali. halp: Hypergraph Algorithms Package. http://murali-group.github.io/halp/.Google ScholarGoogle Scholar
  5. D. L. Berre and A. Parrain. The Sat4j library, release 2.2. Journal on Satisfiability, Boolean Modeling and Computation, pages 59–6, 2010.Google ScholarGoogle Scholar
  6. 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 ScholarGoogle Scholar
  7. J. K. Feser, S. Chaudhuri, and I. Dillig. Synthesizing data structure transformations from input-output examples. In PLDI, pages 229– 239. ACM, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. A. Finkel. The minimal coverability graph for Petri nets. Springer, 1993.Google ScholarGoogle ScholarCross RefCross Ref
  9. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  10. G. Gallo, G. Longo, and S. Pallottino. Directed hypergraphs and applications. Discrete Applied Mathematics, 42(2):177–201, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. S. Gulwani. Automating string processing in spreadsheets using inputoutput examples. In POPL, pages 317–330. ACM, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. S. Gulwani, S. Jha, A. Tiwari, and R. Venkatesan. Synthesis of loopfree programs. In PLDI, pages 62–73. ACM, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. S. Gulwani, V. A. Korthikanti, and A. Tiwari. Synthesizing geometry constructions. In PLDI, pages 50–61. ACM, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. S. Gulwani, W. R. Harris, and R. Singh. Spreadsheet data manipulation using examples. Communications of the ACM, 55(8):97–105, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. T. Gvero and V. Kuncak. Synthesizing Java expressions from freeform queries. In OOPSLA, pages 416–432, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. T. Gvero, V. Kuncak, and R. Piskac. Interactive synthesis of code snippets. In CAV, pages 418–423, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. T. Gvero, V. Kuncak, I. Kuraj, and R. Piskac. Complete completion using types and weights. In PLDI, pages 27–38, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. W. R. Harris and S. Gulwani. Spreadsheet table transformations from examples. In PLDI, pages 317–328. ACM, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  20. R. Holmes and G. C. Murphy. Using structural context to recommend source code examples. In ICSE, pages 117–125. ACM, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. J. Jeon, X. Qiu, J. S. Foster, and A. Solar-Lezama. Jsketch: Sketching for Java. In ESEC/FSE, pages 934–937. ACM, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. S. Jha, S. Gulwani, S. Seshia, and A. Tiwari. Oracle-guided component-based program synthesis. In ICSE, pages 215–224. IEEE, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. R. Joshi, G. Nelson, and K. H. Randall. Denali: A goal-directed superoptimizer. In PLDI, pages 304–314. ACM, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. R. M. Karp and R. E. Miller. Parallel program schemata. Journal of Computer and System Sciences, pages 147–195, 1969. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. D. E. Knuth. A generalization of dijkstra’s algorithm. Inf. Process. Lett., 6(1):1–5, 1977.Google ScholarGoogle ScholarCross RefCross Ref
  26. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  27. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  28. T. Murata. Petri nets: Properties, analysis and applications. Proceedings of the IEEE, 77(4):541–580, 1989.Google ScholarGoogle ScholarCross RefCross Ref
  29. L. R. Nielsen, K. A. Andersen, and D. Pretolani. Finding the K shortest hyperpaths. Computers & OR, 32:1477–1497, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. S. Ogata, T. Tsuchiya, and T. Kikuno. SAT-based verification of safe petri nets. In ATVA, pages 79–92. Springer, 2004.Google ScholarGoogle Scholar
  31. P.-M. Osera and S. Zdancewic. Type-and-example-directed program synthesis. In PLDI, pages 619–630, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. D. Peled. Ten years of partial order reduction. In CAV, pages 17–28. Springer, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. D. Perelman, S. Gulwani, T. Ball, and D. Grossman. Type-directed completion of partial expressions. In PLDI, pages 275–286. ACM, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. D. Perelman, S. Gulwani, D. Grossman, and P. Provost. Test-driven synthesis. In PLDI, page 43. ACM, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. V. Raychev, M. T. Vechev, and E. Yahav. Code completion with statistical language models. In PLDI, page 44. ACM, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. A. Reinking and R. Piskac. A type-directed approach to program repair. In CAV, pages 511–517, 2015.Google ScholarGoogle Scholar
  37. N. Sahavechaphan and K. Claypool. Xsnippet: Mining for sample code. In OOPSLA, pages 413–430. ACM, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. R. Singh and S. Gulwani. Learning semantic string transformations from examples. PVLDB, pages 740–751, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. R. Singh and S. Gulwani. Synthesizing number transformations from input-output examples. In CAV, pages 634–651. ACM, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. A. Solar-Lezama. Program Synthesis By Sketching. PhD thesis, EECS Department, University of California, Berkeley, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  42. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  43. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  44. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  45. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  46. W. Vogler. Efficiency of asynchronous systems and read arcs in petri nets. In ICALP, pages 538–548. Springer, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  48. K. Yessenov, Z. Xu, and A. Solar-Lezama. Data-driven synthesis for object-oriented frameworks. In OOPSLA, pages 65–82. ACM, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  1. Component-based synthesis for complex APIs

    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
    • Published in

      cover image ACM Conferences
      POPL '17: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages
      January 2017
      901 pages
      ISBN:9781450346603
      DOI:10.1145/3009837

      Copyright © 2017 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: 1 January 2017

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article

      Acceptance Rates

      Overall Acceptance Rate824of4,130submissions,20%

      Upcoming Conference

      POPL '25

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader