Isomorphisms of types in the presence of higher-order references (extended version)
We investigate the problem of type isomorphisms in the presence of higher-order references. We first introduce a finitary programming language with sum types and higher-order references, for which we build a fully abstract games model following the work of Abramsky, Honda and McCusker. Solving an open problem by Laurent, we show that two finitely branching arenas are isomorphic if and only if they are geometrically the same, up to renaming of moves (Laurent’s forest isomorphism). We deduce from this an equational theory characterizing isomorphisms of types in our language. We show however that Laurent’s conjecture does not hold on infinitely branching arenas, yielding new non-trivial type isomorphisms in a variant of our language with natural numbers.
💡 Research Summary
The paper tackles the long‑standing problem of characterising type isomorphisms in languages that combine higher‑order references with sum types. The authors first define a finitary λ‑calculus‑style language L that includes base values, function types, binary sum types (A + B) and reference types (ref A). References are first‑class and may be passed to or returned from higher‑order functions, thus modelling the mutable memory effects found in real‑world languages.
To give L a mathematically precise semantics, the authors adapt the game‑theoretic framework of Abramsky, Honda and McCusker. Each type is interpreted as an arena: a rooted forest of moves where Player (the program) and Opponent (the environment) exchange questions and answers. Sums are modelled by a choice move that selects one of the sub‑arenas; references are modelled by a “location” move together with read and write answer moves. Higher‑order references are represented by nesting arenas, allowing the same memory cell to be duplicated and accessed at multiple levels.
The central technical contribution is a complete isomorphism theorem for finite‑branching arenas. Building on a conjecture of Laurent (the “forest isomorphism” conjecture), the authors prove that two such arenas are isomorphic precisely when they are identical up to a renaming of moves. The proof proceeds by (1) normalising strategies to eliminate redundant internal moves, (2) constructing a bijective mapping between the normalised strategies that preserves the justification structure, and (3) exploiting finiteness of branching to rule out infinite back‑and‑forth constructions. Crucially, the argument shows that the copy‑cat behaviour of references and the choice behaviour of sums commute, so that even when references appear inside function types the structural isomorphism remains unchanged.
From this theorem the authors extract an equational theory E that completely characterises type isomorphisms in L. E contains the familiar laws for functions (A → B) ≅ (C → D) iff A ≅ C and B ≅ D, the commutativity and associativity of sums, and a set of novel rules involving references:
- ref (A → B) ≅ (ref A) → (ref B)
- (A × ref B) ≅ ref (A × B) (when A is a value type)
- ref A ≅ ref B iff A ≅ B
These equations demonstrate that mutable cells can be moved across function boundaries without changing the observable behaviour, a phenomenon absent in pure functional languages. The authors also prove that the above rules are sound and complete with respect to the game model: any two types that are provably isomorphic in E have isomorphic arenas, and conversely any arena isomorphism yields a derivation in E.
The second major part of the paper investigates infinitely branching arenas, which arise when the language is extended with a natural‑number type Nat. Laurent’s conjecture fails in this setting. By constructing a variant L′ that includes Nat, the authors exhibit a non‑trivial isomorphism Nat ≅ Nat → Nat. The intuition is that an arena with infinitely many initial moves (the natural numbers) can be “folded” into a function arena that repeatedly queries the same infinite choice. This shows that infinite duplication and infinite choice give rise to new isomorphisms that cannot be captured by the finite‑branching forest‑isomorphism theorem.
The paper concludes with a discussion of implications. For language designers, the equational theory provides a solid basis for optimisation passes that rewrite programs using type isomorphisms, even in the presence of mutable state. For theorists, the separation between finite and infinite branching highlights a boundary where decidability of isomorphism may break down. Finally, the work showcases the power of game semantics as a fully abstract bridge between operational language features and categorical notions of type equivalence, and points to future extensions involving concurrency, exceptions, or richer effect systems, as well as the development of automated tools for checking type isomorphisms in realistic languages.