Remix.run Logo
▲ solomonb an hour ago

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