skip to main content
10.1145/3009837.3009856acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
research-article

Gradual refinement types

Published:01 January 2017Publication History

ABSTRACT

Refinement types are an effective language-based verification technique. However, as any expressive typing discipline, its strength is its weakness, imposing sometimes undesired rigidity. Guided by abstract interpretation, we extend the gradual typing agenda and develop the notion of gradual refinement types, allowing smooth evolution and interoperability between simple types and logically-refined types. In doing so, we address two challenges unexplored in the gradual typing literature: dealing with imprecise logical information, and with dependent function types. The first challenge leads to a crucial notion of locality for refinement formulas, and the second yields novel operators related to type- and term-level substitution, identifying new opportunity for runtime errors in gradual dependently-typed languages. The gradual language we present is type safe, type sound, and satisfies the refined criteria for gradually-typed languages of Siek et al. We also explain how to extend our approach to richer refinement logics, anticipating key challenges to consider.

References

  1. F. Bañados Schwerter, R. Garcia, and É. Tanter. A theory of gradual effect systems. In 19th ACM SIGPLAN Conference on Functional Programming (ICFP 2014), pages 283–295, Gothenburg, Sweden, Sept. 2014. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. F. Bañados Schwerter, R. Garcia, and É. Tanter. Gradual type-and-effect systems. Journal of Functional Programming, 26:19:1–19:69, Sept. 2016.Google ScholarGoogle ScholarCross RefCross Ref
  3. J. Bengtson, K. Bhargavan, C. Fournet, A. D. Gordon, and S. Maffeis. Refinement types for secure implementations. ACM Transactions on Programming Languages and Systems, 33(2):8:1–8:45, Jan. 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. R. Chugh. Nested Refinement Types for JavaScript. PhD thesis, University of California, Sept. 2013.Google ScholarGoogle Scholar
  5. R. Chugh, D. Herman, and R. Jhala. Dependent types for JavaScript. In 27th ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA 2012), pages 587–606, Tucson, AZ, USA, Oct. 2012a. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. R. Chugh, P. M. Rondon, A. Bakst, and R. Jhala. Nested refinements: a logic for duck typing. In 39th annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2012), pages 231–244, Philadelphia, USA, Jan. 2012b. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. A. Church. A formulation of the simple theory of types. J. Symbolic Logic, 5(2):56–68, 06 1940.Google ScholarGoogle ScholarCross RefCross Ref
  8. P. Cousot and R. Cousot. Abstract interpretation: A unified lattice model for static analysis of programs by construction or approximation of fixpoints. In 4th ACM Symposium on Principles of Programming Languages (POPL 77), pages 238–252, Los Angeles, CA, USA, Jan. 1977. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. ACM Press.Google ScholarGoogle Scholar
  10. T. Disney and C. Flanagan. Gradual information flow typing. In International Workshop on Scripts to Programs, 2011.Google ScholarGoogle Scholar
  11. L. Fennell and P. Thiemann. Gradual security typing with references. In Computer Security Foundations Symposium, pages 224–239, June 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. R. B. Findler and M. Felleisen. Contracts for higher-order functions. In 7th ACM SIGPLAN Conference on Functional Programming (ICFP 2002), pages 48–59, Pittsburgh, PA, USA, Sept. 2002. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. C. Flanagan. Hybrid type checking. In 33th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2006), pages 245–256, Charleston, SC, USA, Jan. 2006. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. T. Freeman and F. Pfenning. Refinement types for ML. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’91), pages 268–277. ACM Press, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. R. Garcia and M. Cimini. Principal type schemes for gradual programs. In 42nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2015), pages 303–315. ACM Press, Jan. 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. R. Garcia, A. M. Clark, and É. Tanter. Abstracting gradual typing. In 43rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2016), St Petersburg, FL, USA, Jan. 2016. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. M. Greenberg, B. C. Pierce, and S. Weirich. Contracts made manifest. In 37th annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2010), pages 353–364. ACM Press, Jan. 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. J. Gronski and C. Flanagan. Unifying hybrid types and contracts. In Trends in Functional Programming, pages 54–70, 2007.Google ScholarGoogle Scholar
  19. W. A. Howard. The formulae-as-types notion of construction. In J. P. Seldin and J. R. Hindley, editors, To H. B. Curry: Essays on Combinatory Logic, Lambda Calculus, and Formalism, pages 479–490. Academic Press, New York, 1980. Reprint of 1969 article. M. Kawaguchi, P. Rondon, and R. Jhala. Type-based data structure verification. In Proceedings of the 30th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2009), pages 304–315. ACM Press, June 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. K. Knowles and C. Flanagan. Hybrid type checking. ACM Trans. Program. Lang. Syst., 32(2), 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. N. Lehmann and É. Tanter. Gradual refinement types – extended version with proofs. Technical Report TR/DCC-2016-1, University of Chile, Nov. 2016.Google ScholarGoogle Scholar
  22. A. Miné. Weakly Relational Numerical Abstract Domains. PhD thesis, L’École Polythechnique, Dec. 2004.Google ScholarGoogle Scholar
  23. X. Ou, G. Tan, Y. Mandelbaum, and D. Walker. Dynamic typing with dependent types. In Proceedings of the IFIP International Conference on Theoretical Computer Science, pages 437–450, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  24. P. M. Rondon, M. Kawaguci, and R. Jhala. Liquid types. In 29th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2008), pages 159–169, Tucson, AZ, USA, June 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. ACM Press.Google ScholarGoogle Scholar
  26. J. G. Siek and W. Taha. Gradual typing for functional languages. In Scheme and Functional Programming Workshop, pages 81–92, Sept. 2006.Google ScholarGoogle Scholar
  27. J. G. Siek, M. M. Vitousek, M. Cimini, and J. T. Boyland. Refined criteria for gradual typing. In 1st Summit on Advances in Programming Languages (SNAPL 2015), pages 274–293, 2015.Google ScholarGoogle Scholar
  28. M. Sozeau. Subset coercions in Coq. In Types for Proofs and Programs, volume 4502 of LNCS, pages 237–252. Springer-Verlag, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. N. Swamy, C. Hritcu, C. Keller, A. Rastogi, A. Delignat-Lavaud, S. Forest, K. Bhargavan, C. Fournet, P.-Y. Strub, M. Kohlweiss, J. K. Zinzindohoue, and S. Zanella Béguelin. Dependent types and multi-effects in F. In 43rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2016), pages 256–270, St Petersburg, FL, USA, Jan. 2016. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. É. Tanter and N. Tabareau. Gradual certified programming in Coq. In Proceedings of the 11th ACM Dynamic Languages Symposium (DLS 2015), pages 26–40, Pittsburgh, PA, USA, Oct. 2015. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. P. Thiemann and L. Fennell. Gradual typing for annotated type systems. In Z. Shao, editor, 23rd European Symposium on Programming Languages and Systems (ESOP 2014), volume 8410 of LNCS, pages 47–66, Grenoble, France, 2014. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. N. Vazou, P. M. Rondon, and R. Jhala. Abstract refinement types. In M. Felleisen and P. Gardner, editors, Proceedings of the 22nd European Symposium on Programming Languages and Systems (ESOP 2013), volume 7792 of LNCS, pages 209–228, Rome, Italy, Mar. 2013. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. N. Vazou, E. L. Seidel, R. Jhala, D. Vytiniotis, and S. L. P. Jones. Refinement types for haskell. In 19th ACM SIGPLAN Conference on Functional Programming (ICFP 2014), pages 269–282, Gothenburg, Sweden, Sept. 2014. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. N. Vazou, A. Bakst, and R. Jhala. Bounded refinement types. In 20th ACM SIGPLAN Conference on Functional Programming (ICFP 2015), pages 48–61, Vancouver, Canada, Sept. 2015. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. P. Vekris, B. Cosman, and R. Jhala. Refinement types for TypeScript. In Proceedings of the 37th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2016), pages 310–325, Santa Barbara, CA, USA, June 2016. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. H. Xi and F. Pfenning. Eliminating array bound checking through dependent types. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’98), pages 249–257. ACM Press, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Gradual refinement types

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in
      • Published in

        cover image ACM Conferences
        POPL '17: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages
        January 2017
        901 pages
        ISBN:9781450346603
        DOI:10.1145/3009837

        Copyright © 2017 ACM

        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 1 January 2017

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article

        Acceptance Rates

        Overall Acceptance Rate824of4,130submissions,20%

        Upcoming Conference

        POPL '25

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader