Relational Verification Through Horn Clause Transformation

  • Emanuele De Angelis
  • Fabio Fioravanti
  • Alberto Pettorossi
  • Maurizio Proietti
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9837)


We present a method for verifying relational program properties, that is, properties that relate the input and the output of two programs. Our verification method is parametric with respect to the definition of the operational semantics of the programming language in which the two programs are written. That definition of the semantics consists of a set Int of constrained Horn clauses (CHCs) that encode the interpreter of the programming language. Then, given the programs and the relational property we want to verify, we generate, by using Int, a set of constrained Horn clauses whose satisfiability is equivalent to the validity of the property. Unfortunately, state-of-the-art solvers for CHCs have severe limitations in proving the satisfiability, or the unsatisfiability, of such sets of clauses. We propose some transformation techniques that increase the power of CHC solvers when verifying relational properties. We show that these transformations, based on unfold/fold rules, preserve satisfiability. Through an experimental evaluation, we show that in many cases CHC solvers are able to prove the satisfiability (or the unsatisfiability) of sets of clauses obtained by applying the transformations we propose, whereas the same solvers are unable to perform those proofs when given as input the original, untransformed sets of CHCs.



We wish to thank A. Gurfinkel, V. Klebanov, Ph. Rümmer and the participants in the HCVS and VPT workshops at ETAPS 2016 for stimulating conversations. We also thank the anonymous referees for their very constructive comments. We acknowledge the financial support of INdAM-GNCS (Italy). E. De Angelis, F. Fioravanti, and A. Pettorossi are research associates at IASI-CNR.


  1. 1.
    Albert, E., Gómez-Zamalloa, M., Hubert, L., Puebla, G.: Verification of java bytecode using analysis and transformation of logic programs. In: Hanus, M. (ed.) PADL 2007. LNCS, vol. 4354, pp. 124–139. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  2. 2.
    Alberti, F., Ghilardi, S., Sharygina, N.: Decision procedures for flat array properties. In: Ábrahám, E., Havelund, K. (eds.) TACAS 2014 (ETAPS). LNCS, vol. 8413, pp. 15–30. Springer, Heidelberg (2014)CrossRefGoogle Scholar
  3. 3.
    Asada, K., Sato, R., Kobayashi, N.: Verifying relational properties of functional programs by first-order refinement. In: Proceedings of PEPM 2015, pp. 61–72. ACM (2015)Google Scholar
  4. 4.
    Barnett, M., Chang, B.-Y.E., DeLine, R., Jacobs, B., M. Leino, K.R.: Boogie: a modular reusable verifier for object-oriented programs. In: de Boer, F.S., Bonsangue, M.M., Graf, S., de Roever, W.-P. (eds.) FMCO 2005. LNCS, vol. 4111, pp. 364–387. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  5. 5.
    Barthe, G., Crespo, J.M., Kunz, C.: Relational verification using product programs. In: Butler, M., Schulte, W. (eds.) FM 2011. LNCS, vol. 6664, pp. 200–214. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  6. 6.
    Benton, N.: Simple relational correctness proofs for static analyses and program transformations. In: Proceedings of POPL 2004, pp. 14–25. ACM (2004)Google Scholar
  7. 7.
    Bjørner, N., Gurfinkel, A., McMillan, K., Rybalchenko, A.: Horn clause solvers for program verification. In: Blass, A., Dershowitz, N., Finkbeiner, B., Schulte, W., Beklemishev, L.D., Beklemishev, L.D. (eds.) Gurevich Festschrift II 2015. LNCS, vol. 9300, pp. 24–51. Springer, Heidelberg (2015). doi: 10.1007/978-3-319-23534-9_2 CrossRefGoogle Scholar
  8. 8.
    Borralleras, C., Lucas, S., Oliveras, A., Rodríguez-Carbonell, E., Rubio, A.: SAT modulo linear arithmetic for solving polynomial constraints. J. Autom. Reasoning 48(1), 107–131 (2012)MathSciNetCrossRefzbMATHGoogle Scholar
  9. 9.
    Bradley, A.R., Manna, Z., Sipma, H.B.: What’s decidable about arrays? In: Emerson, E.A., Namjoshi, K.S. (eds.) VMCAI 2006. LNCS, vol. 3855, pp. 427–442. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  10. 10.
    Chaki, S., Gurfinkel, A., Strichman, O.: Regression verification for multi-threaded programs. In: Kuncak, V., Rybalchenko, A. (eds.) VMCAI 2012. LNCS, vol. 7148, pp. 119–135. Springer, Heidelberg (2012)CrossRefGoogle Scholar
  11. 11.
    Ciobâcă, Ş., Lucanu, D., Rusu, V., Roşu, G.: A language-independent proof system for mutual program equivalence. In: Merz, S., Pang, J. (eds.) ICFEM 2014. LNCS, vol. 8829, pp. 75–90. Springer, Heidelberg (2014)Google Scholar
  12. 12.
    De Angelis, E., Fioravanti, F., Pettorossi, A., Proietti, M.: Program verification via iterated specialization. Sci. Comput. Program. 95(Part 2), 149–175 (2014)CrossRefGoogle Scholar
  13. 13.
    De Angelis, E., Fioravanti, F., Pettorossi, A., Proietti, M.: A rule-based verification strategy for array manipulating programs. Fundamenta Informaticae 140(3–4), 329–355 (2015)MathSciNetCrossRefzbMATHGoogle Scholar
  14. 14.
    De Angelis, E., Fioravanti, F., Pettorossi, A., Proietti, M.: VeriMAP: a tool for verifying programs through transformations. In: Ábrahám, E., Havelund, K. (eds.) TACAS 2014 (ETAPS). LNCS, vol. 8413, pp. 568–574. Springer, Heidelberg (2014). CrossRefGoogle Scholar
  15. 15.
    De Angelis, E., Fioravanti, F., Pettorossi, A., Proietti, M.: Proving correctness of imperative programs by linearizing constrained Horn clauses. Theor. Pract. Logic Program. 15(4–5), 635–650 (2015)MathSciNetCrossRefGoogle Scholar
  16. 16.
    De Angelis, E., Fioravanti, F., Pettorossi, A., Proietti, M.: Semantics-based generation of verification conditions by program specialization. In: Proceedings of PPDP 2015, pp. 91–102. ACM (2015)Google Scholar
  17. 17.
    de Moura, L., Bjørner, N.S.: Z3: an efficient SMT solver. In: Ramakrishnan, C.R., Rehof, J. (eds.) TACAS 2008. LNCS, vol. 4963, pp. 337–340. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  18. 18.
    De Schreye, D., Glück, R., Jørgensen, J., Leuschel, M., Martens, B., Sørensen, M.H.: Conjunctive partial deduction: foundations, control, algorithms, and experiments. J. Logic Program. 41(2–3), 231–277 (1999)MathSciNetCrossRefzbMATHGoogle Scholar
  19. 19.
    Etalle, S., Gabbrielli, M.: Transformations of CLP modules. Theor. Comput. Sci. 166, 101–146 (1996)MathSciNetCrossRefzbMATHGoogle Scholar
  20. 20.
    Felsing, D., Grebing, S., Klebanov, V., Rümmer, P., Ulbrich, M.: Automating regression verification. In: Proceedings of ASE 2014, pp. 349–360 (2014)Google Scholar
  21. 21.
    Filliâtre, J.-C., Paskevich, A.: Why3 — where programs meet provers. In: Felleisen, M., Gardner, P. (eds.) ESOP 2013. LNCS, vol. 7792, pp. 125–128. Springer, Heidelberg (2013)CrossRefGoogle Scholar
  22. 22.
    Ganty, P., Iosif, R., Konečný, F.: Underapproximation of procedure summaries for integer programs. In: Piterman, N., Smolka, S.A. (eds.) TACAS 2013 (ETAPS 2013). LNCS, vol. 7795, pp. 245–259. Springer, Heidelberg (2013)CrossRefGoogle Scholar
  23. 23.
    Godlin, B., Strichman, O.: Regression verification: proving the equivalence of similar programs. Softw. Test. Verif. Reliab. 23(3), 241–258 (2013)CrossRefGoogle Scholar
  24. 24.
    Hawblitzel, C., Kawaguchi, M., Lahiri, S.K., Rebêlo, H.: Towards modularly comparing programs using automated theorem provers. In: Bonacina, M.P. (ed.) CADE 2013. LNCS, vol. 7898, pp. 282–299. Springer, Heidelberg (2013)CrossRefGoogle Scholar
  25. 25.
    Hoder, K., Bjørner, N.: Generalized property directed reachability. In: Cimatti, A., Sebastiani, R. (eds.) SAT 2012. LNCS, vol. 7317, pp. 157–171. Springer, Heidelberg (2012)CrossRefGoogle Scholar
  26. 26.
    Hojjat, H., Konečný, F., Garnier, F., Iosif, R., Kuncak, V., Rümmer, P.: A verification toolkit for numerical transition systems. In: Giannakopoulou, D., Méry, D. (eds.) FM 2012. LNCS, vol. 7436, pp. 247–251. Springer, Heidelberg (2012)CrossRefGoogle Scholar
  27. 27.
    Jaffar, J., Maher, M.: Constraint logic programming: a survey. J. Logic Program. 19(20), 503–581 (1994)MathSciNetCrossRefzbMATHGoogle Scholar
  28. 28.
    Jones, N.D., Gomard, C.K., Sestoft, P.: Partial Evaluation and Automatic Program Generation. Prentice Hall, Englewood Cliffs (1993)zbMATHGoogle Scholar
  29. 29.
    Kafle, B., Gallagher, J.P.: Constraint specialisation in Horn clause verification. In: Proceedings of PEPM 2015, pp. 85–90. ACM (2015)Google Scholar
  30. 30.
    Lahiri, S.K., McMillan, K.L., Sharma, R., Hawblitzel, C.: Differential assertion checking. In: Proceedings of ESEC/FSE 2013, pp. 345–355. ACM (2013)Google Scholar
  31. 31.
    Matijasevic, Y.V.: Enumerable sets are diophantine. Doklady Akademii Nauk SSSR 191, 279–282 (1970). in RussianMathSciNetGoogle Scholar
  32. 32.
    McMillan, K., Rybalchenko, A.: Computing relational fixed points using interpolation. Technical report MSR-TR-2013-6, Microsoft Research, January 2013Google Scholar
  33. 33.
    Necula, G.C., McPeak, S., Rahul, S.P., Weimer, W.: CIL: intermediate language and tools for analysis and transformation of C programs. In: Nigel Horspool, R. (ed.) CC 2002. LNCS, vol. 2304, pp. 213–265. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  34. 34.
    Peralta, J.C., Gallagher, J.P., Saglam, H.: Analysis of imperative programs through analysis of constraint logic programs. In: Levi, G. (ed.) SAS 1998. LNCS, vol. 1503, pp. 246–261. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  35. 35.
    Pettorossi, A., Proietti, M.: Transformation of logic programs: foundations and techniques. J. Logic Program. 19(20), 261–320 (1994)MathSciNetCrossRefzbMATHGoogle Scholar
  36. 36.
    Tamaki, H., Sato, T.: Unfold/fold transformation of logic programs. In: Proceedings of ICLP 1984, pp. 127–138 (1984)Google Scholar
  37. 37.
    Verdoolaege, S., Janssens, G., Bruynooghe, M.: Equivalence checking of static affine programs using widening to handle recurrences. ACM Trans. Program. Lang. Syst. 34(3), 11 (2012)CrossRefzbMATHGoogle Scholar
  38. 38.
    Zaks, A., Pnueli, A.: CoVaC: compiler validation by program analysis of the cross-product. In: Cuellar, J., Sere, K. (eds.) FM 2008. LNCS, vol. 5014, pp. 35–51. Springer, Heidelberg (2008)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag GmbH Germany 2016

Authors and Affiliations

  1. 1.DECUniversity ‘G. D’Annunzio’PescaraItaly
  2. 2.DICIIUniversity of Rome Tor VergataRomeItaly
  3. 3.IASI-CNRRomeItaly

Personalised recommendations