Hostname: page-component-74656f9884-2dmjx Total loading time: 0 Render date: 2026-11-09T21:16:43.781Z Has data issue: false hasContentIssue false

Taming the Merge Operator

Published online by Cambridge University Press:  02 November 2021

XUEJING HUANG
Affiliation:
Department of Computer Science, The University of Hong Kong, Pokfulam, Hong Kong (e-mail: xjhuang@cs.hku.hk)
JINXU ZHAO
Affiliation:
Department of Computer Science, The University of Hong Kong, Pokfulam, Hong Kong (e-mail: jxzhao@cs.hku.hk)
BRUNO C. D. S. OLIVEIRA
Affiliation:
Department of Computer Science, The University of Hong Kong, Pokfulam, Hong Kong (e-mail: bruno@cs.hku.hk)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the 'Save PDF' action button.

Calculi with disjoint intersection types support a symmetric merge operator with subtyping. The merge operator generalizes record concatenation to any type, enabling expressive forms of object composition, and simple solutions to hard modularity problems. Unfortunately, recent calculi with disjoint intersection types and the merge operator lack a (direct) operational semantics with expected properties such as determinism and subject reduction, and only account for terminating programs. This paper proposes a type-directed operational semantics (TDOS) for calculi with intersection types and a merge operator. We study two variants of calculi in the literature. The first calculus, called λi, is a variant of a calculus presented by Oliveira et al. (2016) and closely related to another calculus by Dunfield (2014). Although Dunfield proposes a direct small-step semantics for her calculus, her semantics lacks both determinism and subject reduction. Using our TDOS, we obtain a direct semantics for λi that has both properties. The second calculus, called λi+, employs the well-known subtyping relation of Barendregt, Coppo and Dezani-Ciancaglini (BCD). Therefore, λi+ extends the more basic subtyping relation of λi, and also adds support for record types and nested composition (which enables recursive composition of merged components). To fully obtain determinism, both λi and λi+ employ a disjointness restriction proposed in the original λi calculus. As an added benefit the TDOS approach deals with recursion in a straightforward way, unlike previous calculi with disjoint intersection types where recursion is problematic. We relate the static and dynamic semantics of λi to the original version of the calculus and the calculus by Dunfield. Furthermore, for λi+, we show a novel formulation of BCD subtyping, which is algorithmic, has a very simple proof of transitivity and allows for the modular addition of distributivity rules (i.e. without affecting other rules of subtyping). All results have been fully formalized in the Coq theorem prover.

Information

Type
Research Article
Copyright
© The Author(s), 2021. Published by Cambridge University Press
Submit a response

Discussions

No Discussions have been published for this article.