Advertisement

Type Inference with Structural Subtyping: A Faithful Formalization of an Efficient Constraint Solver

  • Vincent Simonet
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2895)

Abstract

We are interested in type inference in the presence of structural subtyping from a pragmatic perspective. This work combines theoretical and practical contributions: first, it provides a faithful description of an efficient algorithm for solving and simplifying constraints; whose correctness is formally proved. Besides, the framework has been implemented in Objective Caml, yielding a generic type inference engine. Its efficiency is assessed by a complexity result and a series of experiments in realistic cases.

Keywords

Term Structure Type Inference Ground Term Type Constructor Program Language Design 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Bourdoncle, F., Merz, S.: Type checking higher-order polymorphic multi-methods. In: 24th Principles of Programming Languages (1997)Google Scholar
  2. 2.
    Pottier, F.: A versatile constraint-based type inference system. Nordic Journal of Computing 7 (2000)Google Scholar
  3. 3.
    Aiken, A.S., Fähndrich, M.: Program analysis using mixed term and set constraints. In: 4th Static Analysis Symposium (1997)Google Scholar
  4. 4.
    Palsberg, J., O’Keefe, P.M.: A type system equivalent to flow analysis. In: 22nd Principles of Programming Languages (1995)Google Scholar
  5. 5.
    Pottier, F., Simonet, V.: Information flow inference for ML. In: 29th Principles of Programming Languages (2002)Google Scholar
  6. 6.
    Mitchell, J.C.: Coercion and type inference. In: 11th Principles of Programming Languages (1984)Google Scholar
  7. 7.
    Cardelli, L.: A semantics of multiple inheritance. Information and Computation 76 (1988)Google Scholar
  8. 8.
    Tiuryn, J.: Subtype inequalities. In: 7th IEEE Symposium on Logic in Computer Science (1992)Google Scholar
  9. 9.
    Hoang, M., Mitchell, J.C.: Lower bounds on type inference with subtypes. In: 22nd Principles of Programming Languages (1995)Google Scholar
  10. 10.
    Mitchell, J.C.: Type inference with simple subtypes. Journal of Functional Programming 1 (1991)Google Scholar
  11. 11.
    Fuh, Y.C., Mishra, P.: Type inference with subtypes. In: Ganzinger, H. (ed.) ESOP 1988. LNCS, vol. 300, Springer, Heidelberg (1988)Google Scholar
  12. 12.
    Fuh, Y.C., Mishra, P.: Polymorphic subtype inference: Closing the theory-practice gap. In: Díaz, J., Orejas, F. (eds.) TAPSOFT 1989 and CCIPL 1989. LNCS, vol. 352, Springer, Heidelberg (1989)Google Scholar
  13. 13.
    Frey, A.: Satisfying subtype inequalities in polynomial space. In: Van Hentenryck, P. (ed.) SAS 1997. LNCS, vol. 1302, Springer, Heidelberg (1997)CrossRefGoogle Scholar
  14. 14.
    Kuncak, V., Rinard, M.: Structural subtyping of non-recursive types is decidable. In: 18th IEEE Symposium on Logic in Computer Science (2003)Google Scholar
  15. 15.
    Aiken, A.S., Fähndrich, M.: Making set-constraint based program analyses scale. Technical Report CSD-96-917, University of California, Berkeley (1996)Google Scholar
  16. 16.
    Trifonov, V., Smith, S.: Subtyping constrained types. In: Cousot, R., Schmidt, D.A. (eds.) SAS 1996. LNCS, vol. 1145, Springer, Heidelberg (1996)Google Scholar
  17. 17.
    Flanagan, C., Felleisen, M.: Componential set-based analysis. In: Programming Language Design and Implementation (1997)Google Scholar
  18. 18.
    Pottier, F.: Simplifying subtyping constraints: a theory. Information and Computation 170 (2001)Google Scholar
  19. 19.
    Rehof, J.: Minimal typings in atomic subtyping. In: 24th Principles of Programming Languages (1997)Google Scholar
  20. 20.
    Marlow, S., Wadler, P.: A practical subtyping system for Erlang. In: International Conference on Functional Programming (1997)Google Scholar
  21. 21.
    Fendrick, M.: Bane, A Library for Scalable Constraint-Based Program Analysis. PhD thesis (1999) Google Scholar
  22. 22.
    Pottier, F.: Wallace, an efficient implementation of type inference with subtyping (2000), http://pauillac.inria.fr/~fpottier/wallace/
  23. 23.
    Frey, A.: Jazz (1998), http://www.exalead.com/jazz/
  24. 24.
    Kodumal, J.: Banshee, a toolkit for building constraint-based analyses. PhD thesis (2002)Google Scholar
  25. 25.
    Foster, J.S., Fähndrich, M., Aiken, A.: A Theory of Type Qualifiers. In: Programming Language Design and Implementation (1999)Google Scholar
  26. 26.
    Foster, J.S., Terauchi, T., Aiken, A.: Flow-sensitive type qualifiers. In: Programming Language Design and Implementation (2002)Google Scholar
  27. 27.
    Glynn, K., Stuckey, P.J., Sulzmann, M., Søndergaard, H.: Boolean constraints for binding-time analysis. In: Danvy, O., Filinski, A. (eds.) PADO 2001. LNCS, vol. 2053, p. 39. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  28. 28.
    Simonet, V.: Dalton, an efficient implementation of type inference with structural subtyping (2002), http://cristal.inria.fr/~simonet/soft/dalton/
  29. 29.
    Heintze, N., McAllester, D.: Linear-time subtransitive control flow analysis. In: Programming Language Design and Implementation (1997)Google Scholar
  30. 30.
    Saha, B., Heintze, N., Oliva, D.: Subtransitive CFA using types. Technical report, Yale University (1998)Google Scholar
  31. 31.
    Rémy, D.: Extending ML type system with a sorted equational theory. Research Report 1766, Institut de Recherche en Informatique et en Automatique (1992)Google Scholar
  32. 32.
    Pessaux, F., Leroy, X.: Type-based analysis of uncaught exceptions. ACM Transactions on Programming Languages and Systems 22 (2000)Google Scholar
  33. 33.
    Simonet, V.: Type inference with structural subtyping: A precise formalization of an efficient constraint solver (2003), Full version http://cristal.inria.fr/simonet/publis/simonet-structural-subtypingfull.ps.gz
  34. 34.
    Abadi, M., Banerjee, A., Heintze, N., Riecke, J.G.: A core calculus of dependency. In: 26th Principles of Programming Languages (1999)Google Scholar
  35. 35.
    Pottier, F.: A constraint-based presentation and generalization of rows. In: 18th IEEE Symposium on Logic in Computer Science (2003)Google Scholar
  36. 36.
    Tarjan, R.E.: Efficiency of a good but not linear set union algorithm. Journal of the ACM 22 (1975)Google Scholar
  37. 37.
    Fendrich, M., Foster, J.S., Su, Z., Aiken, A.S.: Partial online cycle elimination in inclusion constraint graphs. In: Programming Language Design and Implementation (1998)Google Scholar
  38. 38.
    Eifrig, J., Smith, S., Trifonov, V.: Sound polymorphic type inference for objects. ACM SIGPLAN Notices 30 (1995)Google Scholar
  39. 39.
    Simonet, V.: Flow Caml, information flow inference in Objective Caml., http://cristal.inria.fr/~simonet/soft/flowcaml/ (2002)
  40. 40.
    Fendrich, M., Rehof, J., Das, M.: Scalable context-sensitive flow analysis using instantiation constraints. In: Programming Language Design and Implementation (2000)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2003

Authors and Affiliations

  • Vincent Simonet
    • 1
  1. 1.INRIA Rocquencourt 

Personalised recommendations