Skip to main content
QUICK REVIEW

[Paper Review] Subtyping Context-Free Session Types

Gil Silva, Andreia Mordido|arXiv (Cornell University)|Jan 1, 2023
Formal Methods in VerificationComputer Science4 citations
TL;DR

This paper proposes a novel subtyping relation for context-free session types based on XYZW-simulation, a generalized observational preorder that extends XY-simulation to handle non-regular recursion and co/contravariant message types. The authors present a sound algorithm for subtyping that encodes types into simple grammars and checks XYZW-similarity, enabling practical subtyping in a setting where traditional decidability fails.

ABSTRACT

Context-free session types describe structured patterns of communication on heterogeneously-typed channels, allowing the specification of protocols unconstrained by tail recursion. The enhanced expressive power provided by non-regular recursion comes, however, at the cost of the decidability of subtyping, even if equivalence is still decidable. We present an approach to subtyping context-free session types based on a novel kind of observational preorder we call $\mathcal{XYZW}$-simulation, which generalizes $\mathcal{XY}$-simulation (also known as covariant-contravariant simulation) and therefore also bisimulation and plain simulation. We further propose a subtyping algorithm that we prove to be sound, and present an empirical evaluation in the context of a compiler for a programming language. Due to the general nature of the simulation relation upon which it is built, this algorithm may also find applications in other domains.

Motivation & Objective

  • To address the undecidability of subtyping in context-free session types, which arises due to non-regular recursion.
  • To develop a semantic subtyping relation that captures behavioural compatibility beyond regular session types.
  • To design a sound, algorithmic subtyping method based on observational simulation for context-free session types.
  • To integrate subtyping with functional and higher-order session types, including linear and unrestricted functions.
  • To evaluate the performance of the algorithm and compare it with existing type equivalence techniques.

Proposed method

  • Introduces XYZW-simulation, a novel observational preorder generalizing XY-simulation to handle co/contravariant message types and non-regular recursion.
  • Defines semantic subtyping via XYZW-similarity between session type encodings in simple grammars.
  • Proposes a subtyping algorithm that first encodes session types into words of a simple grammar and then checks XYZW-similarity.
  • Uses type equivalence algorithms from Almeida et al. as a foundation, adapting them to subtyping via simulation.
  • Employs a three-phase algorithm: type encoding, simulation relation construction, and pruning of redundant pairs.
  • Generates valid and invalid subtyping pairs using structural properties of subtyping, with constraints on free references in covariant/contravariant positions.

Experimental results

Research questions

  • RQ1Can a sound and effective subtyping relation be defined for context-free session types despite undecidability?
  • RQ2How can co/contravariant message types be handled meaningfully in subtyping for non-regular session types?
  • RQ3Can XYZW-simulation provide a generalization of XY-simulation that supports non-regular recursion and higher-order types?
  • RQ4Is the proposed algorithm sound with respect to the semantic subtyping relation defined by XYZW-simulation?
  • RQ5How does the performance of the algorithm compare to existing type equivalence algorithms in practice?

Key findings

  • The proposed XYZW-simulation relation generalizes XY-simulation and enables semantic subtyping for context-free session types.
  • The subtyping algorithm is proven sound with respect to the XYZW-simulation-based semantic subtyping relation.
  • The algorithm is grammar-based and can be applied to other objects with non-regular and contravariant structures.
  • Empirical evaluation shows the algorithm performs well, with measurable efficiency in generating and validating subtyping pairs.
  • The method successfully handles complex cases involving recursion, message variance, and sequential composition.
  • The algorithm correctly identifies and discards invalid subtyping pairs through structural constraints and simulation checks.

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.