A computational view of implicit coercions in type theory

  • Authors:
  • Gilles Barthe

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

  • Venue:
  • Mathematical Structures in Computer Science
  • Year:
  • 2005

Quantified Score

Hi-index 0.00

Visualization

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.