Skip to main content

Program Synthesis Using Example Propagation

  • Conference paper
  • First Online:
Practical Aspects of Declarative Languages (PADL 2023)

Abstract

We present Scrybe, an example-based synthesis tool for a statically-typed functional programming language, which combines top-down deductive reasoning in the style of \(\lambda ^2\) with Smyth-style live bidirectional evaluation. During synthesis, example constraints are propagated through sketches to prune and guide the search. This enables Scrybe to make more effective use of functions provided in the context. To evaluate our tool, it is run on the combined, largely disjoint, benchmarks of \(\lambda ^2\) and Myth. Scrybe is able to synthesize most of the combined benchmark tasks.

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 64.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 84.99
Price excludes VAT (USA)
  • Compact, lightweight 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

Similar content being viewed by others

Notes

  1. 1.

    In this example, as well as in the rest of this paper, we leave type constraints implicit.

  2. 2.

    Note that function calls within the branches of a stuck pattern match are not inlined.

  3. 3.

    https://github.com/ndmitchell/hlint.

  4. 4.

    https://github.com/NiekM/scrybe.

  5. 5.

    https://github.com/haskell/criterion.

References

  1. Claessen, K., Smallbone, N., Hughes, J.: QuickSpec: guessing formal specifications using testing. In: Fraser, G., Gargantini, A. (eds.) TAP 2010. LNCS, vol. 6143, pp. 6–21. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-13977-2_3

    Chapter  Google Scholar 

  2. Danvy, O., Spivey, M.: On Barron and Strachey’s cartesian product function. In: Proceedings of the 12th ACM SIGPLAN International Conference on Functional Programming, ICFP 2007, pp. 41–46. Association for Computing Machinery, New York (2007). https://doi.org/10.1145/1291151.1291161

  3. Feser, J.K., Chaudhuri, S., Dillig, I.: Synthesizing data structure transformations from input-output examples. ACM SIGPLAN Not. 50(6), 229–239 (2015). https://doi.org/10.1145/2813885.2737977

    Article  Google Scholar 

  4. Frankle, J., Osera, P.M., Walker, D., Zdancewic, S.: Example-directed synthesis: a type-theoretic interpretation. SIGPLAN Not. 51(1), 802–815 (2016). https://doi.org/10.1145/2914770.2837629

    Article  MATH  Google Scholar 

  5. Guo, Z., et al.: Program synthesis by type-guided abstraction refinement. Proc. ACM Program. Lang. 4(POPL) (2019). https://doi.org/10.1145/3371080

  6. Katayama, S.: Efficient exhaustive generation of functional programs using Monte-Carlo search with iterative deepening. In: Ho, T.-B., Zhou, Z.-H. (eds.) PRICAI 2008. LNCS (LNAI), vol. 5351, pp. 199–210. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-89197-0_21

    Chapter  Google Scholar 

  7. Koppel, J., Guo, Z., de Vries, E., Solar-Lezama, A., Polikarpova, N.: Searching entangled program spaces. Proc. ACM Program. Lang. 6(ICFP) (2022). https://doi.org/10.1145/3547622

  8. Lubin, J., Collins, N., Omar, C., Chugh, R.: Program sketching with live bidirectional evaluation. Proc. ACM Program. Lang. 4(ICFP) (2020). https://doi.org/10.1145/3408991

  9. Omar, C., Voysey, I., Chugh, R., Hammer, M.A.: Live functional programming with typed holes. Proc. ACM Program. Lang. 3(POPL) (2019). https://doi.org/10.1145/3290327

  10. Osera, P.M., Zdancewic, S.: Type-and-example-directed program synthesis. ACM SIGPLAN Not. 50(6), 619–630 (2015). https://doi.org/10.1145/2813885.2738007

    Article  Google Scholar 

  11. Peleg, H., Gabay, R., Itzhaky, S., Yahav, E.: Programming with a read-eval-synth loop. Proc. ACM Program. Lang. 4(OOPSLA) (2020). https://doi.org/10.1145/3428227

  12. Smith, C., Albarghouthi, A.: Program synthesis with equivalence reduction. In: Enea, C., Piskac, R. (eds.) VMCAI 2019. LNCS, vol. 11388, pp. 24–47. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-11245-5_2

    Chapter  Google Scholar 

  13. Solar-Lezama, A.: Program synthesis by sketching. Ph.D. thesis, Berkeley (2008)

    Google Scholar 

  14. Solar-Lezama, A.: The sketching approach to program synthesis. In: Hu, Z. (ed.) APLAS 2009. LNCS, vol. 5904, pp. 4–13. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-10672-9_3

    Chapter  Google Scholar 

Download references

Acknowledgements

We would like to thank Alex Gerdes, Koen Claessen, and the anonymous reviewers of HATRA 2022 and PADL 2023 for their supportive comments and constructive feedback.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Niek Mulleners .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Mulleners, N., Jeuring, J., Heeren, B. (2023). Program Synthesis Using Example Propagation. In: Hanus, M., Inclezan, D. (eds) Practical Aspects of Declarative Languages. PADL 2023. Lecture Notes in Computer Science, vol 13880. Springer, Cham. https://doi.org/10.1007/978-3-031-24841-2_2

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-24841-2_2

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-24840-5

  • Online ISBN: 978-3-031-24841-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics