skip to main content
research-article
Open access

On Polymorphic Sessions and Functions: A Tale of Two (Fully Abstract) Encodings

Published: 10 June 2021 Publication History

Abstract

This work exploits the logical foundation of session types to determine what kind of type discipline for the Λ-calculus can exactly capture, and is captured by, Λ-calculus behaviours. Leveraging the proof theoretic content of the soundness and completeness of sequent calculus and natural deduction presentations of linear logic, we develop the first mutually inverse and fully abstract processes-as-functions and functions-as-processes encodings between a polymorphic session π-calculus and a linear formulation of System F. We are then able to derive results of the session calculus from the theory of the Λ-calculus: (1) we obtain a characterisation of inductive and coinductive session types via their algebraic representations in System F; and (2) we extend our results to account for value and process passing, entailing strong normalisation.

References

[1]
Davide Ancona, Viviana Bono, Mario Bravetti, Joana Campos, Giuseppe Castagna, Pierre-Malo Deniélou, Simon J. Gay, Nils Gesbert, Elena Giachino, Raymond Hu, Einar Broch Johnsen, Francisco Martins, Viviana Mascardi, Fabrizio Montesi, Rumyana Neykova, Nicholas Ng, Luca Padovani, Vasco T. Vasconcelos, and Nobuko Yoshida. 2016. Behavioral types in programming languages. Foundations and Trends in Programming Languages 3, 2-3 (2016), 95–230.
[2]
E. S. Bainbridge, Peter J. Freyd, Andre Scedrov, and Philip J. Scott. 1990. Functorial polymorphism. Theor. Comput. Sci. 70, 1 (1990), 35–64.
[3]
Stephanie Balzer and Frank Pfenning. 2017. Manifest sharing with session types. PACMPL 1, ICFP (2017), 37:1–37:29.
[4]
Stephanie Balzer, Frank Pfenning, and Bernardo Toninho. 2018. A universal session type for untyped asynchronous communication. In 29th International Conference on Concurrency Theory (CONCUR 2018). (September 4-7, 2018, Beijing, China). 30:1–30:18.
[5]
Andrew Barber. 1996. Dual Intuitionistic Linear Logic. Technical Report ECS-LFCS-96-347. School of Informatics, University of Edinburgh.
[6]
P. N. Benton. 1994. A mixed linear and non-linear logic: Proofs, terms and models (extended abstract). In 8th International Workshop on Computer Science Logic, (CSL ’94). (Kazimierz, Poland, September 25-30, 1994), Selected Papers. 121–135.
[7]
Martin Berger, Kohei Honda, and Nobuko Yoshida. 2001. Sequentiality and the -calculus. In Proceedings of TLCA’01.Lecture Notes in Computer Science (LNCS), vol. 2044. Springer, 29–45.
[8]
Martin Berger, Kohei Honda, and Nobuko Yoshida. 2005. Genericity and the pi-calculus. Acta Inf. 42, 2-3 (2005), 83–141.
[9]
Richard Bird and Oege De Moor. 1997. The Algebra of Programming. Prentice-Hall.
[10]
Lars Birkedal, Rasmus Ejlers Møgelberg, and Rasmus Lerchedahl Petersen. 2006. Linear Abadi and Plotkin logic. Logical Methods in Computer Science 2, 5 (2006).
[11]
Luís Caires, Jorge A. Pérez, Frank Pfenning, and Bernardo Toninho. 2013. Behavioral polymorphism and parametricity in session-based communication. In Programming Languages and Systems - 22nd European Symposium on Programming, ESOP 2013, Held as Part of the European Joint Conferences on Theory and Practice of Software, (ETAPS 2013). (Rome, Italy, March 16-24, 2013). 330–349.
[12]
Luís Caires and Frank Pfenning. 2010. Session types as intuitionistic linear propositions. In 21th International Conference on Concurrency Theory, CONCUR 2010), (Paris, France, August 31-September 3, 2010).Lecture Notes in Computer Science (LNCS), vol. 6269. Springer, 222–236.
[13]
Luís Caires, Frank Pfenning, and Bernardo Toninho. 2016. Linear logic propositions as session types. Mathematical Structures in Computer Science 26, 3 (2016), 367–423.
[14]
Marco Carbone, Sam Lindley, Fabrizio Montesi, Carsten Schürmann, and Philip Wadler. 2016. Coherence generalises duality: A logical explanation of multiparty session types. In 27th International Conference on Concurrency Theory (CONCUR 2016). (August 23-26, 2016, Québec City, Canada). 33:1–33:15.
[15]
Marco Carbone, Fabrizio Montesi, Carsten Schürmann, and Nobuko Yoshida. 2015. Multiparty session types as coherence proofs. In 26th International Conference on Concurrency Theory (CONCUR 2015). (Madrid, Spain, September 1-4, 2015). 412–426.
[16]
Ornela Dardha, Elena Giachino, and Davide Sangiorgi. 2012. Session types revisited. In PPDP ’12: Proceedings of the 14th Symposium on Principles and Practice of Declarative Programming. ACM, New York, NY, USA, 139–150.
[17]
Romain Demangeon, Daniel Hirschkoff, and Davide Sangiorgi. 2009. Mobile processes and termination. In Semantics and Algebraic Specification. 250–273.
[18]
Romain Demangeon, Daniel Hirschkoff, and Davide Sangiorgi. 2010. Termination in higher-order concurrent calculi. J. Log. Algebr. Program. 79, 7 (2010), 550–577.
[19]
Simon Fowler. 2020. Model-view-update-communicate: Session types meet the Elm architecture. In 34th European Conference on Object-Oriented Programming E 2020, (November 15-17, 2020, Berlin, Germany) (Virtual Conference) (LIPIcs), vol. 166. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 14:1–14:28.
[20]
Simon Fowler, Sam Lindley, J. Garrett Morris, and Sára Decova. 2019. Exceptional asynchronous session types: Session types without tiers. In Proceedings of the ACM Symposium on Programming Languages 3, (POPL2019), 28:1–28:29.
[21]
Simon Gay and Antonio Ravara (Eds.). 2017. Behavioural Types: From Theory to Tools. River Publishers.
[22]
Gerhard Gentzen. 1935. Untersuchungen über das logische Schließen. Mathematische Zeitschrift 39 (1935), 176–210.
[23]
Jean-Yves Girard. 1987. Linear logic. Theor. Comput. Sci. 50 (1987), 1–102.
[24]
Jean-Yves Girard, Yves Lafont, and Paul Taylor. 1989. Proofs and Types. Cambridge University Press.
[25]
Daniele Gorla. 2010. Towards a unified approach to encodability and separation results for process calculi. Inf. Comput. 208, 9 (2010), 1031–1053.
[26]
Daniele Gorla and Uwe Nestmann. 2016. Full abstraction for expressiveness: History, myths and facts. Mathematical Structures in Computer Science 26, 4 (2016), 639–654.
[27]
Ryu Hasegawa. 1994. Categorical data types in parametric polymorphism. Mathematical Structures in Computer Science 4, 1 (1994), 71–109.
[28]
Kohei Honda. 1993. Types for dyadic interaction. In 4th International Conference on Concurrency Theory (CONCUR ’93), (Hildesheim, Germany, August 23-26, 1993),. 509–523.
[29]
Kohei Honda. 2012. Session types and distributed computing. In 39th International Colloquium on Automata, Languages, and Programming -, (ICALP 2012), (Warwick, UK, July 9-13, 2012), Part II. 23.
[30]
Kohei Honda, Vasco Thudichum Vasconcelos, and Makoto Kubo. 1998. Language primitives and type discipline for structured communication-based programming. In Programming Languages and Systems - ESOP’98, 7th European Symposium on Programming, held as part of the European Joint Conferences on the Theory and Practice of Software, (ETAPS’98), (Lisbon, Portugal, March 28 - April 4, 1998),. 122–138.
[31]
Kohei Honda, Nobuko Yoshida, and Marco Carbone. 2008. Multiparty asynchronous session types. In 35th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2008), (San Francisco, California, January 7-12, 2008). 273–284.
[32]
Keigo Imai, Rumyana Neykova, Nobuko Yoshida, and Shoji Yuen. 2020. Multiparty session programming with global protocol combinators. In 34th European Conference on Object-Oriented Programming. 9:1–9:30.
[33]
Keigo Imai, Nobuko Yoshida, and Shoji Yuen. 2017. Session-Ocaml: A session-based library with polarities and lenses. In Coordination Models and Languages - 19th IFIP WG 6.1 International Conference (COORDINATION 2017,) held as part of the 12th International Federated Conference on Distributed Computing Techniques, DisCoTec 2017, (Neuchâtel, Switzerland, June 19-22, 2017),. 99–118.
[34]
Keigo Imai, Nobuko Yoshida, and Shoji Yuen. 2019. Session-Ocaml: A session-based library with polarities and lenses. scico (2019), 1–50.
[35]
Dimitrios Kouzapas, Jorge A. Pérez, and Nobuko Yoshida. 2016. On the relative expressiveness of higher-order session processes. In Programming Languages and Systems - 25th European Symposium on Programming, (ESOP 2016), held as part of the European Joint Conferences on Theory and Practice of Software (ETAPS 2016), (Eindhoven, The Netherlands, April 2-8, 2016), s. 446–475.
[36]
Sam Lindley and J. Garrett Morris. 2015. A semantics for propositions as sessions. In Programming Languages and Systems - 24th European Symposium on Programming (ESOP 2015), held as part of the European Joint Conferences on Theory and Practice of Software (ETAPS 2015), (London, UK, April 11-18, 2015). 560–584.
[37]
Sam Lindley and J. Garrett Morris. 2016. Talking bananas: Structural recursion for session types. In Proceedings of the 21st ACM SIGPLAN International Conference on Functional Programming (ICFP 2016), (Nara, Japan, September 18-22, 2016). 434–447.
[38]
Sam Lindley and J. Garrett Morris. 2017. Lightweight functional session types. In Behavioural Types: From Theory to Tools. River Publishers.
[39]
John Maraist, Martin Odersky, David N. Turner, and Philip Wadler. 1999. Call-by-name, call-by-value, call-by-need and the linear lambda calculus. Theor. Comput. Sci. 228, 1-2 (1999), 175–210.
[40]
N. P. Mendler. 1987. Recursive types and type constraints in second-order lambda calculus. In Symposium on Logic in Computer Science (LICS ’87) (Ithaca, New York, June 22-25, 1987). 30–36.
[41]
Robin Miler. 2001. Speech on receiving an Honorary Degree from the University of Bologna. www.cs.unibo.it/icalp/Lauree_milner.html.
[42]
Robin Milner. 1992. Functions as processes. Mathematical Structures in Computer Science 2, 2 (1992), 119–141.
[43]
Robin Milner, Joachim Parrow, and David Walker. 1992. A calculus of mobile processes, I and II. Inf. Comput. 100, 1 (1992), 1–77.
[44]
Uwe Nestmann and Benjamin C. Pierce. 2000. Decoding choice encodings. Information and Computation 163, 1 (2000), 1–59.
[45]
Yo Ohta and Masahito Hasegawa. 2006. A terminating and confluent linear lambda calculus. In 17th International Conferenceon Term Rewriting and Applications, (RTA 2006), (Seattle, WA, August 12-14, 2006),. 166–180.
[46]
Dominic Orchard and Nobuko Yoshida. 2017. Session types with linearity in Haskell. In Behavioural Types: From Theory to Tools. River Publishers.
[47]
Dominic A. Orchard and Nobuko Yoshida. 2016. Effects as sessions, sessions as effects. In 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2016), (St. Petersburg, FL, January 20-22, 2016). 568–581.
[48]
Luca Padovani. 2017. Context-free session type inference. 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),. 804–830.
[49]
Joachim Parrow. 2008. Expressiveness of process algebras. In Proceedings of the LIX Colloquium on Emerging Trends in Concurrency Theory (LIX 2006),Electronic Notes in Theoretical Computer Science 209 (2008), 173–186.
[50]
Jorge A. Pérez, Luís Caires, Frank Pfenning, and Bernardo Toninho. 2012. Linear logical relations for session-based concurrency. In Programming Languages and Systems - 21st European Symposium on Programming (ESOP 2012), held as part of the European Joint Conferences on Theory and Practice of Software (ETAPS 2012), (Tallinn, Estonia, March 24 - April 1, 2012). 539–558.
[51]
Jorge A. Pérez, Luís Caires, Frank Pfenning, and Bernardo Toninho. 2014. Linear logical relations and observational equivalences for session-based concurrency. Inf. Comput. 239 (2014), 254–302.
[52]
Kirstin Peters. 2019. Comparing process calculi using encodings. In Proceedings of the Combined 26th International Workshop on Expressiveness in Concurrency and 16th Workshop on Structural Operational Semantics (EXPRESS/SOS 2019) (Amsterdam, The Netherlands, 26th August 2019) (EPTCS), vol. 300. 19–38.
[53]
Frank Pfenning and Dennis Griffith. 2015. Polarized substructural session types. In 18th International Conference Foundations of Software Science and Computation Structures (FoSSaCS 2015), held as Part of the European Joint Conferences on Theory and Practice of Software (ETAPS 2015), (London, UK, April 11-18, 2015). 3–22.
[54]
Benjamin C. Pierce. 2004. Advanced Topics in Types and Programming Languages. The MIT Press.
[55]
Benjamin C. Pierce and Davide Sangiorgi. 1996. Typing and subtyping for mobile processes. Mathematical Structures in Computer Science 6, 5 (1996), 409–453.
[56]
Benjamin C. Pierce and Davide Sangiorgi. 2000. Behavioral equivalence in the polymorphic pi-calculus. J. ACM 47, 3 (2000), 531–584.
[57]
Benhamin C. Pierce and David N. Turner. 1990. Pict Programming Language homepage. https://www.cis.upenn.edu/ bcpierce/papers/pict/Html/Pict.html.
[58]
Gordon D. Plotkin and Martín Abadi. 1993. A logic for parametric polymorphism. In International Conference on Typed Lambda Calculi and Applications (TLCA ’93), (Utrecht, The Netherlands, March 16-18, 1993),. 361–375.
[59]
John C. Reynolds. 1983. Types, abstraction and parametric polymorphism. In Information Processing 83, Proceedings of the IFIP 9th World Computer Congress (Paris, France, September 19-23, 1983).513–523.
[60]
John C. Reynolds and Gordon D. Plotkin. 1993. On functors expressible in the polymorphic typed lambda calculus. Inf. Comput. 105, 1 (1993), 1–29.
[61]
Davide Sangiorgi. 1993. From pi-calculus to higher-order pi-calculus - and back. In TAPSOFT’93: Theory and Practice of Software Development, International Joint Conference (CAAP/FASE), (Orsay, France, April 13-17, 1993),. 151–166.
[62]
Davide Sangiorgi. 1993. An investigation into functions as processes. In 9th International Conference on Mathematical Foundations of Programming Semantics, (New Orleans, LA, April 7-10, 1993),. 143–159.
[63]
Davide Sangiorgi. 1996. Pi-calculus, internal mobility, and agent-passing calculi. Theor. Comput. Sci. 167, 1&2 (1996), 235–274.
[64]
Davide Sangiorgi. 2000. Lazy functions and mobile processes. In Proof, Language, and Interaction, Essays in Honour of Robin Milner. 691–720.
[65]
Davide Sangiorgi and David Walker. 2001. The Pi-Calculus - A Theory of Mobile Processes. Cambridge University Press.
[66]
Davide Sangiorgi and Xian Xu. 2014. Trees from functions as processes. In 25th International Conference on Concurrency Theory -, (CONCUR 2014), (Rome, Italy, September 2-5, 2014). 78–92.
[67]
Alceste Scalas, Ornela Dardha, Raymond Hu, and Nobuko Yoshida. 2017. A linear decomposition of multiparty sessions for safe distributed programming. In 31st European Conference on Object-Oriented Programming (ECOOP 2017, June 19-23, 2017, Barcelona, Spain). 24:1–24:31.
[68]
Alceste Scalas and Nobuko Yoshida. 2016. Lightweight session programming in Scala. In 30th European Conference on Object-Oriented Programming (LIPIcs). Dagstuhl, 21:1–21:28.
[69]
Miguel Silva, Mário Florido, and Frank Pfenning. 2016. Non-blocking concurrent imperative programming with session types. In 4th International Workshop on Linearity (LINEARITY 2016), (Porto, Portugal, 25 June 2016) (EPTCS), vol. 238. 64–72.
[70]
Bernardo Toninho, Luís Caires, and Frank Pfenning. 2012. Functions as session-typed processes. In 15th International Conference Foundations of Software Science and Computational Structures - FOSSACS 2012), held as part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2012, (Tallinn, Estonia, March 24 - April 1, 2012). 346–360.
[71]
Bernardo Toninho, Luís Caires, and Frank Pfenning. 2013. Higher-order processes, functions, and sessions: A monadic integration. In Programming Languages and Systems - 22nd European Symposium on Programming, (ESOP 2013), held as part of the European Joint Conferences on Theory and Practice of Software, (ETAPS 2013), (Rome, Italy, March 16-24, 2013). 350–369.
[72]
Bernardo Toninho, Luís Caires, and Frank Pfenning. 2014. Corecursion and non-divergence in session-typed processes. In Trustworthy Global Computing - 9th International Symposium, (TGC 2014), (Rome, Italy, September 5-6, 2014). Revised Selected Papers. 159–175.
[73]
Bernardo Toninho and Nobuko Yoshida. 2018. On polymorphic sessions and functions - A tale of two (fully abstract) encodings. In Programming Languages and Systems - 27th European Symposium on Programming (ESOP 2018), held as part of the European Joint Conferences on Theory and Practice of Software (ETAPS 2018), (Thessaloniki, Greece, April 14-20, 2018),. 827–855.
[74]
Bernardo Toninho and Nobuko Yoshida. 2019. Polymorphic session processes as morphisms. In The Art of Modelling Computational Systems: A Journey from Logic and Concurrency to Security and Privacy - Essays Dedicated to Catuscia Palamidessi on the Occasion of Her 60th Birthday. 101–117.
[75]
David Turner. 1996. The Polymorphic Pi-Calculus: Theory and Implementation. Technical Report ECS-LFCS-96-345. School of Informatics, University of Edinburgh.
[76]
Philip Wadler. 2014. Propositions as sessions. J. Funct. Program. 24, 2-3 (2014), 384–418.
[77]
Max Willsey, Rokhini Prabhu, and Frank Pfenning. 2016. Design and implementation of concurrent C0. In 4th International Workshop on Linearity (LINEARITY 2016) (Porto, Portugal, 25 June 2016 (EPTCS)), vol. 238. 73–82.
[78]
Nobuko Yoshida, Martin Berger, and Kohei Honda. 2004. Strong normalisation in the pi-calculus. Inf. Comput. 191, 2 (2004), 145–202.
[79]
Jianzhou Zhao, Qi Zhang, and Steve Zdancewic. 2010. Relational parametricity for a polymorphic linear lambda calculus. In 8th Asian Symposium on Programming Languages and Systems -, (APLAS 2010), (Shanghai, China, November 28 - December 1, 2010). 344–359.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Transactions on Programming Languages and Systems
ACM Transactions on Programming Languages and Systems  Volume 43, Issue 2
June 2021
197 pages
ISSN:0164-0925
EISSN:1558-4593
DOI:10.1145/3470134
Issue’s Table of Contents
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 10 June 2021
Accepted: 01 March 2021
Revised: 01 December 2020
Received: 01 December 2019
Published in TOPLAS Volume 43, Issue 2

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. π-calculus
  2. Session types
  3. full abstraction
  4. linear logic
  5. system F

Qualifiers

  • Research-article
  • Research
  • Refereed

Funding Sources

  • NOVA LINCS

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)129
  • Downloads (Last 6 weeks)24
Reflects downloads up to 31 Dec 2024

Other Metrics

Citations

Cited By

View all

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

HTML Format

View this article in HTML Format.

HTML Format

Login options

Full Access

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media