Skip to main content

Constrained Horn Clauses Satisfiability via Catamorphic Abstractions

  • Conference paper
  • First Online:
Logic-Based Program Synthesis and Transformation (LOPSTR 2023)

Abstract

Catamorphisms are functions recursively defined on Algebraic Data Types (such as lists and trees), which are often used to compute suitable abstractions (such as list size and tree height) of programs that manipulate those data types. It is well known that program properties specified through catamorphisms can be proved by showing the satisfiability of suitable Constrained Horn Clauses (CHCs). We address the problem of checking the satisfiability of sets of CHCs that encode program properties, and we propose a method for transforming a given set of CHCs into an equisatisfiable one where catamorphisms are no longer present. As a consequence, clauses with catamorphisms can be handled without extending the satisfiability algorithms present in existing CHC solvers. Through an experimental evaluation on a non-trivial benchmark consisting of many list and tree processing sets of CHCs, we show that our technique is indeed effective and significantly enhances the performance of state-of-the-art CHC solvers.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Albert, E., Genaim, S., Gutiérrez, R., Martin-Martin, E.: A transformational approach to resource analysis with typed-norms inference. Theory Pract. Log. Program. 20(3), 310–357 (2020)

    Article  MathSciNet  MATH  Google Scholar 

  2. Barrett, C.W., Sebastiani, R., Seshia, S.A., Tinelli, C.: Satisfiability modulo theories. In: Handbook of Satisfiability, volume 185 of Frontiers in Artificial Intelligence and Applications, pp. 825–885. IOS Press (2009)

    Google Scholar 

  3. Bjørner, N., Gurfinkel, A., McMillan, K., Rybalchenko, A.: Horn clause solvers for program verification. In: Beklemishev, L.D., Blass, A., Dershowitz, N., Finkbeiner, B., Schulte, W. (eds.) Fields of Logic and Computation II. LNCS, vol. 9300, pp. 24–51. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-23534-9_2

    Chapter  Google Scholar 

  4. Blicha, M., Fedyukovich, G., Hyvärinen, A.E.J., Sharygina, N.: Transition power abstractions for deep counterexample detection. In: TACAS 2022, Part I. LNCS, vol. 13243, pp. 524–542. Springer, Cham (2022). https://doi.org/10.1007/978-3-030-99524-9_29

    Chapter  Google Scholar 

  5. Bruynooghe, M., Codish, M., Gallagher, J.P., Genaim, S., Vanhoof, W.: Termination analysis of logic programs through combination of type-based norms. ACM Trans. Program. Lang. Syst. 29(2), 10-es (2007)

    Article  Google Scholar 

  6. Cousot, P., Cousot, R.: Abstract interpretation: a unified lattice model for static analysis of programs by construction of approximation of fixpoints. In: 4th Symposium on Principles of Programming Languages, POPL 1977, pp. 238–252. ACM (1977)

    Google Scholar 

  7. De Angelis, E., Fioravanti, F., Gallagher, J.P., Hermenegildo, M.V., Pettorossi, A., Proietti, M.: Analysis and transformation of constrained Horn clauses for program verification. Theory Pract. Log. Program. 22(6), 974–1042 (2022)

    Article  MathSciNet  Google Scholar 

  8. 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. LNCS, vol. 8413, pp. 568–574. Springer, Heidelberg (2014). https://doi.org/10.1007/978-3-642-54862-8_47

    Chapter  Google Scholar 

  9. De Angelis, E., Fioravanti, F., Pettorossi, A., Proietti, M.: Multiple query satisfiability of constrained Horn clauses. In: Hanus, M., Inclezan, D. (eds.) PADL 2023. LNCS, vol. 13880, pp. 125–143. Springer, Cham (2023). https://doi.org/10.1007/978-3-031-24841-2_9

    Chapter  Google Scholar 

  10. De Angelis, E., Govind V. K., H.: CHC-COMP 2022: competition report. In: Proceedings of the 9th Workshop on Horn Clauses for Verification and Synthesis and 10th International Workshop on Verification and Program Transformation, EPTCS 373, pp. 44–62. Open Publishing Association (2022)

    Google Scholar 

  11. De Angelis, E., Proietti, M., Fioravanti, F., Pettorossi, A.: Verifying catamorphism-based contracts using constrained Horn clauses. Theory Pract. Log. Program. 22(4), 555–572 (2022)

    Article  MathSciNet  MATH  Google Scholar 

  12. de Moura, L., Bjørner, N.: Z3: an efficient SMT solver. In: Ramakrishnan, C.R., Rehof, J. (eds.) TACAS 2008. LNCS, vol. 4963, pp. 337–340. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-78800-3_24

    Chapter  Google Scholar 

  13. Hari Govind, V.K., Shoham, S., Gurfinkel, A.: Solving constrained Horn clauses modulo algebraic data types and recursive functions. In: Proceedings of the ACM on Programming Languages, POPL 2022, vol. 6, pp. 1–29 (2022)

    Google Scholar 

  14. Gurfinkel, A.: Program verification with constrained Horn clauses (invited paper). In: Shoham, S., Vizel, Y. (eds.) CAV 2022. LNCS, vol. 13371, pp. 19–29. Springer, Cham (2022). https://doi.org/10.1007/978-3-031-13185-1_2

    Chapter  Google Scholar 

  15. Hermenegildo, M.V., Puebla, G., Bueno, F., López-García, P.: Integrated program debugging, verification, and optimization using abstract interpretation (and the Ciao system preprocessor). Sci. Comput. Program. 58(1–2), 115–140 (2005)

    Article  MathSciNet  MATH  Google Scholar 

  16. Hinze, R., Wu, N., Gibbons, J.: Unifying structured recursion schemes. In: International Conference on Functional Programming, ICFP 2013, pp. 209–220. ACM (2013)

    Google Scholar 

  17. Hojjat, H., Rümmer, P.: The ELDARICA Horn solver. In: Formal Methods in Computer Aided Design, FMCAD 2018, pp. 1–7. IEEE (2018)

    Google Scholar 

  18. Jaffar, J., Maher, M.: Constraint logic programming: a survey. J. Log. Program. 19(20), 503–581 (1994)

    Article  MathSciNet  MATH  Google Scholar 

  19. Komuravelli, A., Gurfinkel, A., Chaki, S.: SMT-based model checking for recursive programs. Formal Methods Syst. Des. 48(3), 175–205 (2016)

    Article  MATH  Google Scholar 

  20. Kostyukov, Y., Mordvinov, D., Fedyukovich, G.: Beyond the elementary representations of program invariants over algebraic data types. In: Conference on Programming Language Design and Implementation, PLDI 2021, pp. 451–465. ACM (2021)

    Google Scholar 

  21. Vediramana Krishnan, H.G., Chen, Y., Shoham, S., Gurfinkel, A.: Global guidance for local generalization in model checking. In: Lahiri, S.K., Wang, C. (eds.) CAV 2020, Part II. LNCS, vol. 12225, pp. 101–125. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-53291-8_7

    Chapter  Google Scholar 

  22. Meijer, E., Fokkinga, M., Paterson, R.: Functional programming with bananas, lenses, envelopes and barbed wire. In: Hughes, J. (ed.) FPCA 1991. LNCS, vol. 523, pp. 124–144. Springer, Heidelberg (1991). https://doi.org/10.1007/3540543961_7

    Chapter  Google Scholar 

  23. Suter, P., Köksal, A.S., Kuncak, V.: Satisfiability modulo recursive programs. In: Yahav, E. (ed.) SAS 2011. LNCS, vol. 6887, pp. 298–315. Springer, Heidelberg (2011). https://doi.org/10.1007/978-3-642-23702-7_23

    Chapter  Google Scholar 

  24. Unno, H., Torii, S., Sakamoto, H.: Automating induction for solving Horn clauses. In: Majumdar, R., Kunčak, V. (eds.) CAV 2017, Part II. LNCS, vol. 10427, pp. 571–591. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-63390-9_30

    Chapter  Google Scholar 

Download references

Acknowledgements

We thank Arie Gurfinkel for helpful suggestions on the use of the Z3/SPACER solver. The authors are members of the INdAM Research Group GNCS.

Author information

Authors and Affiliations

Authors

Corresponding authors

Correspondence to Emanuele De Angelis , Fabio Fioravanti , Alberto Pettorossi or Maurizio Proietti .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2023 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

De Angelis, E., Fioravanti, F., Pettorossi, A., Proietti, M. (2023). Constrained Horn Clauses Satisfiability via Catamorphic Abstractions. In: Glück, R., Kafle, B. (eds) Logic-Based Program Synthesis and Transformation. LOPSTR 2023. Lecture Notes in Computer Science, vol 14330. Springer, Cham. https://doi.org/10.1007/978-3-031-45784-5_4

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-45784-5_4

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-45783-8

  • Online ISBN: 978-3-031-45784-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics