10 research outputs found

    Synthesizing Imperative Programs from Examples Guided by Static Analysis

    Full text link
    We present a novel algorithm that synthesizes imperative programs for introductory programming courses. Given a set of input-output examples and a partial program, our algorithm generates a complete program that is consistent with every example. Our key idea is to combine enumerative program synthesis and static analysis, which aggressively prunes out a large search space while guaranteeing to find, if any, a correct solution. We have implemented our algorithm in a tool, called SIMPL, and evaluated it on 30 problems used in introductory programming courses. The results show that SIMPL is able to solve the benchmark problems in 6.6 seconds on average.Comment: The paper is accepted in Static Analysis Symposium (SAS) '17. The submission version is somewhat different from the version in arxiv. The final version will be uploaded after the camera-ready version is read

    Witnessing (co)datatypes

    Get PDF
    Datatypes and codatatypes are useful for specifying and reasoning about (possibly infinite) computational processes. The Isabelle/HOL proof assistant has recently been extended with a definitional package that supports both. We describe a complete procedure for deriving nonemptiness witnesses in the general mutually recursive, nested case—nonemptiness being a proviso for introducing types in higher-order logic

    Synthesizing Number Transformations from Input-Output Examples

    No full text
    Abstract. Numbers are one of the most widely used data type in pro-gramming languages. Number transformations like formatting and round-ing present a challenge even for experienced programmers as they find it difficult to remember different number format strings supported by different programming languages. These transformations present an even bigger challenge for end-users of spreadsheet systems like Microsoft Excel where providing such custom format strings is beyond their expertise. In our extensive case study of help forums of many programming languages and Excel, we found that both programmers and end-users struggle with these number transformations, but are able to easily express their intent using input-output examples. In this paper, we present a framework that can learn such number trans-formations from very few input-output examples. We first describe an expressive number transformation language that can model these trans-formations, and then present an inductive synthesis algorithm that can learn all expressions in this language that are consistent with a given set of examples. We also present a ranking scheme of these expressions that enables efficient learning of the desired transformation from very few examples. By combining our inductive synthesis algorithm for num-ber transformations with an inductive synthesis algorithm for syntactic string transformations, we are able to obtain an inductive synthesis al-gorithm for manipulating data types that have numbers as a constituent sub-type such as date, unit, and time. We have implemented our algo-rithms as an Excel add-in and have evaluated it successfully over several benchmarks obtained from the help forums and the Excel product team.

    CodeHint: dynamic and interactive synthesis of code snippets

    No full text
    There are many tools that help programmers find code frag-ments, but most are inexpressive and rely on static infor-mation. We present a new technique for synthesizing code that is dynamic (giving accurate results and allowing pro-grammers to reason about concrete executions), easy-to-use (supporting a wide range of correctness specifications), and interactive (allowing users to refine the candidate code snip-pets). Our implementation, which we call CodeHint, gener-ates and evaluates code at runtime and hence can synthe-size real-world Java code that involves I/O, reflection, na-tive calls, and other advanced language features. We have evaluated CodeHint in two user studies and show that its algorithms are efficient and that it improves programmer productivity by more than a factor of two

    Discovering Math APIs by Mining Unit Tests

    No full text
    Abstract. Intoday’sAPI-richworld,programmerproductivitydepends heavily on the programmer’s ability todiscover the requiredAPIs. In this paper, we present a technique and tool, called MathFinder, to discover APIs for mathematical computations by mining unit tests of API methods. Given a math expression, MathFinder synthesizes pseudo-code to compute the expression by mapping its subexpressions to API method calls. For each subexpression, MathFinder searches for a method such that there is a mapping between method inputs and variables of the subexpression. The subexpression, when evaluated on the test inputs of the method under this mapping, should produce results that match the method output on a large number of tests. We implemented Math-Finder as an Eclipse plugin for discovery of third-party Java APIs and performed a user study to evaluate its effectiveness. In the study, the use of MathFinder resulted in a 2x improvement in programmer productivity. In 96 % of the subexpressions queried for in the study, Math-Finder retrieved the desired API methods as the top-most result. The top-most pseudo-code snippet to implement the entire expression was correct in 93 % of the cases. Since the number of methods and unit tests to mine could be large in practice, we also implement MathFinder in a MapReduce framework and evaluate its scalability and response time.

    Code completion with statistical language models

    No full text

    Verifying and Synthesizing Software with Recursive Functions

    No full text
    Our goal is to help people construct software that does what they wish. We develop tools and algorithms that span static and dynamic verification, constraint solving, and program synthesis. I will outline the current state our verification and synthesis system, Leon, which translates software into a functional language and uses SMT solvers to reason about paths in programs and specifications. Certain completeness results partly explain the effectiveness of verification and synthesis procedures implemented within Leon, in particular results on decidability of sufficiently surjective abstraction functions, and the framework of complete functional synthesis
    corecore