arXiv:2610.32558cs.PLOct 2026

Manuscript Offprint

arXiv:2610.32558

On the Expressiveness of Asynchronous Processes with Nested Session Types

Sjors Wortelboer, Dan Frumin, Jorge A. Pérez

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original. This text is shared under the same licence.

Sjors Wortelboer Dan Frumin Jorge A. Pérez

University of Groningen, The Netherlands

Session types are a type-based approach to correct message-passing programs, where types specify protocols for channels and type checking guarantees communication correctness. Traditional session types express regular protocols only, which leaves out many protocols found in practice. Aiming at overcoming this limitation, Nested Session Types (NSTs) can specify nested recursive protocols. NSTs are known to be characterised by one-counter machines and deterministic context-free languages. In this paper, we study the expressiveness of ASP (Asynchronous Session Processes), the process model associated with NSTs as introduced by Das et al.. We prove that ASP is Turing complete by giving a correct encoding of two-counter machines into typed processes. Our encoding uses a non-trivial state-aware representation of counters and instructions that is neatly governed by NSTs.

1 Introduction

Ensuring the correctness of the message-passing programs that underpin large-scale distributed systems is a fascinating and pressing challenge. We are interested in compositional approaches to program verification where types specify protocols for channels and type checking statically guarantees communication correctness for implementations, specified as processes in some suitable formalism. In this approach, expressiveness is a primary concern, in two ways: first, we aim for rich type systems that can express communication structures found in real-world scenarios; second, since types soundly enforce correctness by constraining admissible program behaviours, we would like to determine the expressiveness of the resulting typed processes—which correct programs can be expressed in a typed setting and which cannot. In this paper, we study the expressiveness of a process language with Nested Session Types (NSTs) by Das et al. [9, 10]. NSTs are among the most expressive type systems for concurrency proposed to date.

Session types specify the order and type of messages to be exchanged on a channel [12, 13]. Traditional session types can express regular protocols, as a communication action and a continuation protocol can be composed. However, many practical protocols are not regular; examples include protocols for the (de)serialisation of tree-structured data [22] and for (buffered) message relaying [14]. The quest for more expressive session types led to the context-free session types by Thiemann and Vasconcelos [22]. In context-free session types, generalised protocol composition combined with polymorphic recursion enables the specification of context-free protocols. NSTs achieve high expressivity using different means, namely nested type constructors, which allow recursive type parameters to act like a stack.

A crucial step in laying the foundations of non-regular session types is studying what we may refer to as their intrinsic expressiveness: the properties of these infinite structures in themselves, independent of a target programming model. Important notions for verification (type duality, type equality, subtyping) concern types in isolation. In this respect, the theory of context-free session types is well-developed [1, 2, 21]; for NSTs, Das et al. prove that type equality is decidable and give a sound algorithm. Gay et al. [11] offer a unified treatment of intrinsic expressiveness results for recursive session types. They complement the results in [9, 10] and obtain a strict hierarchy where NSTs are precisely characterised by one-counter machines and deterministic context-free languages, with decidable type equivalence and duality.

Preliminary Report. Final version to appear in: EXPRESS/SOS 2026

© S. Wortelboer, D. Frumin & J.A. Pérez

This work is licensed under the

Creative Commons Attribution License.

On the Expressiveness of Asynchronous Processes with Nested Session Types

In this paper, we pursue a different yet complementary goal: establishing the expressiveness of the language underlying NSTs, as introduced by Das et al. [9, 10]. We refer to this language as ASP (Asynchronous Session Processes). The language implements asynchronous communication in configurations, which contain processes; its formulation follows the Curry-Howard correspondence between intuitionistic linear logic and session types [8]. As a result, well-typed configurations in ASP enjoy confluence and deadlock freedom. However, the question of the expressiveness of well-typed ASP configurations remains open. Given the context-free nature of NSTs and the decidability of their key properties, we investigate whether the synchronisation mechanisms in ASP, together with the intrinsic expressiveness of types, suffice to obtain Turing completeness.

Our main result answers this question affirmatively. We prove that ASP is Turing complete by correctly encoding Minsky machines [19]. Minsky machines are a Turing-complete model that consists of two counters with a finite set of instructions; instructions can either increment a counter, decrement it (if the counter's current value is not zero), or jump to a given instruction (if the value is zero). With this minimal state and set of possible instructions, Minsky machines are, arguably, a simpler source for encoding, compared to Turing machines. Let us briefly discuss how we model Minsky machines in ASP.

Intuitively, counters can be implemented as stacks using polymorphic nested types to capture state at the type level. Given a natural m, we define the nested type

∣m∣={0[]ifm=0S[∣m−1∣]ifm>0\left|m\right|=\begin{cases}0[]&if m=0\\S[\left|m-1\right|]&if m>0\end{cases}

where 0 and S stand for (parametric) type definitions for zero and successor, given as follows:

0[]≜&{incr ⁣:S[0]],jump ⁣:0[]}S[α]≜&{incr ⁣:S[S[α]],decr ⁣:α}0[]\triangleq\&\{\mathrm{i n c r}\colon S[0]],\mathrm{j u m p}\colon0[]\}\qquad S[\alpha]\triangleq\&\{\mathrm{i n c r}\colon S[S[\alpha]],\mathrm{d e c r}\colon\alpha\}

Expressed as a branching type (&, external choice), this nested session type captures the protocol that specifies the correct state after executing an instruction, using nested types and polymorphic recursion. This way, e.g., 0[] admits increment and jump (but not decrement) and S[α]S[\alpha] admits increment and decrement (but not jump) by suitably modifying the nesting of the type variable α\alpha, the parameter of S. Such counter types can then be combined on the process level (by a process that we will denote [m]r[m]_{r}) with the consequence that processes representing instructions are required to be state-aware: they need a separate mechanism to keep track of the combined state of the two counters. This is where NSTs enable a continuation of the state-aware processes, allowing transitions to be captured at the level of processes.

Overall, we believe that our encoding of Minsky machines is a significant test of the expressiveness of the coupling of ASP and NSTs. Indeed, we achieve a pleasant design in which NSTs elegantly govern the correct behaviours of the encodings of counters and instructions, and their interactions.

The rest of the paper is structured as follows. Section 2 recalls background notions of ASP and NSTs and the definition of Minsky machines. The encoding of Minsky machines in ASP is presented and illustrated in Section 3; its correctness is given in terms of typability (Theorem 4) and operational correspondence (Theorems 5 and 6). Section 4 concludes the paper and discusses some related work.

References (8)