# I checked Clojure's core with Lean and found unreported bugs

- HackerByte page: <https://hackerbyte.net/en/stories/verification-of-clojure-s-core-functionality-using-the-lean-theorem-prover-revea-50642939>
- Original source: <https://s.conao3.com/blog/2026/e4f733>
- Hacker News discussion: <https://news.ycombinator.com/item?id=50642939>
- Submitted to Hacker News: 2026-11-25T14:56:52.000Z

Verification of Clojure's core functionality using the Lean theorem prover revealed previously unreported bugs.

## AI-generated summary

The author formally verified parts of Clojure's core Java implementation using the Lean 4 proof assistant. Despite Clojure's maturity, 17 previously unreported bugs were discovered, primarily in arithmetic operations and data structure interop, outside the core HAMT and vector tree structures. While differential testing matched Java's collections, specific edge cases in Clojure's implementations were revealed through formal methods.

## Key points

- 17 previously unreported bugs found in Clojure's core Java implementation.
- Bugs were located in arithmetic, vector\-of operations, and Hash Collision Node handling.
- Lean 4's formal verification found issues missed by differential testing and existing bug trackers.
- Specific interop issues between Clojure functions and Java interfaces were identified.
- Core data structures like HAMT and vector trees showed no bugs under extensive testing.
