Hostname: page-component-89b8bd64d-7zcd7 Total loading time: 0 Render date: 2026-05-08T08:08:51.740Z Has data issue: false hasContentIssue false

Catamorphic Abstractions for Constrained Horn Clause Satisfiability

Published online by Cambridge University Press:  29 October 2024

EMANUELE DE ANGELIS
Affiliation:
IASI-CNR, Rome, Italy (email: emanuele.deangelis@iasi.cnr.it)
FABIO FIORAVANTI
Affiliation:
DEc, University ‘G. d’Annunzio’, Chieti-Pescara, Italy (email: fabio.fioravanti@unich.it)
ALBERTO PETTOROSSI
Affiliation:
DICII, University of Rome ‘Tor Vergata’, Rome, Italy (email: pettorossi@info.uniroma2.it)
MAURIZIO PROIETTI
Affiliation:
IASI-CNR, Rome, Italy (email: maurizio.proietti@iasi.cnr.it)
Rights & Permissions [Opens in a new window]

Abstract

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

Information

Type
Rapid Communication
Creative Commons
Creative Common License - CCCreative Common License - BY
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.
Copyright
© The Author(s), 2024. Published by Cambridge University Press
Figure 0

Fig. 1. The initial set of CHCs (clauses 1–6) and query 7 that specifies that the number of occurrences of an element $X$ in the list $\mathit{Zs}$ is even.

Figure 1

Fig. 2. Clauses $D1$$D4$ are the predicate definitions introduced during transformation. Clauses 11–23 are the clauses derived after transformation from clauses 1–6 and query 7 of Figure 1.

Figure 2

Fig. 3. The $\mathit{Define}$, $\mathit{Unfold}$, $\mathit{AddCata}$, $\mathit{Fold}$, and $\mathit{AddErasure}$ functions.

Figure 3

Table 1. Properties proved by the solvers Eldarica and Z3 before and after the transformation performed by algorithm ${\mathcal{T}}_{\mathit{abs}}$. In the before case, the input to the solver is the source set of clauses (src-columns), and in the after case, the input is $T_{\mathit{w\&wo}}$ ($T_{\mathit{w{\&} wo}}$-columns). The columns occur in pairs referring to the sat properties ($s$-columns) and the unsat properties ($u$-columns), respectively. The two $T_w$-columns and the two $T_{\mathit{wo}}$-columns refer to the input $T_{\mathit{w}}$ and $T_{\mathit{wo}}$, respectively. The last column shows the time (in seconds) taken by ${\mathcal{T}}_{\mathit{abs}}$ as implemented by VeriCaT$_{\!\mathit{abs}}$.