skip to main content
research-article

Synthesizing data structure transformations from input-output examples

Published:03 June 2015Publication History
Skip Abstract Section

Abstract

We present a method for example-guided synthesis of functional programs over recursive data structures. Given a set of input-output examples, our method synthesizes a program in a functional language with higher-order combinators like map and fold. The synthesized program is guaranteed to be the simplest program in the language to fit the examples. Our approach combines three technical ideas: inductive generalization, deduction, and enumerative search. First, we generalize the input-output examples into hypotheses about the structure of the target program. For each hypothesis, we use deduction to infer new input/output examples for the missing subexpressions. This leads to a new subproblem where the goal is to synthesize expressions within each hypothesis. Since not every hypothesis can be realized into a program that fits the examples, we use a combination of best-first enumeration and deduction to search for a hypothesis that meets our needs. We have implemented our method in a tool called λ2, and we evaluate this tool on a large set of synthesis problems involving lists, trees, and nested data structures. The experiments demonstrate the scalability and broad scope of λ2. A highlight is the synthesis of a program believed to be the world's earliest functional pearl.

References

  1. A. Albarghouthi, S. Gulwani, and Z. Kincaid. Recursive program synthesis. In CAV, pages 934–950, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. R. Alur, R. Bod´ık, G. Juniwal, M. M. K. Martin, M. Raghothaman, S. A. Seshia, R. Singh, A. Solar-Lezama, E. Torlak, and A. Udupa. Syntax-guided synthesis. In FMCAD, 2013.Google ScholarGoogle ScholarCross RefCross Ref
  3. D. W. Barron and C. Strachey. Programming. Advances in Programming and Non-Numerical Computation, pages 49–82, 1966.Google ScholarGoogle ScholarCross RefCross Ref
  4. T. A. Beyene, S. Chaudhuri, C. Popeea, and A. Rybalchenko. A constraint-based approach to solving games on infinite graphs. In POPL, pages 221–234, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. R. Bloem, K. Chatterjee, T. A. Henzinger, and B. Jobstmann. Better quality in synthesis through quantitative objectives. In Computer Aided Verification, pages 140–156, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. S. Chaudhuri, M. Clochard, and A. Solar-Lezama. Bridging boolean and quantitative synthesis using smoothed proof search. In POPL, pages 207–220, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. O. Danvy and M. Spivey. On Barron and Strachey’s cartesian product function. In ICFP, pages 41–46, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. T. Dillig, I. Dillig, and S. Chaudhuri. Optimal guard synthesis for memory safety. 2014.Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. P. Garg, C. Löding, P. Madhusudan, and D. Neider. ICE: A robust framework for learning invariants. In CAV, pages 69–87, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. S. Gulwani. Dimensions in program synthesis. In FMCAD, 2010. 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. T. Gvero, V. Kuncak, I. Kuraj, and R. Piskac. Complete completion using types and weights. In PLDI, volume 48, pages 27–38. ACM, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. W. R. Harris and S. Gulwani. Spreadsheet table transformations from examples. In PLDI, pages 317–328. ACM, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. S. Katayama. Efficient exhaustive generation of functional programs using monte-carlo search with iterative deepening. In Trends in Artificial Intelligence, 10th Pacific Rim International Conference on Artificial Intelligence., pages 199–210, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. E. Kitzelmann. Inductive programming: A survey of program synthesis techniques. In Approaches and Applications of Inductive Programming, Third International Workshop, pages 50–73, 2009.Google ScholarGoogle Scholar
  16. E. Kitzelmann. Analytical inductive functional programming. In Logic-Based Program Synthesis and Transformation, pages 87–102. Springer, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. E. Kitzelmann. A combined analytical and search-based approach for the inductive synthesis of functional programs. KI-Künstliche Intelligenz, 25(2):179–182, 2011.Google ScholarGoogle ScholarCross RefCross Ref
  18. E. Kitzelmann and U. Schmid. Inductive synthesis of functional programs: An explanation based generalization approach. Journal of Machine Learning Research, 7:429–454, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. V. Kuncak, M. Mayer, R. Piskac, and P. Suter. Complete functional synthesis. In PLDI, pages 316–329, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. N. Lavrac and S. Dzeroski. Inductive logic programming. In WLP, pages 146–160. Springer, 1994.Google ScholarGoogle Scholar
  21. V. Le and S. Gulwani. Flashextract: A framework for data extraction by examples. In PLDI, pages 542–553, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. H. Lieberman. Your wish is my command: Programming by example. Morgan Kaufmann, 2001.Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. D. Mandelin, L. Xu, R. Bod´ık, and D. Kimelman. Jungloid mining: helping to navigate the API jungle. In PLDI, pages 48–61, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. A. Menon, O. Tamuz, S. Gulwani, B. Lampson, and A. Kalai. A machine learning framework for programming by example. In ICML, pages 187–195, 2013.Google ScholarGoogle Scholar
  25. R. Olsson. Inductive functional programming using incremental program transformation. Artif. Intell., 74(1):55–8, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. D. Perelman, S. Gulwani, T. Ball, and D. Grossman. Type-directed completion of partial expressions. In PLDI, volume 47, pages 275– 286. ACM, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. D. Perelman, S. Gulwani, D. Grossman, and P. Provost. Test-driven synthesis. In PLDI, page 43, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. R. Sharma, S. Gupta, B. Hariharan, A. Aiken, P. Liang, and A. V. Nori. A data driven approach for algebraic loop invariants. In ESOP, pages 574–592, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. R. Singh and S. Gulwani. Synthesizing number transformations from input-output examples. In Computer Aided Verification, pages 634– 651. Springer, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. A. Solar-Lezama, L. Tancau, R. Bod´ık, S. A. Seshia, and V. A. Saraswat. Combinatorial sketching for finite programs. In ASPLOS, pages 404–415, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. S. Srivastava, S. Gulwani, and J. S. Foster. Template-based program verification and program synthesis. STTT, 15(5-6):497–518, 2013.Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. M. T. Vechev, E. Yahav, and G. Yorsh. Abstraction-guided synthesis of synchronization. STTT, 15(5-6):413–431, 2013.Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Synthesizing data structure transformations from input-output examples

      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

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!