skip to main content

Theorems for free from separation logic specifications

Published:19 August 2021Publication History
Skip Abstract Section

Abstract

Separation logic specifications with abstract predicates intuitively enforce a discipline that constrains when and how calls may be made between a client and a library. Thus a separation logic specification of a library intuitively enforces a protocol on the trace of interactions between a client and the library. We show how to formalize this intuition and demonstrate how to derive "free theorems" about such interaction traces from abstract separation logic specifications. We present several examples of free theorems. In particular, we prove that a so-called logically atomic concurrent separation logic specification of a concurrent module operation implies that the operation is linearizable. All the results presented in this paper have been mechanized and formally proved in the Coq proof assistant using the Iris higher-order concurrent separation logic framework.

Skip Supplemental Material Section

Supplemental Material

Auxiliary Presentation Video

This is a presentation video of the talk at ICFP'21 for our paper accepted in the research track. Separation logic specifications with abstract predicates intuitively enforce a discipline that constrains when and how calls may be made between a client and a library. Thus a separation logic specification of a library intuitively enforces a protocol on the trace of interactions between a client and the library. We show how to formalize this intuition and demonstrate how to derive ``free theorems'' about such interaction traces from abstract separation logic specifications. We present several examples of free theorems. In particular, we prove that a so-called logically atomic concurrent separation logic specification of a concurrent module operation implies that the operation is linearizable. All the results presented in this paper have been mechanized and formally proved in the Coq proof assistant using the Iris higher-order concurrent separation logic framework.

3473586.mp4

Presentation Videos

References

  1. Rajeev Alur and P. Madhusudan. 2004. Visibly pushdown languages. In Proceedings of the 36th Annual ACM Symposium on Theory of Computing, Chicago, IL, USA, June 13-16, 2004. 202–211. https://doi.org/10.1145/1007352.1007390 Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Thibaut Balabonski, François Pottier, and Jonathan Protzenko. 2016. The Design and Formalization of Mezzo, a Permission-Based Programming Language. ACM Trans. Program. Lang. Syst., 38, 4 (2016), Article 14, Aug., 94 pages. issn:0164-0925 https://doi.org/10.1145/2837022 Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Jesper Bengtson, Karthikeyan Bhargavan, Cédric Fournet, Andrew D. Gordon, and Sergio Maffeis. 2011. Refinement Types for Secure Implementations. ACM Trans. Program. Lang. Syst., 33, 2 (2011), Feb., 8:1–8:45. https://doi.org/10.1145/1890028.1890031 Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Kevin Bierhoff and Jonathan Aldrich. 2007. Modular Typestate Checking of Aliased Objects. In Proceedings of the 22nd Annual ACM SIGPLAN Conference on Object-oriented Programming Systems and Applications (OOPSLA’07). ACM, 301–320. https://doi.org/10.1145/1297027.1297050 Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Kevin Bierhoff, Nels E Beckman, and Jonathan Aldrich. 2009. Practical API Protocol Checking with Access Permissions. In Proceedings of the 23rd European Conference on Object-Oriented Programming (ECOOP’09). Springer-Verlag, 195–219. https://doi.org/10.1007/978-3-642-03013-0_10 Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Bodil Biering, Lars Birkedal, and Noah Torp-Smith. 2007. BI-hyperdoctrines, Higher-order Separation Logic, and Abstraction. ACM Trans. Program. Lang. Syst., 29, 5 (2007), Article 24, Aug., issn:0164-0925 https://doi.org/10.1145/1275497.1275499 Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Lars Birkedal and Aleš Bizjak. 2020. Lecture Notes on Iris: Higher-Order Concurrent Separation Log. http://iris-project.org/tutorial-pdfs/iris-lecture-notes.pdfGoogle ScholarGoogle Scholar
  8. Johannes Borgström, Andrew D. Gordon, and Riccardo Pucella. 2011. Roles, Stacks, Histories: A Triple for Hoare. Journal of Functional Programming, 21 (2011), 159–207. https://doi.org/10.1017/S0956796810000134 Google ScholarGoogle ScholarCross RefCross Ref
  9. Qinxiang Cao, Lennart Beringer, Samuel Gruetter, Josiah Dodds, and Andrew W. Appel. 2018. VST-Floyd: A Separation Logic Tool to Verify Correctness of C Programs. Journal of Automated Reasoning, 61, 1-4 (2018), 367–422. https://doi.org/10.1007/s10817-018-9457-5 Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Pedro da Rocha Pinto, Thomas Dinsdale-Young, and Philippa Gardner. 2014. TaDA: A Logic for Time and Data Abstraction. In Proceedings of ECOOP. https://doi.org/10.1007/978-3-662-44202-9_9 Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Robert DeLine and Manuel Fähndrich. 2001. Enforcing High-level Protocols in Low-level Software. In Proceedings of the ACM SIGPLAN 2001 Conference on Programming Language Design and Implementation (PLDI ’01). ACM, 59–69. https://doi.org/10.1145/381694.378811 Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Robert DeLine and Manuel Fähndrich. 2004. Typestates for Objects. In Object-Oriented Programming: Proceedings of the 18th European Conference on Object-Oriented Programming (ECOOP’04). Springer-Verlag, 465. https://doi.org/10.1007/978-3-540-24851-4_21 Google ScholarGoogle ScholarCross RefCross Ref
  13. Matthew Fluet, Greg Morrisett, and Amal Ahmed. 2006. Linear Regions Are All You Need. In Programming Languages and Systems, Peter Sestoft (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg. 7–21. isbn:978-3-540-33096-7 https://doi.org/10.1007/11693024_2 Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Ming Fu, Yong Li, Xinyu Feng, Zhong Shao, and Yu Zhang. 2010. Reasoning about Optimistic Concurrency Using a Program Logic for History. In In Proceedings of CONCUR. https://doi.org/10.1007/978-3-642-15375-4_27 Google ScholarGoogle ScholarCross RefCross Ref
  15. Philippa Gardner, Gian Ntzik, and Adam Wright. 2014. Local Reasoning for the POSIX File System. In ESOP. 169–188. https://doi.org/10.1007/978-3-642-54833-8_10 Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Hannah Gommerstadt, Limin Jia, and Frank Pfenning. 2018. Session-Typed Concurrent Contracts. In Programming Languages and Systems, Amal Ahmed (Ed.). Springer International Publishing, Cham. 771–798. isbn:978-3-319-89884-1 https://doi.org/10.1007/978-3-319-89884-1_27 Google ScholarGoogle ScholarCross RefCross Ref
  17. Alexey Gotsman, Noam Rinetzky, and Hongseok Yang. 2013. Verifying Concurrent Memory Reclamation Algorithms with Grace. In Proceedings of ESOP. https://doi.org/10.1007/978-3-642-37036-6_15 Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Maurice P. Herlihy and Jeannette M. Wing. 1990. Linearizability: a correctness condition for concurrent objects. ACM Trans. Program. Lang. Syst., 12, 3 (1990), July, 463–492. https://doi.org/10.1145/78969.78972 Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Kohei Honda, Vasco T. Vasconcelos, and Makoto Kubo. 1998. Language primitives and type discipline for structured communication-based programming. In Programming Languages and Systems, Chris Hankin (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg. 122–138. isbn:978-3-540-69722-0 https://doi.org/10.1007/BFb0053567 Google ScholarGoogle ScholarCross RefCross Ref
  20. Atsushi Igarashi and Naoki Kobayashi. 2002. Resource Usage Analysis. In Proceedings of the 29th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’02). ACM, 331–342. https://doi.org/10.1145/503272.503303 Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Samin S. Ishtiaq and Peter W. O’Hearn. 2001. BI As an Assertion Language for Mutable Data Structures. In Proceedings of the 28th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’01). ACM, 14–26. https://doi.org/10.1145/360204.375719 Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Ralf Jung, David Swasey, Filip Sieczkowski, Kasper Svendsen, Aaron Turon, Lars Birkedal, and Derek Dreyer. 2015. Iris: Monoids and Invariants as an Orthogonal Basis for Concurrent Reasoning. In Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2015, Mumbai, India, January 15-17, 2015. 637–650. https://doi.org/10.1145/2676726.2676980 Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Ralf Jung, David Swasey, Filip Sieczkowski, Kasper Svendsen, Aaron Turon, Lars Birkedal, and Derek Dreyer. 2015. Iris: Monoids and Invariants as an Orthogonal Basis for Concurrent Reasoning. In Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2015, Mumbai, India, January 15-17, 2015. 637–650. https://doi.org/10.1145/2676726.2676980 Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Naoki Kobayashi. 2009. Types and Higher-order Recursion Schemes for Verification of Higher-order Programs. In Proceedings of the 36th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’09). ACM, 416–428. https://doi.org/10.1145/1480881.1480933 Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Nicolas Koh, Yao Li, Yishuai Li, Li-yao Xia, Lennart Beringer, Wolf Honoré, William Mansky, Benjamin C. Pierce, and Steve Zdancewic. 2019. From C to Interaction Trees: Specifying, Verifying, and Testing a Networked Server. In Proceedings of the 8th ACM SIGPLAN International Conference on Certified Programs and Proofs (CPP 2019). Association for Computing Machinery, New York, NY, USA. 234–248. isbn:9781450362221 https://doi.org/10.1145/3293880.3294106 Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Neelakantan R. Krishnaswami, Jonathan Aldrich, Lars Birkedal, Kasper Svendsen, and Alexandre Buisse. 2009. Design Patterns in Separation Logic. In Proceedings of the 4th International Workshop on Types in Language Design and Implementation (TLDI’09). ACM, 105–116. https://doi.org/10.1145/1481861.1481874 Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. A. N. Maslov. 1976. Multilevel stack automata. Problems Inform. Transmission, 12, 1 (1976), 38–42.Google ScholarGoogle Scholar
  28. Karl Mazurak, Jianzhou Zhao, and Steve Zdancewic. 2010. Lightweight Linear Types in System F°. In Proceedings of the 5th ACM SIGPLAN Workshop on Types in Language Design and Implementation (TLDI ’10). Association for Computing Machinery, New York, NY, USA. 77–88. isbn:9781605588919 https://doi.org/10.1145/1708016.1708027 Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Greg Morrisett, Amal Ahmed, and Matthew Fluet. 2005. L3: A Linear Language with Locations. In Typed Lambda Calculi and Applications, Paweł Urzyczyn (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg. 293–307. isbn:978-3-540-32014-2 https://doi.org/10.1007/11417170_22 Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Nomair A Naeem and Ondrej Lhoták. 2008. Typestate-like analysis of multiple interacting objects. OOPSLA’08: Proceedings of Object-Oriented Programming, Systems, Languages and Applications, https://doi.org/10.1145/1449764.1449792 Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Matthew Parkinson and Gavin Bierman. 2005. Separation Logic and Abstraction. In Proceedings of the 32nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’05). ACM, 247–258. https://doi.org/10.1145/1040305.1040326 Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. François Pottier and Jonathan Protzenko. 2015. A few lessons from the Mezzo project. In Summit oN Advances in Programming Languages (SNAPL) (Leibniz International Proceedings in Informatics, Vol. 32). Asilomar, United States. https://doi.org/10.4230/LIPIcs.SNAPL.2015.221 Google ScholarGoogle ScholarCross RefCross Ref
  33. J.C. Reynolds and G.D. Plotkin. 1993. On Functors Expressible in the Polymorphic Typed Lambda Calculus. Information and Computation, 105, 1 (1993), 1–29. https://doi.org/10.1006/inco.1993.1037 Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. John C. Reynolds. 1983. Types, Abstraction and Parametric Polymorphism. In Information Processing 83. 513–523. http://www.cse.chalmers.se/edu/year/2010/course/DAT140_Types/Reynolds_typesabpara.pdfGoogle ScholarGoogle Scholar
  35. John C Reynolds. 2002. Separation logic: A logic for shared mutable data structures. In Proceedings of the 17th Annual IEEE Symposium on Logic in Computer Science (LICS’02). 55–74. https://doi.org/10.1109/LICS.2002.1029817 Google ScholarGoogle ScholarCross RefCross Ref
  36. Ilya Sergey, Aleksandar Nanevski, and Anindya Banerjee. 2015. Specifying and Verifying Concurrent Algorithms with Histories and Subjectivity. In Proceedings of ESOP. https://doi.org/10.1007/978-3-662-46669-8_14 Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Christian Skalka. 2008. Types and trace effects for object orientation. Higher-Order and Symbolic Computation, 21, 3 (2008), 239–282. https://doi.org/10.1007/s10990-008-9032-6 Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Christian Skalka, Scott Smith, and David Van Horn. 2008. Types and trace effects of higher order programs. Journal of Functional Programming, 18, 02 (2008), 179–249. https://doi.org/10.1017/S0956796807006466 Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Robert E Strom and Shaula Yemini. 1986. Typestate: A Programming Language Concept for Enhancing Software Reliability. IEEE Trans. Softw. Eng., 12, 1 (1986), Jan., 157–171. https://doi.org/10.1109/TSE.1986.6312929 Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Nikhil Swamy, Juan Chen, Cédric Fournet, Pierre-Yves Strub, Karthikeyan Bhargavan, and Jean Yang. 2013. Secure Distributed Programming with Value-Dependent Types. Journal of Functional Programming, 23, 4 (2013), 402–451. https://doi.org/10.1017/S0956796813000142 Google ScholarGoogle ScholarCross RefCross Ref
  41. Vasco T. Vasconcelos. 2012. Fundamentals of session types. Information and Computation, 217 (2012), 52–70. issn:0890-5401 https://doi.org/10.1016/j.ic.2012.05.002 Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Philip Wadler. 1989. Theorems for free!. 347–359. https://doi.org/10.1145/99370.99404 Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. Li-yao Xia, Yannick Zakowski, Paul He, Chung-Kil Hur, Gregory Malecha, Benjamin C. Pierce, and Steve Zdancewic. 2019. Interaction Trees: Representing Recursive and Impure Programs in Coq. Proc. ACM Program. Lang., 4, POPL (2019), Article 51, Dec., 32 pages. https://doi.org/10.1145/3371119 Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Theorems for free from separation logic specifications

      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!