Table of Contents
Fetching ...

On the Semantic Expressiveness of Iso- and Equi-Recursive Types

Dominique Devriese, Eric Mark Martin, Marco Patrignani

TL;DR

This paper studies the semantic expressiveness of STLC with iso- and equi-recursive types, proving that these formulations are equally expressive, and proves that they are both as expressive as STLC with only term-level recursion.

Abstract

Recursive types extend the simply-typed lambda calculus (STLC) with the additional expressive power to enable diverging computation and to encode recursive data-types (e.g., lists). Two formulations of recursive types exist: iso-recursive and equi-recursive. The relative advantages of iso- and equi-recursion are well-studied when it comes to their impact on type-inference. However, the relative semantic expressiveness of the two formulations remains unclear so far. This paper studies the semantic expressiveness of STLC with iso- and equi-recursive types, proving that these formulations are equally expressive. In fact, we prove that they are both as expressive as STLC with only term-level recursion. We phrase these equi-expressiveness results in terms of full abstraction of three canonical compilers between these three languages (STLC with iso-, with equi-recursive types and with term-level recursion). Our choice of languages allows us to study expressiveness when interacting over both a simply-typed and a recursively-typed interface. The three proofs all rely on a typed version of a proof technique called approximate backtranslation. Together, our results show that there is no difference in semantic expressiveness between STLCs with iso- and equi-recursive types. In this paper, we focus on a simply-typed setting but we believe our results scale to more powerful type systems like System F.

On the Semantic Expressiveness of Iso- and Equi-Recursive Types

TL;DR

This paper studies the semantic expressiveness of STLC with iso- and equi-recursive types, proving that these formulations are equally expressive, and proves that they are both as expressive as STLC with only term-level recursion.

Abstract

Recursive types extend the simply-typed lambda calculus (STLC) with the additional expressive power to enable diverging computation and to encode recursive data-types (e.g., lists). Two formulations of recursive types exist: iso-recursive and equi-recursive. The relative advantages of iso- and equi-recursion are well-studied when it comes to their impact on type-inference. However, the relative semantic expressiveness of the two formulations remains unclear so far. This paper studies the semantic expressiveness of STLC with iso- and equi-recursive types, proving that these formulations are equally expressive. In fact, we prove that they are both as expressive as STLC with only term-level recursion. We phrase these equi-expressiveness results in terms of full abstraction of three canonical compilers between these three languages (STLC with iso-, with equi-recursive types and with term-level recursion). Our choice of languages allows us to study expressiveness when interacting over both a simply-typed and a recursively-typed interface. The three proofs all rely on a typed version of a proof technique called approximate backtranslation. Together, our results show that there is no difference in semantic expressiveness between STLCs with iso- and equi-recursive types. In this paper, we focus on a simply-typed setting but we believe our results scale to more powerful type systems like System F.

Paper Structure

This paper contains 28 sections, 26 theorems, 80 equations, 15 figures.

Key Result

Theorem 2.2

Figures (15)

  • Figure 1: Our contributions, visually. Full arrows indicate canonical embeddings ${\color{black }{\left\llbracket {{\color{black }{\cdot}}} \right\rrbracket^{}_{}}}$ while dotted ones are (approximate) backtranslations ${\color{black }{\left\langle\!\left\langle {\cdot} \right\rangle\!\right\rangle^{}_{}}}$. Translations' superscripts indicate input languages while their subscripts indicate output languages.
  • Figure 2: Worlds, observations and related technicalities. These are typeset for the relation between $\mathsf{{\color{RoyalBlue}{\lambda^{fx}_{}}}}$ and $\mathbf{{\color{RedOrange }{\bm{{\color{RedOrange }{\lambda}}}^{\bm{{\color{RedOrange }{\mu}}}}_{I}}}}$ but the other ones do not change.
  • Figure 3: Part of the three cross-language logical relations we rely on (classical bits) and its auxiliary functions.
  • Figure 4: Diagram breakdown of the reflection (left) and preservation (right) proofs of fully-abstract compilation.
  • Figure 5: The type of backtranslated terms.
  • ...and 10 more figures

Theorems & Definitions (47)

  • Definition 2.1: Termination
  • Theorem 2.2: Relation between Termination and Size-Bound Termination
  • Definition 2.3: Logical relation up to $n$ steps for $\mathit{LR}^{\mathsf{{\color{RoyalBlue}{fx}}}}_{{\mathbf{{\color{RedOrange }{\bm{{\color{RedOrange }{\mu}}} I}}}}}$
  • Definition 2.4: $\mathit{LR}^{\mathsf{{\color{RoyalBlue}{fx}}}}_{{\mathbf{{\color{RedOrange }{\bm{{\color{RedOrange }{\mu}}} I}}}}}$ Logical relation
  • Definition 2.5: $\mathit{LR}^{{\mathbf{{\color{RedOrange }{\bm{{\color{RedOrange }{\mu}}} I}}}}}_{\mathit{{\color{CarnationPink }{\mu E}}}}$ Logical relation
  • Definition 2.6: $\mathit{LR}^{\mathsf{{\color{RoyalBlue}{fx}}}}_{\mathit{{\color{CarnationPink }{\mu E}}}}$ Logical relation
  • Definition 2.7: $\mathit{LR}^{\mathsf{{\color{RoyalBlue}{fx}}}}_{{\mathbf{{\color{RedOrange }{\bm{{\color{RedOrange }{\mu}}} I}}}}}$ Logical relation for program contexts
  • Definition 2.8: $\mathit{LR}^{{\mathbf{{\color{RedOrange }{\bm{{\color{RedOrange }{\mu}}} I}}}}}_{\mathit{{\color{CarnationPink }{\mu E}}}}$ Logical relation for program contexts
  • Definition 2.9: $\mathit{LR}^{\mathsf{{\color{RoyalBlue}{fx}}}}_{\mathit{{\color{CarnationPink }{\mu E}}}}$ Logical relation for program contexts
  • Lemma 2.10: Adequacy for $\mathop{\mathrm{\operatorname{\approx}^{}}}\nolimits$ for $\mathit{LR}^{\mathsf{{\color{RoyalBlue}{fx}}}}_{{\mathbf{{\color{RedOrange }{\bm{{\color{RedOrange }{\mu}}} I}}}}}$
  • ...and 37 more