{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,3,21]],"date-time":"2026-03-21T03:17:15Z","timestamp":1774063035668,"version":"3.50.1"},"reference-count":40,"publisher":"Cambridge University Press (CUP)","issue":"4","license":[{"start":{"date-parts":[[2022,7,7]],"date-time":"2022-07-07T00:00:00Z","timestamp":1657152000000},"content-version":"unspecified","delay-in-days":6,"URL":"http:\/\/creativecommons.org\/licenses\/by\/4.0\/"}],"content-domain":{"domain":["cambridge.org"],"crossmark-restriction":true},"short-container-title":["Theory and Practice of Logic Programming"],"published-print":{"date-parts":[[2022,7]]},"abstract":"<jats:title>Abstract<\/jats:title><jats:p>We address the problem of verifying that the functions of a program meet their contracts, specified by pre\/postconditions. We follow an approach based on <jats:italic>constrained Horn clauses<\/jats:italic> (CHCs) by which the verification problem is reduced to the problem of checking satisfiability of a set of clauses derived from the given program and contracts. We consider programs that manipulate <jats:italic>algebraic data types<\/jats:italic> (ADTs) and a class of contracts specified by catamorphisms, that is, functions defined by simple recursion schemata on the given ADTs. We show by several examples that state-of-the-art CHC satisfiability tools are not effective at solving the satisfiability problems obtained by direct translation of the contracts into CHCs. To overcome this difficulty, we propose a transformation technique that removes the ADT terms from CHCs and derives new sets of clauses that work on basic sorts only, such as integers and booleans. Thus, when using the derived CHCs there is no need for induction rules on ADTs. We prove that the transformation is sound, that is, if the derived set of CHCs is satisfiable, then so is the original set. We also prove that the transformation always terminates for the class of contracts specified by catamorphisms. Finally, we present the experimental results obtained by an implementation of our technique when verifying many non-trivial contracts for ADT manipulating programs.<\/jats:p>","DOI":"10.1017\/s1471068422000175","type":"journal-article","created":{"date-parts":[[2022,7,7]],"date-time":"2022-07-07T07:24:13Z","timestamp":1657178653000},"page":"555-572","update-policy":"https:\/\/doi.org\/10.1017\/policypage","source":"Crossref","is-referenced-by-count":10,"title":["Verifying Catamorphism-Based Contracts using Constrained Horn Clauses"],"prefix":"10.1017","volume":"22","author":[{"ORCID":"https:\/\/orcid.org\/0000-0002-7319-8439","authenticated-orcid":false,"given":"EMANUELE","family":"DE ANGELIS","sequence":"first","affiliation":[],"role":[{"role":"author","vocabulary":"crossref"}]},{"ORCID":"https:\/\/orcid.org\/0000-0003-3835-4931","authenticated-orcid":false,"given":"MAURIZIO","family":"PROIETTI","sequence":"additional","affiliation":[],"role":[{"role":"author","vocabulary":"crossref"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-1268-7829","authenticated-orcid":false,"given":"FABIO","family":"FIORAVANTI","sequence":"additional","affiliation":[],"role":[{"role":"author","vocabulary":"crossref"}]},{"ORCID":"https:\/\/orcid.org\/0000-0001-7858-4032","authenticated-orcid":false,"given":"ALBERTO","family":"PETTOROSSI","sequence":"additional","affiliation":[],"role":[{"role":"author","vocabulary":"crossref"}]}],"member":"56","published-online":{"date-parts":[[2022,7,7]]},"reference":[{"key":"S1471068422000175_ref35","doi-asserted-by":"crossref","unstructured":"Reynolds, A. and Kuncak, V. 2015. Induction for SMT solvers. In 16th VMCAI. LNCS, vol. 8931. Springer, 80\u201398.","DOI":"10.1007\/978-3-662-46081-8_5"},{"key":"S1471068422000175_ref32","unstructured":"Mordvinov, D. and Fedyukovich, G. 2017. Synchronizing constrained Horn clauses. In LPAR-21. EPiC Series in Computing, vol. 46. EasyChair, 338\u2013355."},{"key":"S1471068422000175_ref8","doi-asserted-by":"crossref","unstructured":"Cousot, P. and Halbwachs, N. 1978. Automatic discovery of linear restraints among variables of a program. In 5th POPL. ACM, 84\u201396.","DOI":"10.1145\/512760.512770"},{"key":"S1471068422000175_ref34","doi-asserted-by":"publisher","DOI":"10.1007\/s10817-016-9368-2"},{"key":"S1471068422000175_ref12","doi-asserted-by":"publisher","DOI":"10.1093\/logcom\/exab090"},{"key":"S1471068422000175_ref7","doi-asserted-by":"publisher","DOI":"10.1145\/1216374.1216378"},{"key":"S1471068422000175_ref13","doi-asserted-by":"publisher","DOI":"10.48550\/arXiv.2205.06236"},{"key":"S1471068422000175_ref9","doi-asserted-by":"publisher","DOI":"10.1017\/S1471068421000211"},{"key":"S1471068422000175_ref18","doi-asserted-by":"crossref","unstructured":"Grebenshchikov, S. , Lopes, N. P. , Popeea, C. and Rybalchenko, A. 2012. Synthesizing software verifiers from proof rules. In 33rd PLDI, 405\u2013416.","DOI":"10.1145\/2254064.2254112"},{"key":"S1471068422000175_ref1","doi-asserted-by":"publisher","DOI":"10.1017\/S1471068419000401"},{"key":"S1471068422000175_ref15","doi-asserted-by":"publisher","DOI":"10.1016\/0304-3975(95)00148-4"},{"key":"S1471068422000175_ref38","unstructured":"Tamaki, H. and Sato, T. 1984. Unfold\/fold transformation of logic programs. In 2nd ICLP. Uppsala University, Sweden, 127\u2013138."},{"key":"S1471068422000175_ref25","doi-asserted-by":"crossref","unstructured":"Jaffar, J. and Maher, M. 1994. Constraint logic programming: A survey. Journal of Logic Programming 19\/20, 503\u2013581.","DOI":"10.1016\/0743-1066(94)90033-7"},{"key":"S1471068422000175_ref2","doi-asserted-by":"crossref","unstructured":"Barnett, M. , Chang, B.-Y. E. , De Line, R. , Jacobs, B. and Leino, K. R. M. 2006. Boogie: A modular reusable verifier for object-oriented programs. In Formal Methods for Components and Objects. LNCS, vol. 4111. Springer, 364\u2013387.","DOI":"10.1007\/11804192_17"},{"key":"S1471068422000175_ref27","doi-asserted-by":"crossref","unstructured":"Komuravelli, A. , Gurfinkel, A. and Chaki, S. 2014. SMT-based model checking for recursive programs. In 26th CAV. LNCS, vol. 8559. Springer, 17\u201334.","DOI":"10.1007\/978-3-319-08867-9_2"},{"key":"S1471068422000175_ref5","doi-asserted-by":"crossref","unstructured":"Bj\u00f8rner, N. , Gurfinkel, A. , McMillan, K. L. and Rybalchenko, A. 2015. Horn clause solvers for program verification. In Fields of Logic and Computation (II). LNCS, vol. 9300. Springer, 24\u201351.","DOI":"10.1007\/978-3-319-23534-9_2"},{"key":"S1471068422000175_ref14","doi-asserted-by":"crossref","unstructured":"de Moura, L. M. and Bj\u00f8rner, N. 2008. Z3: An efficient SMT solver. In 14th TACAS. LNCS, vol. 4963. Springer, 337\u2013340.","DOI":"10.1007\/978-3-540-78800-3_24"},{"key":"S1471068422000175_ref6","author":"Booch","year":"1994"},{"key":"S1471068422000175_ref31","first-page":"40","article-title":"Applying \u201cDesign by Contract\u201d","volume":"10","author":"Meyer","year":"1992","journal-title":"Computer 25"},{"key":"S1471068422000175_ref10","doi-asserted-by":"crossref","unstructured":"De Angelis, E. , Fioravanti, F. , Pettorossi, A. and Proietti, M. 2014. VeriMAP: A tool for verifying programs through transformations. In 20th TACAS. LNCS, vol. 8413. Springer, 568\u2013574.","DOI":"10.1007\/978-3-642-54862-8_47"},{"key":"S1471068422000175_ref21","doi-asserted-by":"publisher","DOI":"10.1016\/j.scico.2005.02.006"},{"key":"S1471068422000175_ref3","volume-title":"23rd CAV. LNCS","volume":"6806","author":"Barrett","year":"2011"},{"key":"S1471068422000175_ref26","doi-asserted-by":"crossref","unstructured":"Kobayashi, N. , Fedyukovich, G. and Gupta, A. , 2020. Fold\/unfold transformations for fixpoint logic. In 26th TACAS. LNCS, vol. 12079. Springer, 195\u2013214.","DOI":"10.1007\/978-3-030-45237-7_12"},{"key":"S1471068422000175_ref20","doi-asserted-by":"publisher","DOI":"10.1017\/S1471068411000457"},{"key":"S1471068422000175_ref30","doi-asserted-by":"crossref","unstructured":"Meijer, E. , Fokkinga, M. M. and Paterson, R. 1991. Functional programming with bananas, lenses, envelopes and barbed wire. In 5th ACM Conference on Functional Programming Languages and Computer Architecture. LNCS, vol. 523. Springer, 124\u2013144.","DOI":"10.1007\/3540543961_7"},{"key":"S1471068422000175_ref4","unstructured":"Barrett, C. W. , Sebastiani, R. , Seshia, S. A. and Tinelli, C. Satisfiability modulo theories. In Handbook of Satisfiability. Frontiers in Artificial Intelligence and Applications, vol. 185. IOS Press, 825\u2013885."},{"key":"S1471068422000175_ref37","doi-asserted-by":"crossref","unstructured":"Suter, P. , K\u00f6ksal, A. S. and Kuncak, V. 2011. Satisfiability modulo recursive programs. In 18th SAS. LNCS, vol. 6887. Springer, 298\u2013315.","DOI":"10.1007\/978-3-642-23702-7_23"},{"key":"S1471068422000175_ref33","volume-title":"Programming in Scala: A Comprehensive Step-by-Step Guide","author":"Odersky","year":"2011"},{"key":"S1471068422000175_ref11","doi-asserted-by":"publisher","DOI":"10.1017\/S1471068418000157"},{"key":"S1471068422000175_ref36","doi-asserted-by":"crossref","unstructured":"Suter, P. , Dotta, M. and Kuncak, V. 2010 Decision procedures for algebraic data types with abstractions. In 37th POPL. ACM, 199\u2013210.","DOI":"10.1145\/1707801.1706325"},{"key":"S1471068422000175_ref40","doi-asserted-by":"crossref","unstructured":"Yang, W. , Fedyukovich, G. and Gupta, A. 2019. Lemma synthesis for automating induction over algebraic data types. In 25th CP. LNCS, vol. 11802. Springer, 600\u2013617.","DOI":"10.1007\/978-3-030-30048-7_35"},{"key":"S1471068422000175_ref39","doi-asserted-by":"crossref","unstructured":"Unno, H. , Torii, S. and Sakamoto, H. 2017. Automating induction for solving Horn clauses. In 29th CAV. LNCS, vol. 10427. Springer, 571\u2013591.","DOI":"10.1007\/978-3-319-63390-9_30"},{"key":"S1471068422000175_ref28","doi-asserted-by":"crossref","unstructured":"Kostyukov, Y. , Mordvinov, D. and Fedyukovich, G. 2021. Beyond the elementary representations of program invariants over algebraic data types. In 42nd PLDI. ACM, 451\u2013465.","DOI":"10.1145\/3453483.3454055"},{"key":"S1471068422000175_ref24","doi-asserted-by":"crossref","unstructured":"Hojjat, H. and R\u00fcmmer, P. 2018. The ELDARICA Horn solver. In Formal Methods in Computer Aided Design, FMCAD. IEEE, 1\u20137.","DOI":"10.23919\/FMCAD.2018.8603013"},{"key":"S1471068422000175_ref17","doi-asserted-by":"crossref","unstructured":"Govind, V. K. , H., Shoham, S. and Gurfinkel, A. 2022. Solving constrained Horn clauses modulo algebraic data types and recursive functions. Proceedings of the ACM on Programming Languages 6, POPL, 1\u201329.","DOI":"10.1145\/3498722"},{"key":"S1471068422000175_ref16","doi-asserted-by":"crossref","unstructured":"Filli\u00e2tre, J.-C. and Paskevich, A. 2013. Why3 - Where programs meet provers. In 22nd ESOP. LNCS, vol. 7792. Springer, 125\u2013128.","DOI":"10.1007\/978-3-642-37036-6_8"},{"key":"S1471068422000175_ref22","doi-asserted-by":"crossref","unstructured":"Hinze, R. , Wu, N. and Gibbons, J. 2013. Unifying structured recursion schemes. In ICFP 2013. ACM, 209\u2013220.","DOI":"10.1145\/2544174.2500578"},{"key":"S1471068422000175_ref23","doi-asserted-by":"publisher","DOI":"10.1145\/363235.363259"},{"key":"S1471068422000175_ref29","volume-title":"International Conference on Software Engineering","author":"Leino","year":"2013"},{"key":"S1471068422000175_ref19","doi-asserted-by":"crossref","unstructured":"Hamza, J. , Voirol, N. and Kuncak, V. 2019. System FR: Formalized foundations for the Stainless verifier. ACM on Programming Languages 3, OOPSLA, 166:1\u2013166:30.","DOI":"10.1145\/3360592"}],"container-title":["Theory and Practice of Logic Programming"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/www.cambridge.org\/core\/services\/aop-cambridge-core\/content\/view\/S1471068422000175","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2023,4,2]],"date-time":"2023-04-02T23:40:30Z","timestamp":1680478830000},"score":1,"resource":{"primary":{"URL":"https:\/\/www.cambridge.org\/core\/product\/identifier\/S1471068422000175\/type\/journal_article"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2022,7]]},"references-count":40,"journal-issue":{"issue":"4","published-print":{"date-parts":[[2022,7]]}},"alternative-id":["S1471068422000175"],"URL":"https:\/\/doi.org\/10.1017\/s1471068422000175","relation":{},"ISSN":["1471-0684","1475-3081"],"issn-type":[{"value":"1471-0684","type":"print"},{"value":"1475-3081","type":"electronic"}],"subject":[],"published":{"date-parts":[[2022,7]]},"assertion":[{"value":"\u00a9 The Author(s), 2022. Published by Cambridge University Press","name":"copyright","label":"Copyright","group":{"name":"copyright_and_licensing","label":"Copyright and Licensing"}},{"value":"This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (http:\/\/creativecommons.org\/licenses\/by\/4.0\/), which permits unrestricted re-use, distribution and reproduction, provided the original article is properly cited.","name":"license","label":"License","group":{"name":"copyright_and_licensing","label":"Copyright and Licensing"}},{"value":"This content has been made available to all.","name":"free","label":"Free to read"}]}}