logoalt Hacker News

danilafe • yesterday at 5:42 PM • 4 replies • view on HN

I agree with you in part, as I have lightly alluded to in my article. There's a lot to love! Lean's typeclasses + inference, metaprogramming, custom notation, "X implemented as Y" support, and much more are fantastic.

It's not clear to me, however, that the space is completely filled. I find it hard to imagine using Lean for software that deeply interacts with the OS or hardware, or even just "doesn't refcount". Am I unaware of progress in this area? In a similar vein, in terms of practical software success, I think we've seen the most with model checking, yet Lean is not particularly amenable to this. It remains to be seen whether tactics and proofs (+ some sort of repair) will beat out the incumbent.


Replies

nylonstrung • yesterday at 6:16 PM

Great article BTW, I think it was incredibly detailed and well written

> I find it hard to imagine using Lean for software that deeply interacts with the OS or hardware, or even just "doesn't refcount".

This is true: my thought is that the path to using Lean for "practical software" looks like delegating a lot of stuff like I/O to Rust libs. Lean will soon be able to compile to LLVM IR instead of just C and IMO it makes more sense to think about how to fill the gaps with the smartest cross-lang approaches rather than to rebuild a lot of basic stuff as pure Lean

➕ show 1 reply
kccqzy • yesterday at 11:39 PM

I think one aspect that real software cares a lot more but hard to formally verify is performance. Basic big-O is in the realm of mathematics and doable, but important details like cache locality, SoA versus AoS, compiler-guaranteed tailcalls and compiler-guaranteed strength reduction are all aspects that need to be tackled before we can formally verify software.

jeremyjh • yesterday at 6:09 PM

I really liked your article, and I haven't read or absorbed all of it yet but I agreed with your points on this topic.

I think Lean could perhaps serve in most server application use cases (and many others - roughly any use case where you could use Haskell), and Aeneas or something like it could leverage Lean only for verification. https://lean-lang.org/use-cases/aeneas/

➕ show 1 reply
erichocean • yesterday at 6:09 PM

I'm doing Lean 4 certificates for Armv9 assembly. It's doable.

Update: Google did something similar here: https://deepmind.google/blog/introducing-alphaproof-code/