Formally verified 3D CSG uses a 93-line spec and 60,000 lines of AI-written proofs

permute · hn · 2026-07-28

Formal verification for 3D CSG in Lean 4

The author claims this is the first formally verified implementation of a 3D constructive solid geometry operation: mesh intersection. The kernel is implemented in Lean 4 and checked against a compact 93-line specification that defines the resulting mesh surface precisely and enforces practical well-formedness conditions.

A central goal of the project is to reduce trust in AI-written code: a human only needs to review the short specification and run the Lean checker, while more than 60,000 lines of Lean proofs were generated by an agent and never need to be manually inspected. The implementation and proofs are treated as a black box because correctness is enforced at compile time. There is also a browser demo running the verified kernel compiled to WebAssembly.

Original post →

More from coding & agent

coding & agent channel →