Skip to main content

Empirically Scalable Invariant Generation Leveraging Divide-and-Conquer with Pruning

  • Conference paper
  • First Online:
Theoretical Aspects of Software Engineering (TASE 2024)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 14777))

Included in the following conference series:

  • 518 Accesses

Abstract

Invariant generation is a critical task in program verification. Literature highlights Farkas’ Lemma as a principal sound and complete framework for proactively generating tight invariants in constraint-solving. Recent advances have identified the conversion from CNF to DNF as a major bottleneck, leading to a combinatorial explosion. In this study, we introduce an optimized algorithm to address the combinatorial explosion by trading off space for time-efficiency. Our approach employs two key strategies to boost speed. First, we apply a divide-and-conquer strategy to decompose a complex problem into smaller, more manageable subproblems that can be solved quickly and in parallel. Second, we intelligently apply a pruning strategy in two ways, navigating the depth-first search process to avoid unnecessary checks. These improvements maintain the accuracy and speed up the analysis. The experiments indicate that our approach outperforms the state-of-the-art, demonstrating significant speed improvements. With this solution, we bring a significant advance in accelerating invariant generation with Farkas’ Lemma.

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

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

References

  1. Adjé, A., Garoche, P.-L., Magron, V.: Property-based polynomial invariant generation using sums-of-squares optimization. In: Blazy, S., Jensen, T. (eds.) SAS 2015. LNCS, vol. 9291, pp. 235–251. Springer, Heidelberg (2015). https://doi.org/10.1007/978-3-662-48288-9_14

    Chapter  MATH  Google Scholar 

  2. Asadi, A., Chatterjee, K., Fu, H., Goharshady, A.K., Mahdavi, M.: Polynomial reachability witnesses via stellensätze. In: PLDI, pp. 772–787. ACM (2021). https://doi.org/10.1145/3453483.3454076

  3. Breck, J., Cyphert, J., Kincaid, Z., Reps, T.W.: Templates and recurrences: better together. In: PLDI, pp. 688–702. ACM (2020).https://doi.org/10.1145/3385412.3386035

  4. Chatterjee, K., Fu, H., Goharshady, A.K.: Non-polynomial worst-case analysis of recursive programs. ACM Trans. Program. Lang. Syst. 41(4), 20:1–20:52 (2019). https://doi.org/10.1145/3339984

  5. Chatterjee, K., Fu, H., Goharshady, A.K., Goharshady, E.K.: Polynomial invariant generation for non-deterministic recursive programs. In: PLDI, pp. 672–687. ACM (2020). https://doi.org/10.1145/3385412.3385969

  6. Chen, Y.-F., Hong, C.-D., Wang, B.-Y., Zhang, L.: Counterexample-guided polynomial loop invariant generation by lagrange interpolation. In: Kroening, D., Păsăreanu, C.S. (eds.) CAV 2015. LNCS, vol. 9206, pp. 658–674. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-21690-4_44

    Chapter  MATH  Google Scholar 

  7. Colón, M.A., Sankaranarayanan, S., Sipma, H.B.: Linear invariant generation using non-linear constraint solving. In: Hunt, W.A., Somenzi, F. (eds.) CAV 2003. LNCS, vol. 2725, pp. 420–432. Springer, Heidelberg (2003). https://doi.org/10.1007/978-3-540-45069-6_39

    Chapter  Google Scholar 

  8. Csallner, C., Tillmann, N., Smaragdakis, Y.: Dysy: dynamic symbolic execution for invariant inference. In: ICSE, pp. 281–290. ACM (2008).https://doi.org/10.1145/1368088.1368127

  9. Farzan, A., Kincaid, Z.: Compositional recurrence analysis. In: FMCAD, pp. 57–64. IEEE (2015)

    Google Scholar 

  10. Garg, P., Löding, C., Madhusudan, P., Neider, D.: ICE: a robust framework for learning invariants. In: Biere, A., Bloem, R. (eds.) CAV 2014. LNCS, vol. 8559, pp. 69–87. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-08867-9_5

    Chapter  MATH  Google Scholar 

  11. Garg, P., Neider, D., Madhusudan, P., Roth, D.: Learning invariants using decision trees and implication counterexamples. In: POPL, pp. 499–512. ACM (2016https://doi.org/10.1145/2837614.2837664

  12. Giacobazzi, R., Ranzato, F.: Completeness in abstract interpretation: a domain perspective. In: Johnson, M. (ed.) AMAST 1997. LNCS, vol. 1349, pp. 231–245. Springer, Heidelberg (1997). https://doi.org/10.1007/BFb0000474

    Chapter  MATH  Google Scholar 

  13. Gulwani, S., Srivastava, S., Venkatesan, R.: Program analysis as constraint solving. In: PLDI, pp. 281–292. ACM (2008).https://doi.org/10.1145/1375581.1375616

  14. Gupta, A., Majumdar, R., Rybalchenko, A.: From tests to proofs. In: Kowalewski, S., Philippou, A. (eds.) TACAS 2009. LNCS, vol. 5505, pp. 262–276. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-00768-2_24

    Chapter  MATH  Google Scholar 

  15. Gupta, A., Rybalchenko, A.: InvGen: an efficient invariant generator. In: Bouajjani, A., Maler, O. (eds.) CAV 2009. LNCS, vol. 5643, pp. 634–640. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-02658-4_48

    Chapter  MATH  Google Scholar 

  16. Halbwachs, N., Proy, Y., Roumanoff, P.: Verification of real-time systems using linear relation analysis. Formal Methods Syst. Des. 11(2), 157–185 (1997). https://doi.org/10.1023/A:1008678014487

    Article  MATH  Google Scholar 

  17. He, J., Singh, G., Püschel, M., Vechev, M.T.: Learning fast and precise numerical analysis. In: PLDI, pp. 1112–1127. ACM (2020). https://doi.org/10.1145/3385412.3386016

  18. Hrushovski, E., Ouaknine, J., Pouly, A., Worrell, J.: Polynomial invariants for affine programs. In: LICS, pp. 530–539. ACM (2018). https://doi.org/10.1145/3209108.3209142

  19. Ji, Y., Fu, H., Fang, B., Chen, H.: Affine loop invariant generation via matrix algebra. In: Shoham, S., Vizel, Y. (eds.) Computer Aided Verification - 34th International Conference, CAV 2022, Haifa, Israel, 7-10 August 2022, Proceedings, Part I, LNCS, vol. 13371, pp. 257–281. Springer, Cham (2022). https://doi.org/10.1007/978-3-031-13185-1_13

  20. Lamport, L.: A fast mutual exclusion algorithm. ACM Trans. Comput. Syst. 5(1), 1–11 (1987). https://doi.org/10.1145/7351.7352

    Article  MATH  Google Scholar 

  21. Liu, H., Fu, H., Yu, Z., Song, J., Li, G.: Scalable linear invariant generation with farkas’ lemma. Proc. ACM Program. Lang. 6(OOPSLA2), 204–232 (2022). https://doi.org/10.1145/3563295

    Article  MATH  Google Scholar 

  22. Nguyen, T., Kapur, D., Weimer, W., Forrest, S.: Using dynamic analysis to discover polynomial and array invariants. In: ICSE, pp. 683–693. IEEE Computer Society (2012). https://doi.org/10.1109/ICSE.2012.6227149

  23. de Oliveira, S., Bensalem, S., Prevosto, V.: Polynomial invariants by linear algebra. In: Artho, C., Legay, A., Peled, D. (eds.) ATVA 2016. LNCS, vol. 9938, pp. 479–494. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-46520-3_30

    Chapter  MATH  Google Scholar 

  24. Padon, O., McMillan, K.L., Panda, A., Sagiv, M., Shoham, S.: Ivy: safety verification by interactive generalization. In: PLDI, pp. 614–630. ACM (2016). https://doi.org/10.1145/2908080.2908118

  25. Rodríguez-Carbonell, E., Kapur, D.: An abstract interpretation approach for automatic generation of polynomial invariants. In: Giacobazzi, R. (ed.) SAS 2004. LNCS, vol. 3148, pp. 280–295. Springer, Heidelberg (2004). https://doi.org/10.1007/978-3-540-27864-1_21

    Chapter  MATH  Google Scholar 

  26. Rodríguez-Carbonell, E., Kapur, D.: Automatic generation of polynomial loop invariants: algebraic foundations. In: ISSAC, pp. 266–273. ACM (2004). https://doi.org/10.1145/1005285.1005324

  27. Rodríguez-Carbonell, E., Kapur, D.: Automatic generation of polynomial invariants of bounded degree using abstract interpretation. Sci. Comput. Program. 64(1), 54–75 (2007). https://doi.org/10.1016/j.scico.2006.03.003

    Article  MathSciNet  MATH  Google Scholar 

  28. Sankaranarayanan, S., Sipma, H.B., Manna, Z.: Constraint-based linear-relations analysis. In: Giacobazzi, R. (ed.) SAS 2004. LNCS, vol. 3148, pp. 53–68. Springer, Heidelberg (2004). https://doi.org/10.1007/978-3-540-27864-1_7

    Chapter  MATH  Google Scholar 

  29. Schrijver, A.: Theory of linear and integer programming. Wiley-Interscience series in discrete mathematics and optimization, Wiley (1999)

    Google Scholar 

  30. Software verification competition. https://sv-comp.sosy-lab.org (2023)

  31. Xu, R., He, F., Wang, B.: Interval counterexamples for loop invariant learning. In: ESEC/FSE, pp. 111–122. ACM (2020). https://doi.org/10.1145/3368089.3409752

  32. Yao, J., Ryan, G., Wong, J., Jana, S., Gu, R.: Learning nonlinear loop invariants with gated continuous logic networks. In: PLDI, pp. 106–120. ACM (2020). https://doi.org/10.1145/3385412.3385986

Download references

Acknowledgement

This work is supported by the National Natural Science Foundation of China Grant No. 61872232.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Guoqiang Li .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2024 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Liu, H., Li, G. (2024). Empirically Scalable Invariant Generation Leveraging Divide-and-Conquer with Pruning. In: Chin, WN., Xu, Z. (eds) Theoretical Aspects of Software Engineering. TASE 2024. Lecture Notes in Computer Science, vol 14777. Springer, Cham. https://doi.org/10.1007/978-3-031-64626-3_19

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-64626-3_19

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-64625-6

  • Online ISBN: 978-3-031-64626-3

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics