Origami: (un)folding the abstraction of recursion schemes for program synthesis
Matheus Campos Fernandes, Fabricio Olivetti de Franca, Emilio Francesquini
TL;DR
The paper tackles the challenge of program synthesis in the presence of recursion by leveraging Recursion Schemes to structure programs into fold/unfold templates, thereby constraining the search space. It introduces Origami, a template-driven GP approach that first selects a recursion scheme, then a base data type, and finally evolves a set of template functions guided by type information. Preliminary GPSB experiments show that Origami achieves higher success rates and broader coverage than baselines like HOTGP and other GP methods, solving the majority of solvable benchmarks. The work demonstrates that enforcing recursion-pattern templates can simplify synthesis and points to future improvements via richer templates and monoid-based annotations to further reduce search complexity and expand applicability.
Abstract
Program synthesis with Genetic Programming searches for a correct program that satisfies the input specification, which is usually provided as input-output examples. One particular challenge is how to effectively handle loops and recursion avoiding programs that never terminate. A helpful abstraction that can alleviate this problem is the employment of Recursion Schemes that generalize the combination of data production and consumption. Recursion Schemes are very powerful as they allow the construction of programs that can summarize data, create sequences, and perform advanced calculations. The main advantage of writing a program using Recursion Schemes is that the programs are composed of well defined templates with only a few parts that need to be synthesized. In this paper we make an initial study of the benefits of using program synthesis with fold and unfold templates, and outline some preliminary experimental results. To highlight the advantages and disadvantages of this approach, we manually solved the entire GPSB benchmark using recursion schemes, highlighting the parts that should be evolved compared to alternative implementations. We noticed that, once the choice of which recursion scheme is made, the synthesis process can be simplified as each of the missing parts of the template are reduced to simpler functions, which are further constrained by their own input and output types.
