Abstract

Program synthesis aims to mechanise the task of programming from the user intent (using pre and post condition, examples and sketches). There are many approaches (or concepts) in program synthesis that are usually implemented in isolation: deductive, syntax-based, inductive, etc. In this paper, we present a characterisation of program synthesis as model finding, using Alloy ⁎ . Such a characterisation unifies several of these concepts in a single model. Through model finding, we obtain a general framework for rapid development of a program synthesiser accommodating denotational semantics based synthesis, simultaneous deductive and inductive synthesis, software reuse, syntactic ingredients (the Alloy ⁎ scope of entities), and a new one: a soft sketch (a set of commands that must appear in the synthesised program but in no particular order of execution). Our family of synthesisers produce general purpose programs in the Java language. As the Alloy ⁎ synthesiser requires several rounds of user assistance to set scope, sketches, etc., particularly for complex problems, we integrated the model finder to a genetic algorithm module, where candidate solutions and user inputs are generated and mutated automatically. We carried out empirical evaluations on program synthesis successfully. As results, we verified that: (i) we can synthesise thirteen programs ( Maj5 , Maj8 , IntSQRT , Max4 , Modu , Fact , Fib , aMax , aDouble , aSum , eCount , aBubSort , aSelSort ); (ii) inductive synthesis was faster than deductive synthesis; (iii) synthesis with reuse was faster; and (iv) Genetic Algorithm is better than user trial and error approach. • Alloy ⁎ Program Synthesiser (APS) can be used for general purpose program synthesis. • Implementing denotational semantics based synthesis for Turing complete problems. • Exploring the notion of: state, control flow, while loops commands, and arrays. • Also: deductive/inductive synthesis, code reuse, soft sketch and genetic algorithm. • APS synthesized 17 well-known programs, including array based, such as Bubble sorting.

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