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.
- CBMC. http://www.cprover.org/cbmc/.Google Scholar
- LZW and LZ77. http://en.wikipedia.org/wiki/Lempel-Ziv-Welch and URLhttp://en.wikipedia.org/wiki/LZ77_and_LZ78.Google Scholar
- PINS. http://www.cs.umd.edu/~saurabhs/vs3/PINS/.Google Scholar
- Wei Chen. A formal approach to program inversion. In CSC: Proc. of the ACM conference on Cooperation, pages 398--403, 1990. Google ScholarDigital Library
- Byron Cook, Sumit Gulwani, Tal Lev-Ami, Andrey Rybalchenko, and Mooly Sagiv. Proving conditional termination. In CAV'08. Google ScholarDigital Library
- Byron Cook, Andreas Podelski, and Andrey Rybalchenko. Termination proofs for systems code. In PLDI, pages 415--426, 2006. Google ScholarDigital Library
- Leonardo de~Moura and Nikolaj Bjø rner. Z3, 2008. http://research.microsoft.com/projects/Z3/.Google Scholar
- 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 ScholarDigital Library
- David Eppstein. A heuristic approach to program inversion. In IJCAI, pages 219--221, 1985. Google ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- David Gries. The Science of Programming. Springer-Verlag New York, Inc., 1987. Google ScholarDigital Library
- Sumit Gulwani. Dimensions in program synthesis (invited talk paper). In ACM Symposium on PPDP, 2010. Google ScholarDigital Library
- Sumit Gulwani. Automating string processing in spreadsheets using input-output examples. In POPL, pages 317--330, 2011. Google ScholarDigital Library
- Sumit Gulwani, Susmit~Kumar Jha, Ashish Tiwari, and Ramarathnam Venkatesan. Synthesis of loop-free programs. In PLDI, 2011. Google ScholarDigital Library
- Sumit Gulwani, Vijay Korthikanti, and Ashish Tiwari. Synthesizing geometry constructions. In PLDI, 2011. Google ScholarDigital Library
- Sumit Gulwani, Saurabh Srivastava, and Ramarathnam Venkatesan. Program analysis as constraint solving. In PLDI, 2008. Google ScholarDigital Library
- Sumit Gulwani and Ashish Tiwari. Constraint-based approach for analysis of hybrid systems. In CAV, pages 190--203, 2008. Google ScholarDigital Library
- Sumit Gulwani and Florian Zuleger. The reachability-bound problem. In PLDI'10, pages 292--304, 2010. Google ScholarDigital Library
- William~R. Harris and Sumit Gulwani. Spreadsheet table transformations from examples. In PLDI, 2011. Google ScholarDigital Library
- Shachar Itzhaky, Sumit Gulwani, Neil Immerman, and Mooly Sagiv. A simple inductive synthesis methodology and its applications. In OOPSLA, pages 36--46, 2010. Google ScholarDigital Library
- Susmit Jha, Sumit Gulwani, Sanjit Seshia, and Ashish Tiwari. Oracle-guided component-based program synthesis. In ICSE, 2010. Google ScholarDigital Library
- Aditya Kanade, Rajeev Alur, Sriram Rajamani, and G~Ramalingam. Representation dependence testing using program inversion. In FSE, 2010. Google ScholarDigital Library
- Masahiko Kawabe and Robert Glück. The program inverter lrinv and its structure. In PADL, pages 219--234, 2005. Google ScholarDigital Library
- James C. King. Symbolic execution and program testing. Communications of the ACM, 19(7):385--394, 1976. Google ScholarDigital Library
- Viktor Kuncak, Mikael Mayer, Ruzica Piskac, and Philippe Suter. Complete functional synthesis. In PLDI, 2010. Google ScholarDigital Library
- Zohar Manna and Richard Waldinger. A deductive approach to program synthesis. ACM Trans. Program. Lang. Syst., 2(1), 1980. Google ScholarDigital Library
- Zohar Manna and Richard J. Waldinger. Toward automatic program synthesis. Communications of the ACM, 14(3):151--165, 1971. Google ScholarDigital Library
- Kazutaka Morita, Akimasa Morihata, Kiminori Matsuzaki, Zhenjiang Hu, and Masato Takeichi. Automatic inversion generates divide-and-conquer parallel programs. In PLDI'07. Google ScholarDigital Library
- 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 Scholar
- Brian J. Ross. Running programs backwards: The logical inversion of imperative computation. Formal Asp. Comput., 9(3):331--348, 1997.Google ScholarCross Ref
- D. R. Smith. Kids: A semiautomatic program development system. IEEE Trans. Softw. Eng., 16:1024--1043, 1990. Google ScholarDigital Library
- Armando Solar-Lezama, Gilad Arnold, Liviu Tancau, Rastislav Bodik, Vijay Saraswat, and Sanjit Seshia. Sketching stencils. In PLDI, pages 167--178, 2007. Google ScholarDigital Library
- Armando Solar-Lezama, Christopher~Grant Jones, and Rastislav Bodík. Sketching concurrent data structures. In PLDI, 2008. Google ScholarDigital Library
- 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 ScholarDigital Library
- Saurabh Srivastava and Sumit Gulwani. Program verification using templates over predicate abstraction. In PLDI, 2009. Google ScholarDigital Library
- Saurabh Srivastava, Sumit Gulwani, and Jeffrey S. Foster. VS3: SMT solvers for program verification. In CAV, 2009. Google ScholarDigital Library
- Saurabh Srivastava, Sumit Gulwani, and Jeffrey S. Foster. From program verification to program synthesis. In POPL, 2010. Google ScholarDigital Library
- Ankur Taly, Sumit Gulwani, and Ashish Tiwari. Synthesizing switching logic using constraint solving. In VMCAI, pages 305--319, 2009. Google ScholarDigital Library
- T. A. Welch. A technique for high-performance data compression. Computer, 17(6):8--19, 1984. Google ScholarDigital Library
- Daniel~M. Yellin. Attribute grammar inversion and source-to-source translation. Springer-Verlag New York, Inc., 1988. Google ScholarDigital Library
- J. Ziv and A. Lempel. A universal algorithm for sequential data compression. IEEE Transactions on Information Theory, IT-23(5):337--343, 1977.Google ScholarDigital Library
Index Terms
- Path-based inductive synthesis for program inversion
Recommendations
Path-based inductive synthesis for program inversion
PLDI '11In 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, ...
On the memorability of system-generated pins: can chunking help?
SOUPS '15: Proceedings of the Eleventh USENIX Conference on Usable Privacy and SecurityTo ensure that users do not choose weak personal identification numbers (PINs), many banks give out system-generated random PINs. 4-digit is the most commonly used PIN length, but 6-digit system-generated PINs are also becoming popular. The increased ...
Automatic program inversion using symbolic transducers
PLDI '17We propose a fully-automated technique for inverting functional programs that operate over lists such as string encoders and decoders. We consider programs that can be modeled using symbolic extended finite transducers (), an expressive model that can ...
Comments