CompCert4Lean moves a verified C compiler into Lean: one expert directing parallel agents completes the port in six weeks
Synopsis
The verified compiler core of CompCert 3.17 existed only in Rocq, and its definitions and proofs could not be imported directly into Lean. CompCert4Lean partitions the development along its dependencies into 166 units, translates definitions and theorem statements first under independent audit, then reconstructs proofs in parallel; one expert directing parallel LLM agents completed the port in about six weeks, discharging all 4,908 recorded proof obligations without project-specific axioms and producing executable Linux binaries.
Interpretation
A mature verified compiler core now has a Lean version covering the whole pipeline from typed CompCert C abstract syntax to x86-64 assembly abstract syntax, discharging all 4,908 recorded proof obligations without project-specific axioms. Previously this infrastructure was available only in Rocq, with its semantics, memory model and correctness proofs tied to Rocq and not directly importable into Lean; for reference, the 154 Rocq modules in the migration scope of CompCert 3.17 contain 149,038 lines. A transitive audit of 75,348 project declarations finds no axioms beyond Lean's three standard foundational axioms; the executable toolchain passes all 139 applicable CompCert small tests at both O0 and O2 and completes 20 correctness executions across six SPEC CPU2026 programs at the two optimization levels.
The migration partitions the development along its dependency graph into 166 units, 154 source components and 12 shared providers, with one canonical owner per declaration, so agents translate definitions, semantics and exact theorem statements in parallel against stable interfaces. Parallelism can amplify errors: a mistranslated shared definition or theorem statement spreads into downstream definitions, interfaces and proofs, and neither a successful build nor kernel-checked proofs rules this out. The first audit found 1,091 theorem statements reduced to True, errors that translation-time builds had missed; eleven broad definition-review rounds followed, with the count of units carrying critical findings peaking at 104 and falling to one in the last broad round.
Once definitions and statements are frozen, agents reconstruct proofs in parallel from an inventory of 4,908 obligations; the automatic runner was stopped with 471 remaining, which moved to human-guided agent sessions and were all completed. At the expert-directed stop, 4,437 obligations were complete, 90.1% of the initially unfinished 4,738 targets, with the remainder spread across integer foundations, value-domain reasoning, memory and compiler-pass proofs. Of 1,071 substantive human messages, 951 (88.8%) concerned workflow and coordination, 117 (10.9%) technical review and discussion, and only three (0.3%) supplied technical direction.
The migrated compiler is easier for agents to improve: under matched budgets of 24 active hours, GPT-6-astra's Lean candidate lowers generated-program runtime by 11.7% across 29 small-tests programs relative to original CompCert 3.17, versus 2.3% for its Rocq candidate, both preserving the end-to-end correctness theorem. These percentages include differences already present in the starting compilers and do not measure gains relative to each campaign's own baseline; on SPEC inputs the corresponding reductions are 6.9% and 2.2%, and those inputs are selected test/train inputs, not reportable SPEC scores. Within the same budget the agent produced 106 candidate variants completing full compiler and proof builds in Lean, compared with 40 in Rocq, under broadly comparable recorded token usage.
Perspective
The demonstrated scope is CompCert 3.17's verified pipeline for the selected x86-64 configuration, from typed CompCert C abstract syntax to x86-64 assembly abstract syntax; parsing and elaboration precede it, and assembly printing, assembling and linking follow it outside the compilation theorem. Differential testing covers 22,062 test records, the RTL comparison is identical at all nine stages for 18,807 programs at O2 and 18,808 at O0, and 202 executable specification functions agree bit-for-bit on 37.4 million inputs.
Correspondence with the Rocq development is supported by independent source review and differential testing rather than a mechanized equivalence theorem; in the final obligation-inventory round 25 units lacked an accepted result, and the planned complete-cycle and external final-global gates were waived after bounded repair and targeted recheck, not reported as passed. Each optimization campaign ran once per environment, so model capability, proof automation, repository structure and search choices cannot be separated; retained changes are informed by the evaluation workloads, and gains on unseen workloads are not established.
