Symbolic Automatic Relations and Their Applications to SMT and CHC Solving

Takumi Shimoda, Naoki Kobayashi, Ken Sakayori, Ryosuke Sato

TL;DR

This paper introduces Symbolic Automatic Relations (SARs), a new framework for reasoning about recursive data structures like integer lists by combining symbolic automata with automatic relations. By reducing the satisfiability of these relations to Constrained Horn Clause (CHC) solving over integers, the authors provide a powerful automated method that outperforms state-of-the-art SMT solvers on complex inductive list properties.

What Problem Does This Paper Address?

Automated program verification relies heavily on backends like SMT (Satisfiability Modulo Theory) and CHC solvers. While these tools are excellent at reasoning about basic data types like integers or reals, they often stumble when faced with recursive data structures (e.g., lists and trees).

The core challenge is that reasoning about lists often requires induction, which is difficult to automate. Existing "automatic relations" work well for finite alphabets, but real-world programs use infinite domains (like the set of all integers). Current SMT solvers like Z3 or CVC4 support recursive functions, but they frequently fail to prove even simple inductive properties without manual guidance or specific tactics. This paper seeks to bridge that gap by providing a formal, automata-based way to represent and solve relations over infinite-alphabet sequences.

Methods

The authors introduce two primary concepts:

  1. Symbolic Synchronous Automata (ss-NFA): These are finite state machines where transitions are labeled with formulas (e.g., $l_0 < l_1 + 1$) rather than simple characters. "Synchronous" means the automaton reads multiple input lists simultaneously, element by element.
  2. Symbolic Automatic Relations (SARs): These are the relations recognized by ss-NFAs. They inherit the "good" properties of standard automatic relations, such as being closed under Boolean operations (AND, OR, NOT).

The Workflow: * Representation: Complex list predicates (like sorted(X) or nth(i, x, X)) are represented as SARs. * Satisfiability via Reduction: The authors prove that checking if a SAR is satisfiable is undecidable in the general case. However, they develop a sound (but incomplete) reduction to CHC solving. * The "Trick": Instead of asking a solver to perform induction on a list, they translate the automaton's transition logic into a set of Horn clauses over integers. A CHC solver then searches for an inductive invariant that proves the reachability (or unreachability) of the automaton's final states.

Datasets

The authors evaluated their approach using three benchmark sets:

  • IsaPlanner: 15 instances derived from a proof planner for the Isabelle theorem prover, focusing on correctness properties of list functions.
  • SAR_SMT: 60 instances of valid and invalid formulas representing various list properties (e.g., prefix relations, sums, and element counts).
  • CHC: 12 instances where SARs are used to describe models for CHCs on data structures, testing the tool's ability to verify candidate models.

The results were compared against Z3 and CVC4, two industry-standard SMT solvers.

Key Insights and Ideas

  • Synchronous Processing is Key: By reading multiple lists at the same time, SARs can easily express relationships between lists of the same length (or padded lengths), such as "List A is element-wise less than List B."
  • The Power of Closure: Because SARs are closed under Boolean operations, you can build very complex queries by combining simpler automata. This makes the framework highly modular.
  • Automata as Certificates: A major "aha moment" is that an SAR can serve as a "certificate" of satisfiability. If a CHC solver finds a model for the reduced problem, that model effectively describes the shape of the data structures that satisfy the original formula.
  • Expressiveness Trade-offs: While SARs can handle sorted and nth, they cannot express the append(X, Y, Z) relation. This is a fundamental limitation of automatic relations (which generally cannot relate words of arbitrary lengths in a non-synchronous way).

Key Results

The authors implemented their reduction in a tool using various CHC solvers (Spacer, HoIce, and Eldarica) as backends.

  • Superior Performance: The proposed tool (specifically the version using Eldarica) solved 85 out of 87 total instances. In contrast, Z3 and CVC4 solved fewer than half (38 and 40 respectively when using recursive function definitions).
  • Induction Handling: Most of the failures for Z3 and CVC4 occurred on properties requiring induction over lists. The SAR-to-CHC reduction effectively "outsourced" the induction to the CHC solver's invariant-finding engine, which proved much more robust.
  • Speed: While the average time for the SAR tool was slightly higher (~0.9 to 5 seconds depending on the backend) compared to the sub-second responses of SMT solvers on simple tasks, it succeeded where the others timed out or gave up.

Limitations and Future Work

  • Undecidability: Since the general problem is undecidable (proven via a reduction from Minsky machines), the tool will always have cases it cannot solve.
  • Limited to Lists (for now): The current implementation focuses on integer lists. The authors suggest that extending this to tree automatic relations is theoretically possible but requires further formalization.
  • The "Append" Problem: The inability to represent the append relation limits the tool's use for certain types of program logic.
  • Learning SARs: Currently, the user must provide the ss-NFA definitions. The authors plan to implement an "ICE-based learner" to automatically discover appropriate SARs from program traces, further automating the verification process.

Summary updated

Abstract

Despite the recent advance of automated program verification, reasoning about recursive data structures remains as a challenge for verification tools and their backends such as SMT and CHC solvers. To address the challenge, we introduce the notion of symbolic automatic relations (SARs), which combines symbolic automata and automatic relations, and inherits their good properties such as the closure under Boolean operations. We consider the satisfiability problem for SARs, and show that it is undecidable in general, but that we can construct a sound (but incomplete) and automated satisfiability checker by a reduction to CHC solving. We discuss applications to SMT and CHC solving on data structures, and show the effectiveness of our approach through experiments.
BibTeX
@inproceedings{shimoda2021symbolic,
  author = {Takumi Shimoda and Naoki Kobayashi and Ken Sakayori and Ryosuke Sato},
  title = {{Symbolic Automatic Relations and Their Applications to SMT and CHC Solving}},
  booktitle = {SAS},
  year = {2021},
  url = {https://openreview.net/forum?id=Mv5PQdIGRo},
}

Loading related content...

Figure