Posted by g-b-r 6 hours ago
I’d like to know more about this part.
"Building" a Lean project actually consists of two steps that can be separated: compiling the high-level Lean document to the simple expression format of the Lean kernel (this part is called "elaboration") and then checking that this expression consistutes a valid proof of the claimed statement (this part is called "kernel checking"). Only the first part potentially involves arbitrary code execution.
Lean ships with a component called `lake comparator` [1]. It works like this: a trusted challenge (formal statement) and the potential proof are elaborated separately in sandboxed environments so that code execution during the build of the proof cannot interfere with the checker or the trusted statement. Then the statement and proof are both exported into a simple JSON-format [2] that represents the relevant terms in the expression format of the Lean kernel, and then the checkers check this JSON.
If this process succeeds, then you know that you definitely have a proof of the relevant statement, with the JSON as a witness of the proof.
[1]: https://lean-lang.org/doc/reference/latest/ValidatingProofs/... [2]: https://github.com/leanprover/lean4export
See question 4 here -
https://xenaproject.wordpress.com/2026/11/12/and-the-proof-i...