License: Creative Commons Attribution 3.0 Unported license (CC-BY 3.0)
When quoting this document, please refer to the following
DOI: 10.4230/LIPIcs.ECOOP.2020.29
URN: urn:nbn:de:0030-drops-131864
URL: https://drops.dagstuhl.de/opus/volltexte/2020/13186/
Go to the corresponding LIPIcs Volume Portal


Oliveira, Bruno C. d. S. ; Shaobo, Cui ; Rehman, Baber

The Duality of Subtyping

pdf-format:
LIPIcs-ECOOP-2020-29.pdf (0.7 MB)


Abstract

Subtyping is a concept frequently encountered in many programming languages and calculi. Various forms of subtyping exist for different type system features, including intersection types, union types or bounded quantification. Normally these features are designed independently of each other, without exploiting obvious similarities (or dualities) between features. This paper proposes a novel methodology for designing subtyping relations that exploits duality between features. At the core of our methodology is a generalization of subtyping relations, which we call Duotyping. Duotyping is parameterized by the mode of the relation. One of these modes is the usual subtyping, while another mode is supertyping (the dual of subtyping). Using the mode it is possible to generalize the usual rules of subtyping to account not only for the intended behaviour of one particular language construct, but also of its dual. Duotyping brings multiple benefits, including: shorter specifications and implementations, dual features that come essentially for free, as well as new proof techniques for various properties of subtyping. To evaluate a design based on Duotyping against traditional designs, we formalized various calculi with common OOP features (including union types, intersection types and bounded quantification) in Coq in both styles. Our results show that the metatheory when using Duotyping does not come at a significant cost: the metatheory with Duotyping has similar complexity and size compared to the metatheory for traditional designs. However, we discover new features as duals to well-known features. Furthermore, we also show that Duotyping can significantly simplify transitivity proofs for many of the calculi studied by us.

BibTeX - Entry

@InProceedings{oliveira_et_al:LIPIcs:2020:13186,
  author =	{Bruno C. d. S. Oliveira and Cui Shaobo and Baber Rehman},
  title =	{{The Duality of Subtyping}},
  booktitle =	{34th European Conference on Object-Oriented Programming (ECOOP 2020)},
  pages =	{29:1--29:29},
  series =	{Leibniz International Proceedings in Informatics (LIPIcs)},
  ISBN =	{978-3-95977-154-2},
  ISSN =	{1868-8969},
  year =	{2020},
  volume =	{166},
  editor =	{Robert Hirschfeld and Tobias Pape},
  publisher =	{Schloss Dagstuhl--Leibniz-Zentrum f{\"u}r Informatik},
  address =	{Dagstuhl, Germany},
  URL =		{https://drops.dagstuhl.de/opus/volltexte/2020/13186},
  URN =		{urn:nbn:de:0030-drops-131864},
  doi =		{10.4230/LIPIcs.ECOOP.2020.29},
  annote =	{Keywords: DuoTyping, OOP, Duality, Subtyping, Supertyping}
}

Keywords: DuoTyping, OOP, Duality, Subtyping, Supertyping
Collection: 34th European Conference on Object-Oriented Programming (ECOOP 2020)
Issue Date: 2020
Date of publication: 06.11.2020
Supplementary Material: ECOOP 2020 Artifact Evaluation approved artifact available at https://doi.org/10.4230/DARTS.6.2.8. https://github.com/baberrehman/coq-duotyping


DROPS-Home | Fulltext Search | Imprint | Privacy Published by LZI