skip to main content
article
Public Access

Program synthesis from polymorphic refinement types

Published:02 June 2016Publication History
Skip Abstract Section

Abstract

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.

References

  1. A. Albarghouthi, S. Gulwani, and Z. Kincaid. Recursive program synthesis. In CAV, 2013.Google ScholarGoogle Scholar
  2. A. Albarghouthi, I. Dillig, and A. Gurfinkel. Maximal specification synthesis. In POPL, 2016. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. R. Alur, R. Bodík, G. Juniwal, M. M. K. Martin, M. Raghothaman, S. A. Seshia, R. Singh, A. Solar-Lezama, E. Torlak, and A. Udupa. Syntax-guided synthesis. In FMCAD, 2013.Google ScholarGoogle ScholarCross RefCross Ref
  4. R. Alur, P. ˇ Cerný, and A. Radhakrishna. Synthesis through unification. In CAV, 2015.Google ScholarGoogle Scholar
  5. L. Augustsson. djinn, the official Haskell package webpage. http://hackage.haskell.org/package/djinn, 2014.Google ScholarGoogle Scholar
  6. E. Brady. Idris, a general-purpose dependently typed programming language: Design and implementation. J. Funct. Program., 23(5):552–593, 2013.Google ScholarGoogle ScholarCross RefCross Ref
  7. K. Claessen, M. Johansson, D. Rosén, and N. Smallbone. Hipspec: Automating inductive proofs of program properties. In ATx/WInG, 2012.Google ScholarGoogle Scholar
  8. T. Coquand. An algorithm for type-checking dependent types. Sci. Comput. Program., 26(1-3):167–177, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. R. Davies and F. Pfenning. Intersection types and computational effects. In ICFP, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. I. Dillig, T. Dillig, B. Li, and K. L. McMillan. Inductive invariant generation via abductive inference. In OOPSLA, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. J. Dunfield and F. Pfenning. Tridirectional typechecking. In POPL, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. J. K. Feser, S. Chaudhuri, and I. Dillig. Synthesizing data structure transformations from input-output examples. In PLDI, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. C. Flanagan. Hybrid type checking. In POPL, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. J. Frankle, P. Osera, D. Walker, and S. Zdancewic. Exampledirected synthesis: a type-theoretic interpretation. In POPL, 2016. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. T. Gvero, V. Kuncak, I. Kuraj, and R. Piskac. Complete completion using types and weights. In PLDI, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. J. Heras, E. Komendantskaya, M. Johansson, and E. Maclean. Proof-pattern recognition and lemma discovery in ACL2. In LPAR, 2013.Google ScholarGoogle ScholarCross RefCross Ref
  17. J. P. Inala, X. Qiu, B. Lerner, and A. Solar-Lezama. Type assisted synthesis of recursive transformers on algebraic data types. CoRR, abs/1507.05527, 2015.Google ScholarGoogle Scholar
  18. R. Jhala, E. Seidel, and N. Vazou. Programming with refinement types (an introduction to liquidhaskell). https: //ucsd-progsys.github.io/liquidhaskell-tutorial, 2015.Google ScholarGoogle Scholar
  19. M. Kawaguchi, P. M. Rondon, and R. Jhala. Type-based data structure verification. In PLDI, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. E. Kneuss, I. Kuraj, V. Kuncak, and P. Suter. Synthesis modulo recursive functions. In OOPSLA, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. K. R. M. Leino and A. Milicevic. Program extrapolation with Jennisys. In OOPSLA, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. M. Liffiton, A. Previti, A. Malik, and J. Marques-Silva. Fast, flexible mus enumeration. Constraints, pages 1–28, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. D. Mandelin, L. Xu, R. Bodík, and D. Kimelman. Jungloid mining: Helping to navigate the api jungle. In PLDI, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. A. Milicevic, J. P. Near, E. Kang, and D. Jackson. Alloy*: A general-purpose higher-order relational constraint solver. In ICSE, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. O. Montano-Rivas, R. L. McCasland, L. Dixon, and A. Bundy. Scheme-based theorem discovery and concept invention. Expert Syst. Appl., 39(2):1637–1646, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. U. Norell. Dependently typed programming in agda. In AFP, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. P. Osera and S. Zdancewic. Type-and-example-directed program synthesis. In PLDI, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. D. Perelman, S. Gulwani, T. Ball, and D. Grossman. Type-directed completion of partial expressions. In PLDI, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. B. C. Pierce. Types and Programming Languages. MIT Press, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. B. C. Pierce and D. N. Turner. Local type inference. ACM Trans. Program. Lang. Syst., 22(1):1–44, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. N. Polikarpova and I. Kuraj. Synquid code repository. https://bitbucket.org/nadiapolikarpova/synquid/, 2015.Google ScholarGoogle Scholar
  32. N. Polikarpova, I. Kuraj, and A. Solar-Lezama. Program synthesis from polymorphic refinement types. CoRR, abs/1510.08419, 2016.Google ScholarGoogle Scholar
  33. P. M. Rondon, M. Kawaguchi, and R. Jhala. Liquid types. In PLDI, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. S. Srivastava and S. Gulwani. Program verification using templates over predicate abstraction. In PLDI, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. P. Suter, A. S. Köksal, and V. Kuncak. Satisfiability modulo recursive programs. In SAS, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. N. Vazou, P. M. Rondon, and R. Jhala. Abstract refinement types. In ESOP, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. N. Vazou, E. L. Seidel, and R. Jhala. Liquidhaskell: experience with refinement types in the real world. In Haskell, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. N. Vazou, E. L. Seidel, R. Jhala, D. Vytiniotis, and S. L. P. Jones. Refinement types for haskell. In ICFP, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. N. Vazou, A. Bakst, and R. Jhala. Bounded refinement types. In ICFP, 2015. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. P. Wadler. Theorems for free! In FPCA, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. H. Xi and F. Pfenning. Dependent types in practical programming. In POPL, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Program synthesis from polymorphic refinement types

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 51, Issue 6
        PLDI '16
        June 2016
        726 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/2980983
        • Editor:
        • Andy Gill
        Issue’s Table of Contents
        • cover image ACM Conferences
          PLDI '16: Proceedings of the 37th ACM SIGPLAN Conference on Programming Language Design and Implementation
          June 2016
          726 pages
          ISBN:9781450342612
          DOI:10.1145/2908080
          • General Chair:
          • Chandra Krintz,
          • Program Chair:
          • Emery Berger

        Copyright © 2016 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 2 June 2016

        Check for updates

        Qualifiers

        • article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!