Skip to main content
QUICK REVIEW

[Paper Review] Dependent Session Types

Hanwen Wu, Hongwei Xi|arXiv (Cornell University)|Apr 24, 2017
Logic, programming, and type systemsComputer Science7 references5 citations
TL;DR

This paper introduces dependent session types in a linear, DML-style type system, enabling precise, compile-time enforcement of communication protocols in concurrent programs. By integrating dependent types with session types via a layered static-dynamic separation, it ensures linearity and duality without runtime checks, and demonstrates practicality through an ATS-to-Erlang compiler backend with verified channel behaviors.

ABSTRACT

Session types offer a type-based discipline for enforcing communication protocols in distributed programming. We have previously formalized simple session types in the setting of multi-threaded $λ$-calculus with linear types. In this work, we build upon our earlier work by presenting a form of dependent session types (of DML-style). The type system we formulate provides linearity and duality guarantees with no need for any runtime checks or special encodings. Our formulation of dependent session types is the first of its kind, and it is particularly suitable for practical implementation. As an example, we describe one implementation written in ATS that compiles to an Erlang/Elixir back-end.

Motivation & Objective

  • To extend linear session types with dependent types to express protocols that depend on values, improving precision in concurrent communication.
  • To ensure type safety, linearity, and duality in session communication without runtime checks or special encodings.
  • To provide a practical, implementable foundation for dependent session types in a real programming language (ATS) with a backend to Erlang/Elixir.
  • To formalize global session types with quantifiers and singleton types to describe protocols that depend on concrete values like integers and booleans.
  • To support advanced session constructs such as branching, iteration, and recursion through a proof-theoretic type system.

Proposed method

  • The paper uses a layered Applied Type System (ATS) where statics (types and propositions) are separated from dynamics (programs and values), enabling dependent types and linear types to coexist.
  • Session types are defined as static terms of sort 'stype', and communication channels are linear dynamic values whose types are indexed by these session protocols.
  • The system introduces global quantification via 'quan' to express universal and existential dependencies across roles, allowing endpoints to be typed based on global protocol structure.
  • Singleton types such as 'int(i)' and 'bool(b)' represent values equal to specific constants, enabling dependent refinement of message types.
  • Key operations like 'exify', 'unify', 'itet', 'itef', 'recurse', and 'cut' are defined to handle type-level reasoning and protocol composition at runtime.
  • The type system is formalized with reduction rules and evaluation contexts for pools, ensuring type safety and protocol fidelity during execution.

Experimental results

Research questions

  • RQ1How can dependent types be integrated with session types to express communication protocols that depend on concrete values?
  • RQ2Can a linear, dependent type system enforce session fidelity and duality without relying on runtime checks or special encodings?
  • RQ3How can global session types with quantifiers be used to describe protocols that are parametric over values, such as equality testing with arbitrary integers?
  • RQ4What is the role of a layered static-dynamic type system in enabling practical implementation of dependent session types?
  • RQ5How can advanced session constructs like branching, iteration, and recursion be type-safe and verified in a dependent session type system?

Key findings

  • The proposed dependent session type system successfully enforces communication protocols at compile time, ensuring that all channel operations adhere to the specified global protocol.
  • The system guarantees linearity and duality through static type checking, eliminating the need for runtime checks or complex runtime encodings.
  • The implementation in ATS compiles to Erlang/Elixir, demonstrating practical feasibility and interoperability with existing concurrent systems.
  • The use of singleton types like 'int(i)' and 'bool(b)' allows precise type-level reflection of values, enabling dependent refinement of message types.
  • The type system supports complex session constructs such as branching, iteration, and recursion through proof-theoretic operations like 'unify', 'itet', 'itef', and 'recurse'.
  • Reduction rules for pools ensure that protocol composition and channel interaction are type-safe and preserve session fidelity during execution.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.