[Paper Review] A Sound Algorithm for Asynchronous Session Subtyping and its Implementation
This paper presents a sound, but incomplete, algorithm for checking asynchronous session subtyping based on a tree representation of coinductive subtyping relations. It detects finite witnesses of infinite successful subtrees to determine subtyping, enabling practical verification of session types in systems with unbounded asynchrony, and implements the algorithm in a tool that efficiently handles real-world examples within seconds.
Session types, types for structuring communication between endpoints in distributed systems, are recently being integrated into mainstream programming languages. In practice, a very important notion for dealing with such types is that of subtyping, since it allows for typing larger classes of system, where a program has not precisely the expected behaviour but a similar one. Unfortunately, recent work has shown that subtyping for session types in an asynchronous setting is undecidable. To cope with this negative result, the only approaches we are aware of either restrict the syntax of session types or limit communication (by considering forms of bounded asynchrony). Both approaches are too restrictive in practice, hence we proceed differently by presenting an algorithm for checking subtyping which is sound, but not complete (in some cases it terminates without returning a decisive verdict). The algorithm is based on a tree representation of the coinductive definition of asynchronous subtyping; this tree could be infinite, and the algorithm checks for the presence of finite witnesses of infinite successful subtrees. Furthermore, we provide a tool that implements our algorithm. We use this tool to test our algorithm on many examples that cannot be managed with the previous approaches, and to provide an empirical evaluation of the time and space cost of the algorithm.
Motivation & Objective
- Address the undecidability of asynchronous session subtyping by proposing a sound, yet incomplete, algorithm that avoids syntactic restrictions or bounded communication.
- Enable practical subtyping checks for session types in systems using unbounded FIFO channels, common in modern languages like Go and Rust.
- Provide a tool that supports empirical evaluation and handles complex, non-trivial examples beyond the reach of prior approaches.
- Establish a connection between asynchronous session subtyping and safety in communicating machines, enabling verification of deadlock-free behavior.
- Lay the foundation for future extensions to multiparty session types and pre-emption mechanisms in communication protocols.
Proposed method
- Represent the coinductive definition of asynchronous subtyping as a potentially infinite tree, where nodes correspond to subtyping judgments.
- Use a finite-state exploration strategy to detect cycles in the tree, where repeated states serve as witnesses of infinite successful subtrees.
- Apply a depth-first search with memoization to avoid redundant exploration of equivalent subtyping states.
- Introduce a termination condition based on detecting previously visited state sets, ensuring soundness even when the tree is infinite.
- Implement the algorithm in a tool that supports parsing session types, constructing the subtyping tree, and checking for finite witnesses of infinite success.
- Optimize the algorithm with pruning and caching techniques to improve performance on typical communication protocols.

Experimental results
Research questions
- RQ1Can a sound algorithm for asynchronous session subtyping be designed that avoids the undecidability of the general problem?
- RQ2Can such an algorithm handle non-trivial examples involving unbounded asynchrony and complex message ordering patterns?
- RQ3Is it possible to detect infinite successful subtrees using finite witnesses, enabling practical subtyping checks?
- RQ4How does the algorithm's performance scale on realistic session types from production code, such as those in Go or Rust?
- RQ5Can the algorithm be extended to support multiparty session types or pre-emption mechanisms in future work?
Key findings
- The algorithm is sound: if it returns 'subtype', the subtyping relation holds; if it returns 'not subtype', the relation does not hold.
- The algorithm terminates within one second for typical session types with three to four communication primitives per channel and two branching choices on average.
- The implementation successfully verifies examples that previous approaches—restricted to bounded asynchrony or syntactic limitations—cannot handle.
- The algorithm detects infinite successful subtrees through finite witnesses of repeated state sets, enabling sound subtyping decisions in non-trivial cases.
- Empirical evaluation confirms the algorithm's practicality despite its worst-case exponential complexity in state set enumeration.
- The approach establishes a correspondence between asynchronous session subtyping and safety in communicating machines, supporting verification of deadlock-free behavior.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.