Abstract
Program sketching is a program synthesis paradigm in which the programmer provides a partial program with holes and assertions. The goal of the synthesizer is to automatically find integer values for the holes so that the resulting program satisfies the assertions. The most popular sketching tool, Sketch, can efficiently solve complex program sketches, but uses an integer encoding that often performs poorly if the sketched program manipulates large integer values. In this paper, we propose a new solving technique that allows Sketch to handle large integer values while retaining its integer encoding. Our technique uses a result from number theory, the Chinese Remainder Theorem, to rewrite program sketches to only track the remainders of certain variable values with respect to several prime numbers. We prove that our transformation is sound and the encoding of the resulting programs are exponentially more succinct than existing Sketch encodings. We evaluate our technique on a variety of benchmarks manipulating large integer values. Our technique provides speedups against both existing Sketch solvers and can solve benchmarks that existing Sketch solvers cannot handle.
Chapter PDF
Similar content being viewed by others
References
A. Abate, C. David, P. Kesseli, D. Kroening, and E. Polgreen. Counterexample guided inductive synthesis modulo theories. In CAV, Lecture Notes in Computer Science. Springer, 2018.
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 Formal Methods in Computer-Aided Design, FMCAD 2013, Portland, OR, USA, October 20-23, 2013, pages 1–8, 2013.
A. Cheung, A. Solar-Lezama, and S. Madden. Optimizing database-backed applications with query synthesis. In Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI ’13, pages 3–14, 2013.
L. N. Childs, editor. The Chinese Remainder Theorem, pages 253–281. Springer New York, New York, NY, 2009.
E. M. Clarke, O. Grumberg, and D. E. Long. Model checking and abstraction. ACM Trans. Program. Lang. Syst., 16(5):1512–1542, Sept. 1994.
P. Cousot and R. Cousot. Abstract interpretation: A unified lattice model for static analysis of programs by construction or approximation of fixpoints. In Proceedings of the 4th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, POPL ’77, pages 238–252, New York, NY, USA, 1977. ACM.
L. D’Antoni, R. Samanta, and R. Singh. Qlose: Program repair with quantitative objectives. In CAV (2), volume 9780 of Lecture Notes in Computer Science, pages 383–401. Springer, 2016.
S. de Oliveira, S. Bensalem, and V. Prevosto. Polynomial invariants by linear algebra. In C. Artho, A. Legay, and D. Peled, editors, Automated Technology for Verification and Analysis, pages 479–494, Cham, 2016. Springer International Publishing.
P. Dusart. Estimates of \(\psi \),\(\vartheta \) for large values of x without the riemann hypothesis. Math. Comput., 85(298):875–888, 2016.
Y. Feng, R. Martins, J. Van Geffen, I. Dillig, and S. Chaudhuri. Component-based synthesis of table consolidation and transformation tasks from examples. In Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2017, pages 422–436, New York, NY, USA, 2017. ACM.
J. Grobchadl. The chinese remainder theorem and its application in a high-speed rsa crypto chip. In Proceedings of the 16th Annual Computer Security Applications Conference, ACSAC ’00, pages 384–, Washington, DC, USA, 2000. IEEE Computer Society.
S. Gulwani. Automating string processing in spreadsheets using input-output examples. In Proceedings of the 38th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2011, Austin, TX, USA, January 26-28, 2011, pages 317–330, 2011.
S. Gulwani, W. R. Harris, and R. Singh. Spreadsheet data manipulation using examples. Commun. ACM, 55(8):97–105, 2012.
S. Gulwani, O. Polozov, and R. Singh. Program synthesis. Foundations and Trends in Programming Languages, 4(1-2):1–119, 2017.
G. J. O. Jameson. The Prime Number Theorem. London Mathematical Society Student Texts. Cambridge University Press, 2003.
N. Polikarpova, I. Kuraj, and A. Solar-Lezama. Program synthesis from polymorphic refinement types. In Proceedings of the 37th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2016, Santa Barbara, CA, USA, June 13-17, 2016, pages 522–538, 2016.
R. Singh and S. Gulwani. Transforming spreadsheet data types using examples. In Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2016, St. Petersburg, FL, USA, January 20 - 22, 2016, pages 343–356, 2016.
R. Singh, S. Gulwani, and A. Solar-Lezama. Automated feedback generation for introductory programming assignments. In ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI ’13, Seattle, WA, USA, June 16-19, 2013, pages 15–26, 2013.
A. Solar-Lezama. Program sketching. STTT, 15(5-6):475–495, 2013.
A. Solar-Lezama, C. G. Jones, and R. BodĂk. Sketching concurrent data structures. In Proceedings of the ACM SIGPLAN 2008 Conference on Programming Language Design and Implementation, Tucson, AZ, USA, June 7-13, 2008, pages 136–148, 2008.
A. Solar-Lezama, L. Tancau, R. Bodik, S. Seshia, and V. Saraswat. Combinatorial sketching for finite programs. SIGOPS Oper. Syst. Rev., 40(5):404–415, Oct. 2006.
A. Tiwari, A. GascĂ³n, and B. Dutertre. Program synthesis using dual interpretation. In Automated Deduction - CADE-25 - 25th International Conference on Automated Deduction, Berlin, Germany, August 1-7, 2015, Proceedings, pages 482–497, 2015.
E. Torlak and R. Bodik. A lightweight symbolic virtual machine for solver-aided host languages. In Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI ’14, pages 530–541, New York, NY, USA, 2014. ACM.
A. Udupa, A. Raghavan, J. V. Deshmukh, S. Mador-Haim, M. M. Martin, and R. Alur. Transit: Specifying protocols with concolic snippets. In Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI ’13, pages 287–296, 2013.
X. Wang, I. Dillig, and R. Singh. Program synthesis using abstraction refinement. PACMPL, 2(POPL):63:1–63:30, 2018.
S.-M. Yen, S. Kim, S. Lim, and S.-J. Moon. Rsa speedup with chinese remainder theorem immune against hardware fault cryptanalysis. IEEE Trans. Comput., 52(4):461–472, Apr. 2003.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Open Access This chapter is licensed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license and indicate if changes were made.
The images or other third party material in this chapter are included in the chapter's Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the chapter's Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder.
Copyright information
© 2020 The Author(s)
About this paper
Cite this paper
Pan, R., Hu, Q., Singh, R., D’Antoni, L. (2020). Solving Program Sketches with Large Integer Values. In: MĂ¼ller, P. (eds) Programming Languages and Systems. ESOP 2020. Lecture Notes in Computer Science(), vol 12075. Springer, Cham. https://doi.org/10.1007/978-3-030-44914-8_21
Download citation
DOI: https://doi.org/10.1007/978-3-030-44914-8_21
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-44913-1
Online ISBN: 978-3-030-44914-8
eBook Packages: Computer ScienceComputer Science (R0)