Abstract
In program synthesis there is a well-known trade-off between concise and strong specifications: if a specification is too verbose, it might be harder to write than the program; if it is too weak, the synthesised program might not match the user’s intent. In this work we explore the use of annotations for restricting memory access permissions in program synthesis, and show that they can make specifications much stronger while remaining surprisingly concise. Specifically, we enhance Synthetic Separation Logic (SSL), a framework for synthesis of heap-manipulating programs, with the logical mechanism of read-only borrows.
We observe that this minimalistic and conservative SSL extension benefits the synthesis in several ways, making it more (a) expressive (stronger correctness guarantees are achieved with a modest annotation overhead), (b) effective (it produces more concise and easier-to-read programs), (c) efficient (faster synthesis), and (d) robust (synthesis efficiency is less affected by the choice of the search heuristic). We explain the intuition and provide formal treatment for read-only borrows. We substantiate the claims (a)–(d) by describing our quantitative evaluation of the borrowing-aware synthesis implementation on a series of standard benchmark specifications for various heap-manipulating programs.
A. Zhu—Work done during an internship at NUS School of Computing in Summer 2019.
Chapter PDF
Similar content being viewed by others
References
The Rust Programming Language: References and Borrowing. https://doc.rust-lang.org/1.8.0/book/references-and-borrowing.html, 2019.
Rajeev Alur, Rastislav Bodík, Garvit Juniwal, Milo M. K. Martin, Mukund Raghothaman, Sanjit A. Seshia, Rishabh Singh, Armando Solar-Lezama, Emina Torlak, and Abhishek Udupa. Syntax-guided synthesis. In FMCAD, pages 1–8. IEEE, 2013.
Andrew W. Appel. Verified software toolchain - (invited talk). In ESOP, volume 6602 of LNCS, pages 1–17. Springer, 2011.
Vytautas Astrauskas, Peter Müller, Federico Poli, and Alexander J. Summers. Leveraging Rust types for modular specification and verification. PACMPL, 3(OOPSLA):147:1–147:30, 2019.
Thibaut Balabonski, François Pottier, and Jonathan Protzenko. The Design and Formalization of Mezzo, a Permission-Based Programming Language. ACM Trans. Program. Lang. Syst., 38(4):14:1–14:94, 2016.
Josh Berdine, Cristiano Calcagno, and Peter W. O’Hearn. Symbolic execution with separation logic. In APLAS, volume 3780 of LNCS, pages 52–68. Springer, 2005.
Richard Bornat, Cristiano Calcagno, Peter W. O’Hearn, and Matthew J. Parkinson. Permission Accounting in Separation Logic. In POPL, pages 259–270. ACM, 2005.
John Boyland. Checking Interference with Fractional Permissions. In SAS, volume 2694 of LNCS, pages 55–72. Springer, 2003.
Arthur Charguéraud and François Pottier. Temporary Read-Only Permissions for Separation Logic. In ESOP, volume 10201 of LNCS, pages 260–286. Springer, 2017.
Dave Clarke, Johan Östlund, Ilya Sergey, and Tobias Wrigstad. Ownership Types: A Survey, pages 15–58. Springer Berlin Heidelberg, 2013.
Andreea Costea, Asankhaya Sharma, and Cristina David. HIPimm: verifying granular immutability guarantees. In PEPM, pages 189–194. ACM, 2014.
Andreea Costea, Amy Zhu, Nadia Polikarpova, and Ilya Sergey. ROBoSuSLik: ESOP 2020 Artifact. 2020. DOI: 10.5281/zenodo.3630044.
Cristina David and Wei-Ngan Chin. Immutable specifications for more concise and precise verification. In OOPSLA, pages 359–374. ACM, 2011.
Benjamin Delaware, Clément Pit-Claudel, Jason Gross, and Adam Chlipala. Fiat: Deductive Synthesis of Abstract Data Types in a Proof Assistant. In POPL, pages 689–700. ACM, 2015.
Robert Dockins, Aquinas Hobor, and Andrew W. Appel. A fresh look at separation algebras and share accounting. In APLAS, volume 5904 of LNCS, pages 161–177. Springer, 2009.
Ronald Garcia, Éric Tanter, Roger Wolff, and Jonathan Aldrich. Foundations of typestate-oriented programming. ACM Trans. Program. Lang. Syst., 36(4):12:1–12:44, 2014.
Adrià Gascón, Ashish Tiwari, Brent Carmer, and Umang Mathur. Look for the proof to find the program: Decorated-component-based program synthesis. In CAV, volume 10427 of LNCS, pages 86–103. Springer, 2017.
Colin S. Gordon, Matthew J. Parkinson, Jared Parsons, Aleks Bromfield, and Joe Duffy. Uniqueness and reference immutability for safe parallelism. In OOPSLA, pages 21–40. ACM, 2012.
Sumit Gulwani, Susmit Jha, Ashish Tiwari, and Ramarathnam Venkatesan. Synthesis of loop-free programs. In PLDI, pages 62–73. ACM, 2011.
Stefan Heule, K. Rustan M. Leino, Peter Müller, and Alexander J. Summers. Abstract read permissions: Fractional permissions without the fractions. In VMCAI, volume 7737 of LNCS, pages 315–334. Springer, 2013.
Bart Jacobs, Jan Smans, Pieter Philippaerts, Frédéric Vogels, Willem Penninckx, and Frank Piessens. VeriFast: A Powerful, Sound, Predictable, Fast Verifier for C and Java. In NASA Formal Methods, volume 6617 of LNCS, pages41–55. Springer, 2011.
Ralf Jung, Jacques-Henri Jourdan, Robbert Krebbers, and Derek Dreyer. RustBelt: Securing the foundations of the Rust programming language. PACMPL, 2(POPL):66, 2017.
Etienne Kneuss, Ivan Kuraj, Viktor Kuncak, and Philippe Suter. Synthesis modulo recursive functions. In OOPSLA, pages 407–426. ACM, 2013.
Tristan Knoth, Di Wang, Nadia Polikarpova, and Jan Hoffmann. Resource-guided program synthesis. In PLDI, pages 253–268. ACM, 2019.
Xuan Bach Le and Aquinas Hobor. Logical reasoning for disjoint permissions. In ESOP, volume 10801 of LNCS, pages 385–414. Springer, 2018.
K. Rustan M. Leino and Aleksandar Milicevic. Program Extrapolation with Jennisys. In OOPSLA, pages 411–430. ACM, 2012.
K. Rustan M. Leino and Peter Müller. A Basis for Verifying Multi-threaded Programs. In ESOP, volume 5502 of LNCS, pages 378–393. Springer, 2009.
K. Rustan M. Leino, Peter Müller, and Jan Smans. Verification of Concurrent Programs with Chalice. In Foundations of Security Analysis and Design V, FOSAD2007/2008/2009 Tutorial Lectures, volume 5705 of LNCS, pages 195–222. Springer, 2009.
Zohar Manna and Richard J. Waldinger. A deductive approach to program synthesis. ACM Trans. Program. Lang. Syst., 2(1):90–121, 1980.
Peter Müller, Malte Schwerhoff, and Alexander J. Summers. Viper: A Verification Infrastructure for Permission-Based Reasoning. In VMCAI, volume 9583 of LNCS, pages 41–62. Springer, 2016.
Karl Naden, Robert Bocchino, Jonathan Aldrich, and Kevin Bierhoff. A type system for borrowing permissions. In POPL, pages 557–570. ACM, 2012.
Peter W. O’Hearn, John C. Reynolds, and Hongseok Yang. Local reasoning about programs that alter data structures. In CSL, volume 2142 of LNCS, pages 1–19. Springer, 2001.
Nadia Polikarpova, Ivan Kuraj, and Armando Solar-Lezama. Program synthesis from polymorphic refinement types. In PLDI, pages 522–538. ACM, 2016.
Nadia Polikarpova and Ilya Sergey. Structuring the Synthesis of Heap-Manipulating Programs. PACMPL, 3(POPL):72:1–72:30, 2019.
Nadia Polikarpova, Jean Yang, Shachar Itzhaky, and Armando Solar-Lezama. Enforcing information flow policies with type-targeted program synthesis. CoRR, abs/1607.03445, 2016.
Xiaokang Qiu and Armando Solar-Lezama. Natural synthesis of provably-correct data-structure manipulations.PACMPL, 1(OOPSLA):65:1–65:28, 2017.
John C. Reynolds. Separation logic: A logic for shared mutable data structures. In LICS, pages 55–74. IEEE Computer Society, 2002.
Reuben N. S. Rowe and James Brotherston. Automatic cyclic termination proofs for recursive procedures in separation logic. In CPP, pages 53–65. ACM, 2017.
Calvin Smith and Aws Albarghouthi. Synthesizing differentially private programs. Proc. ACM Program. Lang., 3(ICFP):94:1–94:29, July 2019.
Armando Solar-Lezama. Program sketching. STTT, 15(5-6):475–495, 2013.
Saurabh Srivastava, Sumit Gulwani, and Jeffrey S. Foster. From program verification to program synthesis. In POPL, pages 313–326. ACM, 2010.
Sven Stork, Karl Naden, Joshua Sunshine, Manuel Mohr, Alcides Fonseca, Paulo Marques, and Jonathan Aldrich. Æminium: A Permission-Based Concurrent-by-Default Programming Language Approach.TOPLAS, 36(1):2:1–2:42, 2014.
Alexander J. Summers and Peter Müller. Automating deductive verification for weak-memory programs. In TACAS, volume 10805 of LNCS, pages 190–209. Springer, 2018.
Emina Torlak and Rastislav Bodík. A lightweight symbolic virtual machine for solver-aided host languages. In PLDI, pages 530–541. ACM, 2014.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Open Access This chapter is licensed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license and indicate if changes were made.
The images or other third party material in this chapter are included in the chapter's Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the chapter's Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder.
Copyright information
© 2020 The Author(s)
About this paper
Cite this paper
Costea, A., Zhu, A., Polikarpova, N., Sergey, I. (2020). Concise Read-Only Specifications for Better Synthesis of Programs with Pointers. In: Müller, P. (eds) Programming Languages and Systems. ESOP 2020. Lecture Notes in Computer Science(), vol 12075. Springer, Cham. https://doi.org/10.1007/978-3-030-44914-8_6
Download citation
DOI: https://doi.org/10.1007/978-3-030-44914-8_6
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-44913-1
Online ISBN: 978-3-030-44914-8
eBook Packages: Computer ScienceComputer Science (R0)