Combinatorial sketching for finite programs

Sketching is a software synthesis approach where the programmer develops a partial implementation - a sketch - and a separate specification of the desired functionality. The synthesizer then completes the sketch to behave like the specification. The correctness of the synthesized implementation is guaranteed by the compiler, which allows, among other benefits, rapid development of highly tuned implementations without the fear of introducing bugs.We develop SKETCH, a language for finite programs with linguistic support for sketching. Finite programs include many highperformance kernels, including cryptocodes. In contrast to prior synthesizers, which had to be equipped with domain-specific rules, SKETCH completes sketches by means of a combinatorial search based on generalized boolean satisfiability. Consequently, our combinatorial synthesizer is complete for the class of finite programs: it is guaranteed to complete any sketch in theory, and in practice has scaled to realistic programming problems.Freed from domain rules, we can now write sketches as simpleto-understand partial programs, which are regular programs in which difficult code fragments are replaced with holes to be filled by the synthesizer. Holes may stand for index expressions, lookup tables, or bitmasks, but the programmer can easily define new kinds of holes using a single versatile synthesis operator.We have used SKETCH to synthesize an efficient implementation of the AES cipher standard. The synthesizer produces the most complex part of the implementation and runs in about an hour.

[1]  Peter Wegner,et al.  A technique for counting ones in a binary computer , 1960, CACM.

[2]  Zohar Manna,et al.  Toward automatic program synthesis , 1971, Symposium on Semantics of Algorithmic Languages.

[3]  E. Reingold,et al.  Combinatorial Algorithms: Theory and Practice , 1977 .

[4]  John Darlington,et al.  A Transformation System for Developing Recursive Programs , 1977, J. ACM.

[5]  Pascal Van Hentenryck,et al.  Strategic directions in constraint programming , 1996, CSUR.

[6]  David Andre,et al.  Programmable Reinforcement Learning Agents , 2000, NIPS.

[7]  Keith H. Randall,et al.  Denali: a goal-directed superoptimizer , 2002, PLDI '02.

[8]  William Thies,et al.  StreamIt: A Language for Streaming Applications , 2002, CC.

[9]  Henry S. Warren,et al.  Hacker's Delight , 2002 .

[10]  Niklas Sörensson,et al.  An Extensible SAT-solver , 2003, SAT.

[11]  Daniel Kroening,et al.  Behavioral consistency of C and Verilog programs using bounded model checking , 2003, Proceedings 2003. Design Automation Conference (IEEE Cat. No.03CH37451).

[12]  Johann Schumann,et al.  Under Consideration for Publication in J. Functional Programming Autobayes: a System for Generating Data Analysis Programs from Statistical Models , 2022 .

[13]  Sharad Malik,et al.  A Comparative Study of 2QBF Algorithms , 2004, SAT.

[14]  Alexander Aiken,et al.  Scalable error detection using boolean satisfiability , 2005, POPL '05.

[15]  Armando Solar-Lezama,et al.  Programming by sketching for bit-streaming programs , 2005, PLDI '05.

[16]  Robert K. Brayton,et al.  DAG-aware AIG rewriting: a fresh look at combinational logic synthesis , 2006, 2006 43rd ACM/IEEE Design Automation Conference.