TL;DR
This paper introduces CATALIA, a novel CHC solver that tackles the challenge of verifying programs with algebraic data types (ADTs). It achieves this by automatically synthesizing "catamorphisms" – generalized fold functions – to abstract complex ADT structures into simpler integer arithmetic, making them amenable to existing solvers. CATALIA significantly outperforms state-of-the-art solvers on satisfiable CHC instances involving ADTs.
What Problem Does This Paper Address?
Verifying software correctness is crucial, and Constrained Horn Clauses (CHCs) offer a powerful, language-agnostic framework for this. However, existing CHC solvers struggle when programs involve complex data structures like algebraic data types (ADTs). Specifically, they have difficulty finding "models" that capture the inductive nature of these data structures, such as properties of lists or trees. This limitation hinders the verification of many real-world programs. The authors aim to bridge this gap by developing a method to automatically discover and utilize inductive properties of ADTs within the CHC solving process.
Methods
The core of CATALIA's approach is catamorphism synthesis within a counterexample-guided abstraction refinement (CEGAR) framework.
- Abstraction: The key idea is to abstract ADT-based CHCs into simpler CHCs over integer arithmetic. This is achieved by using catamorphisms, which map ADT structures to integers (or tuples of integers). For example, a list can be mapped to its length or sum of elements. The authors formalize this abstraction process.
- Catamorphism Synthesis: The crucial innovation is the automatic discovery of these catamorphisms. CATALIA uses a template-based approach, where predefined catamorphism structures (e.g., linear functions) are parameterized. It then employs a counterexample-guided inductive synthesis (CEGIS) technique. When the abstracted CHCs are found to be unsatisfiable, a counterexample is generated. This counterexample is used to refine the catamorphism, guiding the synthesis towards one that can prove the original CHCs satisfiable.
- CEGAR Loop: CATALIA iteratively abstracts the CHCs using the current catamorphism, checks satisfiability of the abstracted CHCs, generates counterexamples if unsatisfiable, and synthesizes a new, refined catamorphism. This process continues until satisfiability is proven or a template is exhausted.
Datasets
The paper evaluates CATALIA on the CHC-COMP 2024 benchmark set for the ADT-LIA division. This benchmark consists of 300 instances of satisfiable and unsatisfiable CHCs involving algebraic data types and linear integer arithmetic.
Key Insights and Ideas
- Catamorphisms as Inductive Models: The paper highlights that catamorphisms are a natural way to express inductive properties of ADTs, making them suitable for finding models in CHC solving.
- Automated Synthesis is Key: The real breakthrough is the automatic synthesis of these catamorphisms. Previous work often required manual supply of these functions, limiting practical applicability.
- CEGAR for ADTs: Adapting the CEGAR paradigm to ADTs by using catamorphism synthesis as the refinement step is a powerful technique. It allows the solver to learn inductive invariants on the fly.
- Abstraction Trade-offs: The authors acknowledge that the choice of catamorphism template and its parameters involves a trade-off between expressiveness and synthesis cost. They use a sequence of increasingly expressive templates.
Key Results
- CATALIA significantly outperformed state-of-the-art CHC solvers on satisfiable instances in the CHC-COMP 2024 ADT-LIA benchmark.
- It solved 67 satisfiable instances, the most among all tested solvers.
- CATALIA uniquely solved 18 satisfiable instances that no other solver could handle within the 300-second timeout.
- The approach is particularly effective at finding complex invariants, such as list length and sums of list elements.
- CATALIA was a core component of ChocoCatalia, which won the ADT-LIA category of CHC-COMP 2025.
Limitations and Future Work
- Template Expressiveness: The current implementation uses linear template catamorphisms. The authors suggest extending templates with conditional expressions to subsume capabilities of other solvers (like RInGen) and handle more complex invariants.
- Efficiency: Increasing template expressiveness might incur higher synthesis costs. Developing strategies for selectively applying templates is an important future direction.
- Unsatisfiable Instances: CATALIA performed slightly worse than some solvers on unsatisfiable instances. Future work may explore random testing techniques to address this.
- Fairness Assumption: The theoretical guarantees of completeness rely on strong assumptions about the fairness of the underlying solvers, which may not hold in practice.
Summary updated