Affine Disjunctive Invariant Generation with Farkas' Lemma (2307.13318v4)
Abstract: In the verification of loop programs, disjunctive invariants are essential to capture complex loop dynamics such as phase and mode changes. In this work, we develop a novel approach for the automated generation of affine disjunctive invariants for affine while loops via Farkas' Lemma, a fundamental theorem on linear inequalities. Our main contributions are two-fold. First, we combine Farkas' Lemma with a succinct control flow transformation to derive disjunctive invariants from the conditional branches in the loop. Second, we propose an invariant propagation technique that minimizes the invariant computation effort by propagating previously solved invariants to yet unsolved locations as much as possible. Furthermore, we resolve the infeasibility checking in the application of Farkas' Lemma which has not been addressed previously, and extend our approach to nested loops via loop summary. Experimental evaluation over more than 100 affine while loops (mostly from SV-COMP 2023) demonstrates that our approach is promising to generate tight linear invariants over affine programs.
- Property-based Polynomial Invariant Generation Using Sums-of-Squares Optimization. In SAS (LNCS, Vol. 9291). Springer, [S.l.], 235–251.
- Ufo: A Framework for Abstraction- and Interpolation-Based Software Verification. In CAV (LNCS, Vol. 7358). Springer, 672–678. https://doi.org/10.1007/978-3-642-31424-7_48
- Multi-dimensional Rankings, Program Termination, and Complexity Bounds of Flowchart Programs. In SAS (LNCS, Vol. 6337). Springer, 117–133. https://doi.org/10.1007/978-3-642-15769-1_8
- Polynomial reachability witnesses via Stellensätze. In PLDI. ACM, 772–787. https://doi.org/10.1145/3453483.3454076
- Precise Widening Operators for Convex Polyhedra. In Static Analysis, 10th International Symposium, SAS 2003, San Diego, CA, USA, June 11-13, 2003, Proceedings (Lecture Notes in Computer Science, Vol. 2694), Radhia Cousot (Ed.). Springer, 337–354. https://doi.org/10.1007/3-540-44898-5_19
- Possibly Not Closed Convex Polyhedra and the Parma Polyhedra Library. In SAS (Lecture Notes in Computer Science, Vol. 2477). Springer, 213–229. https://doi.org/10.1007/3-540-45789-5_17
- Refining the control structure of loops using static analysis. In Proceedings of the 9th ACM & IEEE International conference on Embedded software, EMSOFT 2009, Grenoble, France, October 12-16, 2009, Samarjit Chakraborty and Nicolas Halbwachs (Eds.). ACM, 49–58. https://doi.org/10.1145/1629335.1629343
- Amir M. Ben-Amram and Samir Genaim. 2017. On Multiphase-Linear Ranking Functions. In CAV (LNCS, Vol. 10427), Rupak Majumdar and Viktor Kuncak (Eds.). Springer, 601–620. https://doi.org/10.1007/978-3-319-63390-9_32
- Rémy Boutonnet and Nicolas Halbwachs. 2019. Disjunctive Relational Abstract Interpretation for Interprocedural Program Analysis. In Verification, Model Checking, and Abstract Interpretation - 20th International Conference, VMCAI 2019, Cascais, Portugal, January 13-15, 2019, Proceedings (LNCS, Vol. 11388), Constantin Enea and Ruzica Piskac (Eds.). Springer, 136–159. https://doi.org/10.1007/978-3-030-11245-5_7
- Linear Ranking with Reachability. In CAV (LNCS, Vol. 3576). Springer, 491–504. https://doi.org/10.1007/11513988_48
- Compositional Shape Analysis by Means of Bi-Abduction. J. ACM 58, 6 (2011), 26:1–26:66. https://doi.org/10.1145/2049697.2049700
- Aleksandar Chakarov and Sriram Sankaranarayanan. 2013. Probabilistic Program Analysis with Martingales. In CAV (LNCS, Vol. 8044). Springer, 511–526. https://doi.org/10.1007/978-3-642-39799-8_34
- Non-polynomial Worst-Case Analysis of Recursive Programs. ACM Trans. Program. Lang. Syst. 41, 4 (2019), 20:1–20:52. https://doi.org/10.1145/3339984
- Polynomial invariant generation for non-deterministic recursive programs. In PLDI. ACM, 672–687. https://doi.org/10.1145/3385412.3385969
- Counterexample-Guided Polynomial Loop Invariant Generation by Lagrange Interpolation. In CAV (LNCS, Vol. 9206). Springer, 658–674. https://doi.org/10.1007/978-3-319-21690-4_44
- Discovering Non-linear Ranking Functions by Solving Semi-algebraic Systems. In ICTAC (LNCS, Vol. 4711). Springer, 34–49. https://doi.org/10.1007/978-3-540-75292-9_3
- Clang Static Analyzer 2022. Clang Static Analyzer: A source code analysis tool that finds bugs in C, C++, and Objective-C programs. https://clang-analyzer.llvm.org/.
- Linear Invariant Generation Using Non-linear Constraint Solving. In CAV (LNCS, Vol. 2725). Springer, 420–432. https://doi.org/10.1007/978-3-540-45069-6_39
- Michael Colón and Henny Sipma. 2001. Synthesis of Linear Ranking Functions. In TACAS (LNCS, Vol. 2031). Springer, 67–81. https://doi.org/10.1007/3-540-45319-9_6
- Patrick Cousot. 2005. Proving Program Invariance and Termination by Parametric Abstraction, Lagrangian Relaxation and Semidefinite Programming. In VMCAI (LNCS, Vol. 3385). Springer, 1–24. https://doi.org/10.1007/978-3-540-30579-8_1
- Patrick Cousot and Radhia Cousot. 1977. Abstract Interpretation: A Unified Lattice Model for Static Analysis of Programs by Construction or Approximation of Fixpoints. In POPL. ACM, 238–252. https://doi.org/10.1145/512950.512973
- Patrick Cousot and Nicolas Halbwachs. 1978. Automatic Discovery of Linear Restraints Among Variables of a Program. In POPL. ACM Press, 84–96. https://doi.org/10.1145/512760.512770
- CPAchecker 2022. CPAchecker: The Configurable Software-Verification Platform. https://cpachecker.sosy-lab.org.
- DySy: dynamic symbolic execution for invariant inference. In ICSE. ACM, 281–290. https://doi.org/10.1145/1368088.1368127
- Refinement of path expressions for static analysis. Proc. ACM Program. Lang. 3, POPL (2019), 45:1–45:29. https://doi.org/10.1145/3290358
- VeriAbs: A tool for scalable verification by abstraction (competition contribution). In Tools and Algorithms for the Construction and Analysis of Systems: 27th International Conference, TACAS 2021, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2021, Luxembourg City, Luxembourg, March 27–April 1, 2021, Proceedings, Part II 27. Springer, 458–462.
- Danger Invariants. In FM (LNCS, Vol. 9995). 182–198. https://doi.org/10.1007/978-3-319-48989-6_12
- Polynomial Invariants by Linear Algebra. In ATVA (LNCS, Vol. 9938). 479–494. https://doi.org/10.1007/978-3-319-46520-3_30
- Synthesizing Invariants by Solving Solvable Loops. In ATVA (LNCS, Vol. 10482). Springer, 327–343. https://doi.org/10.1007/978-3-319-68167-2_22
- Inductive invariant generation via abductive inference. In OOPSLA. ACM, 443–456. https://doi.org/10.1145/2509136.2509511
- Software Verification Using k-Induction. In SAS (LNCS, Vol. 6887), Eran Yahav (Ed.). Springer, 351–368. https://doi.org/10.1007/978-3-642-23702-7_26
- Eldarica 2022. Eldarica: A model checker for Horn clauses, Numerical Transition Systems, and software programs. https://github.com/uuverifiers/eldarica.
- J. Farkas. 1894. A Fourier-féle mechanikai elv alkalmazásai (Hungarian). Mathematikaiés Természettudományi Értesitö 12 (1894), 457–472.
- Azadeh Farzan and Zachary Kincaid. 2015. Compositional Recurrence Analysis. In FMCAD. IEEE, 57–64.
- Nonlinear Craig Interpolant Generation. In CAV (LNCS, Vol. 12224). Springer, 415–438. https://doi.org/10.1007/978-3-030-53288-8_20
- ICE: A Robust Framework for Learning Invariants. In CAV (LNCS, Vol. 8559). Springer, 69–87. https://doi.org/10.1007/978-3-319-08867-9_5
- Learning invariants using decision trees and implication counterexamples. In POPL. ACM, 499–512. https://doi.org/10.1145/2837614.2837664
- Denis Gopan and Thomas W. Reps. 2007. Guided Static Analysis. In Static Analysis, 14th International Symposium, SAS 2007, Kongens Lyngby, Denmark, August 22-24, 2007, Proceedings (LNCS, Vol. 4634), Hanne Riis Nielson and Gilberto Filé (Eds.). Springer, 349–365. https://doi.org/10.1007/978-3-540-74061-2_22
- Control-flow refinement and progress invariants for bound analysis. In Proceedings of the 2009 ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2009, Dublin, Ireland, June 15-21, 2009, Michael Hind and Amer Diwan (Eds.). ACM, 375–385. https://doi.org/10.1145/1542476.1542518
- Program analysis as constraint solving. In PLDI. ACM, 281–292. https://doi.org/10.1145/1375581.1375616
- Ashutosh Gupta and Andrey Rybalchenko. 2009. InvGen: An Efficient Invariant Generator. In CAV (LNCS, Vol. 5643). Springer, 634–640. https://doi.org/10.1007/978-3-642-02658-4_48
- Learning fast and precise numerical analysis. In PLDI. ACM, 1112–1127. https://doi.org/10.1145/3385412.3386016
- PAGAI: A Path Sensitive Static Analyser. Electron. Notes Theor. Comput. Sci. 289 (2012), 15–25. https://doi.org/10.1016/j.entcs.2012.11.003
- Polynomial Invariants for Affine Programs. In LICS. ACM, 530–539. https://doi.org/10.1145/3209108.3209142
- Automated Generation of Non-Linear Loop Invariants Utilizing Hypergeometric Sequences. In ISSAC. ACM, 221–228. https://doi.org/10.1145/3087604.3087623
- Affine Loop Invariant Generation via Matrix Algebra. In Computer Aided Verification - 34th International Conference, CAV 2022, Haifa, Israel, August 7-10, 2022, Proceedings, Part I (Lecture Notes in Computer Science, Vol. 13371), Sharon Shoham and Yakir Vizel (Eds.). Springer, 257–281. https://doi.org/10.1007/978-3-031-13185-1_13
- Solving constrained Horn clauses modulo algebraic data types and recursive functions. Proc. ACM Program. Lang. 6, POPL (2022), 1–29. https://doi.org/10.1145/3498722
- Deepak Kapur. 2005. Automatically Generating Loop Invariants Using Quantifier Elimination. In Deduction and Applications (Dagstuhl Seminar Proceedings, Vol. 05431). Internationales Begegnungs- und Forschungszentrum für Informatik (IBFI), Schloss Dagstuhl, Germany. http://drops.dagstuhl.de/opus/volltexte/2006/511
- Compositional recurrence analysis revisited. In PLDI. ACM, 248–262. https://doi.org/10.1145/3062341.3062373
- Non-linear reasoning for invariant synthesis. Proc. ACM Program. Lang. 2, POPL (2018), 54:1–54:33. https://doi.org/10.1145/3158142
- SMT-Based Array Invariant Generation. In Verification, Model Checking, and Abstract Interpretation, 14th International Conference, VMCAI 2013, Rome, Italy, January 20-22, 2013. Proceedings (Lecture Notes in Computer Science, Vol. 7737), Roberto Giacobazzi, Josh Berdine, and Isabella Mastroeni (Eds.). Springer, 169–188. https://doi.org/10.1007/978-3-642-35873-9_12
- SLING: using dynamic analysis to infer program invariants in separation logic. In Proceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2019, Phoenix, AZ, USA, June 22-26, 2019, Kathryn S. McKinley and Kathleen Fisher (Eds.). ACM, 788–801. https://doi.org/10.1145/3314221.3314634
- Proving total correctness and generating preconditions for loop programs via symbolic-numeric computation methods. Frontiers Comput. Sci. 8, 2 (2014), 192–202.
- Inferring Loop Invariants for Multi-Path Loops. In International Symposium on Theoretical Aspects of Software Engineering, TASE 2021, Shanghai, China, August 25-27, 2021. IEEE, 63–70. https://doi.org/10.1109/TASE52547.2021.00030
- Scalable Linear Invariant Generation with Farkas’ Lemma. Proc. ACM Program. Lang. 6, OOPSLA2, Article 132 (oct 2022), 29 pages. https://doi.org/10.1145/3563295
- Zohar Manna and Amir Pnueli. 1995. Temporal verification of reactive systems - safety. Springer.
- Kenneth L. McMillan. 2008. Quantified Invariant Generation Using an Interpolating Saturation Prover. In TACAS (LNCS, Vol. 4963), C. R. Ramakrishnan and Jakob Rehof (Eds.). Springer, 413–427. https://doi.org/10.1007/978-3-540-78800-3_31
- Antoine Miné. 2004. Relational Abstract Domains for the Detection of Floating-Point Run-Time Errors. In Programming Languages and Systems, 13th European Symposium on Programming, ESOP 2004, Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2004, Barcelona, Spain, March 29 - April 2, 2004, Proceedings (Lecture Notes in Computer Science, Vol. 2986), David A. Schmidt (Ed.). Springer, 3–17. https://doi.org/10.1007/978-3-540-24725-8_2
- Antoine Miné. 2006. Symbolic Methods to Enhance the Precision of Numerical Abstract Domains. In Verification, Model Checking, and Abstract Interpretation, 7th International Conference, VMCAI 2006, Charleston, SC, USA, January 8-10, 2006, Proceedings (Lecture Notes in Computer Science, Vol. 3855), E. Allen Emerson and Kedar S. Namjoshi (Eds.). Springer, 348–363. https://doi.org/10.1007/11609773_23
- Using dynamic analysis to discover polynomial and array invariants. In ICSE. IEEE Computer Society, 683–693. https://doi.org/10.1109/ICSE.2012.6227149
- Ivy: safety verification by interactive generalization. In PLDI. ACM, 614–630. https://doi.org/10.1145/2908080.2908118
- Andreas Podelski and Andrey Rybalchenko. 2004. A Complete Method for the Synthesis of Linear Ranking Functions. In VMCAI (LNCS, Vol. 2937). Springer, 239–251. https://doi.org/10.1007/978-3-540-24622-0_20
- Daniel Riley and Grigory Fedyukovich. 2022. Multi-Phase Invariant Synthesis. In ESEC/FSE 2022. To appear.
- Enric Rodríguez-Carbonell and Deepak Kapur. 2004a. An Abstract Interpretation Approach for Automatic Generation of Polynomial Invariants. In SAS (LNCS, Vol. 3148). Springer, 280–295. https://doi.org/10.1007/978-3-540-27864-1_21
- Enric Rodríguez-Carbonell and Deepak Kapur. 2004b. Automatic Generation of Polynomial Loop Invariants: Algebraic Foundations. In ISSAC. ACM, 266–273. https://doi.org/10.1145/1005285.1005324
- CLN2INV: Learning Loop Invariants with Continuous Logic Networks. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net. https://openreview.net/forum?id=HJlfuTEtvB
- Non-linear loop invariant generation using Gröbner bases. In POPL. ACM, 318–329. https://doi.org/10.1145/964001.964028
- Constraint-Based Linear-Relations Analysis. In SAS (LNCS, Vol. 3148). Springer, 53–68. https://doi.org/10.1007/978-3-540-27864-1_7
- Alexander Schrijver. 1999. Theory of linear and integer programming. Wiley.
- SeaHorn 2015. SeaHorn: A fully automated analysis framework for LLVM-based languages. http://seahorn.github.io.
- Rahul Sharma and Alex Aiken. 2016. From invariant checking to invariant inference using randomized search. Formal Methods Syst. Des. 48, 3 (2016), 235–256. https://doi.org/10.1007/s10703-016-0248-5
- Simplifying Loop Invariant Generation Using Splitter Predicates. In Computer Aided Verification - 23rd International Conference, CAV 2011, Snowbird, UT, USA, July 14-20, 2011. Proceedings (Lecture Notes in Computer Science, Vol. 6806), Ganesh Gopalakrishnan and Shaz Qadeer (Eds.). Springer, 703–719. https://doi.org/10.1007/978-3-642-22110-1_57
- A Data Driven Approach for Algebraic Loop Invariants. In ESOP (LNCS, Vol. 7792). Springer, 574–592. https://doi.org/10.1007/978-3-642-37036-6_31
- Learning Loop Invariants for Program Verification. In Advances in Neural Information Processing Systems 31: Annual Conference on Neural Information Processing Systems 2018, NeurIPS 2018, December 3-8, 2018, Montréal, Canada, Samy Bengio, Hanna M. Wallach, Hugo Larochelle, Kristen Grauman, Nicolò Cesa-Bianchi, and Roman Garnett (Eds.). 7762–7773. https://proceedings.neurips.cc/paper/2018/hash/65b1e92c585fd4c2159d5f33b5030ff2-Abstract.html
- Jake Silverman and Zachary Kincaid. 2019. Loop Summarization with Rational Vector Addition Systems. In Computer Aided Verification - 31st International Conference, CAV 2019, New York City, NY, USA, July 15-18, 2019, Proceedings, Part II (Lecture Notes in Computer Science, Vol. 11562), Isil Dillig and Serdar Tasiran (Eds.). Springer, 97–115. https://doi.org/10.1007/978-3-030-25543-5_7
- Fast polyhedra abstract domain. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages, POPL 2017, Paris, France, January 18-20, 2017, Giuseppe Castagna and Andrew D. Gordon (Eds.). ACM, 46–59.
- Fabio Somenzi and Aaron R. Bradley. 2011. IC3: where monolithic and incremental meet. In International Conference on Formal Methods in Computer-Aided Design, FMCAD ’11, Austin, TX, USA, October 30 - November 02, 2011, Per Bjesse and Anna Slobodová (Eds.). FMCAD Inc., 3–8. http://dl.acm.org/citation.cfm?id=2157657
- Saurabh Srivastava and Sumit Gulwani. 2009. Program verification using templates over predicate abstraction. In Proceedings of the 2009 ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2009, Dublin, Ireland, June 15-21, 2009, Michael Hind and Amer Diwan (Eds.). ACM, 223–234. https://doi.org/10.1145/1542476.1542501
- StInG 2006. StInG: Stanford Invariant Generator. http://theory.stanford.edu/~srirams/Software/sting.html.
- SV-COMP 2023. Software Verification Competition. https://sv-comp.sosy-lab.org.
- Robert Tarjan. 1972. Depth-first search and linear graph algorithms. SIAM journal on computing 1, 2 (1972), 146–160.
- Chenglin Wang and Fangzhen Lin. 2023. Solving Conditional Linear Recurrences for Program Verification: The Periodic Case. In OOPSLA. ACM. to appear.
- Quantitative analysis of assertion violations in probabilistic programs. In PLDI. ACM, 1171–1186. https://doi.org/10.1145/3453483.3454102
- Proteus: computing disjunctive loop summary via path dependency analysis. In Proceedings of the 24th ACM SIGSOFT International Symposium on Foundations of Software Engineering, FSE 2016, Seattle, WA, USA, November 13-18, 2016, Thomas Zimmermann, Jane Cleland-Huang, and Zhendong Su (Eds.). ACM, 61–72. https://doi.org/10.1145/2950290.2950340
- Interval counterexamples for loop invariant learning. In ESEC/FSE. ACM, 111–122. https://doi.org/10.1145/3368089.3409752
- Recent advances in program verification through computer algebra. Frontiers Comput. Sci. China 4, 1 (2010), 1–16. https://doi.org/10.1007/s11704-009-0074-7
- Learning nonlinear loop invariants with gated continuous logic networks. In PLDI. ACM, 106–120. https://doi.org/10.1145/3385412.3385986
- Z3 2023. Z3.