Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/2628136.2628161acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

Refinement types for Haskell

Published: 19 August 2014 Publication History

Abstract

SMT-based checking of refinement types for call-by-value languages is a well-studied subject. Unfortunately, the classical translation of refinement types to verification conditions is unsound under lazy evaluation. When checking an expression, such systems implicitly assume that all the free variables in the expression are bound to values. This property is trivially guaranteed by eager, but does not hold under lazy, evaluation. Thus, to be sound and precise, a refinement type system for Haskell and the corresponding verification conditions must take into account which subset of binders actually reduces to values. We present a stratified type system that labels binders as potentially diverging or not, and that (circularly) uses refinement types to verify the labeling. We have implemented our system in LIQUIDHASKELL and present an experimental evaluation of our approach on more than 10,000 lines of widely used Haskell libraries. We show that LIQUIDHASKELL is able to prove 96% of all recursive functions terminating, while requiring a modest 1.7 lines of termination-annotations per 100 lines of code.

References

[1]
L. Augustsson. Cayenne - a language with dependent types. In ICFP, 1998.
[2]
G. Barthe, M. J. Frade, E. Giménez, L. Pinto, and T. Uustalu. Type-based termination of recursive definitions. Mathematical Structures in Computer Science, 2004.
[3]
J. F. Belo, M. Greenberg, A. Igarashi, and B. C. Pierce. Polymorphic contracts. In ESOP, 2011.
[4]
J. Bengtson, K. Bhargavan, C. Fournet, A. D. Gordon, and S. Maffeis. Refinement types for secure implementations. ACM TOPLAS, 2011.
[5]
Y. Bertot and P. Castéran. Coq'Art: The Calculus of Inductive Constructions. Springer Verlag, 2004.
[6]
A. Bradley and Z. Manna. The Calculus of Computation: Decision Procedures With Application To Verification. Springer-Verlag, 2007.
[7]
E. Brady. Idris: general purpose programming with dependent types. In PLPV, 2013.
[8]
V. Capretta. General recursion via coinductive types. Logical Methods in Computer Science, 2005.
[9]
C. Casinghino, V. Sjöberg, and S. Weirich. Combining proofs and programs in a dependently typed language. In POPL, 2014.
[10]
R. L. Constable and S. F. Smith. Partial objects in constructive type theory. In LICS, 1987.
[11]
L. de Moura and N. Bjãrner. Z3: An efficient SMT solver. 2008.
[12]
D. Detlefs, G. Nelson, and J. B. Saxe. Simplify: a theorem prover for program checking. J. ACM, 2005.
[13]
J. Dunfield. Refined typechecking with Stardust. In PLPV, 2007.
[14]
C. Flanagan, K.R.M. Leino, M. Lillibridge, G. Nelson, J. B. Saxe, and R. Stata. Extended static checking for Java. In PLDI, 2002.
[15]
J. Giesl, M. Raffelsieper, P. Schneider-Kamp, S. Swiderski, and R. Thiemann. Automated termination proofs for Haskell by term rewriting. TPLS, 2011.
[16]
C. A. R. Hoare. Procedures and parameters: An axiomatic approach. In Symposium on Semantics of Algorithmic Languages. 1971.
[17]
J. Hughes, L. Pareto, and A. Sabry. Proving the correctness of reactive systems using sized types. In POPL, 1996.
[18]
L. Jia, J. A. Vaughan, K. Mazurak, J. Zhao, L. Zarko, J. Schorr, and S. Zdancewic. Aura: a programming language for authorization and audit. In ICFP, 2008.
[19]
N. D. Jones and N. Bohr. Termination analysis of the untyped lamba-calculus. In RTA, 2004.
[20]
M. Kawaguchi, P. Rondon, and R. Jhala. Type-based data structure verification. In PLDI, 2009.
[21]
K.W. Knowles and C. Flanagan. Hybrid type checking. ACM TOPLAS, 2010.
[22]
G. Nelson. Techniques for program verification. Technical Report CSL81-10, Xerox Palo Alto Research Center, 1981.
[23]
T. Nipkow. Hoare logics for recursive procedures and unbounded nondeterminism. In CSL, 2002.
[24]
U. Norell. Towards a practical programming language based on dependent type theory. PhD thesis, Chalmers, 2007.
[25]
S. R. Della Rocca and L. Paolini. The Parametric Lambda Calculus, A Metamodel for Computation. 2004.
[26]
P. Rondon, M. Kawaguchi, and R. Jhala. Liquid Types. In PLDI, 2008.
[27]
J. Rushby, S. Owre, and N. Shankar. Subtypes for specifications: Predicate subtyping in pvs. IEEE TSE, 1998.
[28]
D. Sereni and N. D. Jones. Termination analysis of higher-order functional programs. In APLAS, 2005.
[29]
W. Sonnex, S. Drossopoulou, and S. Eisenbach. Zeno: An automated prover for properties of recursive data structures. In TACAS, 2012.
[30]
M. Sulzmann, M. M. T. Chakravarty, S. L. Peyton-Jones, and K. Donnelly. System F with type equality coercions. In TLDI, 2007.
[31]
N. Swamy, J. Chen, C. Fournet, P-Y. Strub, K. Bhargavan, and J. Yang. Secure distributed programming with value-dependent types. In ICFP, 2011.
[32]
A. M. Turing. On computable numbers, with an application to the eintscheidungsproblem. In LMS, 1936.
[33]
N. Vazou, P. Rondon, and R. Jhala. Abstract refinement types. In ESOP, 2013.
[34]
N. Vazou, E. L. Seidel, and R. Jhala. Liquidhaskell: Experience with refinement types in the real world. In Haskell Symposium, 2014.
[35]
D. Vytiniotis, S. L. Peyton-Jones, K. Claessen, and D. Rosén. Halo: haskell to logic through denotational semantics. In POPL, 2013.
[36]
H. Xi. Dependent types for program termination verification. In LICS, 2001.
[37]
H. Xi and F. Pfenning. Eliminating array bound checking through dependent types. In PLDI, 1998.
[38]
D. N. Xu, S. L. Peyton-Jones, and K. Claessen. Static contract checking for haskell. In POPL, 2009.

Cited By

View all
  • (2025)Algebraic Temporal Effects: Temporal Verification of Recursively Typed Higher-Order ProgramsProceedings of the ACM on Programming Languages10.1145/37049149:POPL(2306-2336)Online publication date: 9-Jan-2025
  • (2025)Formalising Graph Algorithms with CoinductionProceedings of the ACM on Programming Languages10.1145/37048929:POPL(1657-1686)Online publication date: 9-Jan-2025
  • (2025)Generic Refinement TypesProceedings of the ACM on Programming Languages10.1145/37048859:POPL(1446-1474)Online publication date: 9-Jan-2025
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
ICFP '14: Proceedings of the 19th ACM SIGPLAN international conference on Functional programming
August 2014
390 pages
ISBN:9781450328739
DOI:10.1145/2628136
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 ACM 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]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 19 August 2014

Permissions

Request permissions for this article.

Check for updates

Qualifiers

  • Research-article

Funding Sources

Conference

ICFP'14
Sponsor:

Acceptance Rates

ICFP '14 Paper Acceptance Rate 28 of 85 submissions, 33%;
Overall Acceptance Rate 333 of 1,064 submissions, 31%

Upcoming Conference

ICFP '25
ACM SIGPLAN International Conference on Functional Programming
October 12 - 18, 2025
Singapore , Singapore

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)170
  • Downloads (Last 6 weeks)23
Reflects downloads up to 08 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2025)Algebraic Temporal Effects: Temporal Verification of Recursively Typed Higher-Order ProgramsProceedings of the ACM on Programming Languages10.1145/37049149:POPL(2306-2336)Online publication date: 9-Jan-2025
  • (2025)Formalising Graph Algorithms with CoinductionProceedings of the ACM on Programming Languages10.1145/37048929:POPL(1657-1686)Online publication date: 9-Jan-2025
  • (2025)Generic Refinement TypesProceedings of the ACM on Programming Languages10.1145/37048859:POPL(1446-1474)Online publication date: 9-Jan-2025
  • (2025)Flexible Type-Based Resource Estimation in Quantum Circuit Description LanguagesProceedings of the ACM on Programming Languages10.1145/37048839:POPL(1386-1416)Online publication date: 9-Jan-2025
  • (2024)Refinement Type RefutationsProceedings of the ACM on Programming Languages10.1145/36897458:OOPSLA2(962-987)Online publication date: 8-Oct-2024
  • (2024)Synchronous Programming with Refinement TypesProceedings of the ACM on Programming Languages10.1145/36746578:ICFP(938-972)Online publication date: 15-Aug-2024
  • (2024)Quiver: Guided Abductive Inference of Separation Logic Specifications in CoqProceedings of the ACM on Programming Languages10.1145/36564138:PLDI(889-913)Online publication date: 20-Jun-2024
  • (2024)Automated Verification of Fundamental Algebraic LawsProceedings of the ACM on Programming Languages10.1145/36564088:PLDI(766-789)Online publication date: 20-Jun-2024
  • (2024)Answer Refinement Modification: Refinement Type System for Algebraic Effects and HandlersProceedings of the ACM on Programming Languages10.1145/36332808:POPL(115-147)Online publication date: 5-Jan-2024
  • (2024)Indexed Types for a Statically Safe WebAssemblyProceedings of the ACM on Programming Languages10.1145/36329228:POPL(2395-2424)Online publication date: 5-Jan-2024
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media