First, (.indexOf (seq (byte-array [1 2 3])) 2) fails because byte arrays store bytes and the argument 2 to `.indexOf` is a Long value. Simple type checking (via eyeballing) could have flagged the incorrect usage. I think such exercises can be more helpful if we can reduce the noise.
Second, (get "abc" 1.9) fails because `get` coerces the given key to integer in the context of string objects, which makes sense; specifically in the context of weakly typed language. That said, I believe that detailed documentation of the behavior of `get` can help clients just as well as returning `nil` or not-found value. However, we are still left with questions such as "who and where do we draw the line about the dynamism of the language?" and "what is the agreed upon semantics that we are checking against?"
Hyrum's law, anyone?
> With a sufficient number of users of an API, it does not matter what you promise in the contract: all observable behaviors of your system will be depended on by somebody.
To be fair this is true in more traditional verification too but Systemverilog is designed to model digital logic with multiple levels of abstraction.
My first thought in reading the title is how likely is it they got their models right?
Modeling mathematical theorems is probably much more natural in lean, but even there it seems like flawed models are a huge risk. I think it’s mitigated by a greater set of peers skilled in validating these sorts of models. I m skeptical that is true of software or chip designs.
Now, during the design and architecture stage I imagine there can be a lot of value in proving a model before you commit to a design.
Asking as someone who doesn't know Clojure (or really any lisp): are you saying that this isn't actually a bug, or that the bug could have easily been spotted by a human?
If the former, that certainly makes the output here somewhat questionable, but if latter, what you're saying basically sounds like it could apply to any runtime type error due to a lack of static type checking that's ever occurred (or really any bug at all); programmers are capable of noticing virtually any bug in theory, but in practice no one is actually able to catch all of them up front. Having a type system is useful because it genuinely does a better job than humans at spotting bugs like this. If you're using a dynamically typed language, there will be errors that human eyeballs could notice but didn't.
The disagreement between `.indexOf` and `.contains` is interesting. Nice catch!!
Digging into the code, `.indexOf` invokes `ArraySeq_byte.indexOf` while `.contains` invokes `ASeq.contains`. Interestingly, `ASeq.contains` and `ASeq.indexOf` have similar behavior while `ArraySeq_byte.indexOf` and `ASeq.contains` different behavior.
Are language models significantly better at writing Lean than Rocq?
As for why Lean is now used: I guess it's just frontier labs having configured their RLVR environments for Lean? Not sure why, though intuitively I think of Mathlib.
Sadly, posted on LinkedIn, but in a nutshell, he claims that LLMs are not a tool, they are intrinsic automation.
And by using them, you are kinda giving up.
[dead]
[dead]
Lisp/clojure/scheme etc is inherently untyped. These libs don't guarantee anything near to the level that a formal verification would suggest.
If this were the haskell standard lib however, that would be news.
So, while I prefer changing get's behavior to match our intuition in the context of string objects, I think it could go either way, which is not saying much :)
Well, what does the specification say?
That said, I think the issue of model fidelity and spec/property correctness will still exist in a reduced form. Also, simpler solutions/tools may be better suited for certain classes of properties.
As for how this exercise worked, my guess is that the agent models both the SUT and the environment, encodes the property based on property templates, and checks the model for bugs (w/ counterexample) or correctness proof using a set of tactics; see https://github.com/hirosassa/lean-verify/blob/main/skills/le.... I hope the author or others can provide a better explanation.
This is not a bug. This is acting as you would expect once you realize the types you are looking at. While a simple reading of this would expect it to return the "3", this line doesn't return the "3" because the "2" is a Java Long, while the bytes are bytes.
[1] https://www.quantabooks.org/books/the-proof-in-the-code/
Most use OpenJDK upstream Java code and SDK and HotSpot jvm code. Even if you didn't also check vendor patches, the huge majority of code and behavior would still be covered by the verification, and this already covers the largest share of users.
Then you have all the others that have nothing to do with OpenJDK, like PTC, Aicas, microEJ, and the myriad of embedded ones.
We're talking about verifying the codebase, not the binary or the compiler.
-was-. JVM belongs in the same box.
- Idiomatic Clojure code has less defects whether written by humans or by LLMs.
- Less code (more expressive).
- LLMs can use the REPL to explore and modify the program in real time, and functional code makes this safe.
Don't be sad. You can disagree with the creator of a technology and still use the technology.
[What tipped the scales for Closure] https://www.youtube.com/watch?v=tzzg8CVkl2A
https://mccormick.cx/news/entries/advantages-of-generating-c...
Just the other day, someone told me "AI tools can write better code than you, right?", that gave me a chuckle. Yet that attitude is pervasive, I worry it encourages people to let the tool do all of the work. At that point I find myself agreeing with Rich: is it even a tool anymore?
The main advantage Clojure has in LLM use is that it has a good REPL. LLMs are quite fast at writing code; the bottleneck is often the time it takes to compile and test that code, which is higher for most compiled languages than it is for an open REPL. A LLM writing Clojure typically has a faster iteration loop than one writing C++.
And while I have no hard evidence of this, I also wonder if Clojure's general design philosophy of reducing complexity (i.e. interconnectivity) is also a benefit for LLMs. My experience is that LLMs tend to be more effective the more isolated and unconnected a piece of code is, which Clojure is specifically designed around.
Things trickle down to Haskell from higher up but it takes a long time to incorporate them. Dependent Haskell has been in the making for like… 9 years? Maybe more? And it’s still being debated whether Haskell should even adopt it.
The type theory needed for formal proofs is much more advanced at this point. Idris, Agda, Lean, Roq… this is where you need to look to see the 100’s.
It means Not True Scotsman Typed.
You can't think of it as "lacking type information"; watch out: that's a trap laid to reveal you as a n00b who doesn't speak the lingo.
I understand Clojure is strongly typed too.
At the implementation level, there exist storage locations (which we might call "value cells"). These can hold any value and so in a sense they have one type.
The abstract nodes of the program, its expressions, have a type we can reason about. Often a single type that can be known without executing the program..
Static functional languages, too, have typeless value cells in their implementations: word-sized units of storage that can point to anything and may have type tags, gc bits and whatnot. The difference is that nodes of the abstract program are checked.
Dynamic languages have type inference implementations also. The situation is not so strict that an uncheckable program may not be executed, though.
“[…] reduce it, the call never returns once the vector has 65505 or more elements.”
> These libs don't guarantee anything near to the level that a formal verification would suggest.
This is just plain wrong. A lisp library can absolutely make performance and correctness guarantees, and formal methods can refute or verify those guarantees. A type system is just a special kind of formal method that can rule out certain classes of bugs.
I have used Lisps with LLMs a bit. I toyed around with an indented Lisp I developed with LLMs, to get rid of all the parenthesis, maybe make the LLM more capable of writing it since it looked somewhat closer to Python. I still play around with it, its nice to look at.