skip to main content

Modular Denotational Semantics for Effects with Guarded Interaction Trees

Published:05 January 2024Publication History
Skip Abstract Section

Abstract

We present guarded interaction trees — a structure and a fully formalized framework for representing higher-order computations with higher-order effects in Coq, inspired by domain theory and the recently proposed interaction trees. We also present an accompanying separation logic for reasoning about guarded interaction trees. To demonstrate that guarded interaction trees provide a convenient domain for interpreting higher-order languages with effects, we define an interpretation of a PCF-like language with effects and show that this interpretation is sound and computationally adequate; we prove the latter using a logical relation defined using the separation logic. Guarded interaction trees also allow us to combine different effects and reason about them modularly. To illustrate this point, we give a modular proof of type soundness of cross-language interactions for safe interoperability of different higher-order languages with different effects. All results in the paper are formalized in Coq using the Iris logic over guarded type theory.

References

  1. Casper Bach Poulsen and Cas van der Rest. 2023. Hefty Algebras: Modular Elaboration of Higher-Order Algebraic Effects. Proceedings of the ACM on Programming Languages, 7, POPL (2023), Jan., 62:1801–62:1831. https://doi.org/10.1145/3571255 Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Andrej Bauer and Matija Pretnar. 2015. Programming with Algebraic Effects and Handlers. Journal of Logical and Algebraic Methods in Programming, 84, 1 (2015), Jan., 108–123. issn:2352-2208 https://doi.org/10.1016/j.jlamp.2014.02.001 Google ScholarGoogle ScholarCross RefCross Ref
  3. Lars Birkedal and Rasmus Ejlers Møgelberg. 2013. Intensional Type Theory with Guarded Recursive Types qua Fixed Points on Universes. In 28th Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2013, New Orleans, LA, USA, June 25-28, 2013. IEEE Computer Society, 213–222. https://doi.org/10.1109/LICS.2013.27 Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Lars Birkedal, Rasmus Ejlers Møgelberg, Jan Schwinghammer, and Kristian Støvring. 2012. First steps in synthetic guarded domain theory: step-indexing in the topos of trees. Log. Methods Comput. Sci., 8, 4 (2012), https://doi.org/10.2168/LMCS-8(4:1)2012 Google ScholarGoogle ScholarCross RefCross Ref
  5. Lars Birkedal, Bernhard Reus, Jan Schwinghammer, and Hongseok Yang. 2008. A Simple Model of Separation Logic for Higher-Order Store. In Automata, Languages and Programming, 35th International Colloquium, ICALP 2008, Reykjavik, Iceland, July 7-11, 2008, Proceedings, Part II - Track B: Logic, Semantics, and Theory of Programming & Track C: Security and Cryptography Foundations, Luca Aceto, Ivan Damgård, Leslie Ann Goldberg, Magnús M. Halldórsson, Anna Ingólfsdóttir, and Igor Walukiewicz (Eds.) (Lecture Notes in Computer Science, Vol. 5126). Springer, 348–360. https://doi.org/10.1007/978-3-540-70583-3_29 Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Lars Birkedal, Kristian Støvring, and Jacob Thamsborg. 2010. The Category-Theoretic Solution of Recursive Metric-Space Equations. Theoretical Computer Science, 411, 47 (2010), Oct., 4102–4122. issn:03043975 https://doi.org/10.1016/j.tcs.2010.07.010 Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Lars Birkedal and Hongseok Yang. 2008. Relational Parametricity and Separation Logic. Log. Methods Comput. Sci., 4, 2 (2008), https://doi.org/10.2168/LMCS-4(2:6)2008 Google ScholarGoogle ScholarCross RefCross Ref
  8. Ales Bizjak, Hans Bugge Grathwohl, Ranald Clouston, Rasmus Ejlers Møgelberg, and Lars Birkedal. 2016. Guarded Dependent Type Theory with Coinductive Types. CoRR, abs/1601.01586 (2016), arXiv:1601.01586. arxiv:1601.01586 Google ScholarGoogle Scholar
  9. Paulo Emílio de Vilhena and François Pottier. 2021. A Separation Logic for Effect Handlers. Proceedings of the ACM on Programming Languages, 5, POPL (2021), Jan., 33:1–33:28. https://doi.org/10.1145/3434314 Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Matthias Felleisen and Robert Hieb. 1992. The revised report on the syntactic theories of sequential control and state. Theoretical Computer Science, 103, 2 (1992), 235–271. issn:0304-3975 https://doi.org/10.1016/0304-3975(92)90014-7 Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Peter Freyd. 1991. Algebraically Complete Categories. In Category Theory, Aurelio Carboni, Maria Cristina Pedicchio, and Guiseppe Rosolini (Eds.) (Lecture Notes in Mathematics). Springer, Berlin, Heidelberg. 95–104. isbn:978-3-540-46435-8 https://doi.org/10.1007/BFb0084215 Google ScholarGoogle ScholarCross RefCross Ref
  12. Naohiko Hoshino. 2012. Step Indexed Realizability Semantics for a Call-by-Value Language Based on Basic Combinatorial Objects. In 2012 27th Annual IEEE Symposium on Logic in Computer Science. 385–394. issn:1043-6871 https://doi.org/10.1109/LICS.2012.74 Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Patricia Johann, Alex Simpson, and Janis Voigtländer. 2010. A Generic Operational Metatheory for Algebraic Effects. In Proceedings of the 25th Annual IEEE Symposium on Logic in Computer Science, LICS 2010, 11-14 July 2010, Edinburgh, United Kingdom. IEEE Computer Society, 209–218. https://doi.org/10.1109/LICS.2010.29 Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Ralf Jung, Robbert Krebbers, Lars Birkedal, and Derek Dreyer. 2016. Higher-order ghost state. In Proceedings of the 21st ACM SIGPLAN International Conference on Functional Programming, ICFP 2016, Nara, Japan, September 18-22, 2016, Jacques Garrigue, Gabriele Keller, and Eijiro Sumii (Eds.). ACM, 256–269. https://doi.org/10.1145/2951913.2951943 Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Ralf Jung, Robbert Krebbers, Jacques-Henri Jourdan, Ales Bizjak, Lars Birkedal, and Derek Dreyer. 2018. Iris from the ground up: A modular foundation for higher-order concurrent separation logic. J. Funct. Program., 28 (2018), e20. https://doi.org/10.1017/S0956796818000151 Google ScholarGoogle ScholarCross RefCross Ref
  16. 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, Sriram K. Rajamani and David Walker (Eds.). ACM, 637–650. https://doi.org/10.1145/2676726.2676980 Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. 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:978-1-4503-6222-1 https://doi.org/10.1145/3293880.3294106 Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Robbert Krebbers, Ralf Jung, Ales Bizjak, Jacques-Henri Jourdan, Derek Dreyer, and Lars Birkedal. 2017. The Essence of Higher-Order Concurrent Separation Logic. In Programming Languages and Systems - 26th European Symposium on Programming, ESOP 2017, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2017, Uppsala, Sweden, April 22-29, 2017, Proceedings, Hongseok Yang (Ed.) (Lecture Notes in Computer Science, Vol. 10201). Springer, 696–723. https://doi.org/10.1007/978-3-662-54434-1_26 Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Robbert Krebbers, Amin Timany, and Lars Birkedal. 2017. Interactive proofs in higher-order concurrent separation logic. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages, POPL 2017, Paris, France, January 18-20, 2017, Giuseppe Castagna and Andrew D. Gordon (Eds.). ACM, 205–217. https://doi.org/10.1145/3009837.3009855 Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Mohsen Lesani, Li-yao Xia, Anders Kaseorg, Christian J. Bell, Adam Chlipala, Benjamin C. Pierce, and Steve Zdancewic. 2022. C4: Verified Transactional Objects. Proceedings of the ACM on Programming Languages, 6, OOPSLA1 (2022), April, 80:1–80:31. https://doi.org/10.1145/3527324 Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Jacob Matthews and Robert Bruce Findler. 2007. Operational Semantics for Multi-Language Programs. ACM SIGPLAN Notices, 42, 1 (2007), Jan., 3–10. issn:0362-1340 https://doi.org/10.1145/1190215.1190220 Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Rasmus E. Møgelberg and Marco Paviotti. 2019. Denotational Semantics of Recursive Types in Synthetic Guarded Domain Theory. Mathematical Structures in Computer Science, 29, 3 (2019), March, 465–510. issn:0960-1295, 1469-8072 Google ScholarGoogle ScholarCross RefCross Ref
  23. Rasmus Ejlers Møgelberg and Andrea Vezzosi. 2021. Two Guarded Recursive Powerdomains for Applicative Simulation. Electronic Proceedings in Theoretical Computer Science, 351 (2021), Dec., 200–217. issn:2075-2180 arxiv:2112.14056. Google ScholarGoogle ScholarCross RefCross Ref
  24. Daniel Patterson, Noble Mushtak, Andrew Wagner, and Amal Ahmed. 2022. Semantic Soundness for Language Interoperability. In Proceedings of the 43rd ACM SIGPLAN International Conference on Programming Language Design and Implementation (PLDI 2022). Association for Computing Machinery, New York, NY, USA. 609–624. isbn:978-1-4503-9265-5 https://doi.org/10.1145/3519939.3523703 Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Marco Paviotti, Rasmus Ejlers Møgelberg, and Lars Birkedal. 2015. A Model of PCF in Guarded Type Theory. Electronic Notes in Theoretical Computer Science, 319 (2015), Dec., 333–349. issn:1571-0661 Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Andrew M. Pitts. 1996. Relational Properties of Domains. Information and Computation, 127, 2 (1996), June, 66–90. issn:0890-5401 https://doi.org/10.1006/inco.1996.0052 Google ScholarGoogle ScholarCross RefCross Ref
  27. G. D. Plotkin. 1977. LCF Considered as a Programming Language. Theoretical Computer Science, 5, 3 (1977), Dec., 223–255. issn:0304-3975 https://doi.org/10.1016/0304-3975(77)90044-5 Google ScholarGoogle ScholarCross RefCross Ref
  28. Gordon D. Plotkin and Matija Pretnar. 2013. Handling Algebraic Effects. Logical Methods in Computer Science, Volume 9, Issue 4 (2013), Dec., issn:1860-5974 https://doi.org/10.2168/LMCS-9(4:23)2013 Google ScholarGoogle ScholarCross RefCross Ref
  29. Dana Scott. 1976. Data Types as Lattices. SIAM J. Comput., 5, 3 (1976), Sept., 522–587. issn:0097-5397 https://doi.org/10.1137/0205037 Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Lucas Silver, Paul He, Ethan Cecchetti, Andrew K Hirsch, and Steve Zdancewic. 2023. Semantics for Noninterference with Interaction Trees. Google ScholarGoogle Scholar
  31. M. B. Smyth and G. D. Plotkin. 1982. The Category-Theoretic Solution of Recursive Domain Equations. SIAM J. Comput., 11, 4 (1982), Nov., 761–783. issn:0097-5397 https://doi.org/10.1137/0211062 Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Birthe van den Berg, Tom Schrijvers, Casper Bach Poulsen, and Nicolas Wu. 2021. Latent Effects for Reusable Language Components. In Programming Languages and Systems, Hakjoo Oh (Ed.) (Lecture Notes in Computer Science). Springer International Publishing, Cham. 182–201. isbn:978-3-030-89051-3 https://doi.org/10.1007/978-3-030-89051-3_11 Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Nicolas Wu, Tom Schrijvers, and Ralf Hinze. 2014. Effect Handlers in Scope. In Proceedings of the 2014 ACM SIGPLAN Symposium on Haskell (Haskell ’14). Association for Computing Machinery, New York, NY, USA. 1–12. isbn:978-1-4503-3041-1 https://doi.org/10.1145/2633357.2633358 Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. 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. Proceedings of the ACM on Programming Languages, 4, POPL (2019), Dec., 51:1–51:32. https://doi.org/10.1145/3371119 Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Zhixuan Yang and Nicolas Wu. 2021. Reasoning about Effect Interaction by Fusion. Proceedings of the ACM on Programming Languages, 5, ICFP (2021), Aug., 73:1–73:29. https://doi.org/10.1145/3473578 Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Kangfeng Ye, Simon Foster, and Jim Woodcock. 2022. Formally Verified Animation for RoboChart Using Interaction Trees. In Formal Methods and Software Engineering, Adrian Riesco and Min Zhang (Eds.) (Lecture Notes in Computer Science). Springer International Publishing, Cham. 404–420. isbn:978-3-031-17244-1 https://doi.org/10.1007/978-3-031-17244-1_24 Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Yannick Zakowski, Calvin Beck, Irene Yoon, Ilia Zaichuk, Vadim Zaliva, and Steve Zdancewic. 2021. Modular, Compositional, and Executable Formal Semantics for LLVM IR. Proceedings of the ACM on Programming Languages, 5, ICFP (2021), Aug., 67:1–67:30. https://doi.org/10.1145/3473572 Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Hengchu Zhang, Wolf Honoré, Nicolas Koh, Yao Li, Yishuai Li, Li-Yao Xia, Lennart Beringer, William Mansky, Benjamin Pierce, and Steve Zdancewic. 2021. Verifying an HTTP Key-Value Server with Interaction Trees and VST. In 12th International Conference on Interactive Theorem Proving (ITP 2021), Liron Cohen and Cezary Kaliszyk (Eds.) (Leibniz International Proceedings in Informatics (LIPIcs), Vol. 193). Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl, Germany. 32:1–32:19. isbn:978-3-95977-188-7 issn:1868-8969 https://doi.org/10.4230/LIPIcs.ITP.2021.32 Google ScholarGoogle ScholarCross RefCross Ref

Index Terms

  1. Modular Denotational Semantics for Effects with Guarded Interaction Trees

        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

        • Article Metrics

          • Downloads (Last 12 months)149
          • Downloads (Last 6 weeks)35

          Other Metrics

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader