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.

Highlights

  • Program synthesis, the art of automatically generating programs that meet a user’s intent, promises to increase the productivity of programmers by automating tedious, error-prone, and time-consuming tasks

  • One of the earliest and successful syntaxguided program synthesis frameworks is program sketching [19], where (i ) the search space of the synthesis problem is described using a partial program in which certain integer constants are left unspecified, and (ii ) the specification is provided as a set of assertions describing the intended behavior of the program

  • We evaluate our technique on 181 benchmarks from various applications of program sketching

Read more

Summary

Introduction

The art of automatically generating programs that meet a user’s intent, promises to increase the productivity of programmers by automating tedious, error-prone, and time-consuming tasks. The Cegis algorithm iteratively considers a finite set I of inputs for the program and performs SAT queries to identify values for the holes so that the resulting program satisfies all the assertions for the inputs in I. Can be represented efficiently in the SAT formulas as lookup operations This unary encoding, results in huge formulas for solving sketches with larger integer values as we observe in our evaluation. An SMT-like technique that extends the SAT solver with native integer variables and integer constraints was proposed to alleviate this issue in Sketch. It guesses values for the integer variables and propagates them through the integer constraints, and learns from conflict clauses. An extended version containing all proofs and further details has been uploaded to arXiv as supplementary material

Motivating Example
Preliminaries
Modular Arithmetic Semantics
The Chinese Remainder Theorem
The IMP-MOD Language
Equivalence between the two Semantics
Data Flow Analysis
From IMP to IMP-MOD
Synthesis in IMP-MOD
Incremental Synthesis Algorithm
Complexity of Rewritten Programs
Bit-complexity of Binary Encoding
Bit-complexity of Unary Encoding
Number of Required Primes
Evaluation
Benchmarks
Performance of Unary-p
Performance of Incremental Solving
Varying the Prime Number Set P
Size of SAT Formulas
Related Work
Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.