Abstract

A key challenge in program synthesis is synthesizing programs that use libraries, which most real-world software does. The current state of the art is to model libraries with mock library implementations that perform the same function in a simpler way. However, mocks may still be large and complex, and must include many implementation details, both of which could limit synthesis performance. To address this problem, we introduce JLibSketch, a Java program synthesis tool that allows library behavior to be described with algebraic specifications, which are rewrite rules for sequences of method calls, e.g., encryption followed by decryption (with the same key) is the identity. JLibSketch implements rewrite rules by compiling JLibSketch problems into problems for the Sketch program synthesis tool. More specifically, after compilation, library calls are represented by abstract data types (ADTs), and rewrite rules manipulate those ADTs. We formalize compilation and prove it sound and complete if the rewrite rules are ordered and non-unifiable. We evaluated JLibSketch by using it to synthesize nine programs that use libraries from three domains: data structures, cryptography, and file systems. We found that algebraic specifications are, on average, about half the size of mocks. We also found that algebraic specifications perform better than mocks on seven of the nine programs, sometimes significantly so, and perform equally well on the last two programs. Thus, we believe that JLibSketch takes an important step toward synthesis of programs that use libraries.

Highlights

  • In recent years, there has been tremendous progress on sketch-based program synthesis, which, given a partial program containing some unknowns, solves for those unknowns so the resulting program satisfies its assertions [Solar-Lezama 2013; Solar-Lezama et al 2006].Authors’ addresses: Benjamin Mariano, University of Maryland, College Park, USA; Josh Reese, University of Maryland, College Park, USA; Siyuan Xu, Purdue University, USA; ThanhVu Nguyen, University of Nebraska, Lincoln, USA; Xiaokang Qiu, Purdue University, USA; Jeffrey S

  • We introduce JLibSketch 1, a novel Java program synthesis tool in which libraries can be described with algebraic specifications

  • We introduced JLibSketch, a Java program synthesis tool in which library methods can be described with algebraic specifications

Read more

Summary

INTRODUCTION

There has been tremendous progress on sketch-based program synthesis, which, given a partial program (or sketch) containing some unknowns, solves for those unknowns so the resulting program satisfies its assertions [Solar-Lezama 2013; Solar-Lezama et al 2006]. Good synthesis performance can be hard to achieve with mocks To address this problem, we introduce JLibSketch 1, a novel Java program synthesis tool in which libraries can be described with algebraic specifications. We introduce JLibSketch 1, a novel Java program synthesis tool in which libraries can be described with algebraic specifications We express these specifications as rewrite rules of the form pattern ⇒ result. The JLibSketch synthesis problem is to find a program that is correct for any library satisfying the algebraic specifications and any program input To solve such a problem, JLibSketch builds on top of JSketch [Jeon et al 2015b], a compiler from Java code with unknowns to the input language of the Sketch [Solar-Lezama 2016] synthesis system. We believe that JLibSketch takes an important step forward in making synthesis of programs that use libraries more practical

OVERVIEW
Rewriting the Verification Condition
Simulating Rewriting Through ADT Operations
Supporting More Rewriting Rules
IMPLEMENTATION
Summary
EXPERIMENTS
Mocking and Algebraically Specifying Libraries
Synthesis Evaluation
Limitations of Algebraic Specifications
Threats to Validity
RELATED WORK
CONCLUSION
Findings
B TERMINATION AND CONFLUENCE
Full Text
Published version (Free)

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