Abstract
We present a technique for integrating GHC's type-checker with an SMT solver. The technique was developed to add support for reasoning about type-level functions on natural numbers, and so our implementation uses the theory of linear arithmetic. However, the approach is not limited to this theory, and makes it possible to experiment with other external decision procedures, such as reasoning about type-level booleans, bit-vectors, or any other theory supported by SMT solvers.
- Yices Manual, 2015. URL http://yices.csl.sri.com/papers/ manual.pdf.Google Scholar
- Adam Gundry. A typechecker plugin for units of measure. Submitted for publication., 2015.Google Scholar
- Christiaan Baaij. A plug-in for normalising type literals in ghc. 2015. URL https://github.com/clash-lang/ ghc-typelits-natnormalise.Google Scholar
- Clark Barrett, Aaron Stump, and Cesare Tinelli. The SMT-LIB standard: Version 2.0. Technical report, Department of Computer Science, The University of Iowa, 2010. URL http://smtlib.cs. uiowa.edu/papers/smt-lib-reference-v2.0-r12.09.09.pdf.Google Scholar
- Clark Barrett, Christopher L. Conway, Morgan Deters, Liana Hadarean, Dejan Jovanovi´c, Tim King, Andrew Reynolds, and Cesare Tinelli. CVC4. In Proceedings of the 23rd International Conference on Computer Aided Verification, Snowbird, Utah, USA, 2011. URL http://dl.acm.org/citation.cfm?id=2032305.2032319.Google Scholar
- Dimitrios Vytiniotis and Simon Peyton Jones. Evidence normalization in System FC. In 24th International Conference on Rewriting Techniques and Applications, Eindhoven, Netherlands, 2013. URL http://research.microsoft.com/en-us/um/people/simonpj/ papers/ext-f/fc-new-tyco.pdf.Google Scholar
- Dimitrios Vytiniotis, Simon Peyton Jones, Tom Schrijvers, and Martin Sulzmann. OutsideIn(X): Modular type inference with local assumptions. Journal of Functional Programming, September 2011. URL http://research.microsoft.com/apps/pubs/default. aspx?id=162516. Google Scholar
Digital Library
- Greg Nelson and Derek C. Oppen. Simplification by cooperating decision procedures. ACM Transactions on Programming Languages and Systems, 1(2), October 1979. URL http://doi.acm.org/10. 1145/357073.357079. Google Scholar
Digital Library
- Iavor S. Diatchki. simple-smt: a Haskell library for working with SMT solvers, 2015. URL http://hackage.haskell.org/package/ simple-smt.Google Scholar
- Iavor S. Diatchki. A plug-in for solving linear constraints using an smt solver. 2015. URL https://github.com/yav/type-nat-solver.Google Scholar
- J. Garrett Morris and Mark P. Jones. Instance chains: Type class programming without overlapping instances. In Proceedings of the 15th ACM SIGPLAN International Conference on Functional Programming (ICFP ’10), Baltimore, Maryland, USA, 2010. URL http://web.cecs.pdx.edu/~mpj/pubs/instancechains.pdf. Google Scholar
Digital Library
- Leonardo de Moura and Nikolaj Bjørner. Z3: An efficient smt solver. In Tools and Algorithms for the Construction and Analysis of Systems, 14th International Conference, Budapest, Hungary, 2008. URL http://research.microsoft.com/projects/z3/z3.pdf. Google Scholar
Digital Library
- Mark P. Jones. Simplifying and improving qualified types. In FPCA ’95: Conference on Functional Programming Languages and Computer Architecture, La Jolla, California, USA, 1995. URL http://web.cecs.pdx.edu/~mpj/pubs/fpca95.pdf. Google Scholar
Digital Library
- Niki Vazou, Eric L. Seidel, Ranjit Jhala, Dimitrios Vytiniotis, and Simon Peyton-jones. Refinment types for Haskell. In Proceedings of the 19th ACM SIGPLAN International Conference on Functional Programming, Gothenburg, Sweeden, 2014. URL http://goto. ucsd.edu/~rjhala/papers/refinement_types_for_haskell. pdf. Google Scholar
Digital Library
- Patrick C. Hickey, Lee Pike, Trevor Elliott, James Bielman, and John Launchbury. Building embedded systems with embedded DSLs (experience report). In Proceedings of the 2014 ACM SIGPLAN Conference on Functional Programming, Gothenburg, Sweden, 2014. URL https: //github.com/GaloisInc/smaccmpilot-experiencereport/ blob/master/embedded-experience.pdf?raw=true. Google Scholar
Digital Library
- Richard A. Eisenberg and Jan Stolarek. Promoting functions to type families in Haskell. In Proceedings of the 2014 ACM SIGPLAN Symposium on Haskell, Gothenburg, Sweden, 2014. URL http://www.cis.upenn.edu/~eir/papers/2014/promotion/ promotion.pdf. Google Scholar
Digital Library
- Richard A. Eisenberg and Stephanie Weirich. Dependently typed programming with singletons. In Proceedings of the 2012 ACM SIGPLAN Symposium on Haskell, Copenhagen, Denmark, 2012. Google Scholar
Digital Library
- Sam Lindley and Conor McBride. Hasochism: The pleasure and pain of dependently typed Haskell programming. In Proceedings of the 2013 ACM SIGPLAN Symposium on Haskell, Boston, Massachusetts, USA, 2013. URL https://personal.cis.strath.ac.uk/conor. mcbride/pub/hasochism.pdf. Google Scholar
Digital Library
- Sergey Berezin, Vijay Ganesh, and Daivd L. Dill. An online proofproducing decision procedure for mixed-integer linear arithmetic. In Proceedings of the 9th International Conference on Tools and Algorithms for the Construction and Analysis of Systems, Warsaw, Poland, 2003. URL http://hci.stanford.edu/cstr/reports/2007-07.pdf. Google Scholar
Digital Library
- The GHC Team. The Glorious Glasgow Haskell Compilation System User’s Guide, Version 7.10.1, 2015. URL https://downloads. haskell.org/~ghc/7.10.1/docs/html/users_guide/index. html.Google Scholar
Index Terms
Improving Haskell types with SMT
Recommendations
Improving Haskell types with SMT
Haskell '15: Proceedings of the 2015 ACM SIGPLAN Symposium on HaskellWe present a technique for integrating GHC's type-checker with an SMT solver. The technique was developed to add support for reasoning about type-level functions on natural numbers, and so our implementation uses the theory of linear arithmetic. ...
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 ...
Semantic subtyping with an SMT solver
ICFP '10We study a first-order functional language with the novel combination of the ideas of refinement type (the subset of a type to satisfy a Boolean expression) and type-test (a Boolean expression testing whether a value belongs to a type). Our core ...






Comments