Statically verified refinements for multiparty protocols

With distributed computing becoming ubiquitous in the modern era, safe distributed programming is an open challenge. To address this, multiparty session types (MPST) provide a typing discipline for message-passing concurrency, guaranteeing communication safety properties such as deadlock freedom. While originally MPST focus on the communication aspects, and employ a simple typing system for communication payloads, communication protocols in the real world usually contain constraints on the payload. We introduce refined multiparty session types (RMPST), an extension of MPST, that express data dependent protocols via refinement types on the data types. We provide an implementation of RMPST, in a toolchain called Session*, using Scribble, a toolchain for multiparty protocols, and targeting F*, a verification-oriented functional programming language. Users can describe a protocol in Scribble and implement the endpoints in F* using refinement-typed APIs generated from the protocol. The F* compiler can then statically verify the refinements. Moreover, we use a novel approach of callback-styled API generation, providing static linearity guarantees with the inversion of control. We evaluate our approach with real world examples and show that it has little overhead compared to a naive implementation, while guaranteeing safety properties from the underlying theory.

[1]  Cédric Fournet,et al.  Cryptographic Protocol Synthesis and Verification for Multiparty Sessions , 2009, 2009 22nd IEEE Computer Security Foundations Symposium.

[2]  Nobuko Yoshida,et al.  A Linear Decomposition of Multiparty Sessions for Safe Distributed Programming , 2017, ECOOP.

[3]  Frank Pfenning,et al.  Intensionality, extensionality, and proof irrelevance in modal type theory , 2001, Proceedings 16th Annual IEEE Symposium on Logic in Computer Science.

[4]  Robbert Krebbers,et al.  Actris: session-type based reasoning in separation logic , 2019, Proc. ACM Program. Lang..

[5]  Nobuko Yoshida,et al.  Session-Based Distributed Programming in Java , 2008, ECOOP.

[6]  Nikolaj Bjørner,et al.  Z3: An Efficient SMT Solver , 2008, TACAS.

[7]  Patrick Maxim Rondon,et al.  Liquid types , 2008, PLDI '08.

[8]  António Ravara,et al.  Behavioural Types: from Theory to Tools , 2017 .

[9]  Andrew D. Gordon,et al.  Modular verification of security protocol code by typing , 2010, POPL '10.

[10]  Peter Thiemann,et al.  Gradual session types , 2017, Journal of Functional Programming.

[11]  Frank Pfenning,et al.  Refinement types for ML , 1991, PLDI '91.

[12]  Davide Ancona,et al.  Behavioral Types in Programming Languages , 2016, Found. Trends Program. Lang..

[13]  Andreas Abel,et al.  On Irrelevance and Algorithmic Equality in Predicative Type Theory , 2012, Log. Methods Comput. Sci..

[14]  Nobuko Yoshida,et al.  A session type provider: compile-time API generation of distributed protocols with refinements in F# , 2018, CC.

[15]  Dominic A. Orchard,et al.  Session Types with Linearity in Haskell , 2017 .

[16]  Éric Tanter,et al.  Gradual refinement types , 2017, POPL.

[17]  Nobuko Yoshida,et al.  SPY: Local Verification of Global Protocols , 2013, RV.

[18]  Nobuko Yoshida,et al.  Featherweight Scribble , 2019, Models, Languages, and Tools for Concurrent and Distributed Programming.

[19]  Laura Bocchi,et al.  A Multiparty Multi-session Logic , 2012, TGC.

[20]  Raymond Hu Programming Using Java APIs Generated from Session Types , 2017 .

[21]  Andrew D. Gordon,et al.  Semantic subtyping with an SMT solver , 2010, ICFP '10.

[22]  Philip Wadler,et al.  Refinement reflection: complete verification with SMT , 2017, Proc. ACM Program. Lang..

[23]  Frank Pfenning,et al.  Session Types with Arithmetic Refinements , 2020, CONCUR.

[24]  Wim Vanderbauwhede,et al.  Value-Dependent Session Design in a Dependently Typed Language , 2019, PLACES@ETAPS.

[25]  Nobuko Yoshida,et al.  Distributed programming using role-parametric session types in go: statically-typed endpoint APIs for dynamically-instantiated communication structures , 2019, Proc. ACM Program. Lang..

[26]  Romain Demangeon,et al.  Nested Protocols in Session Types , 2012, CONCUR.

[27]  Ranjit Jhala,et al.  Refinement types for Haskell , 2014, ICFP.

[28]  Andrew D. Gordon,et al.  Refinement Types for Secure Implementations , 2008, 2008 21st IEEE Computer Security Foundations Symposium.

[29]  Daniel Brand,et al.  On Communicating Finite-State Machines , 1983, JACM.

[30]  Nadia Polikarpova,et al.  Liquid resource types , 2020, Proc. ACM Program. Lang..

[31]  Bernardo Toninho,et al.  Certifying data in multiparty session types , 2017, J. Log. Algebraic Methods Program..

[32]  Peter Thiemann,et al.  Label-dependent session types , 2019, Proc. ACM Program. Lang..

[33]  Deian Stefan,et al.  Liquid information flow control , 2020, Proc. ACM Program. Lang..

[34]  Pierre-Yves Strub,et al.  Dependent types and multi-monadic effects in F* , 2016, POPL.

[35]  Laura Bocchi,et al.  A Theory of Design-by-Contract for Distributed Multiparty Interactions , 2010, CONCUR.

[36]  Nobuko Yoshida,et al.  Multiparty Compatibility in Communicating Automata: Characterisation and Synthesis of Global Session Types , 2013, ICALP.

[37]  Roy T. Fielding,et al.  Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing , 2014, RFC.

[38]  Nobuko Yoshida,et al.  Hybrid Session Verification Through Endpoint API Generation , 2016, FASE.

[39]  Viktor Kuncak,et al.  SMT-based checking of predicate-qualified types for Scala , 2016, SCALA@SPLASH.

[40]  Nobuko Yoshida,et al.  Multiparty asynchronous session types , 2008, POPL '08.

[41]  Nikhil Swamy,et al.  SteelCore: an extensible concurrent separation logic for effectful dependently typed programs , 2020, Proc. ACM Program. Lang..

[42]  Nobuko Yoshida,et al.  Session-ocaml: A Session-Based Library with Polarities and Lenses , 2017, COORDINATION.

[43]  Nobuko Yoshida,et al.  Protocols by Default - Safe MPI Code Generation Based on Session Types , 2015, CC.

[44]  Nobuko Yoshida,et al.  Parameterised Multiparty Session Types , 2010, Log. Methods Comput. Sci..

[45]  Graham Hutton,et al.  Liquidate your assets: reasoning about resource usage in liquid Haskell , 2020, Proc. ACM Program. Lang..

[46]  Shoji Yuen,et al.  Multiparty Session Programming with Global Protocol Combinators , 2020, ArXiv.