| ▲ | nylonstrung 2 hours ago |
| We don't need a new verifiable language, everyone trying to build new ones is suffering from NIH in my opinion. Lean is already an extremely powerful and performant FP whose capability is essentially a superset of all other FPs and which has the most powerful metaprogramming and DSL building features outside of Racket It has massive, likely insurmountable network effects in terms of the lemmas already written for it which can be reused in general purpose contexts What we need is more libraries, frameworks, contributions to Core and Batteries which make it more useful outside of the domain of pure proofs and mathematics which has obviously been the focus so far. |
|
| ▲ | jeremyjh an hour ago | parent | next [-] |
| The author acknowledged that. I recently discovered this on my own and was surprised to learn that: * Lean 4 is self-hosting * Lean has monadic I/O, do notation, type classes and other Haskell inspired syntax and language features. * There is at least one guy building infrastructure fundamentals for web app development: https://github.com/paulbutcher?tab=repositories&q=&type=&lan... * If you know and like Haskell, Lean is quite approachable (at least initially). * Dependent types can be much easier to understand than the capabilities possible with the many different type extensions in Haskell. For example, lean-pq has compile time verification of usage of table schemas (that are defined in code) and the machinery for that is very simple to understand compared to the various Haskell libraries that achieve this (click the Try it link at the bottom of the README section on this at https://github.com/typednotes/lean-pq#compile-time-column-ve...) |
| |
|
| ▲ | danilafe 2 hours ago | parent | prev | next [-] |
| 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/ |
|
|
| ▲ | dnautics an hour ago | parent | prev [-] |
| > capability is essentially a superset of all other FPs Is that what we really want? For SW verification you mostly want "just plain logic" and really "set theory" is enough. Sure, the result will be more verbose, but do we care anymore now that the LLMs are writing so much of things? We should pivot to one where these two properties hold: 1. The bridge between the code and the proof is obvious 2. The proof is easily checkable by a human. That could mean more verbose, if you don't elide logical step or steps where the prover goes and looks for a theorem that satisfies the assertion. |
| |
| ▲ | jeremyjh an hour ago | parent | next [-] | | The article addresses this - there are two different models and they have different pros and cons - probably there is not a single model that is best for every use case. Lean - used alone - would be the intrinsic model. Lean, or another formal language, bridged to a programming language (like the Aeneas project with Rust https://lean-lang.org/use-cases/aeneas/) would be the extrinsic. I haven't gotten far enough into this to really speak knowledgeably about this, but my intuition suggests that the intrinsic model has some significant advantages - specifically it encourages/forces you to model all your invariants in a dependent type system in the first place, and then you can prove things about the interaction of those invariants in a higher abstraction layer that is continuously checked as the program evolves. A language without a dependent type system is significantly constrained in the invariants it can prove in its type system alone - perhaps there are properties you'd have to prove with (pure) unit tests to supplement the type system, and this further constrains design. | | |
| ▲ | dnautics 41 minutes ago | parent [-] | | > A language without a dependent type system is significantly constrained in the invariants it can prove in its type system alone I mean, no? Sure, you can't prove that some user function doesn't make a syscall that under the hood allocates on page, for example, but you can certainly derive invariants (like safety guarantees) based on stdlib usage, and report if a stray syscall or ffi occurs for manual review. You could also maintain a list of "cleared" syscalls/ffis that the prover should just ignore moving forward. As for other things, you're going to have to annotate your software in general. Be that in comments, some sort of metadata tag, even some in-tree manifest file. For example rust does not encode "this is a database call" in its type system. So if you want to instrument your code to verify that no consistency errors can occur (for example, not wrapping a read-modify-write in a transaction) you can't just do it by analyzing the language, you'll have to write your "own plugin". That's why having access to the IR (versus the asm) is better, because you have access to metadata that gets chucked out the window when it goes to asm. |
| |
| ▲ | nylonstrung an hour ago | parent | prev [-] | | My personal thesis and hope is that Lean's real value is being an extremely useful general purpose pure functional language a that, unlike Haskell etc, has a genuine "wedge" and superpower in the form of proof solving I think all the capability it has to verify software and improve correctness are realized far more fully and elegantly if the software itself is built with Lean. Ironically, much of the of software verification by proof it's known for can be rendered unnecessary IMO because for example typechecker itself can enforce correctness by construction "Come for the verification, stay for the type system and metaprogramming." At the very least the proof/verification usecase has resulted in hundreds of millions poured into Lean-centric startups like Harmonic and LLM post-training which gives it an advantage no other existing functional language has had or will ever have. |
|