Skip to main content

Advertisement

SpringerLink
Log in
Menu
Find a journal Publish with us Track your research
Search
Cart
Book cover

European Symposium on Programming

ESOP 2007: Programming Languages and Systems pp 505–519Cite as

  1. Home
  2. Programming Languages and Systems
  3. Conference paper
Type Reconstruction for General Refinement Types

Type Reconstruction for General Refinement Types

  • Kenneth Knowles1 &
  • Cormac Flanagan1 
  • Conference paper
  • 1136 Accesses

  • 10 Citations

  • 1 Altmetric

Part of the Lecture Notes in Computer Science book series (LNTCS,volume 4421)

Abstract

General refinement types allow types to be refined by predicates written in a general-purpose programming language, and can express function pre- and postconditions and data structure invariants. In this setting, with expressive and possibly verbose types, type reconstruction is particularly valuable, yet typeability is undecidable because it subsumes type checking. Using a generalized notion of type reconstruction, we present the first type reconstruction algorithm for a type system with base types refined by abitrary program terms. Our algorithm is a typeability-preserving transformation and defers type checking to a subsequent phase. The algorithm generates and solves a collection of implication constraints over refinement predicates, inferring maximally precise refinement predicates in a largely syntactic manner that is reminiscent of strongest postcondition calculation. Perhaps surprisingly, our notion of type reconstruction is decidable even though type checking is not.

Keywords

  • Functional Programming
  • Type Inference
  • Type Check
  • Shape Reconstruction
  • Type Replacement

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.

Chapter PDF

Download to read the full chapter text

References

  1. Aiken, A., Wimmers, E.: Type inclusion constraints and type inference. In: Proceedings of the Conference on Functional Programming Languages and Computer Architecture, pp. 31–41 (1993)

    Google Scholar 

  2. Back, R.J.R.: A calculus of refinements for program derivations. Acta Informatica 25(6), 593–624 (1988)

    CrossRef  MATH  MathSciNet  Google Scholar 

  3. Hoare, C.A.R.: An axiomatic basis for computer programming. Communications of the ACM 12, 576–580 (1969)

    CrossRef  MATH  Google Scholar 

  4. Cousot, P., Cousot, R.: Formal language, grammar, and set-constraint-based program analysis by abstract interpretation. In: Proceedings of the International Conference on Functional Programming and Computer Architecture, pp. 170–181 (1995)

    Google Scholar 

  5. Davies, R., Pfenning, F.: Intersection types and computational effects. In: Proceedings of the ACM International Conference on Functional Programming, pp. 198–208. ACM Press, New York (2000)

    Google Scholar 

  6. Denney, E.: Refinement types for specification. In: Proceedings of the IFIP International Conference on Programming Concepts and Methods. IFIP Conference Proceedings, vol. 125, pp. 148–166. Chapman and Hall, Boca Raton (1998)

    Google Scholar 

  7. Dijkstra, E.W.: A Discipline of Programming. Prentice-Hall, Englewood Cliffs (1976)

    Google Scholar 

  8. Dunfield, J.: Combining two forms of type refinements. Technical Report CMU-CS-02-182, CMU School of Computer Science, Pittsburgh, Penn. (2002)

    Google Scholar 

  9. Fähndrich, M., Aiken, A.: Making set-constraint based program analyses scale. Technical Report UCB/CSD-96-917, University of California at Berkeley (1996)

    Google Scholar 

  10. Flanagan, C.: Hybrid type checking. In: Proceedings of the ACM Symposium on Principles of Programming Languages, pp. 245–256 (2006)

    Google Scholar 

  11. Flanagan, C., Felleisen, M.: Componential set-based analysis. In: Proceedings of the ACM Conference on Programming Language Design and Implementation, pp. 235–248 (1997)

    Google Scholar 

  12. Floyd, R.W.: Assigning meaning to programs. In: Proceedings of the Symposium in Applied Mathematics: Mathematical Aspects of Computer Science, pp. 19–32 (1967)

    Google Scholar 

  13. Freeman, T., Pfenning, F.: Refinement types for ML. In: Proceedings of the ACM Conference on Programming Language Design and Implementation, pp. 268–277 (1991)

    Google Scholar 

  14. Fuh, Y., Mishra, P.: Type inference with subtypes. In: Proceedings of the European Symposium on Programming, pp. 155–175 (1988)

    Google Scholar 

  15. Gronski, J., et al.: Sage: Practical hybrid checking for expressive types and specifications. In: Proceedings of the Workshop on Scheme and Functional Programming, pp. 93–104 (2006)

    Google Scholar 

  16. Hayashi, S.: Logic of refinement types. In: Proceedings of the Workshop on Types for Proofs and Programs, pp. 157–172 (1993)

    Google Scholar 

  17. Heintze, N.: Set Based Program Analysis. PhD thesis, Carnegie Mellon University (1992)

    Google Scholar 

  18. Hoang, M., Mitchell, J.C.: Lower bounds on type inference with subtypes. In: Proceedings of the ACM Symposium on Principles of Programming Languages, pp. 176–185 (1995)

    Google Scholar 

  19. Knowles, K., Flanagan, C.: Type reconstruction for general refinement types (2007), http://www.soe.ucsc.edu/~cormac/papers/htr-full.pdf

  20. Leino, K.R.M., Millstein, T., Saxe, J.B.: Generating error traces from verification-condition counterexamples. Science of Computer Programming 55(1-3), 209–226 (2005), doi:10.1016/j.scico.2004.05.016

    CrossRef  MATH  MathSciNet  Google Scholar 

  21. Lincoln, P., Mitchell, J.C.: Algorithmic aspects of type inference with subtypes. In: Proceedings of the ACM Symposium on Principles of Programming Languages, pp. 293–304 (1992)

    Google Scholar 

  22. Mandelbaum, Y., Walker, D., Harper, R.: An effective theory of type refinements. In: Proceedings of the ACM International Conference on Functional Programming, Uppsala, Sweden, pp. 213–225. ACM Press, New York (2003), doi:10.1145/944705.944725

    Google Scholar 

  23. Mitchell, J.C.: Coercion and type inference. In: Proceedings of the ACM Symposium on Principles of Programming Languages, pp. 175–185 (1983)

    Google Scholar 

  24. Nanevski, A., Morrisett, G., Birkedal, L.: Polymorphism and separation in hoare type theory. In: Proceedings of the International Conference on Functional Programming, pp. 62–73 (2006)

    Google Scholar 

  25. Odersky, M., Sulzmann, M., Wehr, M.: Type inference with constrained types. Theory and Practice of Object Systems 5(1), 35–55 (1999)

    CrossRef  Google Scholar 

  26. Ou, X., et al.: Dynamic typing with dependent types. In: Proceedings of the IFIP International Conference on Theoretical Computer Science, pp. 437–450 (2004)

    Google Scholar 

  27. Pierce, B.C., Turner, D.N.: Local type inference. In: Proceedings of the ACM Symposium on Principles of Programming Languages, pp. 252–265 (1998)

    Google Scholar 

  28. Pottier, F.: Simplifying subtyping constraints. In: Proceedings of the ACM International Conference on Functional Programming, pp. 122–133. ACM Press, New York (1996)

    CrossRef  Google Scholar 

  29. Xi, H., Pfenning, F.: Dependent types in practical programming. In: Proceedings of the ACM Symposium on Principles of Programming Languages, pp. 214–227 (1999)

    Google Scholar 

Download references

Author information

Authors and Affiliations

  1. University of California, Santa Cruz,  

    Kenneth Knowles & Cormac Flanagan

Authors
  1. Kenneth Knowles
    View author publications

    You can also search for this author in PubMed Google Scholar

  2. Cormac Flanagan
    View author publications

    You can also search for this author in PubMed Google Scholar

Editor information

Rocco De Nicola

Rights and permissions

Reprints and Permissions

Copyright information

© 2007 Springer Berlin Heidelberg

About this paper

Cite this paper

Knowles, K., Flanagan, C. (2007). Type Reconstruction for General Refinement Types. In: De Nicola, R. (eds) Programming Languages and Systems. ESOP 2007. Lecture Notes in Computer Science, vol 4421. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-71316-6_34

Download citation

  • .RIS
  • .ENW
  • .BIB
  • DOI: https://doi.org/10.1007/978-3-540-71316-6_34

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-71314-2

  • Online ISBN: 978-3-540-71316-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Share this paper

Anyone you share the following link with will be able to read this content:

Sorry, a shareable link is not currently available for this article.

Provided by the Springer Nature SharedIt content-sharing initiative

Publish with us

Policies and ethics

search

Navigation

  • Find a journal
  • Publish with us
  • Track your research

Discover content

  • Journals A-Z
  • Books A-Z

Publish with us

  • Publish your research
  • Open access publishing

Products and services

  • Our products
  • Librarians
  • Societies
  • Partners and advertisers

Our imprints

  • Springer
  • Nature Portfolio
  • BMC
  • Palgrave Macmillan
  • Apress
  • Your US state privacy rights
  • Accessibility statement
  • Terms and conditions
  • Privacy policy
  • Help and support
  • Cancel contracts here

167.114.118.210

Not affiliated

Springer Nature

© 2023 Springer Nature