• Sources: primary
  • Summary: Naoya Yamashita modeled small integer and bit functions from Clojure's core as BitVec definitions in Lean 4 and used bv_decide to find counterexamples, and compared persistent collections with java.util over 3 million random operations. A 0xffe0 mask in gvec.clj makes reduce on a dropped vector-of loop forever at 65505 or more elements, and HashCollisionNode.without stores the dissoc key's hash instead of its own, hiding another key. The HAMT and vector trees showed no mismatches, and the bugs sat where two mechanisms meet, such as equality and hashing.
  • Why it matters: Bit-precise Lean models of arithmetic helpers plus differential testing against a reference collection is a cheap recipe that finds real bugs in mature runtime code.
  • Background: A hash array mapped trie splits a key's hash into 5-bit pieces to walk a 32-way tree, with collision nodes at the bottom for keys whose full hashes match. Lean's bv_decide tactic turns bitvector goals into SAT problems, so it proves or refutes properties over every 32- or 64-bit input, including wraparound.