r/Clojure • u/agumonkey • 2d ago
Checked Clojure's core with Lean and differential testing and found unreported bugs in HAMT and vector-of
https://s.conao3.com/blog/2026/e4f733
75
Upvotes
r/Clojure • u/agumonkey • 2d ago
6
u/alexdmiller 1d ago
Very useful work, I'm working through these and filing bugs/patches as I go. I would not classify everything here as bugs, some fall into "undefined behavior" territory.
16
u/steloflute 2d ago
Automated program analysis can be used to create better programs.
8
u/J_M_B 2d ago
I've been using ACL2 to verify a Clojure I wrote on top of Fortran. Lean didn't seem like the best tool to me because I wasn't just proving things that are mathematical as I am formalizing a programming language. I admit I just might not have been able to figure out how to leverage lean.
The road to a formally proven Clojure using acl2 books is a long one though. I had to stop because it was taking forever and also because I was afraid of having a system that would be too brittle. I have managed to get large parts of the system formally verified, including the garbage collector, heap and threads. I also generate my fortran source code by translating the acl2 models directly into code with a proven generator. Not all parts are covered and I am giving myself more flexibility for the parts of the language that will be more static.
The harness consists of the following: cross-referencing gfortran and flang compiler outputs and the respective behavior of their outputs, clojure spec fuzzing and acl2 formal proofs. Fuzzing on the whole finds a lot of bugs. ACL2 books helped me verify the language is working as intended.
1
u/deaddyfreddy 1d ago edited 1d ago
They don't:
Is it a bug?