[Paper Review] On Using VeriFast, VerCors, Plural, and KeY to Check Object Usage (Experience Paper)
This paper evaluates four static verification tools—VeriFast, VerCors, Plural, and KeY—for checking protocol compliance and completion in Java programs with shared, stateful objects. It demonstrates that while all tools can verify correct usage of protocol-bound objects, only KeY supports full interactivity and proof reuse, and none natively guarantee protocol completion; the study highlights the high programmer effort required, especially for complex data structures like linked lists, and calls for better type system support for automatic protocol compliance and completion.
Typestates are a notion of behavioral types that describe protocols for stateful objects, specifying the available methods for each state. Ensuring methods are called in the correct order (protocol compliance), and that, if and when the program terminates, all objects are in the final state (protocol completion) is crucial to write better and safer programs. Objects of this kind are commonly shared among different clients or stored in collections, which may also be shared. However, statically checking protocol compliance and completion when objects are shared is challenging. To evaluate the support given by state of the art verification tools in checking the correct use of shared objects with protocol, we present a survey on four tools for Java: VeriFast, VerCors, Plural, and KeY. We describe the implementation of a file reader, linked-list, and iterator, check for each tool its ability to statically guarantee protocol compliance and completion, even when objects are shared in collections, and evaluate the programmer’s effort in making the code acceptable to these tools. With this study, we motivate the need for lightweight methods to verify the presented kinds of programs.
Motivation & Objective
- To assess the ability of four static verification tools to check correct usage of shared objects with behavioral protocols in Java.
- To evaluate each tool’s support for protocol completion, ensuring all required method calls are made and resources are freed.
- To measure the programmer effort required to make code acceptable to each tool, especially in complex scenarios involving aliasing and data structures.
- To identify limitations in current tools, particularly regarding expressiveness, automation, and usability in verifying complex object usage patterns.
- To advocate for a language-level type system that natively guarantees protocol compliance and completion without manual proof effort.
Proposed method
- Implemented a file reader and a singly linked-list with protocol constraints in Java, using each tool’s specification language.
- Applied each tool’s verification backend to check protocol compliance and completion under shared object access, including in collections.
- Used manual annotations, assertions, lemmas, and proof tactics as required by each tool to guide verification.
- Measured and compared the number of lines and time spent on annotations and proofs across tools.
- Evaluated usability aspects such as proof automation, interactive guidance, and support for proof reuse.
- Explored the impact of specification style (e.g., pretty syntax vs. raw form) and the need for disjointness reasoning in heap-based verification.
Experimental results
Research questions
- RQ1Can VeriFast, VerCors, Plural, and KeY statically verify correct usage of objects with protocols when those objects are shared in collections?
- RQ2To what extent can these tools guarantee protocol completion, ensuring all required method calls are made and resources are freed?
- RQ3How much programmer effort is required to make code acceptable to each tool, particularly in complex data structures like linked lists?
- RQ4What are the key usability and expressiveness limitations of each tool in verifying shared, stateful objects with protocols?
- RQ5Can the tools support efficient reasoning about object permissions and aliasing without requiring low-level separation logic or manual proof construction?
Key findings
- VeriFast and VerCors require significant manual effort—between 100 to 160 lines of annotations and proofs—for verifying complex data structures like linked lists, despite their support for separation logic and fractional permissions.
- Plural supports richer sharing patterns through access permissions but cannot express complex data structures like linked lists due to limited specification expressiveness, and it is no longer actively maintained.
- KeY provides the most interactive and automated experience, including proof reuse and tactical guidance, but its explicit heap notation and complex disjointness reasoning hinder readability and increase proof maintenance cost.
- None of the tools natively guarantee protocol completion; workarounds are required, and the authors argue that such guarantees should be provided directly by the type system.
- All tools require substantial programmer input for verification, especially when reasoning about shared state, and the lack of high-level abstractions for permissions and protocol completion remains a major barrier to adoption.
- The study concludes that a language-level type system supporting automatic protocol compliance and completion under various sharing patterns is essential for practical adoption.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.