[go: up one dir, main page]
More Web Proxy on the site http://driver.im/ skip to main content
10.1145/1706299.1706315acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
research-article

Dependent types from counterexamples

Published: 17 January 2010 Publication History

Abstract

Motivated by recent research in abstract model checking, we present a new approach to inferring dependent types. Unlike many of the existing approaches, our approach does not rely on programmers to supply the candidate (or the correct) types for the recursive functions and instead does counterexample-guided refinement to automatically generate the set of candidate dependent types. The main idea is to extend the classical fixed-point type inference routine to return a counterexample if the program is found untypable with the current set of candidate types. Then, an interpolating theorem prover is used to validate the counterexample as a real type error or generate additional candidate dependent types to refute the spurious counterexample. The process is repeated until either a real type error is found or sufficient candidates are generated to prove the program typable. Our system makes non-trivial use of "linear" intersection types in the refinement phase.
The paper presents the type inference system and reports on the experience with a prototype implementation that infers dependent types for a subset of the Ocaml language. The implementation infers dependent types containing predicates from the quantifier-free theory of linear arithmetic and equality with uninterpreted function symbols.

References

[1]
L. Augustsson. Cayenne -- a language with dependent types. In ICFP, pages 239--250, 1998.
[2]
T. Ball, O. Kupferman, and M. Sagiv. Leaping loops in the presence of abstraction. In CAV, pages 491--503, 2007.
[3]
T. Ball and S.K. Rajamani. The SLAM project: debugging system software via static analysis. In POPL, pages 1--3, 2002.
[4]
J. Bengtson, K. Bhargavan, C. Fournet, A.D. Gordon, and S. Maffeis. Refinement types for secure implementations. In CSF, pages 17--32, 2008.
[5]
D. Beyer, D. Zufferey, and R. Majumdar. CSIsat: Interpolation for LA EUF. In CAV, pages 304--308, 2008.
[6]
W.-N. Chin and S.-C. Khoo. Calculating sized types. Higher-Order and Symbolic Computation, 14(2-3):261--300, 2001.
[7]
W.-N. Chin, S.-C. Khoo, and D.N. Xu. Extending sized type with collection analysis. In PEPM, pages 75--84, 2003.
[8]
A. Cimatti, A. Griggio, and R. Sebastiani. Efficient interpolant generation in satisfiability modulo theories. In TACAS, pages 397--412, 2008.
[9]
E.M. Clarke, O. Grumberg, S. Jha, Y. Lu, and H. Veith. Counterexample-guided abstraction refinement. In CAV, pages 154--169, 2000.
[10]
J. Condit, M. Harren, Z.R. Anderson, D. Gay, and G.C. Necula. Dependent types for low-level programming. In ESOP, pages 520--535, 2007.
[11]
W. Craig. Linear reasoning. a new form of the Herbrand-Gentzen theorem. J. Symb. Log., 22(3):250--268, 1957.
[12]
C. Flanagan. Hybrid type checking. In POPL, pages 245--256, 2006.
[13]
C. Flanagan, A. Sabry, B.F. Duba, and M. Felleisen. The essence of compiling with continuations. In PLDI, pages 237--247, 1993.
[14]
T. Freeman and F. Pfenning. Refinement types for ML. In PLDI, pages 268--277, 1991.
[15]
T.A. Henzinger, R. Jhala, R. Majumdar, and K.L. McMillan. Abstractions from proofs. In POPL, pages 232--244, 2004.
[16]
T.A. Henzinger, R. Jhala, R. Majumdar, and G. Sutre. Lazy abstraction. In POPL, pages 58--70, 2002.
[17]
H. Jain, E.M. Clarke, and O. Grumberg. Efficient Craig interpolation for linear Diophantine (dis)equations and linear modular equations. In CAV, pages 254--267, 2008.
[18]
R. Jhala and K.L. McMillan. Interpolant-based transition relation approximation. In CAV, pages 39--51, 2005.
[19]
T. Johnsson. Lambda lifting: Transforming programs to recursive equations. In FPCA, pages 190--203, 1985.
[20]
D. Kapur, R. Majumdar, and C.G. Zarba. Interpolation for data structures. In SIGSOFT FSE, pages 105--116, 2006.
[21]
A.J. Kfoury and J.B. Wells. Principality and type inference for intersection types using expansion variables. Theor. Comput. Sci., 311(1-3):1--70, 2004.
[22]
K. Knowles and C. Flanagan. Compositional reasoning and decidable checking for dependent contract types. In PLPV, pages 27--38, 2009.
[23]
K.W. Knowles and C. Flanagan. Type reconstruction for general refinement types. In ESOP, pages 505--519, 2007.
[24]
N. Kobayashi. Types and higher-order recursion schemes for verification of higher-order programs. In POPL, pages 416--428, 2009.
[25]
D. Kroening and G. Weissenbacher. Counterexamples with loops for predicate abstraction. In CAV, pages 152--165, 2006.
[26]
K.L. McMillan. Interpolation and SAT-based model checking. In CAV, pages 1--13, 2003.
[27]
K.L. McMillan. An interpolating theorem prover. Theor. Comput. Sci., 345(1):101--121, 2005.
[28]
K.L. McMillan. Lazy abstraction with interpolants. In CAV, pages 123--136, 2006.
[29]
P.M. Neergaard and H.G. Mairson. Types, potency, and idempotency: why nonlinearity and amnesia make a type system work. In ICFP, pages 138--149, 2004.
[30]
C.-H.L. Ong. On model-checking trees generated by higher-order recursion schemes. In LICS, pages 81--90, 2006.
[31]
X. Ou, G. Tan, Y. Mandelbaum, and D. Walker. Dynamic typing with dependent types. In IFIP TCS, pages 437--450, 2004.
[32]
W. Pugh. The Omega test: a fast and practical integer programming algorithm for dependence analysis. In SC, pages 4--13, 1991.
[33]
P.M. Rondon, M. Kawaguchi, and R. Jhala. Liquid types. In PLDI, pages 159--169, 2008.
[34]
R. Statman. The typed lambda-calculus is not elementary recursive. Theor. Comput. Sci., 9:73--81, 1979.
[35]
T. Terauchi. Dependent types from counterexamples, 2009. http://www.kb.ecei.tohoku.ac.jp/~terauchi/.
[36]
H. Unno and N. Kobayashi. Dependent type inference with interpolants. In PPDP, pages 277--288, 2009.
[37]
J.B. Wells. The essence of principal typings. In ICALP, pages 913--925, 2002.
[38]
H. Xi and F. Pfenning. Dependent types in practical programming. In POPL, pages 214--227, 1999.

Cited By

View all
  • (2024)Answer Refinement Modification: Refinement Type System for Algebraic Effects and HandlersProceedings of the ACM on Programming Languages10.1145/36332808:POPL(115-147)Online publication date: 5-Jan-2024
  • (2024)Ill-Typed Programs Don’t EvaluateProceedings of the ACM on Programming Languages10.1145/36329098:POPL(2010-2040)Online publication date: 5-Jan-2024
  • (2023)Refinement Types for Call-by-name ProgramsJournal of Information Processing10.2197/ipsjjip.31.70831(708-721)Online publication date: 2023
  • Show More Cited By

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM Conferences
POPL '10: Proceedings of the 37th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
January 2010
520 pages
ISBN:9781605584799
DOI:10.1145/1706299
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 45, Issue 1
    POPL '10
    January 2010
    500 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/1707801
    Issue’s Table of Contents
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]

Sponsors

In-Cooperation

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 17 January 2010

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. counterexamples
  2. dependent types
  3. interpolation
  4. intersection types
  5. type inference

Qualifiers

  • Research-article

Conference

POPL '10
Sponsor:

Acceptance Rates

Overall Acceptance Rate 824 of 4,130 submissions, 20%

Upcoming Conference

POPL '25

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

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

Other Metrics

Citations

Cited By

View all
  • (2024)Answer Refinement Modification: Refinement Type System for Algebraic Effects and HandlersProceedings of the ACM on Programming Languages10.1145/36332808:POPL(115-147)Online publication date: 5-Jan-2024
  • (2024)Ill-Typed Programs Don’t EvaluateProceedings of the ACM on Programming Languages10.1145/36329098:POPL(2010-2040)Online publication date: 5-Jan-2024
  • (2023)Refinement Types for Call-by-name ProgramsJournal of Information Processing10.2197/ipsjjip.31.70831(708-721)Online publication date: 2023
  • (2023)Higher-Order Property-Directed ReachabilityProceedings of the ACM on Programming Languages10.1145/36078317:ICFP(48-77)Online publication date: 31-Aug-2023
  • (2023)Higher-Order MSL Horn ConstraintsProceedings of the ACM on Programming Languages10.1145/35712627:POPL(2017-2047)Online publication date: 11-Jan-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)Helmholtz: A Verifier for Tezos Smart Contracts Based on Refinement TypesNew Generation Computing10.1007/s00354-022-00167-140:2(507-540)Online publication date: 27-May-2022
  • (2021)Intensional datatype refinement: with application to scalable verification of pattern-match safetyProceedings of the ACM on Programming Languages10.1145/34343365:POPL(1-29)Online publication date: 4-Jan-2021
  • (2021)Constraint-Based Relational VerificationComputer Aided Verification10.1007/978-3-030-81685-8_35(742-766)Online publication date: 15-Jul-2021
  • (2021)Helmholtz: A Verifier for Tezos Smart Contracts Based on Refinement TypesTools and Algorithms for the Construction and Analysis of Systems10.1007/978-3-030-72013-1_14(262-280)Online publication date: 23-Mar-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