Skip to main content

Program Sketching Using Lifted Analysis for Numerical Program Families

  • Conference paper
  • First Online:
NASA Formal Methods (NFM 2021)

Abstract

This work presents a novel approach for synthesizing numerical program sketches using lifted (family-based) static program analysis. In particular, our approach leverages a lifted static analysis based on abstract interpretation, which is used for analyzing program families with numerical features. It takes as input the common code base, which encodes all variants of a program family, and produces precise results for all variants in a single analysis run. The elements of the underlying lifted analysis domain are decision trees, in which decision nodes are labeled with linear constraints defined over numerical features and leaf nodes belong to a given single-program analysis domain.

We encode a program sketch as a program family such that holes correspond to numerical features and all possible sketch realizations correspond to variants in the program family. Then, we preform a lifted analysis of the family, so that only those variants that satisfy all assertions under all possible inputs represent correct realizations of holes in the sketch.

We have implemented an experimental program synthesizer for resolving C sketches. It is based on a lifted static analyzer for \(\texttt {\#if}\)-based C program families, which uses the numerical domains from the APRON  library. An evaluation yields promising results. Moreover, our approach provides speedups in some cases against the popular sketching tool Sketch  and can solve some numerical benchmarks that Sketch  cannot handle.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 79.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 99.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    This is only high-level description of the encoding. For the precise definition, we refer to Sect. 3.3. See the HelloWorld  program family in Fig. 5a.

  2. 2.

    Since any \(k \in \mathbb {K}\) is a valuation function, we have that either \(k \models \theta \) holds or \(k \not \models \theta \) (which is equivalent to \(k \models \lnot \theta \)) holds, for any \(\theta \in \textit{FeatExp}(\mathbb {F})\).

References

  1. Alur, R., et al.: Syntax-guided synthesis. In: Formal Methods in Computer-Aided Design, FMCAD 2013, pp. 1–8. IEEE (2013)

    Google Scholar 

  2. Apel, S., Batory, D.S., Kästner, C., Saake, G.: Feature-Oriented Software Product Lines - Concepts and Implementation. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-37521-7

  3. Apel, S., von Rhein, A., Wendler, P., Größlinger, A., Beyer, D.: Strategies for product-line verification: case studies and experiments. In: 35th International Conference on Software Engineering, ICSE 2013, pp. 482–491 (2013)

    Google Scholar 

  4. Bradley, A.R., Manna, Z., Sipma, H.B.: The Polyranking principle. In: Caires, L., Italiano, G.F., Monteiro, L., Palamidessi, C., Yung, M. (eds.) ICALP 2005. LNCS, vol. 3580, pp. 1349–1361. Springer, Heidelberg (2005). https://doi.org/10.1007/11523468_109

    Chapter  Google Scholar 

  5. Češka, M., Dehnert, C., Jansen, N., Junges, S., Katoen, J.-P.: Model repair revamped. In: Bartocci, E., Cleaveland, R., Grosu, R., Sokolsky, O. (eds.) From Reactive Systems to Cyber-Physical Systems. LNCS, vol. 11500, pp. 107–125. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-31514-6_7

    Chapter  Google Scholar 

  6. Chen, J., Cousot, P.: A binary decision tree abstract domain Functor. In: Blazy, S., Jensen, T. (eds.) SAS 2015. LNCS, vol. 9291, pp. 36–53. Springer, Heidelberg (2015). https://doi.org/10.1007/978-3-662-48288-9_3

    Chapter  Google Scholar 

  7. Clements, P., Northrop, L.: Software Product Lines: Practices and Patterns. Addison-Wesley, Boston (2001)

    Google Scholar 

  8. 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)

    Google Scholar 

  9. Cousot, P., Cousot, R., Mauborgne, L.: A scalable segmented decision tree abstract domain. In: Manna, Z., Peled, D.A. (eds.) Time for Verification. LNCS, vol. 6200, pp. 72–95. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-13754-9_5

    Chapter  Google Scholar 

  10. 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)

    Google Scholar 

  11. Dimovski, A.S.: Lifted static analysis using a binary decision diagram abstract domain. In: Proceedings of the 18th ACM SIGPLAN International Conference on GPCE 2019, pp. 102–114. ACM (2019)

    Google Scholar 

  12. Dimovski, A.S.: On calculating assertion probabilities for program families. Prilozi Contributions Sec. Nat. Math. Biotech. Sci, MASA 41(1), 13–23 (2020)

    Google Scholar 

  13. Dimovski, A.S., Apel, S., Legay, A.: A decision tree lifted domain for analyzing program families with numerical features. In: FASE 2021. LNCS, vol. 12649, pp. 67–86. Springer, Cham (2021). https://doi.org/10.1007/978-3-030-71500-7_4

    Chapter  Google Scholar 

  14. Dimovski, A.S., Brabrand, C., Wasowski, A.: Variability abstractions: trading precision for speed in family-based analyses. In: 29th European Conference on Object-Oriented Programming, ECOOP 2015. LIPIcs, vol. 37, pp 247–270. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik (2015)

    Google Scholar 

  15. Dimovski, A.S., Brabrand, C., Wąsowski, A.: Finding suitable variability abstractions for family-based analysis. In: Fitzgerald, J., Heitmeyer, C., Gnesi, S., Philippou, A. (eds.) FM 2016. LNCS, vol. 9995, pp. 217–234. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-48989-6_14

    Chapter  Google Scholar 

  16. Dimovski, A.S., Brabrand, C., Wasowski, A.: Finding suitable variability abstractions for lifted analysis. Formal Aspect Comput. 31(2), 231–259 (2019). https://doi.org/10.1007/s00165-019-00479-y

    Article  MathSciNet  MATH  Google Scholar 

  17. Hunsen, C., et al.: Preprocessor-based variability in open-source and industrial software systems: an empirical study. Empirical Softw. Eng. 21(2), 449–482 (2015). https://doi.org/10.1007/s10664-015-9360-1

    Article  Google Scholar 

  18. Iosif-Lazar, A.F., Melo, J., Dimovski, A.S., Brabrand, C., Wasowski, A.: Effective analysis of C programs by rewriting variability. Art Sci. Eng. Program. 1(1), 1 (2017)

    Article  Google Scholar 

  19. 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

    Chapter  Google Scholar 

  20. Midtgaard, J., Dimovski, A.S., Brabrand, C., Wasowski, A.: Systematic derivation of correct variability-aware program analyses. Sci. Comput. Program. 105, 145–170 (2015)

    Article  Google Scholar 

  21. Parnas, D.L.: On the design and development of program families. IEEE Trans. Softw. Eng. 2(1), 1–9 (1976)

    Article  Google Scholar 

  22. Singh, G., Püschel, M., Vechev, M.T.: Making numerical program analysis fast. In: Proceedings of the 36th ACM SIGPLAN Conference on PLDI 2015, pp. 303–313. ACM (2015)

    Google Scholar 

  23. Solar-Lezama, A.: Program sketching. STTT 15(5–6), 475–495 (2013)

    Article  Google Scholar 

  24. 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)

    Google Scholar 

  25. Urban, C.: FuncTion: an abstract domain Functor for termination. In: Baier, C., Tinelli, C. (eds.) TACAS 2015. LNCS, vol. 9035, pp. 464–466. Springer, Heidelberg (2015). https://doi.org/10.1007/978-3-662-46681-0_46

    Chapter  Google Scholar 

  26. Caterina Urban: Static analysis by abstract interpretation of functional temporal properties of programs. Ph.D. thesis, École Normale Supérieure, Paris, France (2015)

    Google Scholar 

  27. 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

    Chapter  Google Scholar 

  28. von Rhein, A., Liebig, J., Janker, A., Kästner, C., Apel, S.: Variability-aware static analysis at scale: an empirical study. ACM Trans. Softw. Eng. Methodol. 27(4), 181–1833 (2018)

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Aleksandar S. Dimovski .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2021 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Dimovski, A.S., Apel, S., Legay, A. (2021). Program Sketching Using Lifted Analysis for Numerical Program Families. In: Dutle, A., Moscato, M.M., Titolo, L., Muñoz, C.A., Perez, I. (eds) NASA Formal Methods. NFM 2021. Lecture Notes in Computer Science(), vol 12673. Springer, Cham. https://doi.org/10.1007/978-3-030-76384-8_7

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-76384-8_7

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-76383-1

  • Online ISBN: 978-3-030-76384-8

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics