Papers
Topics
Authors
Recent
Gemini 2.5 Flash
Gemini 2.5 Flash
125 tokens/sec
GPT-4o
47 tokens/sec
Gemini 2.5 Pro Pro
43 tokens/sec
o3 Pro
4 tokens/sec
GPT-4.1 Pro
47 tokens/sec
DeepSeek R1 via Azure Pro
28 tokens/sec
2000 character limit reached

Origami: (un)folding the abstraction of recursion schemes for program synthesis (2402.13828v2)

Published 21 Feb 2024 in cs.NE and cs.PL

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.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (21)
  1. Program synthesis using uniform mutation by addition and deletion. In Proceedings of the Genetic and Evolutionary Computation Conference, pages 1127–1134, 2018.
  2. Code building genetic programming. In Proceedings of the 2020 Genetic and Evolutionary Computation Conference, pages 994–1002, 2020.
  3. Grammatical evolution. IEEE Transactions on Evolutionary Computation, 5(4):349–358, 2001.
  4. Grammar-guided genetic programming. Encyclopedia of Artificial Intelligence, pages 767–773, 2009.
  5. HOTGP - Higher-Order Typed Genetic Programming. In Proceedings of the Genetic and Evolutionary Computation Conference, GECCO ’23, page 1091–1099, New York, NY, USA, 2023. Association for Computing Machinery.
  6. Functional programming with bananas, lenses, envelopes and barbed wire. In Functional Programming Languages and Computer Architecture: 5th ACM Conference Cambridge, MA, USA, August 26–30, 1991 Proceedings 5, pages 124–144. Springer, 1991.
  7. Jeremy Gibbons. The fun of programming. 2003.
  8. General program synthesis benchmark suite. In Proceedings of the 2015 Annual Conference on Genetic and Evolutionary Computation, pages 1039–1046, 2015.
  9. Neil D Jones. The expressive power of higher-order types or, life without cons. Journal of Functional Programming, 11(1):55–94, 2001.
  10. Brian Harvey. Avoiding recursion. Hoyles, C., Noss, R. Learning Mathematics and LOGO. The MIT Press Cambridge, Massachusetts, USA, 393426, 1992.
  11. Program schemes, recursion schemes, and formal languages. Journal of Computer and System Sciences, 7(2):119–160, 1973.
  12. General program synthesis benchmark suite. In GECCO ’15: Proceedings of the 2015 Annual Conference on Genetic and Evolutionary Computation, pages 1039–1046, Madrid, Spain, 2015. ACM.
  13. A grammar design pattern for arbitrary program synthesis problems in genetic programming. In James McDermott, Mauro Castelli, Lukas Sekanina, Evert Haasdijk, and Pablo García-Sánchez, editors, Genetic Programming, pages 262–277, Cham, 2017. Springer International Publishing.
  14. Extending program synthesis grammars for grammar-guided genetic programming. In Anne Auger, Carlos M. Fonseca, Nuno Lourenço, Penousal Machado, Luís Paquete, and Darrell Whitley, editors, Parallel Problem Solving from Nature – PPSN XV, pages 197–208, Cham, 2018. Springer International Publishing.
  15. Functional code building genetic programming. In Proceedings of the Genetic and Evolutionary Computation Conference, GECCO ’22, page 1000–1008, New York, NY, USA, 2022. Association for Computing Machinery.
  16. Why functional program synthesis matters (in the realm of genetic programming). In Proceedings of the Genetic and Evolutionary Computation Conference Companion, GECCO ’22, page 1844–1853, New York, NY, USA, 2022. Association for Computing Machinery.
  17. Problem-Solving Benefits of Down-Sampled Lexicase Selection. Artificial Life, 27(3–4):183–203, 03 2022.
  18. Program synthesis using uniform mutation by addition and deletion. In Proceedings of the Genetic and Evolutionary Computation Conference, GECCO ’18, page 1127–1134, New York, NY, USA, 2018. Association for Computing Machinery.
  19. Gptips: an open source genetic programming toolbox for multigene symbolic regression. In Proceedings of the International multiconference of engineers and computer scientists, volume 1, pages 77–80. Citeseer, 2010.
  20. Improving performance and cooperation in multi-agent systems. Genetic Programming Theory and Practice V, pages 221–237, 2008.
  21. Methods for competitive and cooperative co-evolution. In Adaptation, Coevolution and Learning in Multiagent Systems: Papers from the 1996 AAAI Spring Symposium, pages 45–50, 1996.

Summary

  • The paper introduces Origami, a novel method that employs recursion schemes like catamorphisms and anamorphisms to simplify program synthesis.
  • The approach narrows the search space by evolving specific parts of program templates through inductive synthesis, ensuring efficient termination.
  • Experimental results demonstrate that Origami outperforms methods such as PushGP and CBGP, highlighting its promise for future automatic programming.

Unveiling the Potential of Recursion Schemes in Program Synthesis with Origami

Introduction to Recursion Schemes in Program Synthesis

The automation of computer program generation, known as Program Synthesis, is a critical area in computer science that promises to revolutionize the way we approach programming tasks. A significant challenge in program synthesis is effectively handling iterative processes such as loops and recursion, particularly ensuring programs terminate properly. Recursion Schemes offer a compelling abstraction that can address this challenge by generalizing data production and consumption patterns, thus simplifying the synthesis process. This paper introduces Origami, an initial exploration into leveraging Recursion Schemes, specifically fold and unfold patterns, to facilitate program synthesis.

Recursion Schemes: A Primer

Recursion, pivotal in functional programming, often brings about concerns, especially regarding program termination and memory usage. To mitigate such issues, the paper leans on the abstraction provided by Recursion Schemes. These schemes encapsulate common recursive patterns in programming, allowing for a structured approach to constructing recursive algorithms. The essence of Recursion Schemes lies in dividing the programming task into simpler, manageable steps, thereby offering an elegant solution to traditionally complex problems in program synthesis. Key recursion schemes discussed include catamorphisms and anamorphisms, which correspond to generalized forms of folding and unfolding.

The Origami Approach

Origami aims to reduce the complexity of program synthesis by breaking down the synthesis process into smaller, more manageable parts. By identifying the appropriate recursion scheme and base inductive type, Origami significantly narrows the search space for potential programs. This process involves determining the recursion scheme, selecting the base data type, crafting program templates, and evolving these templates through inductive synthesis. This structured approach ensures that only specific parts of the program template need evolution, guided by clear input and output types. Origami not only simplifies the task at hand but also enhances the efficiency of creating correct and efficient programs.

Experimentation and Results

The experimentation with Origami involved adapting the Higher-Order Typed Genetic Programming (HOTGP) algorithm to focus exclusively on evolving parts defined by catamorphism templates. The comparison of Origami's performance against established methods in the field, such as PushGP and CBGP, highlights its efficacy. Origami demonstrated superior performance in many of the benchmark tests, indicating the advantage of employing recursion schemes in program synthesis. These promising results underscore the potential of Origami to revolutionize the program synthesis landscape by providing a structured and efficient methodology.

Future Directions

The exploration presented in this paper is but an initial foray into the potential of Recursion Schemes in program synthesis. Future work aims to explore this promising area, including expanding the use of different recursion schemes and exploring multi-gene approaches for evolving programs with multiple parts. Furthermore, the implication of monoids in simplifying programs presents another exciting avenue for research.

Conclusion

The introduction of Origami marks a significant step forward in the field of program synthesis. By harnessing the power of Recursion Schemes, Origami presents a structured, efficient, and effective approach to synthesizing programs that handle iterative processes elegantly. The promising results from initial experiments pave the way for further exploration and innovation in program synthesis, promising to make automatic programming more accessible and reliable.