NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

A separation logic for sequences in pointer programs and its decidability

Tianyue Cao, Bowen Zhang, Zhao Jin, Yongzhi Cao, Hanpin WangarXiv 2023 · DOI

Introduction

Formal verification of pointer-heavy programs often relies on Separation Logic (SL), which excels at describing memory partitioning. However, standard SL is typically restricted to fixed-size memory records. This rigidity makes it cumbersome to reason about variable-length data structures like stacks, queues, or multi-level storage systems (e.g., file systems and memory paging). While Sequence Predicate Logic handles strings and sequences, it lacks an understanding of the heap.

Researchers have introduced Sequence-Heap Separation Logic (SeqSL) to bridge this gap. SeqSL is a unified formal framework that allows pointers to map to entire variable-length sequences of data, enabling formal reasoning about complex structures while identifying the boundaries of computational decidability.

The SeqSL Framework

SeqSL extends classical separation logic by incorporating sequence variables ($\alpha, \beta$) and functions such as concatenation ($\circ$) and reversal ($\dagger$). The core innovation is the sequence singleton heap term $x \mapsto \alpha$. Unlike standard SL where $x \mapsto y$ denotes a pointer to a single value, in SeqSL, $x \mapsto \alpha$ signifies that pointer $x$ points to a variable-length sequence $\alpha$.

Visualization of a pointer $x$ mapping to a sequence $\alpha$ containing nested pointers.

This "block" abstraction naturally models data chunks of varying sizes, making it ideal for modern cloud storage or file systems. Furthermore, SeqSL can describe reachability in graphs with unbounded out-degrees more elegantly than standard SL, which often requires complex inductive definitions.

Decidability and the "Cliff Edge"

A significant portion of the research focuses on the decidability of SeqSL—determining whether a computer can automatically verify statements within the logic. The authors identify a "cliff edge" where the logic transitions from decidable to undecidable based on the complexity of quantifiers.

  1. Propositional SeqSL (PSeqSL): This fragment includes the separating conjunction ($*$) and the "magic wand" separating implication ($-*$). The authors proved PSeqSL is decidable by reducing it to word equations and demonstrating a "small model property," which allows solvers to search a finite space for solutions.
  2. Undecidable Fragments: The logic becomes undecidable when specific patterns of "for all" ($\forall$) and "there exists" ($\exists$) quantifiers are introduced. For instance, having two alternations of quantifiers over program variables and one over sequence variables allows the logic to simulate a two-counter Minsky machine.
Decidability results for various fragments of separation logic.

Key Results and Expressiveness

The paper demonstrates the practical utility of SeqSL by formally defining complex program properties:

  • List Reversal: Proving that a program correctly reverses a sequence in memory.
  • Multi-level Storage: Describing the memory structure of tree-based storage systems or two-tier cloud storage blocks.

The proof that the propositional fragment remains decidable even with the "magic wand" operator is a major theoretical contribution, as this operator frequently leads to undecidability in other logical systems.

Conclusion and Future Directions

SeqSL provides a powerful tool for verifying programs that manipulate variable-length data. While the logic is highly expressive, its computational complexity remains a challenge for fragments with high quantifier depth. Future work aims to refine the boundaries of decidability, investigate inductive predicates within this framework, and develop automated verification tools to assist software engineers in verifying real-world code.

Summary updated

BibTeX
@misc{cao2023separation,
  author = {Tianyue Cao and Bowen Zhang and Zhao Jin and Yongzhi Cao and Hanpin Wang},
  title = {{A separation logic for sequences in pointer programs and its decidability}},
  year = {2023},
  eprint = {2301.06237},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2301.06237},
}
Figure