skip to main content
research-article

Learning refinement types

Published:29 August 2015Publication History
Skip Abstract Section

Abstract

We propose the integration of a random test generation system (capable of discovering program bugs) and a refinement type system (capable of expressing and verifying program invariants), for higher-order functional programs, using a novel lightweight learning algorithm as an effective intermediary between the two. Our approach is based on the well-understood intuition that useful, but difficult to infer, program properties can often be observed from concrete program states generated by tests; these properties act as likely invariants, which if used to refine simple types, can have their validity checked by a refinement type checker. We describe an implementation of our technique for a variety of benchmarks written in ML, and demonstrate its effectiveness in inferring and proving useful invariants for programs that express complex higher-order control and dataflow.

References

  1. A. Albarghouthi and K. L. McMillan. Beautiful interpolants. In CAV, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. D. Beyer and M. E. Keremoglu. Cpachecker: A tool for configurable software verification. In CAV, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. C. Boyapati, S. Khurshid, and D. Marinov. Korat: Automated testing based on java predicates. In ISSTA, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. H. R. Chamarthi, P. C. Dillinger, M. Kaufmann, and P. Manolios. Integrating testing and interactive theorem proving. In ACL2, 2011.Google ScholarGoogle ScholarCross RefCross Ref
  5. R. Chugh, P. M. Rondon, and R. Jhala. Nested refinements: A logic for duck typing. In POPL, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. K. Claessen and J. Hughes. Quickcheck: A lightweight tool for random testing of haskell programs. In ICFP, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. E. Clarke, O. Grumberg, S. Jha, Y. Lu, and H. Veith. Counterexampleguided abstraction refinement for symbolic model checking. J. ACM, 50(5):752–794, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. M. D. Ernst, J. H. Perkins, P. J. Guo, S. McCamant, C. Pacheco, M. S. Tschantz, and C. Xiao. The Daikon system for dynamic detection of likely invariants. Sci. Comput. Program., 69(1-3):35–45, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. C. Flanagan and K. R. M. Leino. Houdini, an annotation assistant for esc/java. In FME, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. P. Garg, C. Löding, P. Madhusudan, and D. Neider. Ice: A robust learning framework for learning invariants. In CAV, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. S. Graf and H. Sa¨ıdi. Construction of abstract state graphs with pvs. In CAV, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. B. S. Gulavani, T. A. Henzinger, Y. Kannan, A. V. Nori, and S. K. Rajamani. Synergy: A new algorithm for property checking. In FSE, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. T. A. Henzinger, R. Jhala, R. Majumdar, and K. L. McMillan. Abstractions from proofs. In POPL, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. R. Jhala, R. Majumdar, and A. Rybalchenko. Hmc: Verifying functional programs using abstract interpreters. In CAV, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. M. Kawaguchi, P. Rondon, and R. Jhala. Type-based data structure verification. In PLDI, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. N. Kobayashi. Types and higher-order recursion schemes for verification of higher-order programs. In POPL, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. N. Kobayashi, R. Sato, and H. Unno. Predicate abstraction and cegar for higher-order model checking. In PLDI, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. S. Lindley and C. McBride. Hasochism: The pleasure and pain of dependently typed haskell programming. In Haskell, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. C. McBride. Faking it simulating dependent types in haskell. J. Funct. Program., 12(5):375–392, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. E. J. McCluskey. Minimization of boolean functions. Bell system technical Journal, 35(6):1417–1444, 1956.Google ScholarGoogle Scholar
  21. K. L. McMillan. An interpolating theorem prover. Theor. Comput. Sci., 345(1):101–121, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. A. Nanevski, G. Morrisett, A. Shinnar, P. Govereau, and L. Birkedal. Ynot: Dependent types for imperative programs. In ICFP, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. C. G. Nelson. Techniques for program verification. Technical report, XEROX Research Center, 1981.Google ScholarGoogle Scholar
  24. P. C. Nguyen and D. V. Horn. Relatively complete counterexamples for higher-order programs. In PLDI, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. T. Nguyen, D. Kapur, W. Weimer, and S. Forrest. Using dynamic analysis to discover polynomial and array invariants. In ICSE, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. OCAML Library. http://caml.inria.fr/pub/docs/.Google ScholarGoogle Scholar
  27. S. J. Ramsay, R. P. Neatherway, and C.-H. L. Ong. A type-directed abstraction refinement approach to higher-order model checking. In POPL, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. P. M. Rondon, M. Kawaguci, and R. Jhala. Liquid types. In PLDI, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. E. L. Seidel, N. Vazou, and R. Jhala. Type targeted testing. In ESOP, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. R. Sharma and A. Aiken. From invariant checking to invariant inference using randomized search. In CAV, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. R. Sharma, M. Gligoric, A. Arcuri, G. Fraser, and D. Marinov. Testing container classes: Random or systematic? In FASE, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. R. Sharma, A. V. Nori, and A. Aiken. Interpolants as classifiers. In CAV, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. R. Sharma, S. Gupta, B. Hariharan, A. Aiken, P. Liang, and A. V. Nori. A data driven approach for algebraic loop invariants. In ESOP, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. R. Sharma, S. Gupta, B. Hariharan, A. Aiken, and A. V. Nori. Verification as learning geometric concepts. In SAS, 2013.Google ScholarGoogle ScholarCross RefCross Ref
  35. SML Library. http://www.smlnj.org/doc/smlnj-lib/.Google ScholarGoogle Scholar
  36. N. Swamy, J. Weinberger, C. Schlesinger, J. Chen, and B. Livshits. Verifying higher-order programs with the dijkstra monad. In PLDI, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. T. Terauchi. Dependent types from counterexamples. In POPL, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. H. Unno and N. Kobayashi. Dependent type inference with interpolants. In PPDP, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. H. Unno, T. Terauchi, and N. Kobayashi. Automating relatively complete verification of higher-order functional programs. In POPL, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. N. Vazou, P. M. Rondon, and R. Jhala. Abstract refinement types. In ESOP, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. H. Xi and F. Pfenning. Dependent types in practical programming. In POPL, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Yices SMT solver. http://yices.csl.sri.com/.Google ScholarGoogle Scholar
  43. H. Zhu and S. Jagannathan. Compositional and lightweight dependent type inference for ml. In VMCAI, 2013.Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. H. Zhu, A. V. Nori, and S. Jagannathan. Learning refinement types. Technical report, Purdue Univsersity, 2015.Google ScholarGoogle Scholar
  45. https://www.cs. purdue.edu/homes/zhu103/msolve/tech.pdf.Google ScholarGoogle Scholar

Index Terms

  1. Learning 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

              Full Access

              • Published in

                cover image ACM SIGPLAN Notices
                ACM SIGPLAN Notices  Volume 50, Issue 9
                ICFP '15
                September 2015
                436 pages
                ISSN:0362-1340
                EISSN:1558-1160
                DOI:10.1145/2858949
                • Editor:
                • Andy Gill
                Issue’s Table of Contents
                • cover image ACM Conferences
                  ICFP 2015: Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming
                  August 2015
                  436 pages
                  ISBN:9781450336697
                  DOI:10.1145/2784731

                Copyright © 2015 ACM

                Publisher

                Association for Computing Machinery

                New York, NY, United States

                Publication History

                • Published: 29 August 2015

                Check for updates

                Qualifiers

                • research-article

              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!