A relational framework for higher-order shape analysis

We propose the integration of a relational specification framework within a dependent type system capable of verifying complex invariants over the shapes of algebraic datatypes. Our approach is based on the observation that structural properties of such datatypes can often be naturally expressed as inductively-defined relations over the recursive structure evident in their definitions. By interpreting constructor applications (abstractly) in a relational domain, we can define expressive relational abstractions for a variety of complex data structures, whose structural and shape invariants can be automatically verified. Our specification language also allows for definitions of parametricrelations for polymorphic data types that enable highly composable specifications and naturally generalizes to higher-order polymorphic functions. We describe an algorithm that translates relational specifications into a decidable fragment of first-order logic that can be efficiently discharged by an SMT solver. We have implemented these ideas in a type checker called CATALYST that is incorporated within the MLton SML compiler. Experimental results and case studies indicate that our verification strategy is both practical and effective.

[1]  Chris Okasaki,et al.  Purely functional data structures , 1998 .

[2]  Stephanie Weirich,et al.  Binders unbound , 2011, ICFP.

[3]  Ranjit Jhala,et al.  Type-based data structure verification , 2009, PLDI '09.

[4]  Bor-Yuh Evan Chang,et al.  Relational inductive shape analysis , 2008, POPL '08.

[5]  Viktor Kuncak,et al.  Decision procedures for algebraic data types with abstractions , 2010, POPL '10.

[6]  Lars Birkedal,et al.  Logical Step-Indexed Logical Relations , 2009, 2009 24th Annual IEEE Symposium on Logic In Computer Science.

[7]  Conor McBride Faking it: Simulating dependent types in Haskell , 2002, J. Funct. Program..

[8]  Fritz Henglein,et al.  Generic top-down discrimination for sorting and partitioning in linear time* , 2012, Journal of Functional Programming.

[9]  Conor McBride,et al.  Hasochism: the pleasure and pain of dependently typed haskell programming , 2013, Haskell '13.

[10]  Amal Ahmed,et al.  Step-Indexed Syntactic Logical Relations for Recursive and Quantified Types , 2006, ESOP.

[11]  Arthur Charguéraud,et al.  The Locally Nameless Representation , 2012, Journal of Automated Reasoning.

[12]  Patrick Maxim Rondon,et al.  Liquid types , 2008, PLDI '08.

[13]  Martin Hofmann,et al.  Relational semantics for effect-based program transformations: higher-order store , 2009, PPDP '09.

[14]  Matthew Might Shape Analysis in the Absence of Pointers and Structure , 2010, VMCAI.

[15]  Ranjit Jhala,et al.  Abstract Refinement Types , 2013, ESOP.

[16]  Gang Chen,et al.  Guarded recursive datatype constructors , 2003, POPL '03.

[17]  Benjamin C. Pierce,et al.  Local type inference , 1998, POPL '98.

[18]  A. Meyers Reading , 1999, Language Teaching.

[19]  Juan Chen,et al.  Secure distributed programming with value-dependent types , 2011, Journal of Functional Programming.

[20]  Nick Benton,et al.  Reading, Writing and Relations Towards Extensional Semantics for Effect Analyses , 2006 .

[21]  Simon Peyton Jones,et al.  The Glasgow Haskell Compiler , 2012 .

[22]  L. D. Moura,et al.  Deciding Effectively Propositional Logic with Equality , 2008 .

[23]  Juan Chen,et al.  Self-certification: bootstrapping certified typecheckers in F* with Coq , 2012, POPL '12.

[24]  Bertrand Jeannet,et al.  A relational approach to interprocedural shape analysis , 2004, TOPL.

[25]  Nick Benton,et al.  Relational Reasoning in a Nominal Semantics for Storage , 2005, TLCA.