Hostname: page-component-848d4c4894-hfldf Total loading time: 0 Render date: 2024-05-14T01:53:57.282Z Has data issue: false hasContentIssue false

Efficient recursive subtyping

Published online by Cambridge University Press:  04 March 2009

Dexter Kozen
Affiliation:
Computer Science Department, Cornell University, Ithaca, New York 14853, USA
Jens Palsberg
Affiliation:
Computer Science Department, Aarhus University, 8000 Aarhus C, Denmark
Michael I. Schwartzbach
Affiliation:
Computer Science Department, Aarhus University, 8000 Aarhus C, Denmark

Abstract

Subtyping in the presence of recursive types for the λ-calculus was studied by Amadio and Cardelli in 1991 (Amadio and Cardelli 1991). In that paper they showed that the problem of deciding whether one recursive type is a subtype of another is decidable in exponential time. In this paper we give an 0(n2) algorithm. Our algorithm is based on a simplification of the definition of the subtype relation, which allows us to reduce the problem to the emptiness problem for a certain finite automaton with quadratically many states.

It is known that equality of recursive types and the covariant Bohm order can be decided efficiently by means of finite automata, since they are just language equality and language inclusion, respectively. Our results extend the automata-theoretic approach to handle orderings based on contravariance.

Type
Research Article
Copyright
Copyright © Cambridge University Press 1995

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.)

References

Amadio, R. M. and Cardelli, L. (1991) Subtyping recursive types. In: Proc. 18th Symp. Princip. Programming Lang., ACM 104–118.CrossRefGoogle Scholar
Cardelli, L. (1985) Amber. In: Combinators and Functional Programming Languages, Proc. 13th Summer School School of the LITP. Springer- Verlag Lecture Notes in Computer Science 242.Google Scholar
Cardelli, L. (1989) Typeful programming. In: Lect. Notes for the IFIP Advanced Seminar on Formal Methods in Programming Language Semantics.Google Scholar
Cardelli, L. and Wegner, P. (1985) On understanding types, data abstraction, and polymorphism. Computing Surveys 17 (4) 471522.CrossRefGoogle Scholar
Courcelle, B. (1983) Fundamental properties of infinite trees. Theor. Comput. Sci. 25 95169.CrossRefGoogle Scholar
Hopcroft, J. E. and Ullman, J. D. (1979) Introduction to Automata Theory, Languages, and Computation, Addison-Wesley.Google Scholar
Kozen, D., Palsberg, J. and Schwartzbach, M. I. (1992) Efficient inference of partial types. In: Proc. 33rd IEEE Symp. Found. Comput. Sci. 363371.CrossRefGoogle Scholar
Kozen, D., Palsberg, J. and Schwartzbach, M. I. (1993) Efficient recursive subtyping. In: Proc. 20th ACM Symp. Princip. Programming Lang., ACM 419428.CrossRefGoogle Scholar
O'Keefe, P. M. and Wand, M. (1992) Type inference for partial types is decidable. In: Proc. ESOP'92, European Symposium on Programming. Springer-Verlag Lecture Notes in Computer Science 582.CrossRefGoogle Scholar
Thatte, S. (1988) Type inference with partial types. In: Proc. International Colloquium on Automata, Languages, and Programming 1988. Springer-Verlag Lecture Notes in Computer Science 317.CrossRefGoogle Scholar