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. To guarantee correctness and applicability to software (and not just hardware), these algorithms should also support unbounded data types, such as numbers and data structures. To obtain appropriate synthesis algorithms, we propose to generalize decision procedures into predictable and complete synthesis procedures. Such procedures are guaranteed to find the 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 a quantifier elimination decision procedure for Boolean algebra of set with Presburger arithmetic and transforming it into a synthesis procedure. Our procedure also works in the presence of parametric coefficients. 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, give up a deterministic execution model, or provide code skeletons.
Similar content being viewed by others
References
Anand, S., Godefroid, P., Tillmann, N.: Demand-driven compositional symbolic execution. In: Tools and Algorithms for the Construction and Analysis of Systems (2008)
Asarin, E., Maler, O., Pnueli, A.: Symbolic controller synthesis for discrete and timed systems. In: Hybrid Systems II, pp. 1–20 (1995)
Banerjee U.K.: Dependence Analysis for Supercomputing. Kluwer, Norwell (1988)
Boigelot B., Jodogne S., Wolper P.: An effective decision procedure for linear arithmetic over the integers and reals. ACM Trans. Comput. Log. 6(3), 614–633 (2005)
Bradley A.R., Manna Z.: The Calculus of Computation. Springer, Berlin (2007)
Bryant R.E.: Graph-based algorithms for Boolean function manipulation. IEEE Trans. Comput. C-35(8), 677–691 (1986)
Barrett C., Shikanian I., Tinelli C.: An abstract decision procedure for satisfiability in the theory of recursive data types. Electron. Notes Theor. Comput. Sci. 174(8), 23–37 (2007)
Cormen T.H., Leiserson C.E., Rivest R.L., Stein C.: Introduction to Algorithms, 2nd edn. MIT Press and McGraw-Hill, Cambridge (2001)
Cooper D.C.: Theorem proving in arithmetic without multiplication. In: Meltzer, B., Michie, D. (eds) Machine Intelligence, vol. 7, pp. 91–100. Edinburgh University Press, Edinburgh (1972)
de Moura, L., Bjørner, N.: Z3: an efficient SMT solver. In: TACAS (2008)
Dewar R.B.K., Grand A., Liu S.-C., Schwartz J.T., Schonberg E.: Programming by refinement, as exemplified by the SETL representation sublanguage. ACM Trans. Program. Lang. Syst. (TOPLAS) 1(1), 27–49 (1979). doi:10.1145/357062.357064
Dijkstra E.W.: A Discipline of Programming. Prentice-Hall, Inc., Englewood Cliffs (1976)
Emir, B., Odersky, M., Williams, J.: Matching objects with patterns. In: ECOOP (2007)
Eisenbrand F., Shmonin G.: Parametric integer programming in fixed dimension. Math. Oper. Res. 33(4), 839–850 (2008)
Ford, D., Havas, G.: A new algorithm and refined bounds for extended gcd computation. In: ANTS, pp. 145–150 (1996)
Flanagan, C., Leino, K.R.M., Lilibridge, M., Nelson, G., Saxe, J.B., Stata, R.: Extended static checking for Java. In: PLDI (2002)
Ferrante, J., Rackoff, C.W.: The Computational Complexity of Logical Theories. Lecture Notes in Mathematics, vol. 718. Springer, Berlin (1979)
Feferman S., Vaught R.L.: The first order properties of products of algebraic systems. Fundam. Math. 47, 57–103 (1959)
Ganzinger, H., Hagen, G., Nieuwenhuis, R., Oliveras, A., Cesare, T.: DPLL(T): fast decision procedures. In: CAV, pp. 175–188 (2004)
Ginsburg S., Spanier E.: Bounded algol-like languages. Trans. Am. Math. Soc. 113(2), 333–368 (1964)
Ginsburg S., Spanier E.: Semigroups, Presburger formulas and languages. Pac. J. Math. 16(2), 285–296 (1966)
Hamza, J., Jobstmann, B., Kuncak, V.: Synthesis for regular specifications over unbounded domains. In: FMCAD, pp. 101–109 (2010)
Hodges W.: Model Theory. Encyclopedia of Mathematics and its Applications, vol. 42. Cambridge University Press, London (1993)
Jacobs, S.: Hierarchic decision procedures for verification. PhD thesis, Universität des Saarlandes (2010)
Jobstmann, B., Bloem, R.: Optimizations for LTL synthesis. In: FMCAD (2006)
Jones, S.P. et al.: Haskell 98 language and libraries: the revised report (2010)
Jones, N.D., Gomard, C.K., Sestoft, P.: Partial evaluation and automatic program generation (available on the Web) (1993)
Jobstmann, B., Galler, S., Weiglhofer, M., Bloem, R.: Anzu: a tool for property synthesis. In: CAV. LNCS, vol. 4590 (2007)
Jaffar J., Maher M.J.: Constraint logic programming: a survey. J. Log. Program. 19/20, 503–581 (1994)
Köksal, A.S., Kuncak, V., Suter, P.: Scala to the power of Z3: integrating SMT and programming. In: CADE, pp. 400–406 (2011)
Klaedtke, F.: On the automata size for Presburger arithmetic. Technical Report 186, Institute of Computer Science at Freiburg University (2003)
Klarlund, N., Møller, A.: MONA version 1.4 user manual. BRICS Notes Series NS-01-1, Department of Computer Science, University of Aarhus (2001)
Kuncak V., Nguyen H.H., Rinard M.: Deciding Boolean algebra with Presburger arithmetic. J. Autom. Reason. 36(3), 213–236 (2006)
Kuncak, V., Piskac, R., Suter, P.: Ordered sets in the calculus of data structures. In: CSL, pp. 34–48 (2010)
Kuncak, V., Piskac, R., Suter, P., Wies, T.: Building a calculus of data structures. In:VMCAI. LNCS, vol. 5944 (2010)
Kuncak, V., Rinard, M.: Towards efficient satisfiability checking for Boolean Algebra with Presburger Arithmetic. In: CADE-21. LNCS, vol. 4603 (2007)
Klarlund, N., Schwartzbach, M.I.: Graph types. In: POPL, Charleston, SC (1993)
Kukula, J.H., Shiple, T.R.: Building circuits from relations. In: CAV (2000)
McPeak, S., Necula, G.C.: Data structure specifications via local equality axioms. In: CAV, pp. 476–490 (2005)
Monniaux, D.P.: Automatic modular abstractions for linear constraints. In: Proceedings of the 36th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 140–151 (2009)
Moskal, M.: Satisfiability modulo software. PhD thesis, University of Wrocław (2009)
Manna Z., Waldinger R.J.: Toward automatic program synthesis. Commun. ACM 14(3), 151–165 (1971)
Manna Z., Waldinger R.: A deductive approach to program synthesis. ACM Trans. Program. Lang. Syst. 2(1), 90–121 (1980)
Nipkow, T.: Linear quantifier elimination. In: IJCAR (2008)
Oppen, D.C.: Reasoning about recursively defined data structures. In: POPL, pp. 151–157 (1978)
Odersky M., Spoon L., Venners B.: Programming in Scala: A Comprehensive Step-by-Step Guide. Artima Press, Walnut Creek (2008)
Piskac, R., Kuncak, V.: Decision procedures for multisets with cardinality constraints. In: VMCAI. LNCS, vol. 4905 (2008)
Piskac, R., Kuncak, V.: Linear arithmetic with stars. In: CAV. LNCS, vol. 5123 (2008)
Piterman, N., Pnueli, A., Sa’ar, Y.: Synthesis of reactive(1) designs. In: VMCAI (2006)
Pnueli, A., Rosner, R.: On the synthesis of a reactive module. In: POPL (1989)
Pugh W.: A practical algorithm for exact array dependence analysis. Commun. ACM 35(8), 102–114 (1992)
Schrijver A.: Theory of Linear and Integer Programming. Wiley, New York (1998)
Suter, P., Dotta, M., Kuncak, V.: Decision procedures for algebraic data types with abstractions. In: POPL (2010)
Syme D., Granicz A., Cisternino A.: Expert F#. Apress, New York (2007)
Srivastava, S., Gulwani, S., Foster, J.S.: From program verification to program synthesis. In: POPL (2010)
Sharir M.: Some observations concerning formal differentiation of set theoretic expressions. Trans. Program. Lang. Syst. 4(2), 196–226 (1982)
Solar-Lezama, A., Arnold, G., Tancau, L., Bodík, R., Saraswat, V.A., Seshia, S.A.: Sketching stencils. In: PLDI (2007)
Solar-Lezama, A., Jones, C.G., Bodík, R.: Sketching concurrent data structures. In: PLDI (2008)
Solar-Lezama, A., Tancau, L., Bodík, R., Seshia, S.A., Saraswat, V.A.: Combinatorial sketching for finite programs. In: ASPLOS (2006)
Sekar R.C., Ramesh R., Ramakrishnan I.V.: Adaptive pattern matching. SIAM J. Comput. 24, 1207–1234 (1995)
Vechev, M.T., Yahav, E., Bacon, D.F., Rinetzky, N.: Cgcexplorer: a semi-automated search procedure for provably correct concurrent collectors. In: PLDI, pp. 456–467 (2007)
Vechev, M.T., Yahav, E., Yorsh, G.: Inferring synchronization under limited observability. In: TACAS (2009)
Weispfenning, V.: Complexity and uniformity of elimination in Presburger arithmetic. In: Proceedings of the International Symposium on Symbolic and Algebraic Computation, pp. 48–53 (1997)
Wintersteiger, C.M., Hamadi, Y., de Moura, L.: Efficiently solving quantified bit-vector formulas. In: FMCAD, pp. 239–246 (2010)
Wies, T., Piskac, R., Kuncak, V.: Combining theories with shared set operations. In: FroCoS: Frontiers in Combining Systems (2009)
Yessenov, K., Piskac, R., Kuncak, V.: Collections, cardinalities, and relations. In: VMCAI. LNCS, vol. 5944 (2010)
Zarba, C.G.: A quantifier elimination algorithm for a fragment of set theory involving the cardinality operator. In: 18th International Workshop on Unification (2004)
Zarba C.G.: Combining sets with cardinals. J. Autom. Reason. 34(1), 1–29 (2005)
Zee, K., Kuncak, V., Rinard, M.: Full functional verification of linked data structures. In: PLDI (2008)
Author information
Authors and Affiliations
Corresponding author
Additional information
R. Piskac was supported by the EPFL School of Computer and Communication Sciences and in part by the Swiss National Foundation Grant SCOPES IZ73Z0_127979. P. Suter was supported by the Swiss National Science Foundation Grant 200021_120433.
Rights and permissions
About this article
Cite this article
Kuncak, V., Mayer, M., Piskac, R. et al. Functional synthesis for linear arithmetic and sets. Int J Softw Tools Technol Transfer 15, 455–474 (2013). https://doi.org/10.1007/s10009-011-0217-7
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10009-011-0217-7