Proving Properties of Sorting Programs: A Case Study in Horn Clause Verification

07/09/2019 ∙ by Emanuele De Angelis, et al. ∙ University of Rome Tor Vergata Consiglio Nazionale delle Ricerche 0

The proof of a program property can be reduced to the proof of satisfiability of a set of constrained Horn clauses (CHCs) which can be automatically generated from the program and the property. In this paper we have conducted a case study in Horn clause verification by considering several sorting programs with the aim of exploring the effectiveness of a transformation technique which allows us to eliminate inductive data structures such as lists or trees. If this technique is successful, we derive a set of CHCs with constraints over the integers and booleans only, and the satisfiability check can often be performed in an effective way by using state-of-the-art CHC solvers, such as Eldarica or Z3. In this case study we have also illustrated the usefulness of a companion technique based on the introduction of the so-called difference predicates, whose definitions correspond to lemmata required during the verification. We have considered functional programs which implement the following kinds of sorting algorithms acting on lists of integers: (i) linearly recursive sorting algorithms, such as insertion sort and selection sort, and (ii) non-linearly recursive sorting algorithms, such as quicksort and mergesort, and we have considered the following properties: (i) the partial correctness properties, that is, the orderedness of the output lists, and the equality of the input and output lists when viewed as multisets, and (ii) some arithmetic properties, such as the equality of the sum of the elements before and after sorting.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

2 Verification of Linearly Recursive Sorting Algorithms

3 Verification of Non-Linearly Recursive Sorting Algorithms

4 Concluding Remarks

5 Acknowledgments

References

  • [1]
  • [2] N. Bjørner, A. Gurfinkel, K. L. McMillan & A. Rybalchenko (2015): Horn Clause Solvers for Program Verification. In L. D. Beklemishev, A. Blass, N. Dershowitz, B. Finkbeiner & W. Schulte, editors: Fields of Logic and Computation II - Essays Dedicated to Yuri Gurevich on the Occasion of His 75th Birthday, Lecture Notes inComputer Science 9300, Springer, pp. 24–51, doi:http://dx.doi.org/10.1007/978-3-319-23534-9_2.
  • [3] A. Bundy (2001): The Automation of Proof by Mathematical Induction. In A. Robinson & A. Voronkov, editors:

    Handbook of Automated Reasoning

    , I, North Holland, pp. 845–911, doi:http://dx.doi.org/10.1016/B978-044450813-3/50015-1.
  • [4] E. De Angelis, F. Fioravanti, A. Pettorossi & M. Proietti (2014): Program Verification via Iterated Specialization. Science of Computer Programming 95, Part 2, pp. 149–175, doi:http://dx.doi.org/10.1016/j.scico.2014.05.017. Selected and extended papers from Partial Evaluation and Program Manipulation 2013.
  • [5] E. De Angelis, F. Fioravanti, A. Pettorossi & M. Proietti (2014): VeriMAP: A Tool for Verifying Programs through Transformations. In: Proceedings of the 20th International Conference on Tools and Algorithms for the Construction and Analysis of Systems, TACAS ’14, Lecture Notes in Computer Science 8413, Springer, pp. 568–574, doi:http://dx.doi.org/10.1007/978-3-642-54862-8˙47. Available at: http://www.map.uniroma2.it/VeriMAP.
  • [6] E. De Angelis, F. Fioravanti, A. Pettorossi & M. Proietti (2015): Proving correctness of imperative programs by linearizing constrained Horn clauses.

    Theory and Practice of Logic Programming

    15(4–5), pp. 635–650, doi:http://dx.doi.org/10.1017/S1471068415000289.
  • [7] E. De Angelis, F. Fioravanti, A. Pettorossi & M. Proietti (2017): Semantics-based generation of verification conditions via program specialization. Science of Computer Programming 147, pp. 78–108, doi:http://dx.doi.org/10.1016/j.scico.2016.11.002. Available at http://www.sciencedirect.com/science/article/pii/S016764231630199X. Selected and Extended papers from the International Symposium on Principles and Practice of Declarative Programming 2015.
  • [8] E. De Angelis, F. Fioravanti, A. Pettorossi & M. Proietti (2018): Predicate Pairing for program verification. TPLP 18(2), pp. 126–166, doi:http://dx.doi.org/10.1017/S1471068417000497.
  • [9] E. De Angelis, F. Fioravanti, A. Pettorossi & M. Proietti (2018): Solving Horn Clauses on Inductive Data Types Without Induction. TPLP 18(3-4), pp. 452–469, doi:http://dx.doi.org/10.1017/S1471068418000157.
  • [10] E. De Angelis, F. Fioravanti, A. Pettorossi & M. Proietti (2019): Lemma Generation for Horn Clause Satisfiability: A Preliminary Study. In A. Lisitsa & A. Nemytykh, editors: Proceedings of VPT 2019 Workshop on Program Verification and Program Transformation, Genova, Italy, April 4th, 2019, To appear in EPTCS. Available at http://refal.botik.ru/vpt/vpt2019/VPT2019_paper_9.pdf.
  • [11] S. Etalle & M. Gabbrielli (1996): Transformations of CLP Modules. Theoretical Computer Science 166, pp. 101–146, doi:http://dx.doi.org/10.1016/0304-3975(95)00148-4.
  • [12] G. Fedyukovich, S. Prabhu, K. Madhukar & A. Gupta (2018): Solving Constrained Horn Clauses Using Syntax and Data. In N. Bjørner & A. Gurfinkel, editors: 2018 Formal Methods in Computer Aided Design, FMCAD 2018, Austin, TX, USA, October 30 - November 2, 2018, IEEE, pp. 1–9, doi:http://dx.doi.org/10.23919/FMCAD.2018.8603011.
  • [13] S. Grebenshchikov, N. P. Lopes, C. Popeea & A. Rybalchenko (2012): Synthesizing software verifiers from proof rules. In: Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI ’12, pp. 405–416, doi:http://dx.doi.org/10.1145/2345156.2254112.
  • [14] H. Hojjat, F. Konecný, F. Garnier, R. Iosif, V. Kuncak & P. Rümmer (2012): A Verification Toolkit for Numerical Transition Systems. In D. Giannakopoulou & D. Méry, editors: FM ’12: Formal Methods, 18th International Symposium, Paris, France, August 27–31, 2012. Proceedings, Lecture Notes in Computer Science 7436, Springer, pp. 247–251, doi:http://dx.doi.org/10.1007/978-3-642-32759-9˙21.
  • [15] H. Hojjat & P. Rümmer (2018): The ELDARICA Horn Solver. In N. Bjørner & A. Gurfinkel, editors: 2018 Formal Methods in Computer Aided Design, FMCAD 2018, Austin, TX, USA, October 30 - November 2, 2018, IEEE, pp. 1–7, doi:http://dx.doi.org/10.23919/FMCAD.2018.8603013.
  • [16] B. Kafle, J. P. Gallagher & J. F. Morales (2016): RAHFT: A Tool for Verifying Horn Clauses Using Abstract Interpretation and Finite Tree Automata. In: Computer Aided Verification, 28th International Conference, CAV 2016, Toronto, ON, Canada, July 17-23, 2016, Proceedings, Part I, Lecture Notes in Computer Science 9779, Springer, pp. 261–268, doi:http://dx.doi.org/10.1007/978-3-319-41528-4˙14.
  • [17] A. Komuravelli, A. Gurfinkel & S. Chaki (2014): SMT-Based Model Checking for Recursive Programs. In A. Biere & R. Bloem, editors: Computer Aided Verification - 26th International Conference, CAV 2014, Held as Part of the Vienna Summer of Logic, VSL 2014, Vienna, Austria, July 18-22, 2014. Proceedings, Lecture Notes in Computer Science 8559, Springer, pp. 17–34, doi:http://dx.doi.org/10.1007/978-3-319-08867-9_2.
  • [18] X. Leroy, D. Doligez, A. Frisch, J. Garrigue, D. Rémy & J. Vouillon (2017): The OCaml system, Release 4.06. Documentation and user’s manual, Institut National de Recherche en Informatique et en Automatique, France.
  • [19] D. Mordvinov & G. Fedyukovich (2017): Synchronizing Constrained Horn Clauses. In T. Eiter & D. Sands, editors:

    LPAR-21, 21st International Conference on Logic for Programming, Artificial Intelligence and Reasoning, Maun, Botswana, May 7-12, 2017

    , EPiC Series in Computing 46, EasyChair, pp. 338–355, doi:http://dx.doi.org/10.29007/gr5c.
    Available at https://easychair.org/publications/paper/LlxW.
  • [20] L. M. de Moura & N. Bjørner (2008): Z3: An Efficient SMT Solver. In: Proceedings of the 14th International Conference on Tools and Algorithms for the Construction and Analysis of Systems, TACAS ’08, Lecture Notes in Computer Science 4963, Springer, pp. 337–340, doi:http://dx.doi.org/10.1007/978-3-540-78800-3˙24.
  • [21] A. Reynolds & V. Kuncak (2015): Induction for SMT Solvers. In Deepak D’Souza, Akash Lal & Kim Guldstrand Larsen, editors: Verification, Model Checking, and Abstract Interpretation - Proceedings of the 16th International Conference, VMCAI 2015, Mumbai, India,, Lecture Notes in Computer Science 8931, Springer, pp. 80–98, doi:http://dx.doi.org/10.1007/978-3-662-46081-8˙5.
  • [22] H. Tamaki & T. Sato (1984): Unfold/Fold Transformation of Logic Programs. In S.-Å. Tärnlund, editor: Proceedings of the Second International Conference on Logic Programming, ICLP ’84, Uppsala University, Uppsala, Sweden, pp. 127–138.
  • [23] H. Unno, S. Torii & H. Sakamoto (2017): Automating Induction for Solving Horn Clauses. In Rupak Majumdar & Viktor Kuncak, editors: Proc. Computer Aided Verification - 29th Intern. Conf. CAV 2017, Heidelberg, Germany, Part II, Lecture Notes in Computer Science 10427, Springer, pp. 571–591, doi:http://dx.doi.org/10.1007/978-3-319-63390-9˙30.

6 Appendix