skip to main content
research-article

Learning refinement types

Published: 29 August 2015 Publication History

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

Cited By

View all
  • (2024)LLM Meets Bounded Model Checking: Neuro-symbolic Loop Invariant InferenceProceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering10.1145/3691620.3695014(406-417)Online publication date: 27-Oct-2024
  • (2020)Interval counterexamples for loop invariant learningProceedings of the 28th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering10.1145/3368089.3409752(111-122)Online publication date: 8-Nov-2020
  • (2018)ICE-Based Refinement Type Discovery for Higher-Order Functional ProgramsTools and Algorithms for the Construction and Analysis of Systems10.1007/978-3-319-89960-2_20(365-384)Online publication date: 12-Apr-2018
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

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
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]

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 29 August 2015
Published in SIGPLAN Volume 50, Issue 9

Check for updates

Author Tags

  1. Higher-Order Verification
  2. Learning
  3. Refinement Types
  4. Testing

Qualifiers

  • Research-article

Funding Sources

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)31
  • Downloads (Last 6 weeks)5
Reflects downloads up to 13 Dec 2024

Other Metrics

Citations

Cited By

View all
  • (2024)LLM Meets Bounded Model Checking: Neuro-symbolic Loop Invariant InferenceProceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering10.1145/3691620.3695014(406-417)Online publication date: 27-Oct-2024
  • (2020)Interval counterexamples for loop invariant learningProceedings of the 28th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering10.1145/3368089.3409752(111-122)Online publication date: 8-Nov-2020
  • (2018)ICE-Based Refinement Type Discovery for Higher-Order Functional ProgramsTools and Algorithms for the Construction and Analysis of Systems10.1007/978-3-319-89960-2_20(365-384)Online publication date: 12-Apr-2018
  • (2018)Invariant Synthesis for Incomplete Verification EnginesTools and Algorithms for the Construction and Analysis of Systems10.1007/978-3-319-89960-2_13(232-250)Online publication date: 12-Apr-2018
  • (2018)Higher-Order Program Verification via HFL Model CheckingProgramming Languages and Systems10.1007/978-3-319-89884-1_25(711-738)Online publication date: 14-Apr-2018
  • (2023)Higher-Order Property-Directed ReachabilityProceedings of the ACM on Programming Languages10.1145/36078317:ICFP(48-77)Online publication date: 31-Aug-2023
  • (2023)Loop Invariant Inference through SMT Solving Enhanced Reinforcement LearningProceedings of the 32nd ACM SIGSOFT International Symposium on Software Testing and Analysis10.1145/3597926.3598047(175-187)Online publication date: 12-Jul-2023
  • (2023)HFL(Z) Validity Checking for Automated Program VerificationProceedings of the ACM on Programming Languages10.1145/35711997:POPL(154-184)Online publication date: 11-Jan-2023
  • (2022)Parameterized Recursive Refinement Types for Automated Program VerificationStatic Analysis10.1007/978-3-031-22308-2_18(397-421)Online publication date: 2-Dec-2022
  • (2021)Data flow refinement type inferenceProceedings of the ACM on Programming Languages10.1145/34343005:POPL(1-31)Online publication date: 4-Jan-2021
  • 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

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media