A HAT Trick: Automatically Verifying Representation Invariants using Symbolic Finite Automata
Zhe Zhou, Qianchuan Ye, Benjamin Delaware, Suresh Jagannathan
Abstract
Functional programs typically interact with stateful libraries that hide state behind typed abstractions. One particularly important class of applications are data structure implementations that rely on such libraries to provide a level of efficiency and scalability that may be otherwise difficult to achieve. However, because the specifications of the methods provided by these libraries are necessarily general and rarely specialized to the needs of any specific client, any required application-level invariants must often be expressed in terms of additional constraints on the (often) opaque state maintained by the library.
In this paper, we consider the specification and verification of such representation invariants using symbolic finite automata (SFA). We show that SFAs can be used to succinctly and precisely capture fine-grained temporal and data-dependent histories of interactions between functional clients and stateful libraries. To facilitate modular and compositional reasoning, we integrate SFAs into a refinement type system to qualify stateful computations resulting from such interactions. The particular instantiation we consider, Hoare Automata Types (HATs), allows us to both specify and automatically type-check the representation invariants of a datatype, even when its implementation depends on stateful library methods that operate over hidden state.
We also develop a new bidirectional type checking algorithm that implements an efficient subtyping inclusion check over HATs, enabling their translation into a form amenable for SMT-based automated verification. We present extensive experimental results on an implementation of this algorithm that demonstrates the feasibility of type-checking complex and sophisticated HAT-specified OCaml data structure implementations layered on top of stateful library APIs.
• Software and its engineering → Language types; Software verification and validation.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 121bc597-2448-460e-9930-9cc4f5504ae0Cited by top-tier papers6
- Derivative-Guided Symbolic ExecutionYongwei Yuan, Zhe Zhou, Julia Belyakova, Suresh JagannathanPOPL 2025 · 3 citations
- Abstract Interpretation of Temporal Safety Effects of Higher Order ProgramsMihai Nicola, Chaitanya Agarwal, Eric Koskinen, Thomas WiesOOPSLA 2025 · 1 citation
- Security Reasoning via Substructural Dependency TrackingHemant Gouni, Frank Pfenning, Jonathan AldrichPOPL 2026 · 1 citation
- Trace-Guided Synthesis of Effectful Test GeneratorsZhe Zhou, Ankush Desai, Benjamin Delaware, Suresh JagannathanPLDI 2026 · 1 citation
- On Higher-Order Model Checking of Effectful Answer-Type-Polymorphic ProgramsTaro Sekiyama, Ugo Dal Lago, Hiroshi UnnoOOPSLA 2025
Builds on5
- Interaction trees: representing recursive and impure programs in CoqLi-yao Xia, Yannick Zakowski, Paul He, Chung-Kil Hur et al.POPL 2020 · 133 citations
- Data-driven inference of representation invariantsAnders Miltner, Saswat Padhi, Todd D. Millstein, David WalkerPLDI 2020 · 33 citations
- Choice Trees: Representing Nondeterministic, Recursive, and Impure Programs in CoqNicolas Chappe, Paul He, Ludovic Henrio, Yannick Zakowski et al.POPL 2023 · 21 citations
- Temporal Verification with Answer-Effect Modification: Dependent Temporal Type-and-Effect System with Delimited ContinuationsTaro Sekiyama, Hiroshi UnnoPOPL 2023 · 15 citations
- Data-driven abductive inference of library specificationsZhe Zhou, Robert Dickerson, Benjamin Delaware, Suresh JagannathanOOPSLA 2021 · 15 citations
Related papers
- Zoo: A Framework for the Verification of Concurrent OCaml 5 Programs using Separation LogicClément Allain, Gabriel SchererPOPL 2026 · 2 citations
- Abstraction Functions as Types: Modular Verification of Cost and Behavior in Dependent Type TheoryHarrison Grodin, Runming Li, Robert HarperPOPL 2026 · 2 citations
- Refinement Type RefutationsRobin Webbers, Klaus von Gleissenthall, Ranjit JhalaOOPSLA 2024 · 3 citations
- Type Inference LogicsDenis Carnier, François Pottier, Steven KeuchelOOPSLA 2024 · 3 citations
- Practical Type Inference with LevelsAndong Fan, Han Xu, Ningning XiePLDI 2025 · 3 citations
