Remix.run Logo
▲ solomonb 2 hours ago

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.

▲wuschel 41 minutes ago | parent | next [-]

There is also madness even more unheard of ... e.g. ATS.

The future is here, and we do not know yet what we can do with it, and how fast it will become the past.

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

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?

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

> 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.

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

Yeah you totally can.

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.

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

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.

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

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/

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

I think Coq didn’t caught as much because of the French background. Not sure how much people are excited about Ocaml too.