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.
- L. Augustsson. Cayenne -- a language with dependent types. In ICFP, pages 239--250, 1998. Google ScholarDigital Library
- T. Ball, O. Kupferman, and M. Sagiv. Leaping loops in the presence of abstraction. In CAV, pages 491--503, 2007. Google ScholarDigital Library
- T. Ball and S.K. Rajamani. The SLAM project: debugging system software via static analysis. In POPL, pages 1--3, 2002. Google ScholarDigital Library
- J. Bengtson, K. Bhargavan, C. Fournet, A.D. Gordon, and S. Maffeis. Refinement types for secure implementations. In CSF, pages 17--32, 2008. Google ScholarDigital Library
- D. Beyer, D. Zufferey, and R. Majumdar. CSIsat: Interpolation for LA EUF. In CAV, pages 304--308, 2008. Google ScholarDigital Library
- W.-N. Chin and S.-C. Khoo. Calculating sized types. Higher-Order and Symbolic Computation, 14(2-3):261--300, 2001. Google ScholarDigital Library
- W.-N. Chin, S.-C. Khoo, and D.N. Xu. Extending sized type with collection analysis. In PEPM, pages 75--84, 2003. Google ScholarDigital Library
- A. Cimatti, A. Griggio, and R. Sebastiani. Efficient interpolant generation in satisfiability modulo theories. In TACAS, pages 397--412, 2008. Google ScholarDigital Library
- E.M. Clarke, O. Grumberg, S. Jha, Y. Lu, and H. Veith. Counterexample-guided abstraction refinement. In CAV, pages 154--169, 2000. Google ScholarDigital Library
- 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. Google ScholarDigital Library
- W. Craig. Linear reasoning. a new form of the Herbrand-Gentzen theorem. J. Symb. Log., 22(3):250--268, 1957.Google ScholarCross Ref
- C. Flanagan. Hybrid type checking. In POPL, pages 245--256, 2006. Google ScholarDigital Library
- C. Flanagan, A. Sabry, B.F. Duba, and M. Felleisen. The essence of compiling with continuations. In PLDI, pages 237--247, 1993. Google ScholarDigital Library
- T. Freeman and F. Pfenning. Refinement types for ML. In PLDI, pages 268--277, 1991. Google ScholarDigital Library
- T.A. Henzinger, R. Jhala, R. Majumdar, and K.L. McMillan. Abstractions from proofs. In POPL, pages 232--244, 2004. Google ScholarDigital Library
- T.A. Henzinger, R. Jhala, R. Majumdar, and G. Sutre. Lazy abstraction. In POPL, pages 58--70, 2002. Google ScholarDigital Library
- 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. Google ScholarDigital Library
- R. Jhala and K.L. McMillan. Interpolant-based transition relation approximation. In CAV, pages 39--51, 2005. Google ScholarDigital Library
- T. Johnsson. Lambda lifting: Transforming programs to recursive equations. In FPCA, pages 190--203, 1985. Google ScholarDigital Library
- D. Kapur, R. Majumdar, and C.G. Zarba. Interpolation for data structures. In SIGSOFT FSE, pages 105--116, 2006. Google ScholarDigital Library
- 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. Google ScholarDigital Library
- K. Knowles and C. Flanagan. Compositional reasoning and decidable checking for dependent contract types. In PLPV, pages 27--38, 2009. Google ScholarDigital Library
- K.W. Knowles and C. Flanagan. Type reconstruction for general refinement types. In ESOP, pages 505--519, 2007. Google ScholarDigital Library
- N. Kobayashi. Types and higher-order recursion schemes for verification of higher-order programs. In POPL, pages 416--428, 2009. Google ScholarDigital Library
- D. Kroening and G. Weissenbacher. Counterexamples with loops for predicate abstraction. In CAV, pages 152--165, 2006. Google ScholarDigital Library
- K.L. McMillan. Interpolation and SAT-based model checking. In CAV, pages 1--13, 2003.Google Scholar
- K.L. McMillan. An interpolating theorem prover. Theor. Comput. Sci., 345(1):101--121, 2005. Google ScholarDigital Library
- K.L. McMillan. Lazy abstraction with interpolants. In CAV, pages 123--136, 2006. Google ScholarDigital Library
- 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. Google ScholarDigital Library
- C.-H.L. Ong. On model-checking trees generated by higher-order recursion schemes. In LICS, pages 81--90, 2006. Google ScholarDigital Library
- X. Ou, G. Tan, Y. Mandelbaum, and D. Walker. Dynamic typing with dependent types. In IFIP TCS, pages 437--450, 2004.Google ScholarCross Ref
- W. Pugh. The Omega test: a fast and practical integer programming algorithm for dependence analysis. In SC, pages 4--13, 1991. Google ScholarDigital Library
- P.M. Rondon, M. Kawaguchi, and R. Jhala. Liquid types. In PLDI, pages 159--169, 2008. Google ScholarDigital Library
- R. Statman. The typed lambda-calculus is not elementary recursive. Theor. Comput. Sci., 9:73--81, 1979.Google ScholarCross Ref
- T. Terauchi. Dependent types from counterexamples, 2009. http://www.kb.ecei.tohoku.ac.jp/~terauchi/. Google ScholarDigital Library
- H. Unno and N. Kobayashi. Dependent type inference with interpolants. In PPDP, pages 277--288, 2009. Google ScholarDigital Library
- J.B. Wells. The essence of principal typings. In ICALP, pages 913--925, 2002. Google ScholarDigital Library
- H. Xi and F. Pfenning. Dependent types in practical programming. In POPL, pages 214--227, 1999. Google ScholarDigital Library
Index Terms
- Dependent types from counterexamples
Recommendations
Low-level liquid types
POPL '10: Proceedings of the 37th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languagesWe present Low-Level Liquid Types , a refinement type system for C based on Liquid Types . Low-Level Liquid Types combine refinement types with three key elements to automate verification of critical safety properties of low-level programs: First, by ...
Dependent types from counterexamples
POPL '10Motivated 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 ...
Liquid types
PLDI '08: Proceedings of the 29th ACM SIGPLAN Conference on Programming Language Design and ImplementationWe present Logically Qualified Data Types, abbreviated to Liquid Types, a system that combines Hindley-Milner type inference with Predicate Abstraction to automatically infer dependent types precise enough to prove a variety of safety properties. Liquid ...
Comments