Program synthesis from polymorphic refinement types

We present a method for synthesizing recursive functions that provably satisfy a given specification in the form of a polymorphic refinement type. We observe that such specifications are particularly suitable for program synthesis for two reasons. First, they offer a unique combination of expressive power and decidability, which enables automatic verification—and hence synthesis—of nontrivial programs. Second, a type-based specification for a program can often be effectively decomposed into independent specifications for its components, causing the synthesizer to consider fewer component combinations and leading to a combinatorial reduction in the size of the search space. At the core of our synthesis procedure is a newalgorithm for refinement type checking, which supports specification decomposition. We have evaluated our prototype implementation on a large set of synthesis problems and found that it exceeds the state of the art in terms of both scalability and usability. The tool was able to synthesize more complex programs than those reported in prior work (several sorting algorithms and operations on balanced search trees), as well as most of the benchmarks tackled by existing synthesizers, often starting from a more concise and intuitive user input.

[1]  K. Rustan M. Leino,et al.  Program extrapolation with jennisys , 2012, OOPSLA '12.

[2]  Rastislav Bodík,et al.  Jungloid mining: helping to navigate the API jungle , 2005, PLDI '05.

[3]  Sumit Gulwani,et al.  Recursive Program Synthesis , 2013, CAV.

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

[5]  Nikolaj Bjørner,et al.  Z3: An Efficient SMT Solver , 2008, TACAS.

[6]  Sanjit A. Seshia,et al.  Combinatorial sketching for finite programs , 2006, ASPLOS XII.

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

[8]  Frank Pfenning,et al.  Tridirectional typechecking , 2004, POPL.

[9]  R. Adams Proceedings , 1947 .

[10]  Sumit Gulwani,et al.  Type-directed completion of partial expressions , 2012, PLDI.

[11]  Ranjit Jhala,et al.  Bounded refinement types , 2015, ICFP.

[12]  Rajeev Alur,et al.  Syntax-guided synthesis , 2013, 2013 Formal Methods in Computer-Aided Design.

[13]  Koen Claessen,et al.  HipSpec: Automating Inductive Proofs of Program Properties , 2012, ATx/WInG@IJCAR.

[14]  Frank Pfenning,et al.  Dependent types in practical programming , 1999, POPL '99.

[15]  Armando Solar-Lezama,et al.  Type Assisted Synthesis of Recursive Transformers on Algebraic Data Types , 2015, ArXiv.

[16]  Isil Dillig,et al.  Synthesizing data structure transformations from input-output examples , 2015, PLDI.

[17]  Cormac Flanagan,et al.  Hybrid type checking , 2006, POPL '06.

[18]  Ranjit Jhala,et al.  Refinement types for Haskell , 2014, ICFP.

[19]  Alan Bundy,et al.  Scheme-based theorem discovery and concept invention , 2012, Expert Syst. Appl..

[20]  Isil Dillig,et al.  Maximal specification synthesis , 2016, POPL.

[21]  Peter-Michael Osera,et al.  Type-and-example-directed program synthesis , 2015, PLDI.

[22]  J. Mixter Fast , 2012 .

[23]  Frank Pfenning,et al.  Intersection types and computational effects , 2000, ICFP '00.

[24]  David Walker,et al.  Example-directed synthesis: a type-theoretic interpretation , 2016, POPL.

[25]  Joao Marques-Silva,et al.  Fast, flexible MUS enumeration , 2015, Constraints.

[26]  Ruzica Piskac,et al.  Complete functional synthesis , 2010, PLDI '10.

[27]  Viktor Kuncak,et al.  Satisfiability Modulo Recursive Programs , 2011, SAS.

[28]  Kenneth Knowles,et al.  Type Reconstruction for General Refinement Types , 2007, ESOP.

[29]  Thierry Coquand,et al.  An Algorithm for Type-Checking Dependent Types , 1996, Sci. Comput. Program..

[30]  Benjamin C. Pierce,et al.  Types and programming languages: the next generation , 2003, 18th Annual IEEE Symposium of Logic in Computer Science, 2003. Proceedings..

[31]  Isil Dillig,et al.  Inductive invariant generation via abductive inference , 2013, OOPSLA.

[32]  Jónathan Heras,et al.  Proof-Pattern Recognition and Lemma Discovery in ACL2 , 2013, LPAR.

[33]  Alan Mycroft,et al.  Polymorphic Type Schemes and Recursive Definitions , 1984, Symposium on Programming.

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

[35]  Viktor Kuncak,et al.  Synthesis modulo recursive functions , 2013, OOPSLA.

[36]  Pavol Cerný,et al.  Synthesis Through Unification , 2015, CAV.

[37]  Ranjit Jhala,et al.  LiquidHaskell: experience with refinement types in the real world , 2014, Haskell.

[38]  Edwin Brady,et al.  Idris, a general-purpose dependently typed programming language: Design and implementation , 2013, Journal of Functional Programming.

[39]  Philip Wadler,et al.  Theorems for free! , 1989, FPCA.

[40]  Sumit Gulwani,et al.  Program verification using templates over predicate abstraction , 2009, PLDI '09.

[41]  Ruzica Piskac,et al.  Complete completion using types and weights , 2013, PLDI.

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

[43]  Ulf Norell,et al.  Dependently typed programming in Agda , 2009, TLDI '09.