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

Generically Automating Separation Logic by Functors, Homomorphisms and Modules

Qiyuan Xu, David Sanán, Zhe Hou, Xiaokun Luan, Conrad Watt, Yang Liu · DOI

Abstract

Foundational verification considers the functional correctness of programming languages with formalized semantics and uses proof assistants (e.g., Coq, Isabelle) to certify proofs. The need for verifying complex programs compels it to involve expressive Separation Logics (SLs) that exceed the scopes of well-studied automated proof theories, e.g., symbolic heap. Consequently, automation of SL in foundational verification relies heavily on ad-hoc heuristics that lack a systematic meta-theory and face scalability issues. To mitigate the gap, we propose a theory to specify SL predicates using abstract algebras including functors, homomorphisms, and modules over rings. Based on this theory, we develop a generic SL automation algorithm to reason about any data structures that can be characterized by these algebras. In addition, we also present algorithms for automatically instantiating the algebraic models to real data structures. The instantiation reuses the algebraic models of component structures and preserves their data abstractions. Case studies on formalized imperative semantics show our algorithm can instantiate the algebraic models automatically for a variety of complex data structures. Experimental results indicate the automatically instantiated reasoners from our generic theory show similar results to the state-of-the-art systems made of specifically crafted reasoning rules. The presented theories, proofs, and the verification framework are formalized in Isabelle/HOL.

Introduction

Foundational verification—proving that a program is mathematically correct within a proof assistant like Coq or Isabelle—is the "gold standard" for software reliability. However, it is notoriously difficult to automate. Separation Logic (SL) is the primary tool for this task because it excels at describing memory ownership. The challenge is that current automation for SL is either restricted to simple data shapes or relies on extensive hand-crafted, ad-hoc rules for every new data structure. This lack of a systematic meta-theory makes verifying real-world software a resource-intensive task requiring deep expertise.

Methodology: Algebraic Automation

The authors propose a theory where SL predicates are treated as data refinement relations following specific algebraic laws. Instead of writing unique rules for every structure (e.g., LinkedList or AVLTree), they identify universal algebraic properties:

  • Functors (TF): Handle subtyping and container transformations (e.g., transforming a List of integers into a List of floats).
  • Separating Homomorphisms (SH): Allow splitting and merging abstractions, such as breaking a record into individual fields.
  • Modules over Rings (SA, SD, etc.): Model operations like array slicing, where segments of data can be concatenated or split based on indices.
Workflow of the generic Separation Logic reasoner.

The system's architecture centers on a bi-abductive Transformation Problem (bi-TP) solver. This solver takes a desired transformation between two SL formulas and uses templates derived from the algebraic properties mentioned above to find proof steps automatically. Crucially, the framework includes algorithms to automatically prove that a user-defined predicate satisfies these algebraic laws. This compositionality allows the system to deduce how complex structures (like a List of Pointers) behave by combining the known properties of their components.

Evaluation and Results

The framework was evaluated on 10 widely-used data structures and 8 programs (592 lines of code), including standard structures (Linked Lists, BSTs), complex structures (AVL Trees, Bucket Hash Maps), and algorithmic challenges like Strassen’s matrix multiplication and Quicksort.

Key results include:

  • High Automation: The system automatically generated approximately 80% of the ~300 required reasoning rules.
  • Performance: Automation levels (manual annotations vs. code) were comparable to specialized, hand-tuned tools like RefinedC.
  • Efficiency: The reasoning process scales roughly linearly with formula complexity in practice, despite a theoretical quadratic worst-case.
  • Certified Foundation: The entire framework is formalized in Isabelle/HOL, ensuring the automation itself is mathematically sound.

Conclusion

While the framework significantly advances SL automation, it currently focuses on sequential programs. Future work aims to extend these algebraic models to concurrent "shared ownership" and improve handling of non-associative scalars in slicing operations. Despite these limitations, the approach demonstrates that leveraging abstract algebra can bridge the gap between high-level mathematical abstractions and low-level memory verification.

Summary updated

BibTeX
@article{xu2024generically,
  author = {Qiyuan Xu and David Sanán and Zhe Hou and Xiaokun Luan and Conrad Watt and Yang Liu},
  title = {{Generically Automating Separation Logic by Functors, Homomorphisms and Modules}},
  journal = {Proc. ACM Program. Lang.},
  year = {2024},
  doi = {10.1145/3704903},
}
Figure