skip to main content
research-article
Open Access
Artifacts Available / v1.1

Specification-guided component-based synthesis from effectful libraries

Published:31 October 2022Publication History
Skip Abstract Section

Abstract

Component-based synthesis seeks to build programs using the APIs provided by a set of libraries. Oftentimes, these APIs have effects, which make it challenging to reason about the correctness of potential synthesis candidates. This is because changes to global state made by effectful library procedures affect how they may be composed together, yielding an intractably large search space that can confound typical enumerative synthesis techniques. If the nature of these effects are exposed as part of their specification, however, deductive synthesis approaches can be used to help guide the search for components. In this paper, we present a new specification-guided synthesis procedure that uses Hoare-style pre- and post-conditions to express fine-grained effects of potential library component candidates to drive a bi-directional synthesis search strategy. The procedure alternates between a forward search process that seeks to build larger terms given an existing context but which is otherwise unaware of the actual goal, alongside a backward search mechanism that seeks terms consistent with the desired goal but which is otherwise unaware of the context from which these terms must be synthesized. To further improve efficiency and scalability, we integrate a conflict-driven learning procedure into the synthesis algorithm that provides a semantic characterization of previously encountered unsuccessful search paths that is used to prune the space of possible candidates as synthesis proceeds. We have implemented our ideas in a tool called and demonstrate its effectiveness on a number of challenging synthesis problems defined over OCaml libraries equipped with effectful specifications.

References

  1. Aws Albarghouthi, Isil Dillig, and Arie Gurfinkel. 2016. Maximal Specification Synthesis. In Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’16). Association for Computing Machinery, New York, NY, USA. 789–801. isbn:9781450335492 https://doi.org/10.1145/2837614.2837628 Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Andrew Appel, Lennart Beringer, and Qinxiang Cao. 2021. Electronic textbook. Version 1.1.1, http://softwarefoundations.cis.upenn.edu Google ScholarGoogle Scholar
  3. 2009. Handbook of Satisfiability, Armin Biere, Marijn Heule, Hans van Maaren, and Toby Walsh (Eds.) (Frontiers in Artificial Intelligence and Applications, Vol. 185). IOS Press. isbn:978-1-58603-929-5 Google ScholarGoogle Scholar
  4. Arthur Charguéraud, Jean-Christophe Filliâtre, Mário Pereira, and François Pottier. 2017. VOCAL – A Verified OCaml Library. ML Family Workshop. Google ScholarGoogle Scholar
  5. Leonardo de Moura and Nikolaj Bjørner. 2008. Z3: An Efficient SMT Solver. In Tools and Algorithms for the Construction and Analysis of Systems, C. R. Ramakrishnan and Jakob Rehof (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg. 337–340. isbn:978-3-540-78800-3 Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Benjamin Delaware, Clément Pit-Claudel, Jason Gross, and Adam Chlipala. 2015. Fiat: Deductive Synthesis of Abstract Data Types in a Proof Assistant. In Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’15). Association for Computing Machinery, New York, NY, USA. 689–700. isbn:9781450333009 https://doi.org/10.1145/2676726.2677006 Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Benjamin Delaware, Sorawit Suriyakarn, Clément Pit-Claudel, Qianchuan Ye, and Adam Chlipala. 2019. Narcissus: Correct-by-Construction Derivation of Decoders and Encoders from Binary Formats. Proc. ACM Program. Lang., 3, ICFP (2019), Article 82, July, 29 pages. https://doi.org/10.1145/3341686 Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Jana Dunfield and Neel Krishnaswami. 2021. Bidirectional Typing. ACM Comput. Surv., 54, 5 (2021), Article 98, may, 38 pages. issn:0360-0300 https://doi.org/10.1145/3450952 Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Yu Feng, Ruben Martins, Osbert Bastani, and Isil Dillig. 2018. Program Synthesis Using Conflict-Driven Learning. In Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2018). Association for Computing Machinery, New York, NY, USA. 420–435. isbn:9781450356985 https://doi.org/10.1145/3192366.3192382 Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Yu Feng, Ruben Martins, Jacob Van Geffen, Isil Dillig, and Swarat Chaudhuri. 2017. Component-Based Synthesis of Table Consolidation and Transformation Tasks from Examples. In Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2017). Association for Computing Machinery, New York, NY, USA. 422–436. isbn:9781450349888 https://doi.org/10.1145/3062341.3062351 Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Yu Feng, Ruben Martins, Yuepeng Wang, Isil Dillig, and Thomas W. Reps. 2017. Component-Based Synthesis for Complex APIs. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages (POPL 2017). Association for Computing Machinery, New York, NY, USA. 599–612. isbn:9781450346603 https://doi.org/10.1145/3009837.3009851 Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Jonathan Frankle, Peter-Michael Osera, David Walker, and Steve Zdancewic. 2016. Example-Directed Synthesis: A Type-Theoretic Interpretation. In Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’16). Association for Computing Machinery, New York, NY, USA. 802–815. isbn:9781450335492 https://doi.org/10.1145/2837614.2837629 Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Harald Ganzinger, George Hagen, Robert Nieuwenhuis, Albert Oliveras, and Cesare Tinelli. 2004. DPLL(T): Fast Decision Procedures. In Computer Aided Verification, Rajeev Alur and Doron A. Peled (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg. 175–188. isbn:978-3-540-27813-9 Google ScholarGoogle Scholar
  14. Zheng Guo, Michael James, David Justo, Jiaxiao Zhou, Ziteng Wang, Ranjit Jhala, and Nadia Polikarpova. 2019. Program Synthesis by Type-Guided Abstraction Refinement. Proc. ACM Program. Lang., 4, POPL (2019), Article 12, Dec., 28 pages. https://doi.org/10.1145/3371080 Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Sankha Narayan Guria, Jeffrey S. Foster, and David Van Horn. 2021. RbSyn: Type- and Effect-Guided Program Synthesis. In Proceedings of the 42nd ACM SIGPLAN International Conference on Programming Language Design and Implementation (PLDI 2021). Association for Computing Machinery, New York, NY, USA. 344–358. isbn:9781450383912 https://doi.org/10.1145/3453483.3454048 Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Shachar Itzhaky, Tomer Kotek, Noam Rinetzky, Mooly Sagiv, Orr Tamir, Helmut Veith, and Florian Zuleger. 2017. On the Automated Verification of Web Applications with Embedded SQL. In 20th International Conference on Database Theory, ICDT 2017, March 21-24, 2017, Venice, Italy, Michael Benedikt and Giorgio Orsi (Eds.) (LIPIcs, Vol. 68). Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 16:1–16:18. https://doi.org/10.4230/LIPIcs.ICDT.2017.16 Google ScholarGoogle ScholarCross RefCross Ref
  17. Shachar Itzhaky, Hila Peleg, Nadia Polikarpova, Reuben N. S. Rowe, and Ilya Sergey. 2021. Cyclic Program Synthesis. In Proceedings of the 42nd ACM SIGPLAN International Conference on Programming Language Design and Implementation (PLDI 2021). Association for Computing Machinery, New York, NY, USA. 944–959. isbn:9781450383912 https://doi.org/10.1145/3453483.3454087 Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Shachar Itzhaky, Hila Peleg, Nadia Polikarpova, Reuben N. S. Rowe, and Ilya Sergey. 2021. Deductive Synthesis of Programs with Pointers: Techniques, Challenges, Opportunities. In Computer Aided Verification - 33rd International Conference, CAV 2021, Virtual Event, July 20-23, 2021, Proceedings, Part I, Alexandra Silva and K. Rustan M. Leino (Eds.) (Lecture Notes in Computer Science, Vol. 12759). Springer, 110–134. https://doi.org/10.1007/978-3-030-81685-8_5 Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Michael B. James, Zheng Guo, Ziteng Wang, Shivani Doshi, Hila Peleg, Ranjit Jhala, and Nadia Polikarpova. 2020. Digging for Fold: Synthesis-Aided API Discovery for Haskell. Proc. ACM Program. Lang., 4, OOPSLA (2020), Article 205, nov, 27 pages. https://doi.org/10.1145/3428273 Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Michael B. James, Zheng Guo, Ziteng Wang, Shivani Doshi, Hila Peleg, Ranjit Jhala, and Nadia Polikarpova. 2020. Digging for Fold: Synthesis-Aided API Discovery for Haskell. Proc. ACM Program. Lang., 4, OOPSLA (2020), Article 205, nov, 27 pages. https://doi.org/10.1145/3428273 Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Susmit Jha, Sumit Gulwani, Sanjit A. Seshia, and Ashish Tiwari. 2010. Oracle-Guided Component-Based Program Synthesis. In Proceedings of the 32nd ACM/IEEE International Conference on Software Engineering - Volume 1 (ICSE ’10). Association for Computing Machinery, New York, NY, USA. 215–224. isbn:9781605587196 https://doi.org/10.1145/1806799.1806833 Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Trevor Jim, Yitzhak Mandelbaum, and David Walker. 2010. Semantics and Algorithms for Data-Dependent Grammars. In Proceedings of the 37th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’10). Association for Computing Machinery, New York, NY, USA. 417–430. isbn:9781605584799 https://doi.org/10.1145/1706299.1706347 Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Etienne Kneuss, Ivan Kuraj, Viktor Kuncak, and Philippe Suter. 2013. Synthesis modulo Recursive Functions. In Proceedings of the 2013 ACM SIGPLAN International Conference on Object Oriented Programming Systems Languages and Applications (OOPSLA ’13). Association for Computing Machinery, New York, NY, USA. 407–426. isbn:9781450323741 https://doi.org/10.1145/2509136.2509555 Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Xavier Leroy, Didier Rémy Alain Frisch, Jacques Garrigue, and Jérôme Vouillon. 2022. Parsing with Ocamllex. https://ocaml.org/manual/lexyacc.html Google ScholarGoogle Scholar
  25. J. McCarthy. 1993. Towards a Mathematical Science of Computation. Springer Netherlands, Dordrecht. 35–56. isbn:978-94-011-1793-7 https://doi.org/10.1007/978-94-011-1793-7_2 Google ScholarGoogle ScholarCross RefCross Ref
  26. Ashish Mishra and Suresh Jagannathan. 2022. Cobalt (OOPSLA 2022 Artifact): Code and Benchmarks. https://doi.org/10.5281/zenodo.7065694 Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Ashish Mishra and Suresh Jagannathan. 2022. Specification-Guided Component-Based Synthesis from Effectful Libraries. https://doi.org/10.48550/ARXIV.2209.02752 Google ScholarGoogle Scholar
  28. Aleksandar Nanevski, Greg Morrisett, and Lars Birkedal. 2006. Polymorphism and Separation in Hoare Type Theory. 62–73. isbn:1595933093 https://doi.org/10.1145/1159803.1159812 Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Aleksandar Nanevski, Greg Morrisett, Avraham Shinnar, Paul Govereau, and Lars Birkedal. 2008. Ynot: Dependent Types for Imperative Programs. In Proceedings of the 13th ACM SIGPLAN International Conference on Functional Programming (ICFP ’08). Association for Computing Machinery, New York, NY, USA. 229–240. isbn:9781595939197 https://doi.org/10.1145/1411204.1411237 Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Peter-Michael Osera and Steve Zdancewic. 2015. Type-and-Example-Directed Program Synthesis. In Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’15). Association for Computing Machinery, New York, NY, USA. 619–630. isbn:9781450334686 https://doi.org/10.1145/2737924.2738007 Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Ruzica Piskac, Thomas Wies, and Damien Zufferey. 2013. Automating Separation Logic Using SMT. In Computer Aided Verification, Natasha Sharygina and Helmut Veith (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg. 773–789. isbn:978-3-642-39799-8 Google ScholarGoogle Scholar
  32. Nadia Polikarpova, Ivan Kuraj, and Armando Solar-Lezama. 2016. Program Synthesis from Polymorphic Refinement Types. In Proceedings of the 37th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’16). Association for Computing Machinery, New York, NY, USA. 522–538. isbn:9781450342612 https://doi.org/10.1145/2908080.2908093 Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Nadia Polikarpova and Ilya Sergey. 2019. Structuring the Synthesis of Heap-Manipulating Programs. Proc. ACM Program. Lang., 3, POPL (2019), Article 72, Jan., 30 pages. https://doi.org/10.1145/3290385 Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Xiaokang Qiu, Pranav Garg, Andrei Ştefănescu, and Parthasarathy Madhusudan. 2013. Natural Proofs for Structure, Data, and Separation. In Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’13). Association for Computing Machinery, New York, NY, USA. 231–242. isbn:9781450320146 https://doi.org/10.1145/2491956.2462169 Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. J. C. Reynolds. 2002. Separation logic: a logic for shared mutable data structures. In Proceedings 17th Annual IEEE Symposium on Logic in Computer Science. 55–74. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Taro Sekiyama and Atsushi Igarashi. 2017. Stateful Manifest Contracts. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages (POPL 2017). Association for Computing Machinery, New York, NY, USA. 530–544. isbn:9781450346603 https://doi.org/10.1145/3009837.3009875 Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Kensen Shi, Jacob Steinhardt, and Percy Liang. 2019. FrAngel: Component-Based Synthesis with Control Structures. Proc. ACM Program. Lang., 3, POPL (2019), Article 73, jan, 29 pages. https://doi.org/10.1145/3290386 Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Nikhil Swamy, Joel Weinberger, Cole Schlesinger, Juan Chen, and Benjamin Livshits. 2013. Verifying Higher-Order Programs with the Dijkstra Monad. In Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’13). Association for Computing Machinery, New York, NY, USA. 387–398. isbn:9781450320146 https://doi.org/10.1145/2491956.2491978 Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Philip Wadler and Peter Thiemann. 2003. The Marriage of Effects and Monads. ACM Trans. Comput. Logic, 4, 1 (2003), Jan., 1–32. issn:1529-3785 https://doi.org/10.1145/601775.601776 Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Chenglong Wang, Yu Feng, Rastislav Bodik, Alvin Cheung, and Isil Dillig. 2019. Visualization by Example. Proc. ACM Program. Lang., 4, POPL (2019), Article 49, dec, 28 pages. https://doi.org/10.1145/3371117 Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. Lintao Zhang, Conor F. Madigan, Matthew H. Moskewicz, and Sharad Malik. 2001. Efficient Conflict Driven Learning in a Boolean Satisfiability Solver. In Proceedings of the 2001 IEEE/ACM International Conference on Computer-Aided Design (ICCAD ’01). IEEE Press, 279–285. isbn:0780372492 Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Zhe Zhou, Robert Dickerson, Benjamin Delaware, and Suresh Jagannathan. 2021. Data-driven Abductive Inference of Library Specifications. Proc. ACM Program. Lang., 5, OOPSLA (2021), 1–29. https://doi.org/10.1145/3485493 Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Specification-guided component-based synthesis from effectful libraries

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!