Affiliation:
1. Rice University, USA
2. University of Texas at Austin, USA
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.
Funder
National Science Foundation
Defense Advanced Research Projects Agency
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Cited by
59 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Example-Based Reasoning about the Realizability of Polymorphic Programs;Proceedings of the ACM on Programming Languages;2024-08-15
2. From Batch to Stream: Automatic Generation of Online Algorithms;Proceedings of the ACM on Programming Languages;2024-06-20
3. Recursive Program Synthesis using Paramorphisms;Proceedings of the ACM on Programming Languages;2024-06-20
4. Semantic Code Refactoring for Abstract Data Types;Proceedings of the ACM on Programming Languages;2024-01-05
5. Programming-by-Demonstration for Long-Horizon Robot Tasks;Proceedings of the ACM on Programming Languages;2024-01-05