Skip to main content

Origami: (un)folding the Abstraction of Recursion Schemes for Program Synthesis

  • Chapter
  • First Online:
Genetic Programming Theory and Practice XX

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 119.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Hardcover Book
USD 159.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    In this paper, we employ the Haskell language notation, which is similar to the ML notation.

  2. 2.

    Similar to generics in Java and templates in C++.

  3. 3.

    In category theory, this is called an endofunctor.

  4. 4.

    https://hackage.haskell.org/package/recursion-schemes-5.2.2.4/docs/docs/flowchart.svg.

References

  1. Helmuth, T., McPhee, N.F., Spector, L.: Program synthesis using uniform mutation by addition and deletion. In: Proceedings of the Genetic and Evolutionary Computation Conference, pp. 1127–1134 (2018)

    Google Scholar 

  2. Pantridge, E., Spector, L.: Code building genetic programming. In: Proceedings of the 2020 Genetic and Evolutionary Computation Conference, pp. 994–1002 (2020)

    Google Scholar 

  3. O’Neill, Michael, Ryan, Conor: Grammatical evolution. IEEE Trans. Evolut. Comput. 5(4), 349–358 (2001)

    Article  Google Scholar 

  4. Manrique, D., Ríos, J., Rodríguez-Patón, A.: Grammar-guided genetic programming. In: Encyclopedia of Artificial Intelligence, pp. 767–773 (2009)

    Google Scholar 

  5. Fernandes, M.C., De França, F.O., Francesquini, E.: HOTGP - Higher-Order Typed Genetic Programming. In: Proceedings of the Genetic and Evolutionary Computation Conference, GECCO ’23, pp. 1091–1099, New York, NY, USA (2023). Association for Computing Machinery

    Google Scholar 

  6. Meijer, E., Fokkinga, M., Paterson, R.: 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, pp. 124–144. Springer (1991)

    Google Scholar 

  7. Gibbons, J.: The fun of programming (2003)

    Google Scholar 

  8. Thomas Helmuth and Lee Spector. General program synthesis benchmark suite. In: Proceedings of the 2015 Annual Conference on Genetic and Evolutionary Computation, pp. 1039–1046 (2015)

    Google Scholar 

  9. Jones, N.D.: The expressive power of higher-order types or, life without cons. J. Funct. Program. 11(1), 55–94 (2001)

    Google Scholar 

  10. Harvey, B.: Avoiding recursion. In: Hoyles, C., Noss, R. (eds.) Learning Mathematics and LOGO. The MIT Press Cambridge, Massachusetts, USA, p. 393426 (1992)

    Google Scholar 

  11. Garland, S.J., Luckham, D.C.: Program schemes, recursion schemes, and formal languages. J. Comput. Syst. Sci. 7(2), 119–160 (1973)

    Google Scholar 

  12. Helmuth, T., Spector, L.: General program synthesis benchmark suite. In: GECCO ’15: Proceedings of the 2015 Annual Conference on Genetic and Evolutionary Computation, pp. 1039–1046. ACM, Madrid, Spain (2015)

    Google Scholar 

  13. Forstenlechner, S., Fagan, D., Nicolau, M., O’Neill, M.: A grammar design pattern for arbitrary program synthesis problems in genetic programming. In: McDermott, J., Castelli, M., Sekanina, L., Haasdijk, E., García-Sánchez, P. (eds.) Genetic Programming, pp. 262–277. Springer International Publishing, Cham (2017)

    Google Scholar 

  14. Forstenlechner, S., Fagan, D., Nicolau, M., O’Neill, M.: Extending program synthesis grammars for grammar-guided genetic programming. In: Auger, A., Fonseca, C.M., Lourenço, N., Machado, P., Paquete, L., Whitley, D. (eds.) Parallel Problem Solving from Nature – PPSN XV, pp. 197–208. Springer International Publishing, Cham (2018)

    Google Scholar 

  15. Pantridge, E., Helmuth, T., Spector, L.: Functional code building genetic programming. In: Proceedings of the Genetic and Evolutionary Computation Conference, GECCO ’22, pp. 1000–1008, New York, NY, USA (2022). Association for Computing Machinery

    Google Scholar 

  16. Garrow, F., Lones, M.A., Stewart, R.: Why functional program synthesis matters (in the realm of genetic programming). In: Proceedings of the Genetic and Evolutionary Computation Conference Companion, GECCO ’22, pp. 1844–1853, New York, NY, USA (2022). Association for Computing Machinery

    Google Scholar 

  17. Helmuth, T., Spector, L.: Problem-solving benefits of down-sampled lexicase selection. Artif. Life 27(3–4), 183–203, 03 (2022)

    Google Scholar 

  18. Helmuth, T., McPhee, N.F., Spector, L.: Program synthesis using uniform mutation by addition and deletion. In: Proceedings of the Genetic and Evolutionary Computation Conference, GECCO ’18, pp. 1127–1134, New York, NY, USA (2018). Association for Computing Machinery

    Google Scholar 

  19. Searson, D.P., Leahy, D.E., Willis, M.J.: Gptips: an open source genetic programming toolbox for multigene symbolic regression. In: Proceedings of the International Multiconference of Engineers and Computer Scientists, vol. 1, pp. 77–80. Citeseer (2010)

    Google Scholar 

  20. Soule, T., Heckendorn, R.B.: Improving performance and cooperation in multi-agent systems. Genetic Programming Theory and Practice V, pp. 221–237 (2008)

    Google Scholar 

  21. Grefenstette, J., Daley, R.: Methods for competitive and cooperative co-evolution. In: Adaptation, Coevolution and Learning in Multiagent Systems: Papers from the 1996 AAAI Spring Symposium, pp. 45–50 (1996)

    Google Scholar 

Download references

Acknowledgements

This research was partially funded by Fundação de Amparo à Pesquisa do Estado de São Paulo (FAPESP), grant numbers #2021/12706-1, #2019/26702-8, #2021/06867-2, Coordenação de Aperfeiçoamento de Pessoal de Nível Superior - Brasil (CAPES) and CNPq grant number 301596/2022-0.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Matheus Campos Fernandes .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2024 The Author(s), under exclusive license to Springer Nature Singapore Pte Ltd.

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Fernandes, M.C., de Franca, F.O., Francesquini, E. (2024). Origami: (un)folding the Abstraction of Recursion Schemes for Program Synthesis. In: Winkler, S., Trujillo, L., Ofria, C., Hu, T. (eds) Genetic Programming Theory and Practice XX. Genetic and Evolutionary Computation. Springer, Singapore. https://doi.org/10.1007/978-981-99-8413-8_14

Download citation

  • DOI: https://doi.org/10.1007/978-981-99-8413-8_14

  • Published:

  • Publisher Name: Springer, Singapore

  • Print ISBN: 978-981-99-8412-1

  • Online ISBN: 978-981-99-8413-8

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics