Efficient and Flexible Matching of Recursive Types

  • Authors:
  • Jens Palsberg;Tian Zhao

  • Affiliations:
  • -;-

  • Venue:
  • LICS '00 Proceedings of the 15th Annual IEEE Symposium on Logic in Computer Science
  • Year:
  • 2000

Quantified Score

Hi-index 0.00

Visualization

Abstract

Equality and subtyping of recursive types have been studied in the 1990s by Amadio and Cardelli; Kozen, Palsberg, and Schwartzbach; Brandt and Henglein; and others. Potential applications include automatic generation of bridge code for multi-language systems and type-based retrieval of software modules from libraries. Auerbach, Barton, and Raghavachari advocate a highly flexible combination of matching rules for which there, until now, are no efficient algorithmic techniques. In this paper, we present an efficient decision procedure for a notion of type equality that includes unfolding of recursive types, and associativity and commutativity of product types, as advocated by Auerbach et al. For two types of size at most n, our algorithm decides equality in O(n2) time. The algorithm iteratively prunes a set of type pairs, and eventually it produces a set of pairs of equal types. In each iteration, the algorithm exploits a so-called coherence property of the set of type pairs produced in the preceding iteration. The algorithm takes O(n) iterations each of which takes O(n) time, for a total of O(n2) time.