TL;DR
QCP (Qualified C Programming Verifier) bridges the gap between automation and expressiveness in C program verification by combining symbolic execution, a custom separation logic entailment solver, and the Rocq proof assistant. By automating nearly 75% of verification conditions and integrating directly into VS Code, QCP allows developers to verify complex functional correctness incrementally with real-time feedback.
What Problem Does This Paper Address?
Writing bug-free C code is notoriously difficult, especially when managing manual memory allocation. Software verification tools help prove code correctness, but developers usually have to choose between three flawed options:
- Fully automated tools (like Infer) that catch basic bugs (e.g., null pointers) but can't prove complex functional correctness.
- Annotation-based verifiers (like VeriFast) that use SMT solvers to check properties but require a fully annotated program before providing any feedback.
- Interactive proof assistants (like VST/Rocq) that can prove anything but demand an exhausting amount of manual proof engineering.
Furthermore, traditional tools lack real-time feedback. If a developer makes a mistake in an annotation on line 10, they won't find out until they finish annotating the entire 100-line function. QCP addresses this by providing an interactive, incremental verification workflow that automates tedious proofs while giving live feedback inside the IDE.
Methods
QCP introduces a hybrid verification pipeline that balances automation with interactive proving:
[Annotated C Code] ──> [Symbolic Executor] ──> [Verification Conditions (VCs)]
│
▼
[Custom Entailment Solver]
├── Pass ──> [Auto Proofs]
└── Fail ──> [Rocq (Manual Proofs)]
- Partial Statement Symbolic Execution: QCP’s frontend breaks C programs down into "partial statements." This allows the symbolic executor to compute intermediate program states line-by-line as the user types, rather than waiting for a complete file.
- Hybrid Entailment Solver: Simple verification conditions (VCs) are automatically discharged by a custom solver. This solver combines a rule-based separation logic engine (built on the Stellis framework) to handle spatial/memory constraints and a lightweight SMT solver to handle Linear Integer Arithmetic (LIA) and Uninterpreted Functions (UF).
- Interactive Fallback via Rocq: When the automated solver fails on complex, user-defined predicates, QCP generates a clean proof goal and exports it to the Rocq proof assistant (formerly Coq) for manual verification.
- IDE Integration: QCP includes a VS Code extension that visualizes intermediate verification states. Code that passes preliminary checks is highlighted in green, while verification failures (such as a use-after-free error) are highlighted in red with actionable error messages.
Datasets
The tool was evaluated on a benchmark suite consisting of 155 C functions across five distinct domains:
- Arithmetic (Arith): Basic mathematical functions.
- Typical Data Structures (Typical DS): Singly-linked lists, doubly-linked lists, trees, and arrays.
- Typical Algorithms (Typical alg): Implementations like merge sort and the Knuth-Morris-Pratt (KMP) string-searching algorithm.
- Huawei LiteOS Components: Real-world doubly-linked list structures from an open-source microkernel.
- QCP Implementation Components (QCP Impl): Code from QCP's own codebase (e.g., type inference and Fourier–Motzkin elimination algorithms), serving as a case study for non-verification-oriented software.
Key Insights and Ideas
- Shifting Proof Burden to Annotations: QCP requires a higher number of front-end annotations compared to purely interactive tools like VST-A. However, this is a deliberate design choice: shifting separation logic transformations into annotations makes the verification process more intuitive and drastically reduces the actual lines of backend proof code required.
- Live IDE Diagnostics: By evaluating code incrementally, QCP can pinpoint exactly where a memory permission is lost. For instance, if a pointer is freed and subsequently read, the IDE instantly flags the exact column and line with a "Memory Read" precondition failure.
Key Results
- 74.3% Automation Rate: Across all 155 functions, QCP's automated entailment solver successfully discharged 1,964 verification conditions, leaving only 679 complex conditions for manual proof.
- Significant Proof Effort Reduction: Compared to interactive verifiers, QCP reduced the required lines of proof code by 52.8% against VST-A and 62.3% against VST.
- Drastic Verification Speedups: In verifying singly-linked lists (SLL), QCP achieved a 95.4% reduction in execution time compared to VST-A (16.11 seconds vs. 349.75 seconds), primarily because reducing proof length directly accelerates Rocq's execution.
Limitations and Future Work
While QCP handles standard C programming patterns well, it currently lacks support for several advanced language features:
- Unsupported C Features: Floating-point types, function pointers, bit-fields, string literals, the comma operator, and
gotostatements are not yet supported. - SMT Quantifier Limitations: The built-in SMT solver cannot process quantified formulas, meaning any verification condition requiring quantification must be kicked to Rocq for manual intervention.
The authors plan to extend QCP to support function pointers and goto statements, alongside improving developer usability by allowing the integrated verification of multiple specifications simultaneously.
Summary updated