Skip to main content Accessibility help
×
×
Home

Proving correctness of imperative programs by linearizing constrained Horn clauses

  • EMANUELE DE ANGELIS (a1), FABIO FIORAVANTI (a1), ALBERTO PETTOROSSI (a2) and MAURIZIO PROIETTI (a3)
Abstract

We present a method for verifying the correctness of imperative programs which is based on the automated transformation of their specifications. Given a program prog, we consider a partial correctness specification of the form {ϕ}, prog {ψ}, where the assertions ϕ and ψ are predicates defined by a set Spec of possibly recursive Horn clauses with linear arithmetic (LA) constraints in their premise (also called constrained Horn clauses). The verification method consists in constructing a set PC of constrained Horn clauses whose satisfiability implies that {ϕ}, prog, {ψ} is valid. We highlight some limitations of state-of-the-art constrained Horn clause solving methods, here called LA-solving methods, which prove the satisfiability of the clauses by looking for linear arithmetic interpretations of the predicates. In particular, we prove that there exist some specifications that cannot be proved valid by any of those LA-solving methods. These specifications require the proof of satisfiability of a set PC of constrained Horn clauses that contain nonlinear clauses (that is, clauses with more than one atom in their premise). Then, we present a transformation, called linearization, that converts PC into a set of linear clauses (that is, clauses with at most one atom in their premise). We show that several specifications that could not be proved valid by LA-solving methods, can be proved valid after linearization. We also present a strategy for performing linearization in an automatic way and we report on some experimental results obtained by using a preliminary implementation of our method.

Copyright
References
Hide All
Albert, E., Gómez-Zamalloa, M., Hubert, L., and Puebla, G. 2007. Verification of Java Bytecode Using Analysis and Transformation of Logic Programs. In Practical Aspects of Declarative Languages, Hanus, M., Ed. Lecture Notes in Computer Science 4354. Springer, 124139.
Apt, K. R., de Boer, F. S., and Olderog, E.-R. 2009. Verification of Sequential and Concurrent Programs, Third Edition, Springer.
Benoy, F. and King, A. 1997. Inferring argument size relationships with CLP(R). In Proceedings of the 6th International Workshop on Logic Program Synthesis and Transformation, LOPSTR '96, Stockholm, Sweden, August 28-30, 1996, Gallagher, J. P., Ed. Lecture Notes in Computer Science 1207. Springer, 204223.
Bjørner, N., McMillan, K., and Rybalchenko, A. 2012. Program verification as satisfiability modulo theories. In Proceedings of the 10th International Workshop on Satisfiability Modulo Theories, SMT-COMP '12. 311.
Cimatti, A., Griggio, A., Schaafsma, B., and Sebastiani, R. 2013. The MathSAT5 SMT Solver. In Proceedings of TACAS, Piterman, N. and Smolka, S., Eds. Lecture Notes in Computer Science 7795. Springer, 93107.
Cousot, P. and Cousot, R. 1977. Abstract interpretation: A unified lattice model for static analysis of programs by construction of approximation of fixpoints. In Proceedings of the 4th ACM-SIGPLAN Symposium on Principles of Programming Languages, POPL '77. ACM, 238252.
Cousot, P. and Halbwachs, N. 1978. Automatic discovery of linear restraints among variables of a program. In Proceedings of the Fifth ACM Symposium on Principles of Programming Languages, POPL '78. ACM, 8496.
De Angelis, E., Fioravanti, F., Pettorossi, A., and Proietti, M. 2014a. Program verification via iterated specialization. Science of Computer Programming 95, Part 2, 149–175. Selected and extended papers from Partial Evaluation and Program Manipulation 2013.
De Angelis, E., Fioravanti, F., Pettorossi, A., and Proietti, M. 2014b. 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, 568574. Available at: http://www.map.uniroma2.it/VeriMAP.
de Moura, L. M. and Bjørner, N. 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, 337340.
De Schreye, D., Glück, R., Jørgensen, J., Leuschel, M., Martens, B., and Sørensen, M. H. 1999. Conjunctive Partial Deduction: Foundations, Control, Algorithms, and Experiments. Journal of Logic Programming 41, 2–3, 231277.
Etalle, S. and Gabbrielli, M. 1996. Transformations of CLP modules. Theoretical Computer Science 166, 101146.
Felsing, D., Grebing, S., Klebanov, V., Rümmer, P., and Ulbrich, M. 2014. Automating Regression Verification. In Proceedings of the 29th ACM/IEEE International Conference on Automated Software Engineering, ASE '14. ACM, 349360.
Fioravanti, F., Pettorossi, A., Proietti, M., and Senni, V. 2013. Generalization strategies for the verification of infinite state systems. Theory and Practice of Logic Programming. Special Issue on the 25th Annual GULP Conference 13, 2, 175199.
Grebenshchikov, S., Lopes, N. P., Popeea, C., and Rybalchenko, A. 2012. Synthesizing software verifiers from proof rules. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI '12. 405416.
Hoare, C. 1969. An Axiomatic Basis for Computer Programming. CACM 12, 10 (October), 576580, 583.
Jaffar, J. and Maher, M. 1994. Constraint logic programming: A survey. Journal of Logic Programming 19/20, 503581.
Jaffar, J., Murali, V., Navas, J. A., and Santosa, A. E. 2012. TRACER: A Symbolic Execution Tool for Verification. In Proceedings 24th International Conference on Computer Aided Verification, CAV '12. Lecture Notes in Computer Science 7358. Springer, 758766. http://paella.d1.comp.nus.edu.sg/tracer/.
Kafle, B. and Gallagher, J. P. 2015. Constraint Specialisation in Horn Clause Verification. In Proceedings of the 2015 Workshop on Partial Evaluation and Program Manipulation, PEPM '15, Mumbai, India, January 15–17, 2015. ACM, 8590.
Lloyd, J. W. 1987. Foundations of Logic Programming. Springer, Berlin. 2nd Edition.
Leuschel, M. and Massart, T. 2000. Infinite state model checking by abstract interpretation and program specialization. In Proceedings of the 9th International Workshop on Logic-based Program Synthesis and Transformation (LOPSTR '99), Venezia, Italy, Bossi, A., Ed. Lecture Notes in Computer Science 1817. Springer, 6382.
Lisitsa, A. and Nemytykh, A. P. 2008. Reachability analysis in verification via supercompilation. Int. J. Found. Comput. Sci. 19, 4, 953969.
Matijasevic, Y. V. 1970. Enumerable sets are diophantine. Doklady Akademii Nauk SSSR (in Russian) 191, 279282.
Peralta, J. C., Gallagher, J. P., and Saglam, H. 1998. Analysis of Imperative Programs through Analysis of Constraint Logic Programs. In Proceedings of the 5th International Symposium on Static Analysis, SAS '98, Levi, G., Ed. Lecture Notes in Computer Science 1503. Springer, 246261.
Podelski, A. and Rybalchenko, A. 2007. ARMC: The Logical Choice for Software Model Checking with Abstraction Refinement. In Practical Aspects of Declarative Languages, PADL '07, Hanus, M., Ed. Lecture Notes in Computer Science 4354. Springer, 245259.
Reynolds, C. J. 1998. Theories of Programming Languages. Cambridge University Press.
Rodríguez-Carbonell, E. and Kapur, D. 2007a. Automatic generation of polynomial invariants of bounded degree using abstract interpretation. Sci. Comput. Program. 64, 1, 5475.
Rodríguez-Carbonell, E. and Kapur, D. 2007b. Generating all polynomial invariants in simple loops. J. Symb. Comput. 42, 4, 443476.
Rümmer, P., Hojjat, H., and Kuncak, V. 2013. Disjunctive interpolants for Horn-clause verification. In Proceedings of the 25th International Conference on Computer Aided Verification, CAV '13, Saint Petersburg, Russia, July 13–19, 2013, Sharygina, N. and Veith, H., Eds. Lecture Notes in Computer Science 8044. Springer, 347363.
Sebelik, J. and Stepánek, P. 1982. Horn clause programs for recursive functions. In Logic Programming, Clark, K. L. and Tärnlund, S.-A., Eds. Academic Press, 325340.
Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Theory and Practice of Logic Programming
  • ISSN: 1471-0684
  • EISSN: 1475-3081
  • URL: /core/journals/theory-and-practice-of-logic-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *
×

Keywords

Type Description Title
PDF
Supplementary materials

De Angelis supplementary material
Online Appendix

 PDF (113 KB)
113 KB

Metrics

Full text views

Total number of HTML views: 0
Total number of PDF views: 0 *
Loading metrics...

Abstract views

Total abstract views: 0 *
Loading metrics...

* Views captured on Cambridge Core between <date>. This data will be updated every 24 hours.

Usage data cannot currently be displayed