May 25, 2026
sorryaudit: Transitive Sorry Taint Detection for AI-Assisted Lean 4 Proofs
Anshuman Singh
AI proof assistants (Lean Copilot, LLMs) routinely use `sorry` as a placeholder for proof steps they cannot complete. The file compiles clean, CI passes, and the "formally verified" label gets attached. The problem is transitive: if theorem B depends on theorem A, and A uses sorry anywhere in its proof chain, B is also unsound - but Lean only warns at the point of sorry, not at every downstream dependent.
sorryaudit runs two passes on any Lean 4 codebase. First, a syntactic pass that detects sorry/admit/native_decide/Unsafe.cast by line, stripping comments and string literals to avoid false positives. Second, a semantic pass that runs Lean's own `#print axioms` command on every theorem and checks whether sorryAx appears in the transitive axiom set. Both passes merge into a per-theorem trustworthiness report with an overall project score.
Tested on lean-tcb (117 theorems, 23 files): correctly identified sorryThm (1+1=3) as the only UNSOUND theorem, with 115 trusted. On AI-generated proofs, caught a theorem with no sorry in its own body that was silently unsound due to a dependency - a case the syntactic pass alone misses entirely.
No reviews are available yet
Cite this work
@misc {
title={
(HckPrj) sorryaudit: Transitive Sorry Taint Detection for AI-Assisted Lean 4 Proofs
},
author={
Anshuman Singh
},
date={
5/25/26
},
organization={Apart Research},
note={Research submission to the research sprint hosted by Apart.},
howpublished={https://apartresearch.com}
}


