[go: up one dir, main page]
More Web Proxy on the site http://driver.im/ skip to main content
article
Public Access

Program synthesis from polymorphic refinement types

Published: 02 June 2016 Publication History

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

Cited By

View all
  • (2025)Automated Program Refinement: Guide and Verify Code Large Language Model with Refinement CalculusProceedings of the ACM on Programming Languages10.1145/37049059:POPL(2057-2089)Online publication date: 9-Jan-2025
  • (2024)Control-Flow Deobfuscation using Trace-Informed Compositional Program SynthesisProceedings of the ACM on Programming Languages10.1145/36897898:OOPSLA2(2211-2241)Online publication date: 8-Oct-2024
  • (2024)From Batch to Stream: Automatic Generation of Online AlgorithmsProceedings of the ACM on Programming Languages10.1145/36564188:PLDI(1014-1039)Online publication date: 20-Jun-2024
  • Show More Cited By

Index Terms

  1. Program synthesis from polymorphic refinement types

      Recommendations

      Comments

      Please enable JavaScript to view thecomments powered by Disqus.

      Information & Contributors

      Information

      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
      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 the author(s) 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].

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      Published: 02 June 2016
      Published in SIGPLAN Volume 51, Issue 6

      Check for updates

      Author Tags

      1. Functional Programming
      2. Predicate Abstraction
      3. Program Synthesis
      4. Refinement Types

      Qualifiers

      • Article

      Funding Sources

      Contributors

      Other Metrics

      Bibliometrics & Citations

      Bibliometrics

      Article Metrics

      • Downloads (Last 12 months)587
      • Downloads (Last 6 weeks)80
      Reflects downloads up to 23 Jan 2025

      Other Metrics

      Citations

      Cited By

      View all
      • (2025)Automated Program Refinement: Guide and Verify Code Large Language Model with Refinement CalculusProceedings of the ACM on Programming Languages10.1145/37049059:POPL(2057-2089)Online publication date: 9-Jan-2025
      • (2024)Control-Flow Deobfuscation using Trace-Informed Compositional Program SynthesisProceedings of the ACM on Programming Languages10.1145/36897898:OOPSLA2(2211-2241)Online publication date: 8-Oct-2024
      • (2024)From Batch to Stream: Automatic Generation of Online AlgorithmsProceedings of the ACM on Programming Languages10.1145/36564188:PLDI(1014-1039)Online publication date: 20-Jun-2024
      • (2024)The Functional Essence of Imperative Binary Search TreesProceedings of the ACM on Programming Languages10.1145/36563988:PLDI(518-542)Online publication date: 20-Jun-2024
      • (2024)Recursive Program Synthesis using ParamorphismsProceedings of the ACM on Programming Languages10.1145/36563818:PLDI(102-125)Online publication date: 20-Jun-2024
      • (2024)Generating Well-Typed Terms That Are Not “Useless”Proceedings of the ACM on Programming Languages10.1145/36329198:POPL(2318-2339)Online publication date: 5-Jan-2024
      • (2024)Symbolic metaprogram search improves learning efficiency and explains rule learning in humansNature Communications10.1038/s41467-024-50966-x15:1Online publication date: 10-Aug-2024
      • (2024)Synthesis of Recursive Programs in SaturationAutomated Reasoning10.1007/978-3-031-63498-7_10(154-171)Online publication date: 3-Jul-2024
      • (2023)ANPLProceedings of the 37th International Conference on Neural Information Processing Systems10.5555/3666122.3669162(69404-69440)Online publication date: 10-Dec-2023
      • (2023)Synthesizing MILP Constraints for Efficient and Robust OptimizationProceedings of the ACM on Programming Languages10.1145/35912987:PLDI(1896-1919)Online publication date: 6-Jun-2023
      • Show More Cited By

      View Options

      View options

      PDF

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader

      Login options

      Media

      Figures

      Other

      Tables

      Share

      Share

      Share this Publication link

      Share on social media