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.
- L. Augustsson. Cayenne - a language with dependent types. In ICFP, 1998. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- J. F. Belo, M. Greenberg, A. Igarashi, and B. C. Pierce. Polymorphic contracts. In ESOP, 2011. Google Scholar
Digital Library
- J. Bengtson, K. Bhargavan, C. Fournet, A. D. Gordon, and S. Maffeis. Refinement types for secure implementations. ACM TOPLAS, 2011. Google Scholar
Digital Library
- Y. Bertot and P. Castéran. Coq'Art: The Calculus of Inductive Constructions. Springer Verlag, 2004.Google Scholar
Digital Library
- A. Bradley and Z. Manna. The Calculus of Computation: Decision Procedures With Application To Verification. Springer-Verlag, 2007. Google Scholar
Digital Library
- E. Brady. Idris: general purpose programming with dependent types. In PLPV, 2013. Google Scholar
Digital Library
- V. Capretta. General recursion via coinductive types. Logical Methods in Computer Science, 2005.Google Scholar
Cross Ref
- C. Casinghino, V. Sjöberg, and S. Weirich. Combining proofs and programs in a dependently typed language. In POPL, 2014. Google Scholar
Digital Library
- R. L. Constable and S. F. Smith. Partial objects in constructive type theory. In LICS, 1987.Google Scholar
- L. de Moura and N. Bjãrner. Z3: An efficient SMT solver. 2008.Google Scholar
- D. Detlefs, G. Nelson, and J. B. Saxe. Simplify: a theorem prover for program checking. J. ACM, 2005. Google Scholar
Digital Library
- J. Dunfield. Refined typechecking with Stardust. In PLPV, 2007. Google Scholar
Digital Library
- C. Flanagan, K.R.M. Leino, M. Lillibridge, G. Nelson, J. B. Saxe, and R. Stata. Extended static checking for Java. In PLDI, 2002. Google Scholar
Digital Library
- J. Giesl, M. Raffelsieper, P. Schneider-Kamp, S. Swiderski, and R. Thiemann. Automated termination proofs for Haskell by term rewriting. TPLS, 2011. Google Scholar
Digital Library
- C. A. R. Hoare. Procedures and parameters: An axiomatic approach. In Symposium on Semantics of Algorithmic Languages. 1971.Google Scholar
Cross Ref
- J. Hughes, L. Pareto, and A. Sabry. Proving the correctness of reactive systems using sized types. In POPL, 1996. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- N. D. Jones and N. Bohr. Termination analysis of the untyped lamba-calculus. In RTA, 2004.Google Scholar
- M. Kawaguchi, P. Rondon, and R. Jhala. Type-based data structure verification. In PLDI, 2009. Google Scholar
Digital Library
- K.W. Knowles and C. Flanagan. Hybrid type checking. ACM TOPLAS, 2010. Google Scholar
Digital Library
- G. Nelson. Techniques for program verification. Technical Report CSL81-10, Xerox Palo Alto Research Center, 1981.Google Scholar
- T. Nipkow. Hoare logics for recursive procedures and unbounded nondeterminism. In CSL, 2002. Google Scholar
Digital Library
- U. Norell. Towards a practical programming language based on dependent type theory. PhD thesis, Chalmers, 2007.Google Scholar
- S. R. Della Rocca and L. Paolini. The Parametric Lambda Calculus, A Metamodel for Computation. 2004. Google Scholar
Digital Library
- P. Rondon, M. Kawaguchi, and R. Jhala. Liquid Types. In PLDI, 2008. Google Scholar
Digital Library
- J. Rushby, S. Owre, and N. Shankar. Subtypes for specifications: Predicate subtyping in pvs. IEEE TSE, 1998. Google Scholar
Digital Library
- D. Sereni and N. D. Jones. Termination analysis of higher-order functional programs. In APLAS, 2005. Google Scholar
Digital Library
- W. Sonnex, S. Drossopoulou, and S. Eisenbach. Zeno: An automated prover for properties of recursive data structures. In TACAS, 2012. Google Scholar
Digital Library
- M. Sulzmann, M. M. T. Chakravarty, S. L. Peyton-Jones, and K. Donnelly. System F with type equality coercions. In TLDI, 2007. Google Scholar
Digital Library
- N. Swamy, J. Chen, C. Fournet, P-Y. Strub, K. Bhargavan, and J. Yang. Secure distributed programming with value-dependent types. In ICFP, 2011. Google Scholar
Digital Library
- A. M. Turing. On computable numbers, with an application to the eintscheidungsproblem. In LMS, 1936.Google Scholar
- N. Vazou, P. Rondon, and R. Jhala. Abstract refinement types. In ESOP, 2013. Google Scholar
Digital Library
- N. Vazou, E. L. Seidel, and R. Jhala. Liquidhaskell: Experience with refinement types in the real world. In Haskell Symposium, 2014.Google Scholar
Digital Library
- D. Vytiniotis, S. L. Peyton-Jones, K. Claessen, and D. Rosén. Halo: haskell to logic through denotational semantics. In POPL, 2013. Google Scholar
Digital Library
- H. Xi. Dependent types for program termination verification. In LICS, 2001. Google Scholar
Digital Library
- H. Xi and F. Pfenning. Eliminating array bound checking through dependent types. In PLDI, 1998. Google Scholar
Digital Library
- D. N. Xu, S. L. Peyton-Jones, and K. Claessen. Static contract checking for haskell. In POPL, 2009. Google Scholar
Digital Library
Index Terms
Refinement types for Haskell
Recommendations
Refinement types for Haskell
ICFP '14: Proceedings of the 19th ACM SIGPLAN international conference on Functional programmingSMT-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 ...
Refinement types for Haskell
PLPV '14: Proceedings of the ACM SIGPLAN 2014 Workshop on Programming Languages meets Program VerificationWe present LiquidHaskell (http://goto.ucsd.edu/liquid), an automatic verifier for Haskell. LiquidHaskell uses Refinement types, a restricted form of dependent types where relationships between values are encoded by decorating types with logical ...
Type reconstruction for general refinement types
ESOP'07: Proceedings of the 16th European Symposium on ProgrammingGeneral 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 ...







Comments