Subtyping Recursive Types Modulo Associative Commutative Products

  • Roberto Di Cosmo
  • François Pottier
  • Didier Rémy
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3461)


This work sets the formal bases for building tools that help retrieve classes in object-oriented libraries. In such systems, the user provides a query, formulated as a set of class interfaces. The tool returns classes in the library that can be used to implement the user’s request and automatically builds the required glue code. We propose subtyping of recursive types in the presence of associative and commutative products—that is, subtyping modulo a restricted form of type isomorphisms—as a model of the relation that exists between the user’s query and the tool’s answers. We show that this relation is a composition of the standard subtyping relation with equality up to associativity and commutativity of products and we present an efficient decision algorithm for it. We also provide an automatic way of constructing coercions between related types.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Abadi, M., Fiore, M.P.: Syntactic considerations on recursive types. In: IEEE Symposium on Logic in Computer Science (LICS), pp. 242–252 (July 1996)Google Scholar
  2. 2.
    Amadio, R.M., Cardelli, L.: Subtyping recursive types. ACM Transactions on Programming Languages and Systems 15(4), 575–631 (1993)CrossRefGoogle Scholar
  3. 3.
    Aponte, M.-V., Di Cosmo, R.: Type isomorphisms for module signatures. In: Kuchen, H., Swierstra, S.D. (eds.) PLILP 1996. LNCS, vol. 1140, pp. 334–346. Springer, Heidelberg (1996)Google Scholar
  4. 4.
    Auerbach, J., Barton, C., Raghavachari, M.: Type isomorphisms with recursive types. Technical Report RC 21247, IBM Yorktown Heights (1998)Google Scholar
  5. 5.
    Auerbach, J., Chu-Carrol, M.C.: The Mockingbird system: a compiler-based approach to maximally interoperable distributed systems. Technical Report RC 20718, IBM Yorktown Heights (1997)Google Scholar
  6. 6.
    Auerbach, J., Chu-Carrol, M.C., Barton, C., Raghavachari, M.: Mockingbird: Flexible stub generation from pairs of declarations. Technical Report RC 21309, IBM Yorktown Heights (1998)Google Scholar
  7. 7.
    Balat, V., Di Cosmo, R., Fiore, M.: Remarks on isomorphisms in typed lambda calculi with empty and sum type. In: IEEE Symposium on Logic in Computer Science (LICS) (July 2002)Google Scholar
  8. 8.
    Barton, C.M.: M-types and their coercions. Technical Report RC-21615, IBM Yorktown Heights (December 1999)Google Scholar
  9. 9.
    Brandt, M., Henglein, F.: Coinductive axiomatization of recursive type equality and subtyping. Fundamenta Informaticæ 33, 309–338 (1998)MATHMathSciNetGoogle Scholar
  10. 10.
    Bruce, K., Di Cosmo, R., Longo, G.: Provable isomorphisms of types. Mathematical Structures in Computer Science 2(2), 231–247 (1992)MATHCrossRefMathSciNetGoogle Scholar
  11. 11.
    Cardone, F.: A coinductive completeness proof for the equivalence of recursive types. Theoretical Computer Science 275(1-2), 575–587 (2002)MATHCrossRefMathSciNetGoogle Scholar
  12. 12.
    Courcelle, B.: Fundamental properties of infinite trees. Theoretical Computer Science 25(2), 95–169 (1983)MATHCrossRefMathSciNetGoogle Scholar
  13. 13.
    Di Cosmo, R.: Deciding type isomorphisms in a type assignment framework. Journal of Functional Programming 3(3), 485–525 (1993)CrossRefMathSciNetGoogle Scholar
  14. 14.
    Di Cosmo, R.: Isomorphisms of types: from λ-calculus to information retrieval and language design. In: Progress in Theoretical Computer Science. Birkhauser, Basel (1995)Google Scholar
  15. 15.
    Downey, P.J., Sethi, R., Tarjan, R.E.: Variations on the common subexpression problem. Journal of the ACM 27(4), 758–771 (1980)MATHCrossRefMathSciNetGoogle Scholar
  16. 16.
    Gapeyev, V., Levin, M., Pierce, B.: Recursive subtyping revealed. Journal of Functional Programming 12(6), 511–548 (2003)MathSciNetGoogle Scholar
  17. 17.
    Hopcroft, J.E., Karp, R.M.: An n 5/2 algorithm for maximum matchings in bipartite graphs. SIAM Journal on Computing 2(4), 225–231 (1973)MATHCrossRefMathSciNetGoogle Scholar
  18. 18.
    Jha, S., Palsberg, J., Zhao, T.: Efficient type matching. In: Nielsen, M., Engberg, U. (eds.) FOSSACS 2002. LNCS, vol. 2303, pp. 187–204. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  19. 19.
    Palsberg, J., Zhao, T.: Efficient and flexible matching of recursive types. Information and Computation 171, 364–387 (2001)MATHCrossRefMathSciNetGoogle Scholar
  20. 20.
    Rittri, M.: Using types as search keys in function libraries. Journal of Functional Programming 1(1), 71–89 (1991)MATHCrossRefMathSciNetGoogle Scholar
  21. 21.
    Rittri, M.: Retrieving library functions by unifying types modulo linear isomorphism. RAIRO Theoretical Informatics and Applications 27(6), 523–540 (1993)MATHGoogle Scholar
  22. 22.
    Runciman, C., Toyn, I.: Retrieving re-usable software components by polymorphic type. Journal of Functional Programming 1(2), 191–211 (1991)MATHMathSciNetGoogle Scholar
  23. 23.
    Soloviev, S.V.: The category of finite sets and cartesian closed categories. Journal of Soviet Mathematics 22(3), 1387–1400 (1983)CrossRefGoogle Scholar
  24. 24.
    Thatté, S.R.: Automated synthesis of interface adapters for reusable classes. In: ACM Symposium on Principles of Programming Languages (POPL), January 1994, pp. 174–187 (1994)Google Scholar
  25. 25.
    Wing, J.M., Rollins, E., Zaremski, A.M.: Thoughts on a Larch/ML and a new application for LP. In: First International Workshop on Larch, July 1992, pp. 297–312 (1992)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2005

Authors and Affiliations

  • Roberto Di Cosmo
    • 1
  • François Pottier
    • 2
  • Didier Rémy
    • 2
  1. 1.Université Paris 7 
  2. 2.INRIA Rocquencourt 

Personalised recommendations