Trustworthy AI Mathematical Proofs: Formal Verification and Engineering Practices
Formal verification lets proof assistants check machine-generated proofs step by step, but a passing build does not make a conclusion automatically trustworthy. This article explains why "the machine verified it" is only the starting point of a trust chain, breaks that chain into four links—statement verification, reproducibility, transparent auditing, and kernel trustworthiness—and shows how engineering teams can turn AI-assisted proofs into auditable, reproducible, and accountable artifacts through Lean 4 examples, CI archival, axiom inventories, and a minimal review checklist.
When AI begins contributing to proofs of world-class mathematical problems, the public conversation tends to fixate on “whether AI is stronger than humans.” For engineering teams, however, the more important question is: how does a machine-generated proof enter a track that is auditable, reproducible, and accountable? Formal verification offers a workable answer, but it does not mean that “once it compiles, the conclusion is inherently trustworthy.”
What is formal verification? Put simply, it translates a natural-language mathematical argument into a strict formal language that a proof assistant checks step by step to confirm the reasoning obeys the rules. Why does the machine’s check not directly equal the truth of the conclusion? Because the verifier only checks whether the “reasoning process” is legal—it does not judge whether the “statement” actually captures the conjecture you meant to prove. What tools does reproduction require? This usually depends on the prover, the dependency libraries, and the build environment. How do you audit axioms? You export an axiom-dependency inventory and confirm there are no hidden assumptions. What errors are common? They include misstated propositions, definition drift, unlocked dependencies, and unaudited axioms.
1. Why “the machine verified it” is not the same as absolute trust
The core capability of an interactive theorem prover is maintaining a trusted kernel that is as small as possible. Every reasoning step must start from axioms, definitions, and existing theorems, and be derived through legitimate rules. As long as the kernel is reliable, the machine can confirm that the reasoning chain itself has no logical gaps.
But there is a boundary that is easy to overlook: a formal system is responsible for checking reasoning, not for interpreting intent. If the author weakens the proposition, shifts a definition, or drops an implicit condition, the proof may still pass the check. At this point, the machine has proved “a legal proposition,” but not necessarily “the actual target proposition.”
Therefore, “compiles successfully” is only the starting point of the trust chain, not the endpoint. To make a machine proof genuinely trustworthy, you must verify four links in sequence: the statement, its dependencies, the axioms, and the kernel.
2. The four key links in the trust chain
| Link | Primary risk | Check action | Key artifact |
|---|---|---|---|
| Statement verification | Misstated proposition, definition drift | Compare against standard definitions, two-person review | Statement file, definition-mapping table |
| Reproducibility | Environment differences, dependency drift | Pin versions, independent rerun, hash comparison | Lockfile, build log, hash inventory |
| Transparent audit | Hidden axioms, definition tampering | Export axioms, close dependency loop, diff comparison | Axiom inventory, audit report, baseline hash |
| Kernel trustworthiness | Verifier defects, oversized TCB | Audit the kernel, minimize dependencies, pin versions | Kernel version hash, audit report |
1. Verify the statement and the proof separately
The statement and the proof must be reviewed as two independent objects. The statement answers “what exactly is being proved,” and the proof answers “how it is derived from existing rules.” The two must not be checked together.
To make the workflow executable, you should keep at least three types of files:
- Statement file: for example,
Statement.lean, which only describes the theorem statement; - Proof script: for example,
Proof.leanorMain.lean, which contains the formalized reasoning; - Check command: for example,
lake env lean Main.leanorlake build.
The following is a Lean 4 syntax sketch; in practice you must pin the Lean version, the math library version, and the dependencies:
-- Lean 4 sketch: pin the Lean toolchain, mathlib or project dependenciesimport Mathlibtheorem target_proposition (x y : Nat) : x + y = y + x := byexact Nat.add_comm x y
This example is simple in itself, but it illustrates a key principle: theorem statements should reuse community-standard definitions wherever possible. If the original problem involves objects such as groups, rings, topologies, or metric spaces, prefer definitions from peer-reviewed math libraries over ad hoc definitions. Otherwise, even a successful proof may only be proving a “weakened version” of the problem.
During review, it helps to build a “definition-mapping table”: for each key concept in the paper, record which definition, parameters, assumptions, and namespace it maps to in the formal library. Whenever a mapping changes, the result must be reviewed again.
2. Build results must be reproducible
Reproducibility does not mean “the author says they verified it.” It means an independent verifier can obtain the same conclusion in a clean environment and perform inventory and hash comparison on the key artifacts.
The prerequisite for reproducibility is pinning versions and dependencies. Taking a Lean project as an example, you should record:
lean-toolchain;lakefileor the project configuration file;lake-manifest.jsonor the dependency lockfile;- the commit hash of the math library or external libraries;
- the source version and the input-data version;
- key build parameters.
The independent verifier should re-pull dependencies, rebuild, and re-verify inside an isolated container, and then save:
- the build log;
- the dependency lockfile;
- the verification command;
- the axiom inventory;
- hashes of key artifacts;
- environment version information.
Here, the digests of key artifacts should stay consistent—for example, the conclusion output, axiom dependencies, and core-object hashes. Log text may vary due to differences in paths, timestamps, or compilation caches, so you should not require every log to be identical; instead, compare whether the “verification conclusion” and “key-artifact digests” match.
# Example: record versions and artifact hashessha256sum lean-toolchain lake-manifest.json axioms.txt > hashes.txt
When multiple independent verifiers reach the same conclusion under the same lockfile, trust shifts from “the author’s claim” to a “verifiable fact.”
3. Guard against black-box operations: definitions and axioms must be transparent
A more insidious risk than stating the wrong problem is quietly altering a definition in a mass of code, or injecting an extra axiom, so that a proof that should not hold appears to hold. Manual review struggles to catch such changes, so you must rely on tool-based auditing.
Axiom auditing is a basic action. If a proof actually depends on a certain axiom, that dependency should be explicitly listable, and a reviewer should confirm whether the axiom falls within an academically acceptable range. For example, in Lean you can export a theorem’s dependent axioms as follows:
import Main#print axioms target_proposition
In Coq, you can similarly use Print Assumptions to inspect assumption dependencies. Isabelle users can also export the relevant theorem and axiom-dependency information according to the version they use. Regardless of the tool, the axiom inventory should be treated as a formal deliverable.
Two further checks are also needed:
- Dependency-closure check: every definition, lemma, and theorem should be traceable to an explicit source, with no hidden patches;
- Diff comparison: compare this proof against a baseline version and check whether definitions, axioms, or key lemmas have been changed.
All hidden assumptions must be brought into the open for review. Whenever a proof depends on an extra axiom, its source, purpose, and acceptability must be stated.
4. Kernel trustworthiness and minimizing the trusted computing base
The entire trust chain ultimately converges on the trusted computing base (TCB). No matter how many lines of code the upper-level project contains, what truly determines whether a proof is trustworthy is the trustworthiness of the verification kernel, the dependency-library boundary, and the toolchain.
Kernel-trustworthiness engineering should focus on:
- whether the kernel is small enough;
- whether the kernel version is pinned;
- whether dependencies are minimized;
- whether there are unnecessary high-level plugins;
- whether there are audit records.
It is recommended to keep the following kernel-audit artifacts:
- kernel code size;
- kernel version hash;
- audit report;
- dependency-minimization record;
- compilation options and runtime-environment description.
The trustworthiness of formal verification does not mean “absolute correctness”; it means “compressing the parts that must be trusted unconditionally into the smallest, most auditable scope.”
3. Engineering implementation recommendations
If a team wants to introduce “AI + formal verification” in a real project, it is advisable to implement along three dimensions: process, automation, and audit artifacts.
1. Review the statement first
The review order must be: statement first, then proof.
It is recommended to set up the following structure in the code repository:
Statement/: holds the theorem statements;Proof/: holds the proof scripts;Review/: holds review records;Artifacts/: holds logs, axiom inventories, and hash files.
Any change to a Statement must trigger a two-person review and an update to the definition-mapping table. If a definition comes from a standard math library, record the library version and the definition name.
2. Enforce independent reproduction and CI archival
The second executable action can be illustrated with Lean. Assume the project already has a Lean configuration and a dependency lockfile:
# 1. Record the environment and dependenciescat lean-toolchain lake-manifest.json > env.txt# 2. Build the projectlake build > build.log# 3. Export the axiom inventorycat > AxiomsCheck.lean <<'EOF'import Main#print axioms target_propositionEOFlake env lean AxiomsCheck.lean > axioms.txt# 4. Generate hashes of key artifactssha256sum env.txt build.log axioms.txt > artifacts.sha256
In CI, you should automatically archive the following files:
lean-toolchain;lake-manifest.json;build.log;axioms.txt;artifacts.sha256;- the commit hash and runtime-environment information.
If you use Coq, you can pin the Coq version and dependency packages, and record _CoqProject, the Makefile, the build log, and the assumptions inventory. If you use Isabelle, pin the Isabelle version, the ROOT and SESSION configuration, and archive the session log.
3. Establish an axiom-inventory system
Every verification run must automatically generate an axiom-dependency inventory, for example axioms.txt. Manual confirmation should at least cover:
- whether it depends only on accepted axioms;
- whether assumptions that need to be stated, such as classical choice or the law of excluded middle, appear;
- whether it matches the baseline axiom inventory;
- whether any new axioms have been added;
- whether a manual-review sign-off exists.
The axiom inventory must not be kept only on a developer’s local machine; it should enter CI archival and be stored together with the version hash.
4. Make verification a pipeline
Formal verification should be integrated into the continuous-integration flow. Any commit, merge request, or release action should automatically trigger:
- lockfile checks;
- statement-change checks;
- build verification;
- axiom-inventory export;
- hash comparison;
- artifact archival.
If the lockfile, the definition-mapping table, or the axiom inventory changes, automatic merging should be blocked and manual review required.
5. Elastic compute support and cloud-free alternatives
Large-scale formal verification and independent reproduction typically require parallel builds, dependency caching, and batch runs. Elastic computing in the cloud, container orchestration, and object storage can serve as optional capabilities, but they are not the only option.
A cloud-free environment can also adopt:
- local containers;
- a Kubernetes cluster;
- Slurm batch-job scheduling;
- GitLab CI or GitHub Actions matrix builds;
- object-storage archival such as MinIO;
- a shared file system with hash verification.
What matters is not which infrastructure is used, but ensuring that every verification has a recordable, rerunnable, and archivable environment.
4. Minimal checklist
When reviewing a machine-generated proof, you can check at least the following questions:
- Is the statement consistent with the paper or the requirements document?
- Do the definitions come from a standard library or from reviewed definitions?
- Are there self-built definitions that weaken the proposition?
- Are the toolchain, math library, and dependencies pinned?
- Can an independent verifier reproduce the result in a clean environment?
- Is an axiom inventory generated and archived?
- Are the baseline hash and dependency inventory compared?
- Are the build log, environment file, and verification command saved?
- Have the kernel and dependencies been audited?
Conclusion
The real value of AI in mathematical proofs does not lie in replacing humans with a conclusion that “seems reliable,” but in advancing the proof process onto a public, reproducible, auditable formal track. When a conclusion must withstand step-by-step machine checking, reproduction in an independent environment, and axiom-transparency review, trust no longer rests on some authority’s reputation but is built on verifiable engineering facts.
For technical teams, this approach transfers to critical-code verification, auditing of intelligently generated results, and the construction of high-reliability systems. Any verifier with the toolchain, dependencies, and permissions should be able to reproduce a conclusion from the checklist, inspect dependencies, and trace sources. Compressing the parts that must be trusted unconditionally into the smallest scope, and making everything reproducible and auditable, is the golden rule of engineering trustworthiness.
