Hostname: page-component-7c8c6479df-995ml Total loading time: 0 Render date: 2024-03-29T02:24:52.191Z Has data issue: false hasContentIssue false

A computational view of implicit coercions in type theory

Published online by Cambridge University Press:  04 October 2005

GILLES BARTHE
Affiliation:
INRIA Sophia Antipolis, 2004 Route des Lucioles BP 93, 06902 Sophia Antipolis Cedex, France Email: Gilles.Barthe@sophia.inria.fr

Abstract

Type isomorphisms are pairs of functions $f:A\rightarrow B$ and $g:B\rightarrow A$ that are mutually inverse with respect to convertibility. They can be used in the context of type checking to perform type checking modulo type isomorphisms, by adopting the rule $$\frac{a:A}{a:B}$$ whenever $f:A\rightarrow B$ and $g:B\rightarrow A$ have been declared as type isomorphisms. Type isomorphisms may be viewed as a special instance of coercions that provide embeddings of one type into another. Indeed, type systems for coercive subtyping feature a rule $$\frac{a:A}{a:B}$$ whenever there exists a coercion $f:A\rightarrow B$. By declaring $f$ and $g$ as coercions for every type isomorphism $f:A\rightarrow B$ and $g:B\rightarrow A$, one can simulate type-checking modulo type isomorphisms. However, the proposed encoding relies on the possibility of declaring coercions $f:A\rightarrow B$ and $g:B\rightarrow A$ simultaneously. Such coercions, which we call back-and-forth coercions, are only allowed provided $f$ and $g$ are mutually inverse. In principle, type isomorphisms, viewed as back-and-forth coercions, could be used in the context of proof assistants based on dependent type theory in order to relate equivalent representations of mathematical notions, for example, the polar and cartesian representations of complex numbers. However, the coercions that map one representation into another are not mutually inverse because of the intensional nature of dependent type theories. Consequently, the standard concept of type isomorphisms has limited applicability in the context of proof assistants.

In order to circumvent this problem, we develop a computational interpretation of implicit coercions that allows for the definition of back-and-forth coercions without requiring them to be mutually inverse. We illustrate the usefulness of our approach in a number of formal developments that require us to navigate between different representations of mathematical objects or structures. We also discuss important meta-theoretical properties of our interpretation.

Type
Paper
Copyright
2005 Cambridge University Press

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)