Direct answer: A developer modeled Clojure's core persistent data structures in the Lean proof assistant, backed by differential testing, and reports 17 bugs absent from Clojure's tracker. Per the writeup: an infinite loop in reduce on vector-of, and a key-hiding bug in hash-collision node removal.

The trending query sits on the Hacker News front page on November 25, 2026.

The author's post, dated November 24, 2026 and also discussed on Lobsters, describes modeling Clojure's core in Lean and running differential tests, with findings reported publicly so maintainers can act. The durable lesson: machine-checked proofs and differential testing catch different bug classes, and neither replaces the other.

What Lean checks, mechanically

Lean is a proof assistant: you write definitions and proofs, and a small trusted kernel verifies every deduction step. A proof about a data structure is only as good as its model, so the work is formalizing Clojure's persistent structures faithfully, then proving properties such as lookup consistency.

Differential testing complements the proofs: run the same operations through the model and the real implementation, and flag any divergence. A mismatch points at either a model gap or a genuine bug, and each finding needs triage.

roothash bit 0hash bit 1k1 k2collision nodeShared branches make updates cheap and invariants load-bearing.

Why persistent structures hide subtle bugs

Clojure's maps and vectors are persistent: updates share structure between versions instead of copying. The hash array mapped trie, or HAMT, that backs them branches by hash bits, and when two keys share those bits, a collision node holds both.

Removal inside a collision node must preserve the invariants that lookup depends on, which is exactly where the writeup reports a key-hiding bug in dissoc. The other example, an infinite loop in reduce over vector-of, shows how a small edge case can swallow a whole program.

missedyour Brain mapquiz yourselfmasteredWatch your weak spots turn green.

Drop in your PDF - it doesn't leave your device.
Every miss becomes a red node on your map.
Free plan: 21 nodes, no card, no countdown.

Open Brain - free

What machine-checked does and does not prove

A Lean proof covers the model, so it certifies the math you wrote down. It does not automatically certify the shipped Clojure code, unless the model is extracted from or cross-checked against the real source, which is where differential testing earns its seat.

The other gap is specification: a proof of the wrong property is airtight and useless. Seventeen findings from one author's project is a useful reminder that standard libraries earn their reputation through exactly this kind of external scrutiny.

MethodWhat it catchesWhat it misses
Lean proofLogic errors in the modeled properties.Gaps between model and shipped code.
Differential testingBehavior divergences on run inputs.Untested paths and wrong specs.
Unit testsKnown regressions per case.Everything outside the chosen cases.

Key takeaways

  • Lean verifies proofs step by step with a trusted kernel, so a data-structure claim becomes machine-checked once the model is faithful.
  • Persistent structures share branches between versions, and collision nodes inside the HAMT are a classic spot for invariant bugs.
  • The writeup reports 17 unreported findings, including an infinite loop in reduce on vector-of and a key-hiding bug in collision-node dissoc.
  • Proofs certify the model, differential testing probes the implementation, and production confidence needs both plus review.

Quick answers

What is the Lean theorem prover?
A proof assistant where definitions and proofs are checked mechanically by a small trusted kernel. It is used here to formalize Clojure's persistent data structures.

What is a HAMT?
A hash array mapped trie, the structure behind Clojure's maps and sets. It branches on hash bits and stores colliding keys in shared collision nodes.

What bugs were reported?
Per the writeup, 17 findings absent from Clojure's tracker, including an infinite loop in reduce on vector-of and a key-hiding bug in collision-node removal.

Does a Lean proof prove the Clojure code correct?
It proves properties of the formal model. Bridging model and shipped code needs extraction or cross-checking, which is where differential testing helps.

One thing to do tonight

Read the post's findings list and pick one bug, then predict whether your daily language's equivalent structure would share it. Writing a two-line reproduction attempt in any REPL or scratch file turns the report into a concrete experiment. Follow the thread for maintainer responses, since triage is where verification becomes fixes.