Yaohui Chen

C++ semantics and tooling

How real C++ becomes Rocq checkable, and what you trust when it does.

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

Answers. How real C++ becomes Rocq checkable, and what you trust when it does.

1. Translation with cpp2v

  • SkyLabs cpp2v is part of BRiCk. Clang reads the exact unchanged source. cpp2v emits a Rocq syntax tree, checked_write.v. Translation ran on Linux ARM64 with libstdc++.
  • cpp2v reads existing C++. All of the C++ comes from the source file. Claims cover source. The compiled binary sits outside them.
  • Toolchain versions are pinned in PUBLIC-PINS.tsv. Source is checked_store.hpp at the pinned commit.

2. What is checked at this layer

  • Checked lemmas identify the actual write body and establish: method entry, the guard rule for short-circuit evaluation, boolean operands, branch and return structure, parameter binding and cleanup, and C++17 assignment evaluation order.
  • A library contract interface at signature level typechecks. Contracts themselves stay unproved.
  • WriteRefinement.checked_write_refines_model is independently checked in Rocq. The translated C++ write agrees with Model.write on return result and full model-observable post-state, on the modeled normal-return paths, under explicit representation and map, vector, and iterator contract assumptions. Record: FULL-VERIFICATION.md. Proof modules: brick-write-proof.
  • An issue in the independent checker step was found during validation and resolved in the checking workflow, with the checker itself left unpatched.

3. Trust base in full

  • Print Assumptions on the generated constants reports: assumed guardedness of upstream compare.compareN, the compare.name_comparison axiom, classical and dependent functional extensionality, and built-in string and integer types and operations.
  • Whole graph rocqchk -o also reports upstream axioms and seven unsafe fixpoints and cofixpoints in syntax comparison. The report shows no type in type and no assumed positivity.
  • Post 01 section 3 adds BRiCk semantics, the compiler, and STL contracts. The AST check depends on this base, axioms included.

Sources: PUBLIC-PINS.tsv · FULL-VERIFICATION.md.