Abstract
This paper presents a new approach for synthesizing missing parts from imperative programs by using abstract interpretation and logical abduction. Given a partial program with missing arbitrary expressions, our approach synthesizes concrete expressions that are strong enough to prove the assertions in the given program. Furthermore, the synthesized elements by our approach are the simplest and the weakest among all possible that guarantee the validity of assertions. In particular, we use a combination of forward and backward numerical analyses based on abstract interpretation to generate constraints that are solved by using the logical abduction technique.
We have implemented our approach in a prototype synthesis tool for C programs, and we show that the proposed approach is able to successfully synthesize arithmetic and boolean expressions for various C programs.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
This condition guarantees that the assertion is valid for any non-deterministic choice [2, 3]. If we have used an over-approximating backward analysis, it would infer the necessary condition \((\texttt {z+3>y})\) that may lead to the assertion satisfaction for some non-deterministic choices of [2, 3] (e.g., the execution where the non-deterministic choice [2, 3] returns 3).
- 2.
A solution is simplest if it contains the fewest number of variables.
- 3.
Concretization-based abstraction is a relaxation of the known Galois connection, which uses only a concretization function \(\gamma _{\mathbb {D}}\) (e.g. Polyhedra domain).
References
Albarghouthi, A., Dillig, I., Gurfinkel, A.: Maximal specification synthesis. In: Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2016, pp. 789–801. ACM (2016). https://doi.org/10.1145/2837614.2837628
Alur, R., Bodík, R., et al.: Syntax-guided synthesis. In: Formal Methods in Computer-Aided Design, FMCAD 2013, pp. 1–8. IEEE (2013). https://ieeexplore.ieee.org/document/6679385/
Bourdoncle, F.: Abstract debugging of higher-order imperative languages. In: Proceedings of the ACM SIGPLAN 1993 Conference on Programming Language Design and Implementation (PLDI), pp. 46–55. ACM (1993). https://doi.org/10.1145/155090.155095
Calcagno, C., Distefano, D., O’Hearn, P.W., Yang, H.: Compositional shape analysis by means of bi-abduction. In: Proceedings of the 36th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2009, pp. 289–300. ACM (2009). https://doi.org/10.1145/1480881.1480917
Cousot, P., Cousot, R.: Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints. In: Conference Record of the Fourth ACM Symposium on POPL, pp. 238–252. ACM (1977). https://doi.org/10.1145/512950.512973. https://doi.acm.org/10.1145/512950.512973
Cousot, P., et al.: The ASTREÉ analyzer. In: Sagiv, M. (ed.) ESOP 2005. LNCS, vol. 3444, pp. 21–30. Springer, Heidelberg (2005). https://doi.org/10.1007/978-3-540-31987-0_3
Cousot, P., Halbwachs, N.: Automatic discovery of linear restraints among variables of a program. In: Conference Record of the Fifth Annual ACM Symposium on POPL 1978, pp. 84–96. ACM Press (1978). https://doi.org/10.1145/512760.512770
Dillig, I., Dillig, T.: Explain: a tool for performing abductive inference. In: Sharygina, N., Veith, H. (eds.) CAV 2013. LNCS, vol. 8044, pp. 684–689. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-39799-8_46
Dillig, I., Dillig, T., Aiken, A.: Cuts from proofs: a complete and practical technique for solving linear inequalities over integers. In: Bouajjani, A., Maler, O. (eds.) CAV 2009. LNCS, vol. 5643, pp. 233–247. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-02658-4_20
Dillig, I., Dillig, T., Aiken, A.: Automated error diagnosis using abductive inference. In: ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2012, pp. 181–192. ACM (2012). https://doi.org/10.1145/2254064.2254087
Dillig, I., Dillig, T., Li, B., McMillan, K.L.: Inductive invariant generation via abductive inference. In: Proceedings of the 2013 ACM SIGPLAN International Conference on Object Oriented Programming Systems Languages & Applications, OOPSLA 2013, pp. 443–456. ACM (2013). https://doi.org/10.1145/2509136.2509511
Dillig, T., Dillig, I., Chaudhuri, S.: Optimal guard synthesis for memory safety. In: Biere, A., Bloem, R. (eds.) CAV 2014. LNCS, vol. 8559, pp. 491–507. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-08867-9_32
Dimovski, A.S.: A binary decision diagram lifted domain for analyzing program families. J. Comput. Lang. 63, 101032 (2021)
Dimovski, A.S.: Lifted termination analysis by abstract interpretation and its applications. In: GPCE 2021: Concepts and Experiences, pp. 96–109. ACM (2021). https://doi.org/10.1145/3486609.3487202
Dimovski, A.S.: Quantitative program sketching using lifted static analysis. In: FASE 2022. LNCS, vol. 13241, pp. 102–122. Springer, Cham (2022). https://doi.org/10.1007/978-3-030-99429-7_6
Dimovski, A.S.: Artifact for the paper “generalized program sketching by abstract interpretation and logical abduction”. Zenodo (2023)
Dimovski, A.S.: Quantitative program sketching using decision tree-based lifted analysis. J. Comput. Lang. 75, 101206 (2023)
Dimovski, A.S., Apel, S.: Lifted static analysis of dynamic program families by abstract interpretation. In: 35th European Conference on Object-Oriented Programming, ECOOP 2021. LIPIcs, vol. 194, pp. 14:1–14:28. Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2021). https://doi.org/10.4230/LIPIcs.ECOOP.2021.14
Dimovski, A.S., Apel, S., Legay, A.: Program sketching using lifted analysis for numerical program families. In: Dutle, A., Moscato, M.M., Titolo, L., Muñoz, C.A., Perez, I. (eds.) NFM 2021. LNCS, vol. 12673, pp. 95–112. Springer, Cham (2021). https://doi.org/10.1007/978-3-030-76384-8_7
Dimovski, A.S., Apel, S., Legay, A.: Several lifted abstract domains for static analysis of numerical program families. Sci. Comput. Program. 213, 102725 (2022)
Dimovski, A.S., Legay, A.: Computing program reliability using forward-backward precondition analysis and model counting. In: FASE 2020. LNCS, vol. 12076, pp. 182–202. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-45234-6_9
Greitschus, M., et al.: Ultimate taipan: trace abstraction and abstract interpretation. In: Legay, A., Margaria, T. (eds.) TACAS 2017. LNCS, vol. 10206, pp. 399–403. Springer, Heidelberg (2017). https://doi.org/10.1007/978-3-662-54580-5_31
Gurfinkel, A., Kahsai, T., Komuravelli, A., Navas, J.A.: The SeaHorn verification framework. In: Kroening, D., Păsăreanu, C.S. (eds.) CAV 2015. LNCS, vol. 9206, pp. 343–361. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-21690-4_20
Henry, J., Monniaux, D., Moy, M.: PAGAI: a path sensitive static analyser. Electron. Notes Theor. Comput. Sci. 289, 15–25 (2012)
Jeannet, B., Miné, A.: Apron: a library of numerical abstract domains for static analysis. In: Bouajjani, A., Maler, O. (eds.) CAV 2009. LNCS, vol. 5643, pp. 661–667. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-02658-4_52
Li, B., Dillig, I., Dillig, T., McMillan, K., Sagiv, M.: Synthesis of circular compositional program proofs via abduction. In: Piterman, N., Smolka, S.A. (eds.) TACAS 2013. LNCS, vol. 7795, pp. 370–384. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-36742-7_26
Miné, A.: The octagon abstract domain. High.-Order Symb. Comput. 19(1), 31–100 (2006)
Miné, A.: Backward under-approximations in numeric abstract domains to automatically infer sufficient program conditions. Sci. Comput. Program. 93, 154–182 (2014)
Miné, A.: Tutorial on static inference of numeric invariants by abstract interpretation. Found. Trends Program. Lang. 4(3–4), 120–372 (2017)
Rival, X.: Understanding the origin of alarms in Astrée. In: Hankin, C., Siveroni, I. (eds.) SAS 2005. LNCS, vol. 3672, pp. 303–319. Springer, Heidelberg (2005). https://doi.org/10.1007/11547662_21
So, S., Oh, H.: Synthesizing imperative programs from examples guided by static analysis. In: Ranzato, F. (ed.) SAS 2017. LNCS, vol. 10422, pp. 364–381. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-66706-5_18
Solar-Lezama, A.: Program sketching. STTT 15(5–6), 475–495 (2013)
Solar-Lezama, A., Rabbah, R.M., Bodík, R., Ebcioglu, K.: Programming by sketching for bit-streaming programs. In: Proceedings of the ACM SIGPLAN 2005 Conference on Programming Language Design and Implementation, pp. 281–294. ACM (2005). https://doi.org/10.1145/1065010.1065045
Urban, C., Miné, A.: A decision tree abstract domain for proving conditional termination. In: Müller-Olm, M., Seidl, H. (eds.) SAS 2014. LNCS, vol. 8723, pp. 302–318. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-10936-7_19
Yin, B., Chen, L., Liu, J., Wang, J., Cousot, P.: Verifying numerical programs via iterative abstract testing. In: Chang, B.-Y.E. (ed.) SAS 2019. LNCS, vol. 11822, pp. 247–267. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-32304-2_13
Yoon, Y., Lee, W., Yi, K.: Inductive program synthesis via iterative forward-backward abstract interpretation. In: PLDI 2023: 44th ACM SIGPLAN International Conference on Programming Language Design and Implementation, pp. 1657–1681. ACM (2023). https://doi.org/10.1145/3591288
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Dimovski, A.S. (2023). Generalized Program Sketching by Abstract Interpretation and Logical Abduction. In: Hermenegildo, M.V., Morales, J.F. (eds) Static Analysis. SAS 2023. Lecture Notes in Computer Science, vol 14284. Springer, Cham. https://doi.org/10.1007/978-3-031-44245-2_11
Download citation
DOI: https://doi.org/10.1007/978-3-031-44245-2_11
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-44244-5
Online ISBN: 978-3-031-44245-2
eBook Packages: Computer ScienceComputer Science (R0)