I've been personally invested in these tools for a long time through my interest and experience in functional programming. Its been a wild ride to see their exposure and utilization blow up in the past year.
Before AI the only people really interested in this class of proof checkers was a narrow slice of mathematicians/logicians, programming language theory/type theory researchers, and those of us from the functional programming world who went off the deep end. Outside of this cohort tools like Lean, Agda, and Rocq (formerl Coq) were essentially unheard of.
I think most of us invested in the space assumed dependently typed languages were the future but that that future was many years away from hitting the mainstream.
I’ve only heard of these neato languages on hackernews. Could you write a regular ol’ program with a language like Lean? Like a web server or CLI? And would it be like… proved?? Do “proofs” make sense in the context of regular ol’ software?
Yes, in certain contexts a “proof” of software can be useful. See https://compcert.org/ for a formally verified C compiler; I know it’s been used to compile C code for aircraft. I’m not entirely sure how useful Lean is for developing software like this, but I know it has some facilities to do so.
> Could you write a regular ol’ program with a language like Lean? Like a web server or CLI?
Yes, absolutely you can build a web server or CLI tool in Lean.
The compiler lowers your code to C, and a bundled clang turns that C into a native binary so it can actually be fast. It also has an FFI. The community is small but there are a growing number of general purpose libraries.
Lean is a pure functional programming language whose type system is strong enough to write proofs. To keep proofs sound, it adds some constraints, but there are escape hatches and you can absolutely use them for general purpose programming.
If you want to see a dependently typed language that can act as a proof checker but is actually aimed at building "regular" software, check out Idris.
> And would it be like… proved??
No, using one for a "regular" programming does not mean you have done any formal verification. You would have to specifically use the theorem proving language features to prove anything.
> Do “proofs” make sense in the context of regular ol’ software?
Yes! You can write proofs about invariants in your program and have the compiler enforce them. For example, you could write a list index function that requires a proof that the index is in bounds. Writing proofs is hard and you have to think like a type theorist, but you can do some really cool stuff in these languages.
Yes. There are verified compilers and OS kernels for example. Here's a recent example for someone coding a simple, yet surprisingly performant web server in Lean: https://theoric.com/blog/deriving_the_runtime/
You don’t need to write proofs. You can if you want to. Like you could prove that adding two sized vectors results on a new sized vector with the appropriate length. That’s a trivial one but the sky’s the limit with what iou want to prove about your programs.
It was too expensive to write down a precise enough spec for most things, then it was way too expensive to prove it automatically for most of what survived step 1 and then the proposition to reimplement the solution for the second time and keep the formal proof and production code in sync was just ridiculous.
It is today not at all ridiculous - in fact, it’s becoming irresponsible to not have formal proofs for the software you’re building.
Before AI the only people really interested in this class of proof checkers was a narrow slice of mathematicians/logicians, programming language theory/type theory researchers, and those of us from the functional programming world who went off the deep end. Outside of this cohort tools like Lean, Agda, and Rocq (formerl Coq) were essentially unheard of.
I think most of us invested in the space assumed dependently typed languages were the future but that that future was many years away from hitting the mainstream.
Replies (4)
Replies (4)
Yes, absolutely you can build a web server or CLI tool in Lean.
The compiler lowers your code to C, and a bundled clang turns that C into a native binary so it can actually be fast. It also has an FFI. The community is small but there are a growing number of general purpose libraries.
Lean is a pure functional programming language whose type system is strong enough to write proofs. To keep proofs sound, it adds some constraints, but there are escape hatches and you can absolutely use them for general purpose programming.
If you want to see a dependently typed language that can act as a proof checker but is actually aimed at building "regular" software, check out Idris.
> And would it be like… proved??
No, using one for a "regular" programming does not mean you have done any formal verification. You would have to specifically use the theorem proving language features to prove anything.
> Do “proofs” make sense in the context of regular ol’ software?
Yes! You can write proofs about invariants in your program and have the compiler enforce them. For example, you could write a list index function that requires a proof that the index is in bounds. Writing proofs is hard and you have to think like a type theorist, but you can do some really cool stuff in these languages.
https://agentultra.github.io/lean-4-hackers/
You don’t need to write proofs. You can if you want to. Like you could prove that adding two sized vectors results on a new sized vector with the appropriate length. That’s a trivial one but the sky’s the limit with what iou want to prove about your programs.
The future is here, and we do not know yet what we can do with it, and how fast it will become the past.
It is today not at all ridiculous - in fact, it’s becoming irresponsible to not have formal proofs for the software you’re building.