Decision Procedures for Sequence Theories

Artur Jez, Anthony W. Lin, Oliver Markgraf, Philipp Rümmer

Introduction

Sequences are a ubiquitous data structure in programming, commonly implemented as lists or extendable arrays. Despite their prevalence, the formal verification community has historically had a better grasp of string theories over finite alphabets than sequence theories over infinite domains. This paper, presented at the Conference on Computer-Aided Verification (CAV) 2023, provides a formal foundation for reasoning about sequences where elements come from infinite alphabets, such as integers or nested sequences.

Problem Statement

In SMT (Satisfiability Modulo Theories) solving, while tools like Z3 and cvc5 have offered basic sequence support, the decidability of various sequence operations remained unclear. Specifically, the research community lacked a definitive understanding of which combinations of operations—such as append, map, filter, and concat—were solvable. The authors aim to identify decidable fragments and define the boundaries where sequence theories become undecidable.

Methodology

The authors bridge the gap between infinite sequences and finite strings using several innovative techniques implemented in a new solver called SeCo (Sequence Constraint Solver).

Reduction to Word Equations

A core contribution is the proof that problems over infinite alphabets can be reduced to standard word equations over finite alphabets. This is achieved by fixing the "types" of elements based on the guards they satisfy within an automaton.

Parametric Automata (PA)

The paper identifies Parametric Automata as the ideal formalism for representing regular constraints on sequences. Unlike standard symbolic automata, PAs allow transitions to include free variables (parameters), enabling the model to express constraints across different sequence positions (e.g., "every element in this list must equal parameter $p$").

The Straight-Line (SL) Fragment

To handle complex functions like map and filter, the authors introduce the "Straight-Line" fragment. This approach mirrors symbolic execution, allowing for the iterative elimination of variables and the reduction of the problem to a conjunction of simpler constraints.

Evaluation

SeCo was evaluated using two distinct benchmark suites:

  1. Program Verification: This suite included invariants for classic algorithms such as QuickSort, Lamport’s Bakery Algorithm, and Dijkstra’s Self-Stabilizing Protocol.
  2. Symbolic Register Automata (SRA): A collection of 36 benchmarks focusing on emptiness, equivalence, and inclusion problems for regular expressions with back-references.

Key Results

SeCo demonstrated exceptional performance, solving most benchmarks in under one second. In the SRA suite, it outperformed previous state-of-the-art solvers by up to three orders of magnitude. Furthermore, SeCo successfully verified complex properties, such as mutual exclusion in parameterized systems, in less than 2.6 seconds.

Discussion and Insights

The research highlights a "sweet spot" in automata theory: while Parametric Automata lead to decidable theories, more powerful Register Automata (SRA) result in undecidability, even over simple equality theories.

The complexity of deciding sequence theories is generally higher than that of string theories. While string theories are often in PSpace, sequence theories typically reach ExpSpace. However, for specific theories like Linear Real Arithmetic (LRA), the authors show that the problem remains within PSpace.

Limitations and Future Work

The decidability of sequences with length constraints remains an open problem, as it is tied to the notoriously difficult "word equations with length" problem. Future research directions include automating the elimination of universal quantifiers (Skolemization) and exploring other fragments of register automata that might be integrated into the theory without breaking decidability.

Summary updated

BibTeX
@inproceedings{jez2023decision,
  author = {Artur Jez and Anthony W. Lin and Oliver Markgraf and Philipp Rümmer},
  title = {{Decision Procedures for Sequence Theories}},
  booktitle = {CAV},
  year = {2023},
  doi = {10.1007/978-3-031-37703-7\_2},
}
Figure