Abstract
Quantifier bounding is a standard approach in inductive program synthesis to deal with unbounded domains. In this paper, we propose one such bounding method for the synthesis of recursive functions over recursive input data types. The synthesis problem is specified by an input reference (recursive) function and a recursion skeleton. The goal is to synthesize a recursive function equivalent to the input function whose recursion strategy is specified by the recursion skeleton. In this context, we illustrate that it is possible to selectively bound a subset of the recursively typed parameters, each by a suitable bound. The choices are guided by counterexamples. The evaluation of our strategy on a broad set of benchmarks shows that it succeeds in efficiently synthesizing non-trivial recursive functions where standard across-the-board bounding would fail.
Similar content being viewed by others
Notes
The tool is available publicly at https://github.com/synduce/Synduce/releases/tag/fmsd22.
This example is from [25], which calls this data type zipper.
The full evaluation data is available at https://github.com/synduce/Synduce/tree/fmsd22/benchmarks/data/table3.txt.
References
Abrahamsson O, Myreen MO (2018) Automatically introducing tail recursion in CakeML. In: Trends in functional programming, lecture notes in computer science. Springer International Publishing, pp 118–134
Ahmad MBS, Cheung A (2018) Automatically leveraging mapreduce frameworks for data-intensive applications. In: Proceedings of the 2018 international conference on management of data, SIGMOD ’18. ACM
Albarghouthi A, Gulwani S, Kincaid Z (2013) Recursive program synthesis. In: Computer aided verification, lecture notes in computer science. Springer, pp 934–950
Alur R, Bodik R, Juniwal G, et al (2013) Syntax-guided synthesis. In: 2013 Formal methods in computer-aided design. IEEE, pp 1–8
Barrett C, Conway CL, Deters M et al (2011) CVC4. Computer aided verification. In: Lecture notes in computer science. Springer, pp 171–177
Burstall RM, Darlington J (1977) A transformation system for developing recursive programs. J ACM 24(1):44–67
de Moura L, Bjørner N (2008) Z3: an efficient SMT solver. In: Tools and algorithms for the construction and analysis of systems, Lecture Notes in Computer Science. Springer, pp 337–340
Farzan A, Nicolet V (2017) Synthesis of divide and conquer parallelism for loops. In: Proceedings of the 38th ACM conference on programming language design and implementation, PLDI ’17
Fedyukovich G, Ahmad MBS, Bodik R (2017) Gradual synthesis for static parallelization of single-pass array-processing programs. In: Proceedings of the 38th ACM conference on programming language design and implementation, PLDI 2017
Feldman YMY, Padon O, Immerman N, et al (2017) Bounded quantifier instantiation for checking inductive invariants. In: Tools and algorithms for the construction and analysis of systems, lecture notes in computer science, pp 76–95
Feser JK, Chaudhuri S, Dillig I (2015) Synthesizing data structure transformations from input–output examples. In: Proceedings of the 36th ACM conference on programming language design and implementation, PLDI ’15
Frankle J, Osera PM, Walker D, et al (2016) Example-directed synthesis: a type-theoretic interpretation. In: Proceedings of the 43rd ACM symposium on principles of programming languages, POPL’16
Hamilton GW, Jones ND (2012) Distillation with labelled transition systems. In: Proceedings of the ACM 2012 workshop on partial evaluation and program manipulation, PEPM ’12. ACM, pp 15–24
Huet G (1997) The zipper. J Funct Program 7(5)
Inala JP, Polikarpova N, Qiu X, et al (2017) Synthesis of recursive ADT transformations from reusable templates. In: Tools and algorithms for the construction and analysis of systems, lecture notes in computer science
Itzhaky S, Singh R, Solar-Lezama A, et al (2016) Deriving divide-and-conquer dynamic programming algorithms using solver-aided transformations. In: Proceedings of the 2016 ACM conference on object-oriented programming, systems, languages, and applications. ACM, pp 145–164
Katayama S (2012) An analytical inductive functional programming system that avoids unintended programs. In: Proceedings of the 2012 workshop on partial evaluation and program manipulation, PEPM’12
Kitzelmann E, Schmid U (2006) Inductive synthesis of functional programs: an explanation based generalization approach. J Mach Learn Res 7(15):429–454
Kneuss E, Kuraj I, Kuncak V, et al (2013) Synthesis modulo recursive functions. In: Proceedings of the 2013 international conference on object oriented programming systems languages and applications, OOPSLA’13
Kobayashi N (2009) Types and higher-order recursion schemes for verification of higher-order programs. In: Proceedings of the 36th ACM symposium on principles of programming languages, POPL’09
Kobayashi N, Tabuchi N, Unno H (2010) Higher-order multi-parameter tree transducers and recursion schemes for program verification. In: Proceedings of the 37th ACM symposium on principles of programming languages, POPL’10
Kobayashi N, Sato R, Unno H (2011) Predicate abstraction and CEGAR for higher-order model checking. In: Proceedings of the 32nd ACM conference on programming language design and implementation, PLDI’11, pp 222–233
Leroy X, Doligez D, Frisch A, et al (2019) The OCaml system release 4.11: documentation and user’s manual. p 823
Morihata A, Matsuzaki K (2010) Automatic parallelization of recursive functions using quantifier elimination. In: Proceedings of the 10th international conference on functional and logic programming, FLOPS’10
Morihata A, Matsuzaki K, Hu Z, et al (2009) The third homomorphism theorem on trees: downward and upward lead to divide-and-conquer. In: Proceedings of the 36th ACM symposium on principles of programming languages, POPL’09
Nicolet V (2022) Synduce. https://github.com/synduce/Synduce/releases/tag/fmsd22
Ong CHL, Ramsay SJ (2011) Verifying higher-order functional programs with pattern-matching algebraic data types. In: Proceedings of the 38th ACM symposium on principles of programming languages, POPL’11
Osera PM, Zdancewic S (2015) Type-and-example-directed program synthesis. In: Proceedings of the 36th ACM conference on programming language design and implementation, PLDI’15
Padhi S, Polgreen E, Raghothaman M, et al (2019) The SyGuS language standard version 2.1
Polikarpova N, Kuraj I, Solar-Lezama A (2016) Program synthesis from polymorphic refinement types. In: Proceedings of the 37th ACM conference on programming language design and implementation, PLDI’16
Ramsay SJ, Neatherway RP, Ong CHL (2014) A type-directed abstraction refinement approach to higher-order model checking. In: Proceedings of the 41st ACM symposium on principles of programming languages, POPL’14
Reynolds A, Deters M, Kuncak V, et al (2015) Counterexample-guided quantifier instantiation for synthesis in SMT. In: Computer aided verification, lecture notes in computer science, pp 198–216
Solar-Lezama A (2008) Program synthesis by sketching. University of California, Berkeley
Solar-Lezama A, Tancau L, Bodik R, et al (2006) Combinatorial sketching for finite programs. In: Proceedings of the 12th international conference on architectural support for programming languages and operating systems, ASPLOS XII. pp 404–415
Solar-Lezama A, Arnold G, Tancau L, et al (2007) Sketching stencils. In: Proceedings of the 28th ACM conference on programming language design and implementation, PLDI’07
Solar-Lezama A, Jones CG, Bodik R (2008) Sketching concurrent data structures. In: Proceedings of the 29th ACM conference on programming language design and implementation, PLDI’08
Summers PD (1977) A methodology for LISP program construction from examples. J ACM 24(1):161–175
Yang W, Fedyukovich G, Gupta A (2019) Lemma synthesis for automating induction over algebraic data types. In: Principles and practice of constraint programming, lecture notes in computer science, pp 600–617
Author information
Authors and Affiliations
Corresponding author
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Farzan, A., Nicolet, V. Partial bounding for recursive function synthesis. Form Methods Syst Des (2023). https://doi.org/10.1007/s10703-023-00417-y
Received:
Accepted:
Published:
DOI: https://doi.org/10.1007/s10703-023-00417-y