Abstract
Compositionality, i.e., the use of procedure summarization instead of code inlining, is key to scaling automated verification to large code bases. In this paper, we present a way to exploit compositionality in the context of program synthesis.
The goal in our synthesis problem is to instantiate missing expressions in a procedural program so that the resulting program satisfies a safety or termination requirement in spite of an adversarial environment. The problem is modeled as a game between two players — the program and the environment — that take turns changing the program’s state and stack. The objective of the program is to ensure that all executions of this recursive game satisfy the requirement. Synthesis involves the modular computation of a strategy under which the program meets this objective. Our solution is based on the notion of game summaries, which generalize traditional procedure summaries, and relate program states in a procedural context with sets of states at which the game can return from that context. Our method for compositional reasoning about game summaries is embodied in a set of deductive proof rules. We prove these rules sound and relatively complete. We also show that a sound approximation of these rules can be automated using a Horn constraint solver that utilizes SMT-solving, counterexample-guided abstraction refinement, and interpolation. An experimental evaluation over a set of systems code benchmarks demonstrates the practical promise of the approach.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
The name recursive game captures the fact that our games are played on the configuration graphs of recursive programs, which can be infinite even when program variables range over finite data domains.
References
Albarghouthi, A., Li, Y., Gurfinkel, A., Chechik, M.: UFO: a framework for abstraction- and interpolation-based software verification. In: CAV (2012)
Alur, R., Chaudhuri, S.: Temporal reasoning for procedural programs. In: Barthe, G., Hermenegildo, M. (eds.) VMCAI 2010. LNCS, vol. 5944, pp. 45–60. Springer, Heidelberg (2010)
Alur, R., Chaudhuri, S., Madhusudan, P.: A fixpoint calculus for local and global program flows. In: POPL, pp. 153–165 (2006)
Alur, R., Chaudhuri, S., Madhusudan, P.: Languages of nested trees. In: Ball, T., Jones, R.B. (eds.) CAV 2006. LNCS, vol. 4144, pp. 329–342. Springer, Heidelberg (2006)
Alur, R., Chaudhuri, S., Madhusudan, P.: Software model checking using languages of nested trees. ACM Trans. Program. Lang. Syst. 33(5), 15 (2011)
Ball, T., Rajamani, S.K.: The SLAM project: debugging system software via static analysis. In: POPL (2002)
Beyene, T.A., Chaudhuri, S., Popeea, C., Rybalchenko, A.: A constraint-based approach to solving games on infinite graphs. In: POPL (2014)
Beyene, T.A., Popeea, C., Rybalchenko, A.: Solving existentially quantified horn clauses. In: Sharygina, N., Veith, H. (eds.) CAV 2013. LNCS, vol. 8044, pp. 869–882. Springer, Heidelberg (2013)
Beyer, D.: Second competition on software verification. In: Piterman, N., Smolka, S.A. (eds.) TACAS 2013 (ETAPS 2013). LNCS, vol. 7795, pp. 594–609. Springer, Heidelberg (2013)
Beyer, D., Keremoglu, M.E.: CPACHECKER: a tool for configurable software verification. In: CAV (2011)
Büchi, J.R., Landweber, L.: Solving sequential conditions by finite-state strategies. Trans. Amer. Math. Soc. 138, 295–311 (1969)
Cachat, T.: Symbolic strategy synthesis for games on pushdown graphs. In: Widmayer, P., Triguero, F., Morales, R., Hennessy, M., Eidenbenz, S., Conejo, R. (eds.) ICALP 2002. LNCS, vol. 2380, pp. 704–715. Springer, Heidelberg (2002)
Cook, B., Podelski, A., Rybalchenko, A.: Summarization for termination: no return!. Formal Methods Syst. Design 35(3), 369–387 (2009)
de Moura, L., Bjørner, N.S.: Z3: an efficient SMT solver. In: Ramakrishnan, C.R., Rehof, J. (eds.) TACAS 2008. LNCS, vol. 4963, pp. 337–340. Springer, Heidelberg (2008)
Grädel, E., Thomas, W., Wilke, T. (eds.): Automata, Logics, and Infinite Games. LNCS, vol. 2500. Springer, Heidelberg (2002)
Grebenshchikov, S., Lopes, N.P., Popeea, C., Rybalchenko, A.: Synthesizing software verifiers from proof rules. In: PLDI (2012)
Griesmayer, A., Bloem, R., Cook, B.: Repair of boolean programs with an application to C. In: Ball, T., Jones, R.B. (eds.) CAV 2006. LNCS, vol. 4144, pp. 358–371. Springer, Heidelberg (2006)
Grumberg, O., Lange, M., Leucker, M., Shoham, S.: Don’t Know in the \(\mu \)-Calculus. In: Cousot, R. (ed.) VMCAI 2005. LNCS, vol. 3385, pp. 233–249. Springer, Heidelberg (2005)
Gurfinkel, A., Chechik, M.: Why waste a perfectly good abstraction? In: Hermanns, H., Palsberg, J. (eds.) TACAS 2006. LNCS, vol. 3920, pp. 212–226. Springer, Heidelberg (2006)
Henzinger, T.A., Jhala, R., Majumdar, R., McMillan, K.L.: Abstractions from proofs. In: POPL (2004)
Hoder, K., Bjørner, N., de Moura, L.: \(\mu \)Z– an efficient engine for fixed points with constraints. In: Gopalakrishnan, G., Qadeer, S. (eds.) CAV 2011. LNCS, vol. 6806, pp. 457–462. Springer, Heidelberg (2011)
Holzbaur, C.: OFAI clp(q, r) Manual, 1.3.3(edn.). Austrian Research Institute for Artificial Intelligence, Vienna, TR-95-09 (1995)
Jha, S., Gulwani, S., Seshia, S.A., Tiwari, A.: Oracle-guided component-based program synthesis. In: ICSE (2010)
Jobstmann, B., Griesmayer, A., Bloem, R.: Program repair as a game. In: Etessami, K., Rajamani, S.K. (eds.) CAV 2005. LNCS, vol. 3576, pp. 226–238. Springer, Heidelberg (2005)
Kuncak, V., Mayer, M., Piskac, R., Suter, P.: Complete functional synthesis. In: PLDI (2010)
Lustig, Y., Vardi, M.Y.: Synthesis from component libraries. STTT 15(5–6), 603–618 (2013)
Madhusudan, P.: Synthesizing reactive programs. In: CSL, pp. 428–442 (2011)
Necula, G.C., McPeak, S., Rahul, S.P., Weimer, W.: CIL: Intermediate language and tools for analysis and transformation of C programs. In: CC (2002)
Piterman, N., Pnueli, A., Sa’ar, Y.: Synthesis of reactive(1) designs. In: Emerson, E.A., Namjoshi, K.S. (eds.) VMCAI 2006. LNCS, vol. 3855, pp. 364–380. Springer, Heidelberg (2006)
Pnueli, A., Rosner, R.: On the synthesis of a reactive module. In: POPL, pp. 179–190. ACM (1989)
Podelski, A., Rybalchenko, A.: Transition invariants. In: LICS (2004)
Sharir, M., Pnueli, A.: Two approaches to interprocedural data flow analysis. In: Program Flow Analysis: Theory and Applications, pp. 189–234 (1981)
Singh, R., Singh, R., Xu, Z., Krosnick, R., Solar-Lezama, A.: Modular synthesis of sketches using models. In: McMillan, K.L., Rival, X. (eds.) VMCAI 2014. LNCS, vol. 8318, pp. 395–414. Springer, Heidelberg (2014)
Solar-Lezama, A., Tancau, L., Bodík, R., Seshia, S.A., Saraswat, V.A.: Combinatorial sketching for finite programs. In: ASPLOS, pp. 404–415 (2006)
Srivastava, S., Gulwani, S., Foster, J.S.: From program verification to program synthesis. In: POPL, pp. 313–326 (2010)
Thomas, W.: On the synthesis of strategies in infinite games. In: STACS, pp. 1–13 (1995)
Vechev, M.T., Yahav, E., Yorsh, G.: Abstraction-guided synthesis of synchronization. In: POPL (2010)
Walukiewicz, I.: Pushdown processes: games and model-checking. Inf. Comput. 164(2), 234–263 (2001)
Xie, Y., Aiken, A.: SATURN: A scalable framework for error detection using boolean satisfiability. ACM TOPLAS, 29(3) (2007)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
A Correctness Proofs for RuleTerm
A Correctness Proofs for RuleTerm
Proof
We split the proof into two parts: soundness and relative completeness.
Soundness. We prove the soundness by contradiction.
Assume that there exist an assertions \({sum}(v_1,v_2, R)\), \( round (v_1,v_2)\) and \( descent (v_1,v_2)\) that satisfy the premises of the rule, yet the conclusion of the rule does not hold. That is, there is no winning strategy for Prog.
Hence, there exists a strategy \(\sigma \) for Env in which each play does not terminates. This strategy \(\sigma \) alternates between existential choices of Env and universal choices of Prog. Let \( aux (v)\) be a set of states for which \(\sigma \) provides existentially chosen successors wrt. Prog. Note that no play terminates from any \(s\in aux (v)\) since no play determined by \(\sigma \) terminates.
We derive a contradiction by relying on a certain play \(\pi \) that is determined by \(\sigma \). The play \(\pi \) is constructed iteratively. We start from some root state \(s_0\) of \(\sigma \), which satisfies the initial condition \( init (v)\). Note that \({sum}(s_0,s_0,R_0)\), due to T1, and \( aux (s_0)\) due to \(\sigma \).
Each iteration round extends the matched play \(s_0..s\) obtained so far in three ways:
-
by two states, say \(s_1\) and \(s_2\) where \( env (s, s_1)\) and \( prog (s_1, s_2)\),
-
by a state, say \(s_1\) where \( call (s, s_1)\), or
-
by a sequence of states \(s_1..s_2\) where we have \( call (s, s_1)\), \({sum}(s_1,R_1)\), and \(s_1..s_2\) is a play from \(s_1\) to one of its FURs \(s_2 \in R_1\).
We maintain a condition that for the last state \(s\) of each such play, \({sum}(s_0,s,R)\) and \( aux (s)\) where \(s_0= entry (s)\), i.e., \(s_0\) is the entry state of the calling context of s.
Let \(s\) be the last state of the play \(\pi \) constructed so far, and \(s_0= entry (s)\). Due to our condition, we have \({sum}(s_0,s,R)\) and \( aux (s)\). We iteratively construct a play \(\pi \) taking one of the following steps at a time:
-
\(\sigma \) determines a successor state \(s_1\) such that \( env (s, s_1)\), and T2 guarantees that there exists a state \(s_2\) such that \( prog (s_1, s_2)\), \( round (s, s_2)\), and \({sum}(s_0,s_2,R_2)\) such that \(R_2 \subseteq R\). The play is extended by \(s_1,s_2\). Furthermore, \( aux (s_2)\) due to G.
-
\(\sigma \) determines a successor state \(s_1\) such that \( call (s, s_1)\), and T3 guarantees that there exists a set of FURs \(R_1\) of \(s_1\) such that \({sum}(s_1,s_1,R_1)\), and also \( descent (s_0,s_1)\). The play is extended by \(s_1\). Furthermore, \( aux (s_1)\) due to \(\sigma \).
-
\(\sigma \) determines a sequence of successor state \(s_1\) such that \( call (s, s_1)\), where \({sum}(s_1,s_1,R_1)\) is given together with some \(s_2 \in R_1\). Here, T4 guarantees that there exists a set of FURs \(R_2\) for \(s_2\) such that \({sum}(s_0,s_2,R_2)\) where \(R_2 \subseteq R\), and also \( round (s, s_2)\). The play is extended by \(s_1..s_2\). Furthermore, \( aux (s_2)\) due to \(\sigma \).
By iteratively constructing \(\pi \) following the above steps, we obtain a play that satisfies the strategy \(\sigma \). Hence, one of the following follows:
-
there exists an infinite sequence of Env states at some procedural level if the infinite play is due to infinite intra-procedural steps by Env which contradicts with T6.
-
there exists an infinite sequence of entry states if the infinite play is due to infinite call steps by Env which contradicts with T7
Relative Completeness. Let us assume that Prog has a winning strategy, say \(\sigma \). We show how to construct \({sum}(v_1,v_2,R)\), \( round (v_1,v_2)\) and \( descent (v_1,v_2)\) satisfying the premises of the rule by taking an arbitrary play \(\pi \) determined by \(\sigma \).
Let \({sum}(v_1,v_2,R)\) be the set of all triplets \((s_0,s,R)\) such that \(s\) is a state in\(\pi \) for which \(\sigma \) provides a universally chosen successor w.r.t. Env, \(s_0\) = \( entry (s)\), and \(R\) is the set of FURs in \(\sigma \) starting at \(s\). Let \( round (v_1,v_2)\) be the set of all pairs of states \((s_1, s_2)\) such that \(s_1\) and \(s_2\) are consecutive Env states on the same procedural level. Let \( descent (v_1,v_2)\) be the set of all pairs of states \((s_1, s_2)\) such that \(s_1\) and \(s_2\) are entry states of two consecutive procedural levels.
Since an initial state is an Env state, \({sum}(v_1,v_2,R)\) is defined for any initial state, satisfying T1.
Let us take an arbitrary summary \({sum}(s_0,s_1,R_1)\). \(\sigma \) guarantees that for every successor \(s_2\) of \(s_1\) wrt. Env there exists a successor \(s_3\) wrt. Prog. For every such \(s_3\), \({sum}(s_0,s_3,R_3)\). Since the set of FURs may only shrink across intra-procedural steps, \(R_3 \subseteq R_1\). In addition, we have \( round (s_1,s_3)\) since \(s_1\) and \(s_3\) are consecutive Env states on the same procedural level, i.e. \({sum}(v_1,v_2,R)\) and \( round (v_1,v_2)\) satisfy T2.
For an arbitrary Env state \(s_1\) with \({sum}(s_0,s_1,R_1)\) and a state \(s_2\) such that \( call (s_1,s_2)\), we get \({sum}(s_2,s_2,R_2)\) since \(s_2\) is an Env state. Since \(s_0\) and \(s_2\) are entry states to the caller and callee context respectively, we have \( descent (s_0,s_2)\),i.e. T3 is satisfied.
Let us consider a pair of states \(s_1\) and \(s_2\) such that \({sum}(s_0,s_1,R_1)\), \({sum}(s_2,s_2,R_2)\), and \( call (s_1,s_2)\). For any \(s_3 \in R_2\), we have \({sum}(s_0,s_3,R_3)\) since \(s_3\) is an Env state by definition of FURs, and \(s_0\) is in the same procedural level with all states in \(R_1\) including \(s_2\). It follows that any FUR of \(s_2\) is also FUR of \(s_0\) implying \(R_2 \subseteq R_0\). In addition, we have \( round (s_1,s_3)\) since \(s_1\) and \(s_3\) are consecutive Env states on the same procedural level, i.e. T4 is satisfied.
Now let us consider a state \(s_1\) such that \({sum}(s_0,s_1,R_1)\) for \(s_0 = entry (s_1)\) and \( ret (s_1,s_2)\) for some state \(s_2\). By definition of FURs, we see that \(s_2\) is in \(R_1\), satisfying T5.
Now we show by contradiction that \( round (v_1,v_2)\) is well-founded. Assume otherwise, i.e., there exists an infinite sequence of states s1, s2, . . . induced by \( round (v_1,v_2)\) and Prog still terminates. As noted previously, for each pair of consecutive Env states \(s_i\) and \(s_{i+1}\) there exists an intermediate sequence of state \(s_i'...s_i''\) such that the sequence \(s_1, s_1',..,s_1'', s_2, . . . , s_i, s_i',..,s_i'', s_{i+1}, . . .\) is a play. Since this play does not terminate, we obtain a contradiction to the assumption. Hence, we conclude that \( round (v_1,v_2)\) is well-founded, satisfying T6.
Similarly, we show by contradiction that descent(u, v) is well-founded, satisfying T7. \(\square \)
Rights and permissions
Copyright information
© 2016 Springer International Publishing Switzerland
About this paper
Cite this paper
Beyene, T.A., Chaudhuri, S., Popeea, C., Rybalchenko, A. (2016). Recursive Games for Compositional Program Synthesis. In: Gurfinkel, A., Seshia, S.A. (eds) Verified Software: Theories, Tools, and Experiments. VSTTE 2015. Lecture Notes in Computer Science(), vol 9593. Springer, Cham. https://doi.org/10.1007/978-3-319-29613-5_2
Download citation
DOI: https://doi.org/10.1007/978-3-319-29613-5_2
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-29612-8
Online ISBN: 978-3-319-29613-5
eBook Packages: Computer ScienceComputer Science (R0)