Naoya Yamashita used Lean to check small models of Clojure’s arithmetic and compared Clojure’s collections with their Java counterparts. He reports 17 previously unreported bugs on Clojure 1.12.7. Several turned up at the edges of routines that otherwise held up under testing.

  • Check a small property. Lean searched fixed-width arithmetic for counterexamples. Yamashita replayed the results in Clojure to check that the model matched the code.
  • Compare a large structure. The ordinary hash-map path matched Java’s HashMap over three million operations in one test run. The checks also exercised vector boundaries where the tree gains a level.
  • Test where contracts meet. Primitive-backed vectors have a separate reduction path that can get stuck. A collision-node bug surfaced because keys that Clojure treats as equal can have different hashes.

Comparing against a reference is a good test of the behavior you share. Write separate checks where your types or rules differ. Those are precisely the cases the reference can’t settle for you.