Building c2proof: C to Rust Migration with Verification
A verifier-first c2rust wrapper. Give it a flat C repo, and it outputs a compiling Rust port PR alongside a mathematical proof artifact.
The push for memory safety is moving the industry toward Rust, but rewriting legacy C codebases manually is impossible at scale. Automated tools exist, but they often produce unreadable, unsafe Rust that doesn't compile out of the box or lacks verifiable correctness.
I built c2proof to fix this. It is a verifier-first wrapper around c2rust.
The Problem
Standard c2rust translates C to unsafe Rust. The output is a starting point, not a solution. You still have to manually verify that the logic remains identical and then painstakingly refactor it into idiomatic, safe Rust. If the transpiled code doesn't mathematically prove its equivalence to the original C, the migration introduces as much risk as it solves.
How c2proof Works
c2proof changes the pipeline:
- Input: You provide a flat C repository.
- Transpilation: It runs
c2rustunder the hood. - Verification: This is the core. It generates a verification report proving the mathematical equivalence of the original C and the output Rust.
- Output: It doesn't just dump files. It compiles the Rust port, ensures it builds, and packages it into a ready-to-merge PR, alongside the proof artifact.
Why the Proof Matters
When migrating critical systems, "it compiles and the tests pass" is not enough. The proof artifact generated by c2proof provides mathematical certainty that the translation preserves the exact semantics of the original code. This reduces the review burden on senior engineers from "checking every line" to "reviewing the proof boundaries."
What's Next
Right now, c2proof handles flat C repositories well. The next milestone is handling complex build systems (Makefiles, CMake) and automatically refactoring the generated unsafe Rust into safe abstractions where the borrow checker can prove it's sound.
Written in Rust. Wraps c2rust. Verifier-first migration.
More Essays
Building jev-curate: Fast Synthetic Dataset Sifter in Rust
Filtering synthetic training data with TypeSafe AI Jev: streaming JSONL and Parquet rows through calibrated System One gates at 70ms latency with zero memory accumulation. � 5 min
systemsBuilding jev-git: Sub-Second Git Reflex Gate in Rust
Screening staged git diffs for leaked secrets, destructive payloads, and AI hallucinations in 80ms using TypeSafe AI Jev System One. � 4 min
systemsBuilding jev-scout: Zero-Hallucination Crate and Repo Scout
Preventing AI package hallucinations: discovering real crates and GitHub repositories using live registry APIs and TypeSafe Jev speculative fan-out scoring. � 4 min