skip to main content
research-article
Open access

Program sketching with live bidirectional evaluation

Published: 03 August 2020 Publication History

Abstract

We present a system called Smyth for program sketching in a typed functional language whereby the concrete evaluation of ordinary assertions gives rise to input-output examples, which are then used to guide the search to complete the holes. The key innovation, called live bidirectional evaluation, propagates examples "backward" through partially evaluated sketches. Live bidirectional evaluation enables Smyth to (a) synthesize recursive functions without trace-complete sets of examples and (b) specify and solve interdependent synthesis goals. Eliminating the trace-completeness requirement resolves a significant limitation faced by prior synthesis techniques when given partial specifications in the form of input-output examples.
To assess the practical implications of our techniques, we ran several experiments on benchmarks used to evaluate Myth, a state-of-the-art example-based synthesis tool. First, given expert examples (and no partial implementations), we find that Smyth requires on average 66% of the number of expert examples required by Myth. Second, we find that Smyth is robust to randomly-generated examples, synthesizing many tasks with relatively few more random examples than those provided by an expert. Third, we create a suite of small sketching tasks by systematically employing a simple sketching strategy to the Myth benchmarks; we find that user-provided sketches in Smyth often further reduce the total specification burden (i.e. the combination of partial implementations and examples). Lastly, we find that Leon and Synquid, two state-of-the-art logic-based synthesis tools, fail to complete several tasks on which Smyth succeeds.

Supplementary Material

Presentation at ICFP '20 (a109-lubin-presentation.mp4)

References

[1]
Aws Albarghouthi, Sumit Gulwani, and Zachary Kincaid. 2013. Recursive Program Synthesis. In Computer Aided Verification (CAV).
[2]
Rajeev Alur, Rastislav Bodik, Garvit Juniwal, Milo M. K. Martin, Mukund Raghothaman, Sanjit A. Seshia, Rishabh Singh, Armando Solar-Lezama, Emina Torlak, and Abhishek Udupa. 2013. Syntax-Guided Synthesis. In Formal Methods in Computer-Aided Design (FMCAD).
[3]
Alan Ross Anderson, Nuel D. Belnap Jr., and J. Michael Dunn. 1992. Entailment, Vol. II: The Logic of Relevance and Necessity. Princeton University Press.
[4]
James Bornholt and Emina Torlak. 2018. Finding Code That Explodes under Symbolic Evaluation. Proceedings of the ACM on Programming Languages (PACMPL), Issue OOPSLA ( 2018 ).
[5]
John Byrnes. 1999. Proof Search and Normal Forms in Natural Deduction. Ph.D. Dissertation. Carnegie Mellon University.
[6]
Sarah E. Chasins, Maria Mueller, and Rastislav Bodik. 2018. Rousillon: Scraping Distributed Hierarchical Web Data. In Symposium on User Interface Software and Technology (UIST).
[7]
Adam Chlipala, Leaf Petersen, and Robert Harper. 2005. Strict Bidirectional Type Checking. In Workshop on Types in Languages Design and Implementation (TLDI).
[8]
Yu Feng, Ruben Martins, Jacob Van Gefen, Isil Dillig, and Swarat Chaudhuri. 2017a. Component-Based Synthesis of Table Consolidation and Transformation Tasks from Examples. In Conference on Programming Language Design and Implementation (PLDI).
[9]
Yu Feng, Ruben Martins, Yuepeng Wang, Isil Dillig, and Thomas W. Reps. 2017b. Component-Based Synthesis for Complex APIs. In Symposium on Principles of Programming Languages (POPL).
[10]
John Feser. 2016. Inductive Program Synthesis from Input-Output Examples. Master's Thesis, Rice University.
[11]
John Feser. 2020. Personal communication, February 2020.
[12]
John K. Feser, Swarat Chaudhuri, and Isil Dillig. 2015. Synthesizing Data Structure Transformations from Input-Output Examples. In Conference on Programming Language Design and Implementation (PLDI).
[13]
Jonathan Frankle, Peter-Michael Osera, David Walker, and Steve Zdancewic. 2016. Example-Directed Synthesis: A TypeTheoretic Interpretation. In Symposium on Principles of Programming Languages (POPL).
[14]
Sumit Gulwani. 2011. Automating String Processing in Spreadsheets Using Input-Output Examples. In Symposium on Principles of Programming Languages (POPL).
[15]
Sumit Gulwani, Mikaël Mayer, Filip Niksic, and Ruzica Piskac. 2015. StriSynth: Synthesis for Live Programming. In International Conference on Software Engineering (ICSE).
[16]
Sumit Gulwani, Oleksandr Polozov, and Rishabh Singh. 2017. Program Synthesis. Foundations and Trends in Programming Languages 4, 1-2 ( 2017 ), 1-119. https://doi.org/10.1561/2500000010
[17]
Zheng Guo, David Justo, Michael James, Jiaxiao Zhou, Ziteng Wang, Ranjit Jhala, and Nadia Polikarpova. 2020. Program Synthesis by Type-Guided Abstraction Refinement. Proceedings of the ACM on Programming Languages (PACMPL), Issue POPL ( 2020 ).
[18]
Tihomir Gvero, Viktor Kuncak, Ivan Kuraj, and Ruzica Piskac. 2013. Complete Completion Using Types and Weights. In Conference on Programming Language Design and Implementation (PLDI).
[19]
Brian Hempel, Justin Lubin, and Ravi Chugh. 2019. Output-Directed Programming for SVG. In Symposium on User Interface Software and Technology (UIST).
[20]
Jeevana Priya Inala, Nadia Polikarpova, Xiaokang Qiu, Benjamin S. Lerner, and Armando Solar-Lezama. 2017. Synthesis of Recursive ADT Transformations from Reusable Templates. In Tools and Algorithms for the Construction and Analysis of Systems (TACAS).
[21]
Gilles Kahn. 1987. Natural Semantics. In Symposium on Theoretical Aspects of Computer Sciences (STACS).
[22]
Etienne Kneuss, Manos Koukoutos, and Viktor Kuncak. 2015. Deductive Program Repair. In Computer Aided Verification (CAV).
[23]
Etienne Kneuss, Ivan Kuraj, Viktor Kuncak, and Philippe Suter. 2013. Synthesis Modulo Recursive Functions. In Conference on Object-Oriented Programming Languages, Systems, and Applications (OOPSLA).
[24]
Juraj Kubelka, Romain Robbes, and Alexandre Bergel. 2018. The Road to Live Programming: Insights from the Practice. In International Conference on Software Engineering (ICSE).
[25]
Justin Lubin, Nick Collins, Cyrus Omar, and Ravi Chugh. 2020. Program Sketching with Live Bidirectional Evaluation. Extended version of this ICFP 2020 paper available as CoRR abs/ 1911.00583 (https://arxiv.org/abs/ 1911.00583).
[26]
Kazutaka Matsuda and Meng Wang. 2018. HOBiT: Programming Lenses Without Using Lens Combinators. In European Symposium on Programming (ESOP).
[27]
Mikaël Mayer, Viktor Kunčak, and Ravi Chugh. 2018. Bidirectional Evaluation with Direct Manipulation. Proceedings of the ACM on Programming Languages (PACMPL), Issue OOPSLA ( 2018 ).
[28]
Anders Miltner, Solomon Maina, Kathleen Fisher, Benjamin C. Pierce, David Walker, and Steve Zdancewic. 2019. Synthesizing Symmetric Lenses. Proceedings of the ACM on Programming Languages (PACMPL), Issue ICFP ( 2019 ).
[29]
Anders Miltner, Saswat Padhi, Todd D. Millstein, and David Walker. 2020. Data-Driven Inference of Representation Invariants. In Conference on Programming Language Design and Implementation (PLDI).
[30]
Aleksandar Nanevski, Frank Pfenning, and Brigitte Pientka. 2008. Contextual Modal Type Theory. ACM Transactions on Computational Logic (TOCL) ( 2008 ).
[31]
Cyrus Omar, Ian Voysey, Ravi Chugh, and Matthew A. Hammer. 2019. Live Functional Programming with Typed Holes. Proceedings of the ACM on Programming Languages (PACMPL), Issue POPL ( 2019 ).
[32]
Peter-Michael Osera. 2015. Program Synthesis with Types. Ph.D. Dissertation. University of Pennsylvania.
[33]
Peter-Michael Osera and Steve Zdancewic. 2015. Type-and-Example-Directed Program Synthesis. In Conference on Programming Language Design and Implementation (PLDI).
[34]
Roly Perera, Umut A. Acar, James Cheney, and Paul Blain Levy. 2012. Functional Programs That Explain Their Work. In International Conference on Functional Programming (ICFP).
[35]
Benjamin C. Pierce and David N. Turner. 2000. Local Type Inference. ACM Transactions on Programming Languages and Systems (TOPLAS) ( 2000 ).
[36]
Nadia Polikarpova. 2020. Personal communication, February and May 2020.
[37]
Nadia Polikarpova, Ivan Kuraj, and Armando Solar-Lezama. 2016. Program Synthesis from Polymorphic Refinement Types. In Conference on Programming Language Design and Implementation (PLDI).
[38]
Patrick M. Rondon, Ming Kawaguci, and Ranjit Jhala. 2008. Liquid Types. In Conference on Programming Language Design and Implementation (PLDI).
[39]
Jeremy G. Siek and Walid Taha. 2006. Gradual Typing for Functional Languages. In Scheme and Functional Programming Workshop.
[40]
Jeremy G. Siek, Michael M. Vitousek, Matteo Cimini, and John Tang Boyland. 2015. Refined Criteria for Gradual Typing. In Summit on Advances in Programming Languages (SNAPL).
[41]
Calvin Smith and Aws Albarghouthi. 2016. MapReduce Program Synthesis. In Conference on Programming Language Design and Implementation (PLDI).
[42]
Armando Solar-Lezama. 2008. Program Synthesis by Sketching. Ph.D. Dissertation. UC Berkeley.
[43]
Armando Solar-Lezama. 2009. The Sketching Approach to Program Synthesis. In Asian Symposium on Programming Languages and Systems (APLAS).
[44]
Armando Solar-Lezama, Rodric Rabbah, Rastislav Bodík, and Kemal Ebcioğlu. 2005. Programming by Sketching for Bit-Streaming Programs. In Conference on Programming Language Design and Implementation (PLDI).
[45]
Armando Solar-Lezama, Liviu Tancau, Rastislav Bodik, Sanjit Seshia, and Vijay Saraswat. 2006. Combinatorial Sketching for Finite Programs. In International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS).
[46]
Steven L. Tanimoto. 2013. A Perspective on the Evolution of Live Programming. In Workshop on Live Programming (LIVE).
[47]
Emina Torlak and Rastislav Bodik. 2013. Growing Solver-Aided Languages with Rosette. In Symposium on New Ideas, New Paradigms, and Reflections on Programming & Software (Onward!).
[48]
Emina Torlak and Rastislav Bodik. 2014. A Lightweight Symbolic Virtual Machine for Solver-Aided Host Languages. In Conference on Programming Language Design and Implementation (PLDI).
[49]
Niki Vazou, Patrick M. Rondon, and Ranjit Jhala. 2013. Abstract rRefinement Types. In European Conference on Programming Languages and Systems (ESOP).
[50]
Chenglong Wang, Yu Feng, Rastislav Bodik, Alvin Cheung, and Isil Dillig. 2020. Visualization by Example. Proceedings of the ACM on Programming Languages (PACMPL), Issue POPL ( 2020 ).

Cited By

View all
  • (2024)Statically Contextualizing Large Language Models with Typed HolesProceedings of the ACM on Programming Languages10.1145/36897288:OOPSLA2(468-498)Online publication date: 8-Oct-2024
  • (2024)Example-Based Reasoning about the Realizability of Polymorphic ProgramsProceedings of the ACM on Programming Languages10.1145/36746368:ICFP(317-337)Online publication date: 15-Aug-2024
  • (2024)Equivalence by Canonicalization for Synthesis-Backed RefactoringProceedings of the ACM on Programming Languages10.1145/36564538:PLDI(1879-1904)Online publication date: 20-Jun-2024
  • Show More Cited By

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image Proceedings of the ACM on Programming Languages
Proceedings of the ACM on Programming Languages  Volume 4, Issue ICFP
August 2020
1070 pages
EISSN:2475-1421
DOI:10.1145/3415018
Issue’s Table of Contents
This work is licensed under a Creative Commons Attribution International 4.0 License.

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 03 August 2020
Published in PACMPL Volume 4, Issue ICFP

Permissions

Request permissions for this article.

Check for updates

Badges

Author Tags

  1. Bidirectional Evaluation
  2. Examples
  3. Program Synthesis
  4. Sketches

Qualifiers

  • Research-article

Funding Sources

  • National Science Foundation

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)212
  • Downloads (Last 6 weeks)37
Reflects downloads up to 05 Nov 2024

Other Metrics

Citations

Cited By

View all
  • (2024)Statically Contextualizing Large Language Models with Typed HolesProceedings of the ACM on Programming Languages10.1145/36897288:OOPSLA2(468-498)Online publication date: 8-Oct-2024
  • (2024)Example-Based Reasoning about the Realizability of Polymorphic ProgramsProceedings of the ACM on Programming Languages10.1145/36746368:ICFP(317-337)Online publication date: 15-Aug-2024
  • (2024)Equivalence by Canonicalization for Synthesis-Backed RefactoringProceedings of the ACM on Programming Languages10.1145/36564538:PLDI(1879-1904)Online publication date: 20-Jun-2024
  • (2024)Superfusion: Eliminating Intermediate Data Structures via Inductive SynthesisProceedings of the ACM on Programming Languages10.1145/36564158:PLDI(939-964)Online publication date: 20-Jun-2024
  • (2024)Recursive Program Synthesis using ParamorphismsProceedings of the ACM on Programming Languages10.1145/36563818:PLDI(102-125)Online publication date: 20-Jun-2024
  • (2024)Relational Synthesis of Recursive Programs via Constraint Annotated Tree AutomataComputer Aided Verification10.1007/978-3-031-65633-0_3(41-63)Online publication date: 24-Jul-2024
  • (2024)Program Synthesis from Graded TypesProgramming Languages and Systems10.1007/978-3-031-57262-3_4(83-112)Online publication date: 5-Apr-2024
  • (2023)Synthesizing Efficient Memoization AlgorithmsProceedings of the ACM on Programming Languages10.1145/36228007:OOPSLA2(89-115)Online publication date: 16-Oct-2023
  • (2023)Synthesizing Recursive Programs through Dataflow ConstraintsCompanion Proceedings of the 2023 ACM SIGPLAN International Conference on Systems, Programming, Languages, and Applications: Software for Humanity10.1145/3618305.3623595(25-27)Online publication date: 22-Oct-2023
  • (2023)Trace-Guided Inductive Synthesis of Recursive Functional ProgramsProceedings of the ACM on Programming Languages10.1145/35912557:PLDI(860-883)Online publication date: 6-Jun-2023
  • Show More Cited By

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Get Access

Login options

Full Access

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media