Yaohui Chen

Open challenges. Verifying C++ with formal proof

The workflow end to end, and what stays open for verifying C++ with formal proof.

This series verifies one small C++ program end to end, ByteStore.

Answers. The workflow end to end, and what stays open for verifying C++ with formal proof.

The proof steps settle one property. Overflow does not occur on the covered paths. Post 05 gives the derivation.

1. Workflow

Six steps produce that guarantee.

1 Freeze the spec before the implementation. Do not weaken the spec to pass tests or proofs. 2 Model the spec. Prove the security theorems where stating them is easy. 3 Refine to an implementation-shaped model. Prove simulation for result and post state. 4 Translate the real source. Check what cpp2v and BRiCk can check today. Name the rest as open. 5 Test the binary in a normal build and in sanitizer builds. Use the results as conformance evidence. 6 Audit the assumptions. Publish the trust base with the claim.

2. Open challenges

Four challenges stay open.

  • Generality of the spec. Lesson, from Post 05. The spec requires a rejected write to preserve the whole store, on every rejection path. Tests cover only the paths they are written for. Challenge. Writing specs for whole failure classes, and knowing how much generality is enough.
  • Model-to-code gap. Lesson, from Posts 03 and 04. The proof covers only part of the code, and each part rests on stated assumptions. The refinement covers the translated write method under stated representation and library contract assumptions. The binary, the concrete standard library, the whole lifecycle, and allocation sit outside it. Challenge. Widen what the proof covers and keep every assumption explicit and accounted for.

Binary level, for contrast. Anthropic and Theorem prove compiled binaries instead of source. A binary proof covers the compiler’s output, so no translation gap sits between the proof and the artifact that runs. The trusted base moves down a level, to the instruction-set model and the process model. Their spec is a fuzz obligation restated as a proof. The entry point never crashes. The spec in this series is hand-written and states properties directly, the exact effect of a write and the lifetime of an identity. Their proofs are machine-written and run to hundreds of thousands of lines. The proofs here fit in files a reader can finish. A proof at either level holds inside its stated machine and environment model.

  • Inputs with structure. Lesson, from the toy. Its guards are direct comparisons and offsets get no arithmetic, which is why representability stayed manageable. Challenge. Inputs with structure, parsers and length fields, where untrusted inputs get arithmetic and narrowing before any check.
  • Keeping proof alive. Lesson, from section 1. On a toy, spec, model, translation, and checks stayed in step by hand. Challenge. The cost of keeping specs and proofs in step with code that changes every week.

Sources: Synthesis of Posts 00 to 05. · Anthropic and Theorem, “LLMs are making formal software verification feasible at a much larger scale”