skip to main content
research-article
Open Access
Artifacts Evaluated & Reusable

Local refinement typing

Published:29 August 2017Publication History
Skip Abstract Section

Abstract

We introduce the FUSION algorithm for local refinement type inference, yielding a new SMT-based method for verifying programs with polymorphic data types and higher-order functions. FUSION is concise as the programmer need only write signatures for (externally exported) top-level functions and places with cyclic (recursive) dependencies, after which FUSION can predictably synthesize the most precise refinement types for all intermediate terms (expressible in the decidable refinement logic), thereby checking the program without false alarms. We have implemented FUSION and evaluated it on the benchmarks from the LiquidHaskell suite totalling about 12KLOC. FUSION checks an existing safety benchmark suite using about half as many templates as previously required and nearly 2 × faster. In a new set of theorem proving benchmarks FUSION is both 10 — 50 × faster and, by synthesizing the most precise types, avoids false alarms to make verification possible.

References

  1. C. Barrett, P. Fontaine, and C. Tinelli. 2016. The Satisfiability Modulo Theories Library (SMT-LIB). www.SMT-LIB.org. (2016).Google ScholarGoogle Scholar
  2. J. Bengtson, K. Bhargavan, C. Fournet, A.D. Gordon, and S. Maffeis. 2008. Refinement Types for Secure Implementations. In CSF . Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Dirk Beyer, Alessandro Cimatti, Alberto Griggio, M. Erkan Keremoglu, and Roberto Sebastiani. 2009. Software model checking via large-block encoding. In FMCAD. Google ScholarGoogle ScholarCross RefCross Ref
  4. Nikolaj Bjørner, Arie Gurfinkel, Ken McMillan, and Andrey Rybalchenko. 2015. Horn Clause Solvers for Program Verification. In Fields of Logic and Computation. Google ScholarGoogle ScholarCross RefCross Ref
  5. Rod M. Burstall and John Darlington. 1977. A Transformation System for Developing Recursive Programs. J. ACM 24, 1 (1977), 44–67. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Chris Casinghino, Vilhelm Sjöberg, and Stephanie Weirich. 2014. Combining Proofs and Programs in a Dependently Typed Language. In POPL. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. R.L. Constable. 1986. Implementing Mathematics with the Nuprl Proof Development System. Prentice-Hall.Google ScholarGoogle Scholar
  8. Benjamin Cosman and Ranjit Jhala. 2017. Local Refinement Typing (Extended version). https://arxiv.org/abs/1706.08007 . (2017).Google ScholarGoogle Scholar
  9. J. Dunfield. 2007. Refined typechecking with Stardust. In PLPV. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. M.D. Ernst, J. Cockrell, W. G. Griswold, and D. Notkin. 2001. Dynamically Discovering Likely Program Invariants to Support Program Evolution. IEEE TSE 27(2) (2001), 1–25. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. C. Flanagan, R. Joshi, and K. R. M. Leino. 2001. Annotation inference for modular checkers. Inform. Process. Lett. (2001).Google ScholarGoogle Scholar
  12. C. Flanagan, K.R.M. Leino, M. Lillibridge, G. Nelson, J. B. Saxe, and R. Stata. 2002. Extended static checking for Java. In PLDI. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. C. Flanagan and J.B. Saxe. 2000. Avoiding exponential explosion: generating compact verification conditions. In POPL.Google ScholarGoogle Scholar
  14. Patrice Godefroid and Mihalis Yannakakis. 2013. Analysis of Boolean Programs. In TACAS.Google ScholarGoogle Scholar
  15. S. Graf and H. Saïdi. 1997. Construction of abstract state graphs with PVS. In CAV. Springer, 72–83. Google ScholarGoogle ScholarCross RefCross Ref
  16. Sergey Grebenshchikov, Nuno P. Lopes, Corneliu Popeea, and Andrey Rybalchenko. 2012. Synthesizing software verifiers from proof rules. In PLDI. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Kodai Hashimoto and Hiroshi Unno. 2015. Refinement Type Inference via Horn Constraint Optimization. In Static Analysis -22nd International Symposium, SAS 2015, Saint-Malo, France, September 9-11, 2015, Proceedings . 199–216. Google ScholarGoogle ScholarCross RefCross Ref
  18. Ralf Hinze. 2009. Functional pearl: la tour d’Hanoï. In ICFP. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Kryštof Hoder and Nikolaj Bjørner. 2012. Generalized Property Directed Reachability. In SAT.Google ScholarGoogle Scholar
  20. Ranjit Jhala, Rupak Majumdar, and Andrey Rybalchenko. 2011. HMC: Verifying Functional Programs Using Abstract Interpreters. In CAV. Google ScholarGoogle ScholarCross RefCross Ref
  21. R. Jhala and K.L. McMillan. 2006. A Practical and Complete Approach to Predicate Refinement. In TACAS 06. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Richard M. Karp. 1972. Reducibility Among Combinatorial Problems. In Proceedings of a symposium on the Complexity of Computer Computations . Google ScholarGoogle ScholarCross RefCross Ref
  23. Andrew M. Kent, David Kempe, and Sam Tobin-Hochstadt. 2016. Occurrence typing modulo theories. In PLDI.Google ScholarGoogle Scholar
  24. K. Knowles and C. Flanagan. 2007. Type Reconstruction for General Refinement Types. In ESOP. http://kenn.frap.net/ publications/knowles-flanagan.esop.07.type.pdfGoogle ScholarGoogle Scholar
  25. K.W. Knowles and C. Flanagan. 2010. Hybrid type checking. ACM TOPLAS (2010).Google ScholarGoogle Scholar
  26. K. W. Knowles and C. Flanagan. 2009. Compositional reasoning and decidable checking for dependent contract types. In PLPV .Google ScholarGoogle Scholar
  27. Naoki Kobayashi, Ryosuke Sato, and Hiroshi Unno. 2011. Predicate abstraction and CEGAR for higher-order model checking. In PLDI. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Anvesh Komuravelli, Arie Gurfinkel, and Sagar Chaki. 2016. SMT-based model checking for recursive programs. Formal Methods in System Design 48, 3 (2016), 175–205. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. K. Rustan M. Leino. 2005. Efficient weakest preconditions. Inf. Process. Lett. 93, 6 (2005).Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. G. Nelson. 1981. Techniques for program verification. Technical Report CSL81-10. Xerox Palo Alto Research Center.Google ScholarGoogle Scholar
  31. Martin Odersky, Christoph Zenger, and Matthias Zenger. 2001. Colored local type inference. In POPL. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. X. Ou, G. Tan, Y. Mandelbaum, and D. Walker. 2004. Dynamic Typing with Dependent Types. In IFIP TCS. Google ScholarGoogle ScholarCross RefCross Ref
  33. Alberto Pettorossi and Maurizio Proietti. 1994. Transformation of logic programs: Foundations and techniques. The Journal of Logic Programming 19 (1994), 261 – 320. Google ScholarGoogle ScholarCross RefCross Ref
  34. B. C. Pierce and D. N. Turner. 1998. Local Type Inference. In POPL. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Nadia Polikarpova, Ivan Kuraj, and Armando Solar-Lezama. 2016. Program synthesis from polymorphic refinement types. In PLDI. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. P. Rondon, M. Kawaguchi, and R. Jhala. 2008. Liquid Types. In PLDI. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Philipp Rümmer, Hossein Hojjat, and Viktor Kuncak. 2015. On recursion-free Horn clauses and Craig interpolation. Formal Methods in System Design 47, 1 (2015), 1–25. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. J. Rushby, S. Owre, and N. Shankar. 1998. Subtypes for Specifications: Predicate Subtyping in PVS. IEEE TSE (1998).Google ScholarGoogle Scholar
  39. Vilhelm Sjöberg and Stephanie Weirich. 2015. Programming up to Congruence. In POPL.Google ScholarGoogle Scholar
  40. N. Swamy, J. Chen, C. Fournet, P-Y. Strub, K. Bhargavan, and J. Yang. 2011. Secure distributed programming with valuedependent types. In ICFP.Google ScholarGoogle Scholar
  41. N. Swamy, J. Weinberger, C. Schlesinger, J. Chen, and B. Livshits. 2013. Verifying Higher-order Programs with the Dijkstra Monad. In PLDI. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Hisao Tamaki and Taisuke Sato. 1984. Unfold/Fold Transformation of Logic Programs. In Proceedings of the Second International Logic Programming Conference, Uppsala University, Uppsala, Sweden, July 2-6, 1984 . 127–138.Google ScholarGoogle Scholar
  43. H. Unno, T. Terauchi, and N. Kobayashi. 2013. Relatively complete verification of higher-order functional programs. In POPL . Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. N. Vazou and R. Jhala. 2016. Refinement Reflection (or, how to turn your favorite language into a proof assistant using SMT). ArXiv e-prints (Oct. 2016). arXiv: cs.PL/1610.04641Google ScholarGoogle Scholar
  45. N. Vazou, E. L. Seidel, and R. Jhala. 2014a. LiquidHaskell: Experience with refinement types in the real world. In Haskell.Google ScholarGoogle Scholar
  46. N. Vazou, E. L. Seidel, R. Jhala, D. Vytiniotis, and S. L. Peyton Jones. 2014b. Refinement Types for Haskell. In ICFP. Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. Panagiotis Vekris, Benjamin Cosman, and Ranjit Jhala. 2016. Refinement types for TypeScript. In PLDI. Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. H. Xi and F. Pfenning. 1998. Eliminating Array Bound Checking Through Dependent Types.. In PLDI. Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. He Zhu, Aditya V. Nori, and Suresh Jagannathan. 2015. Learning refinement types. In ICFP.Google ScholarGoogle Scholar

Index Terms

  1. Local refinement typing

      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

      Full Access

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!