## Complete Functional Synthesis

Citations: | 28 - 12 self |

### BibTeX

@MISC{Kuncak_completefunctional,

author = {Viktor Kuncak and Mikaël Mayer and Ruzica Piskac},

title = {Complete Functional Synthesis},

year = {}

}

### OpenURL

### Abstract

Synthesis of program fragments from specifications can make programs easier to write and easier to reason about. To integrate synthesis into programming languages, synthesis algorithms should behave in a predictable way—they should succeed for a well-defined class of specifications. They should also support unbounded data types such as numbers and data structures. We propose to generalize decision procedures into predictable and complete synthesis procedures. Such procedures are guaranteed to find code that satisfies the specification if such code exists. Moreover, we identify conditions under which synthesis will statically decide whether the solution is guaranteed to exist, and whether it is unique. We demonstrate our approach by starting from decision procedures for linear arithmetic and data structures and transforming them into synthesis procedures. We establish results on the size and the efficiency of the synthesized code. We show that such procedures are useful as a language extension with implicit value definitions, and we show how to extend a compiler to support such definitions. Our constructs provide the benefits of synthesis to programmers, without requiring them to learn new concepts or give up a deterministic execution model.

### Citations

2930 | Graph-based algorithms for Boolean function manipulation
- Bryant
- 1986
(Show Context)
Citation Context ...lem). Suppose that ⃗x are output variables and ⃗a are the remaining propositional variables (parameters) in F . To synthesize a function from ⃗a to ⃗x, build an ordered binary decision diagram (OBDD) =-=[Bry86]-=- for F , treating both ⃗a and ⃗x as variables for OBDD construction, and using a variable ordering that puts all parameters ⃗a before all output variables ⃗x. Then split the OBDD graph at the point wh... |

1459 |
Theory of linear and integer programming
- Schrijver
- 1986
(Show Context)
Citation Context ...nd the inequalities to the form 0 < t. 5.1 Solving Conjunctions of Literals Given the observations in Section 4.4, we consider conjunctions of literals. The method follows Fourier-Motzkin elimination =-=[Sch98]-=-. Consider the elimination of a variable x. Equalities. If x occurs in an equality constraint t = 0, then solve the constraint for x and rewrite it as x = t ′ , where t ′ does not contain x. Then simp... |

768 | Constraint Logic Programming: A Survey
- Jaffar, Maher
- 1994
(Show Context)
Citation Context ...to the Z3 satisfiability modulo theories (SMT) solver [B08]. Such mechanisms promise to bring the algorithmic improvements of SMT solvers to declarative paradigms such as Constraint Logic Programming =-=[JM94]-=-. However, they involve a possibly unpredictable search at run-time, and require the deployment of the entire decision procedure as a component of the run-time system. Our goal is to provide the benef... |

711 | Introduction to Algorithms”, Second Edition - Cormen, Leiserson, et al. - 2001 |

639 |
Partial Evaluation and Automatic Program Generation. Available online: http://www.itu.dk/people/sestoft/pebook
- Jones, Gomard, et al.
- 1993
(Show Context)
Citation Context ...order logic. Automata have also been applied to the synthesis of efficient code for pattern-matching expressions [SRR95]. Our approach can be viewed as sharing some of the goals of partial evaluation =-=[JGS93]-=-. However, we do not need to employ general-purpose partial evaluation techniques (which typically provide linear speedup), because we have the knowledge of a particular decision procedure. We use thi... |

347 |
Dependence Analysis for Supercomputing
- Banerjee
(Show Context)
Citation Context ...chose the algorithm presented here because of its simplicity. Other algorithms for finding a solution of an equation t+Σ n i=1γiui = 0 can be found in [Ban88, FH96]. They also run in polynomial time. =-=[Ban88]-=- additionally allows bounded inequality constraints, whereas [FH96] guarantees that the returned numbers are no larger than the largest of the input coefficients divided by 2. The equation t + Σ n i=1... |

193 | Mathematical Theory of Computation - Manna - 2003 |

182 |
A practical algorithm for exact array dependence analysis
- PUGH
- 1992
(Show Context)
Citation Context ...new Exception(“No solution”) 91 >= C A >; Although the disjunctive normal form can be exponentially larger than the original formula, the transformation to disjunctive normal form is used in practice =-=[Pug92]-=- and has advantages in terms of the quality of synthesized code generated for individual disjuncts. What further justifies this approach is that we expect a small number of disjuncts in our specificat... |

163 | Raymie Stata. Extended static checking for java - Flanagan, Leino, et al. - 2002 |

154 | A deductive approach to program synthesis - Manna, Waldinger - 1980 |

125 | Graph types
- Klarlund, Schwartzbach
(Show Context)
Citation Context ...utomata-based decision procedures, such as those implemented in the MONA tool [KM01] could be used to synthesize efficient (even if large) code from expressive specifications. The work on graph types =-=[KS93]-=- proposes to synthesize fields given by definitions in monadic second-order logic. Automata have also been applied to the synthesis of efficient code for pattern-matching expressions [SRR95]. Our appr... |

116 | DPLL(T) fast decision procedures - Ganzinger, Hagen, et al. - 2004 |

109 | Symbolic controller synthesis for discrete and timed systems
- Asarin, Maler, et al.
- 1995
(Show Context)
Citation Context ...eactive systems generates programs that run forever and interact with the environment. However, known complete algorithms for reactive synthesis work with finite-state systems [PR89] or timed systems =-=[AMP95]-=-. Such techniques have applications to control the behavior of hardware and embedded systems or concurrent programs [VYY09]. These techniques usually take specifications in a fragment of temporal logi... |

92 | Theorem proving in arithmetic without multiplication - Cooper - 1972 |

79 | Full functional verification of linked data structures - Zee, Kuncak, et al. - 2008 |

78 | Data structure specifications via local equality axioms - McPeak, Necula - 2005 |

73 |
Racko , The Computational Complexity of Logical Theories
- Ferrante, W
- 1979
(Show Context)
Citation Context ...aller) compared to the disjunctive normal form approach of Section 4.4. The starting point of this method are quantifier elimination techniques that avoid disjunctive normal form transformation, e.g. =-=[FR79]-=-, [Nip08], [BM07, Section 7.3]. To remove a variable from negation normal form, this method finds relevant lower bounds ap and upper bounds bq in the formula, then computes the values mpq = (ap + bq)/... |

67 | The first order properties of products of algebraic systems - Feferman, Vaught - 1959 |

64 | Presburger formulas and languages - Semigroups - 1966 |

54 | Synthesis of reactive(1) designs
- Piterman, Pnueli, et al.
(Show Context)
Citation Context ...Such techniques have applications to control the behavior of hardware and embedded systems or concurrent programs [VYY09]. These techniques usually take specifications in a fragment of temporal logic =-=[PPS06]-=- and have resulted in tools that can synthesize useful hardware components [JGWB07, JB06]. Our work examines non-reactive programs, but supports infinite data without any approximation, and incorporat... |

51 |
Programming in Scala, A comprehensive step-by-step guide. Artima
- Odersky, Spoon, et al.
- 2008
(Show Context)
Citation Context ... algorithms for the domains of linear arithmetic and collections of objects. We have implemented these synthesis algorithms and deployed them as a compiler extension of the Scala programming language =-=[OSV08]-=-. We have found that using such constraints we were able to express a number of program fragments in a more naturalway, stating the invariants that the program should satisfy as opposed to the comput... |

50 | From Program Verification to Program Synthesis
- Srivastava, Gulwani, et al.
- 2010
(Show Context)
Citation Context ...ently, while it can synthesize interesting programs containing recursion, it cannot provide completeness and termination guarantees as synthesis based on decision procedures. Recent work on synthesis =-=[SGF10]-=- resolves some of these difficulties by decoupling the problem of inferring program control structure and the problem of synthesizing the computation along the control edges. Furthermore, the work lev... |

48 | Reasoning about recursively defined data structures - Oppen - 1980 |

44 |
Bounded ALGOL-like languages
- Ginsburg, Spanier
- 1964
(Show Context)
Citation Context ...γjyj = 0} which will allow a simple and effective computation of elements in K. Note that the set K describes the set of all solutions of a Presburger arithmetic formula. Recall that a semilinear set =-=[GS64]-=- is a finite union of linear sets. Given an integer vector⃗b and a finite set of integer vectors S, a linear set is a set {⃗x | ⃗x = ⃗b + ⃗s1 + . . . + ⃗sn; si ∈ S; n ≥ 0}. Ginsburg and Spanier [GS64,... |

42 |
Demand-driven compositional symbolic execution
- ANAND, GODEFROID, et al.
- 2008
(Show Context)
Citation Context ...g assignment (a model) whenever the given formula is satisfiable. Such a model-generation functionality has many uses, including better error reporting in verification [Mos09] and testcase generation =-=[AGT08]-=-. Model generation could also be used as an advanced computation mechanism—given a set of values for some of the variables, a constraint solver can at run-time find the values of the remaining variabl... |

36 | Toward automatic program synthesis - Manna, Waldinger - 1971 |

35 | Program by refinement, as exemplified by the setl representation sublanguage - Dewar, Grand, et al. - 1979 |

35 | Optimizations for LTL synthesis - Jobstman, Bloem - 2006 |

31 | Deciding Boolean Algebra with Presburger Arithmetic
- Kuncak, Nguyen, et al.
(Show Context)
Citation Context ...rmula. Figure 3 describes our BAPA synthesis procedure that returns a precondition predicate pre(⃗a) and a solved form ⃗ Ψ. The procedure is based on the quantifier elimination algorithm presented in =-=[KNR06]-=-, which reduces a BAPA formula to an equisatisfiable integer linear arithmetic formula. The algorithm eliminates set variables in two phases. In the first phase all set expressions are rewrit-INPUT: ... |

28 | Towards efficient satisfiability checking for boolean algebra with presburger arithmetic - Kuncak, Rinard - 2007 |

24 | An effective decision procedure for linear arithmetic over the integers and reals - Boigelot, Jodogne, et al. - 2005 |

22 | Anzu: A tool for property synthesis - Jobstmann, Galler, et al. - 2007 |

22 |
Building circuits from relations
- Kukula, Shiple
- 2000
(Show Context)
Citation Context ...mulas over unbounded domains. Nonetheless, to illustrate the potential asymptotic gain of precomputation in synthesis, we illustrate synthesis for the case when F is a propositional formula (see e.g. =-=[KS00]-=- for a more sophisticated approach to this problem). Suppose that ⃗x are output variables and ⃗a are the remaining propositional variables (parameters) in F . To synthesize a function from ⃗a to ⃗x, b... |

22 | Adaptive pattern matching
- Sekar, Ramesh, et al.
- 1992
(Show Context)
Citation Context ...raph types [KS93] proposes to synthesize fields given by definitions in monadic second-order logic. Automata have also been applied to the synthesis of efficient code for pattern-matching expressions =-=[SRR95]-=-. Our approach can be viewed as sharing some of the goals of partial evaluation [JGS93]. However, we do not need to employ general-purpose partial evaluation techniques (which typically provide linear... |

20 | Matching objects with patterns
- Emir, Odersky, et al.
- 2007
(Show Context)
Citation Context ...s a Scala compiler extension. 1 We chose Scala because it supports higher-order functions that make the concept of a choose function natural, and extensible pattern matching in the form of extractors =-=[EOW07]-=-. Moreover, the compiler supports plugins that work as additional compilation phases. We used an off-the-shelf decision procedure [B08] to handle the compile-time checks (we could, in principle, also ... |

16 | CGCExplorer: A semi-automated search procedure for provably correct concurrent collectors
- VECHEV, YAHAV, et al.
(Show Context)
Citation Context ...ally focused on appropriately guided search over the syntax tree of the synthesized program. Search techniques have also been applied to automatically derived concurrent garbage collection algorithms =-=[VYBR07]-=-. In contrast, our synthesis uses the mathematical structure of a decidable theory to explore the space of all functions that satisfy the specification. This enables our approach to achieve completene... |

15 | An Abstract Decision Procedure for Satisfiability in the Theory of Recursive Data Types - Barrett, Shikanian, et al. - 2007 |

13 | Complexity and uniformity of elimination in Presburger arithmetic
- Weispfenning
- 1997
(Show Context)
Citation Context ...resburger Arithmetic is beyond the scope of this paper. Relevant results in the area of decision procedures are automata-based decision procedures [BJW05, Kla03], the bounds on quantifier elimination =-=[Wei97]-=- and results on integer programming in fixed dimensions [ES08]. Automata-based decision procedures, such as those implemented in the MONA tool [KM01] could be used to synthesize efficient (even if lar... |

13 | A quantifier elimination algorithm for a fragment of set theory involving the cardinality operator - Zarba - 2004 |

12 | Some observations concerning formal differentiation of set theoretic expressions - Sharir - 1982 |

11 | Liviu Tancau, Rastislav Bodík, Vijay A. Saraswat, and Sanjit A. Seshia. Sketching stencils - Solar-Lezama, Arnold - 2007 |

10 | Liviu Tancau, Rastislav Bodík, Sanjit A. Seshia, and Vijay A. Saraswat. Combinatorial sketching for finite programs - Solar-Lezama - 2006 |

9 | On the automata size for Presburger arithmetic - Klaedtke - 2004 |

9 | Rastislav Bodík. Sketching Concurrent Data Structures - Solar-Lezama, Jones - 2008 |

8 | Combining sets with cardinals - Zarba |

6 | Building a Calculus of Data Structures
- Kuncak, Piskac, et al.
(Show Context)
Citation Context ...oped for the SETL programming language [Dew79, Sha82]. Regarding data structures, this paper focuses on sets, but the approach applies to other constraints for which decision procedures are available =-=[KPSW10]-=-, including multisets [PK08a, PK08b, YPK10] and algebraic data types [SDK10]. Contributions. This paper makes the following contributions. 1. We describe an approach for deploying algorithms for synth... |

6 | Linear quantifier elimination
- Nipkow
- 2008
(Show Context)
Citation Context ...sion of the variable vector ⃗x and the parameter vector ⃗a in F . From quantifier elimination to synthesis. The precondition pre can be viewed as a result of applying quantifier elimination (see e.g. =-=[Nip08]-=-) to remove ⃗x from F , with the following differences. 1. Synthesis procedures strengthen quantifier elimination procedures by identifying not only pre but also emitting the code ⃗ Ψ that efficiently... |

6 |
Mirco Dotta, and Viktor Kuncak. Decision procedures for algebraic data types with abstractions
- Suter
- 2010
(Show Context)
Citation Context ...res, this paper focuses on sets, but the approach applies to other constraints for which decision procedures are available [KPSW10], including multisets [PK08a, PK08b, YPK10] and algebraic data types =-=[SDK10]-=-. Contributions. This paper makes the following contributions. 1. We describe an approach for deploying algorithms for synthesis within programming languages. Our approach introduces a higher-order li... |

5 | A new algorithm and refined bounds for extended gcd computation
- Ford, Havas
- 1996
(Show Context)
Citation Context ...algorithms for finding a solution of an equation t+Σ n i=1γiui = 0 can be found in [Ban88, FH96]. They also run in polynomial time. [Ban88] additionally allows bounded inequality constraints, whereas =-=[FH96]-=- guarantees that the returned numbers are no larger than the largest of the input coefficients divided by 2. The equation t + Σ n i=1γiui = 0 has a solution iff gcd((γk)k≥1)|t, and the result of parti... |

5 |
Hierarchic Decision Procedures for Verification
- Jacobs
- 2010
(Show Context)
Citation Context ...7, SDK10]. Our approach can also be applied to imperative data structures [KS93]. This idea would benefit from recent advances from more efficient decision procedures based on local theory extensions =-=[Jac10]-=-, including [WPK09, MN05]. Given the range of logics for which we can obtain synthesis procedures, it is important to realize that we can also combine synthesis procedures similarly to the way in whic... |