skip to main content
10.1145/1993498.1993557acmconferencesArticle/Chapter ViewAbstractPublication PagespldiConference Proceedingsconference-collections
research-article

Path-based inductive synthesis for program inversion

Published:04 June 2011Publication History

ABSTRACT

In this paper, we investigate the problem of semi-automated inversion of imperative programs, which has the potential to make it much easier and less error prone to write programs that naturally pair as inverses, such as insert/delete operations, compressors/decompressors, and so on. Viewing inversion as a subproblem of program synthesis, we propose a novel synthesis technique called Path-based inductive synthesis (PINS) and apply it to inversion. PINS starts from a program P and a template T for its inverse. PINS then iteratively refines the space of template instantiations by exploring paths in the composition of P and T with symbolic execution. PINS uses an SMT solver to intelligently guide the refinement process, based on the paths explored so far. The key idea motivating this approach is the small path-bound hypothesis: that the behavior of a program can be summarized with a small, carefully chosen set of its program paths.

We evaluated PINS by using it to invert 14 programs such as compressors (e.g., Lempel-Ziv-Welch), encoders (e.g., UUEncode), and arithmetic operations (e.g., vector rotation). Most of these examples are difficult or impossible to invert using prior techniques, but PINS was able to invert all of them. We also found that a semi-automated technique we developed to mine a template from the program to be inverted worked well. In our experiments, PINS takes between one second to thirty minutes to synthesize inverses. We believe this proof-of-concept implementation demonstrates the viability of the PINS approach to program synthesis.

References

  1. CBMC. http://www.cprover.org/cbmc/.Google ScholarGoogle Scholar
  2. LZW and LZ77. http://en.wikipedia.org/wiki/Lempel-Ziv-Welch and URLhttp://en.wikipedia.org/wiki/LZ77_and_LZ78.Google ScholarGoogle Scholar
  3. PINS. http://www.cs.umd.edu/~saurabhs/vs3/PINS/.Google ScholarGoogle Scholar
  4. Wei Chen. A formal approach to program inversion. In CSC: Proc. of the ACM conference on Cooperation, pages 398--403, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Byron Cook, Sumit Gulwani, Tal Lev-Ami, Andrey Rybalchenko, and Mooly Sagiv. Proving conditional termination. In CAV'08. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Byron Cook, Andreas Podelski, and Andrey Rybalchenko. Termination proofs for systems code. In PLDI, pages 415--426, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Leonardo de~Moura and Nikolaj Bjø rner. Z3, 2008. http://research.microsoft.com/projects/Z3/.Google ScholarGoogle Scholar
  8. Edsger~W. Dijkstra. Program inversion. In Program Construction, http://www.cs.utexas.edu/~EWD/ewd06xx/EWD671.PDF, pages 54--57, London, UK, 1979. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. David Eppstein. A heuristic approach to program inversion. In IJCAI, pages 219--221, 1985. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Michael D. Ernst, Jeff H. Perkins, Philip J. Guo, Stephen McCamant, Carlos Pacheco, Matthew~S. Tschantz, and Chen Xiao. The Daikon system for dynamic detection of likely invariants. Science of Computer Programming, 69(1--3):35--45, December 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Robert Glück and Masahiko Kawabe. A method for automatic program inversion based on LR(0) parsing. Fundam. Inf., 66(4):367--395, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. David Gries. The Science of Programming. Springer-Verlag New York, Inc., 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Sumit Gulwani. Dimensions in program synthesis (invited talk paper). In ACM Symposium on PPDP, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Sumit Gulwani. Automating string processing in spreadsheets using input-output examples. In POPL, pages 317--330, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Sumit Gulwani, Susmit~Kumar Jha, Ashish Tiwari, and Ramarathnam Venkatesan. Synthesis of loop-free programs. In PLDI, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Sumit Gulwani, Vijay Korthikanti, and Ashish Tiwari. Synthesizing geometry constructions. In PLDI, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Sumit Gulwani, Saurabh Srivastava, and Ramarathnam Venkatesan. Program analysis as constraint solving. In PLDI, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Sumit Gulwani and Ashish Tiwari. Constraint-based approach for analysis of hybrid systems. In CAV, pages 190--203, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Sumit Gulwani and Florian Zuleger. The reachability-bound problem. In PLDI'10, pages 292--304, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. William~R. Harris and Sumit Gulwani. Spreadsheet table transformations from examples. In PLDI, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Shachar Itzhaky, Sumit Gulwani, Neil Immerman, and Mooly Sagiv. A simple inductive synthesis methodology and its applications. In OOPSLA, pages 36--46, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Susmit Jha, Sumit Gulwani, Sanjit Seshia, and Ashish Tiwari. Oracle-guided component-based program synthesis. In ICSE, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Aditya Kanade, Rajeev Alur, Sriram Rajamani, and G~Ramalingam. Representation dependence testing using program inversion. In FSE, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Masahiko Kawabe and Robert Glück. The program inverter lrinv and its structure. In PADL, pages 219--234, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. James C. King. Symbolic execution and program testing. Communications of the ACM, 19(7):385--394, 1976. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Viktor Kuncak, Mikael Mayer, Ruzica Piskac, and Philippe Suter. Complete functional synthesis. In PLDI, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Zohar Manna and Richard Waldinger. A deductive approach to program synthesis. ACM Trans. Program. Lang. Syst., 2(1), 1980. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Zohar Manna and Richard J. Waldinger. Toward automatic program synthesis. Communications of the ACM, 14(3):151--165, 1971. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Kazutaka Morita, Akimasa Morihata, Kiminori Matsuzaki, Zhenjiang Hu, and Masato Takeichi. Automatic inversion generates divide-and-conquer parallel programs. In PLDI'07. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. William H. Press, Saul A. Teukolsky, William T. Vetterling, and Brian P. Flannery. LU Decomposition and Its Applications, chapter 2.3, pages 34--42. 1993.Google ScholarGoogle Scholar
  31. Brian J. Ross. Running programs backwards: The logical inversion of imperative computation. Formal Asp. Comput., 9(3):331--348, 1997.Google ScholarGoogle ScholarCross RefCross Ref
  32. D. R. Smith. Kids: A semiautomatic program development system. IEEE Trans. Softw. Eng., 16:1024--1043, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Armando Solar-Lezama, Gilad Arnold, Liviu Tancau, Rastislav Bodik, Vijay Saraswat, and Sanjit Seshia. Sketching stencils. In PLDI, pages 167--178, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Armando Solar-Lezama, Christopher~Grant Jones, and Rastislav Bodík. Sketching concurrent data structures. In PLDI, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Armando Solar-Lezama, Rodric Rabbah, Rastislav Bodík, and Kemal Ebcioğlu. Prog. by sketching for bit-stream. prgs. In PLDI, pages 281--294, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Saurabh Srivastava and Sumit Gulwani. Program verification using templates over predicate abstraction. In PLDI, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Saurabh Srivastava, Sumit Gulwani, and Jeffrey S. Foster. VS3: SMT solvers for program verification. In CAV, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Saurabh Srivastava, Sumit Gulwani, and Jeffrey S. Foster. From program verification to program synthesis. In POPL, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Ankur Taly, Sumit Gulwani, and Ashish Tiwari. Synthesizing switching logic using constraint solving. In VMCAI, pages 305--319, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. T. A. Welch. A technique for high-performance data compression. Computer, 17(6):8--19, 1984. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. Daniel~M. Yellin. Attribute grammar inversion and source-to-source translation. Springer-Verlag New York, Inc., 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. J. Ziv and A. Lempel. A universal algorithm for sequential data compression. IEEE Transactions on Information Theory, IT-23(5):337--343, 1977.Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Path-based inductive synthesis for program inversion

          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
          • Published in

            cover image ACM Conferences
            PLDI '11: Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation
            June 2011
            668 pages
            ISBN:9781450306638
            DOI:10.1145/1993498
            • General Chair:
            • Mary Hall,
            • Program Chair:
            • David Padua
            • cover image ACM SIGPLAN Notices
              ACM SIGPLAN Notices  Volume 46, Issue 6
              PLDI '11
              June 2011
              652 pages
              ISSN:0362-1340
              EISSN:1558-1160
              DOI:10.1145/1993316
              Issue’s Table of Contents

            Copyright © 2011 ACM

            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 ACM 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: 4 June 2011

            Permissions

            Request permissions about this article.

            Request Permissions

            Check for updates

            Qualifiers

            • research-article

            Acceptance Rates

            Overall Acceptance Rate406of2,067submissions,20%

            Upcoming Conference

            PLDI '24

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader