Remix.run Logo
▲ danilafe 2 hours ago

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.

▲nylonstrung an hour ago | parent | next [-]

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

▲danilafe an hour ago | parent [-]

Thank you for your kind words!

> 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

I think this is the sort of approach we should pursue to make progress towards verification as an industry. But every time I write low-level code, and have to think through complicated cases, I feel that it is there that I need the most help. That's when I dream of a tool that can meet me at my level of abstraction and help me lean on rigor and verification. This is part of why mainstream verifiable languages have been on my mind personally, and I admit this implicit bias may affect the focus of the article and original claims.

▲jeremyjh an hour ago | parent | prev | next [-]

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/

▲danilafe an hour ago | parent [-]

Absolutely. Libraries like servant in Haskell, too, relied on extensions to the language (was it data kinds and GADTs?) to make for some very, very sleek abstractions. Lean comes with these language features, but in a single unified type system, and it has even more goodies!

▲jeremyjh an hour ago | parent [-]

What was surprising to me is that (at least some) Lean code is easier to understand than the machinery behind Servant, since you are just using normal code to operate on types.

▲nylonstrung an hour ago | parent [-]

This to me is the single most mindblowing part of Lean that has not been fully taken advantage of yet: that types themselves are first class and fully programmable in a way indistinct from normal code

And it compounds with Lean's dependent type system and the ability for proofs to be "bundled" into said dependent types and then erase at elab time

▲erichocean an hour ago | parent | prev [-]

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/