Lean – Theorem Prover
leanprover.github.io
leanprover.github.io
https://www.typetheoryforall.com/2023/01/16/26-Kevin-Buzzard...
It is great to see that with Lean/mathlib computer scientists and mathematicians have found a way to work together and benefit from the insights and skills of each other.
So please continue doing what you are doing. I believe it will long term have a massive positive impact on both computer science and mathematics.
It made me realise yet again that the math used by computer scientists is usually different from the math used by mathematicians. Because what computer scientists care about (computations and proofs) is very different from what mathematicians care about (structures and proofs).
Which means that computer scientists often choose a different foundation for the mathematics they use. Set theory is but one possible foundation. However other foundations (based on type theory for example) are more useful for computer scientists. Resulting in a different flavour of mathematics. And things that are proven to be true in one foundation isn’t necessarily true in another foundation.
However it is all still math. Just different flavours of math based on different foundational axioms.
https://www.ma.imperial.ac.uk/~buzzard/xena/natural_number_g...
Looking briefly at the example code, it seems pretty similar.
Minor differences: - On the Lean side I leveraged the fact that Arrays can mutate in place (if the refcount is 1). For Idris I'd use a Buffer (IO Monad) or SortedMap. - Lean has a nice mechanism where I can drop an #eval or #check in the code and have the result show up in an editor pane. For most days, I never compiled/ran the code separately. - Lean defaults to total, so I had to put partial in a couple of places.[1] - Lean could have accepted proofs that my indices were in range, but I used the unsafe functions instead.[2] - Idris has some nice editor functionality to stub out functions and case splits for you.
[1]: Idris2 defaults to "covering", which says case splits have to cover, but relaxes termination checking. A couple of the spots where I put partial in lean could be proven total, but I was not familiar with the theorem proving corner of lean. Idris totality checking is slightly different in that you can't add proofs, but I think you can achieve the same results by adding additional arguments.
[2]: Because I didn't know the theorem proving bits, but I intend to go back and try to patch these up as an exercise.
It has improved a lot but still I think Lean has many things going for it including a large focus on programming and using your Lean programs directly (versus extraction, which is roughly a really shitty compiler from Coq to Ocaml or another extracted language).
Coq has FRAP and CPDT [1], which teach you most techniques that are used in industry. Also Software Foundations.
AFAIK, there's a version of Concrete Semantics using Lean [2]. But that's still just semantics.
Any other materials focused on software verification, not on formalizing mathematics?
It will blow your mind.
The future of interactive theorem proving? - https://news.ycombinator.com/item?id=32489099 - Aug 2022 (16 comments)
The Lean Theorem Prover - https://news.ycombinator.com/item?id=30752610 - March 2022 (1 comment)
Propositional logic exercises with the lean theorem prover - https://news.ycombinator.com/item?id=28951457 - Oct 2021 (8 comments)
The Natural Number Game - https://news.ycombinator.com/item?id=27504877 - June 2021 (2 comments)
A Review of the Lean Theorem Prover - https://news.ycombinator.com/item?id=25550240 - Dec 2020 (11 comments)
Lean is better for proper maths than all the other theorem provers - https://news.ycombinator.com/item?id=22802490 - April 2020 (1 comment)
Natural number game - https://news.ycombinator.com/item?id=22801607 - April 2020 (14 comments)
Lean Book: The Hitchhiker's Guide to Logical Verification [pdf] - https://news.ycombinator.com/item?id=22794533 - April 2020 (19 comments)
Doing a math assignment with the Lean theorem prover - https://news.ycombinator.com/item?id=22789953 - April 2020 (29 comments)
Coq is a Lean Typechecker - https://news.ycombinator.com/item?id=22171305 - Jan 2020 (31 comments)
Theorem Proving in Lean [pdf] - https://news.ycombinator.com/item?id=21108357 - Sept 2019 (22 comments)
Theorem Proving in Lean - https://news.ycombinator.com/item?id=17171101 - May 2018 (30 comments)
Theorem Proving in Lean - https://news.ycombinator.com/item?id=9424507 - April 2015 (1 comment)
Tutorial: Theorem Proving in Lean - https://news.ycombinator.com/item?id=9288135 - March 2015 (2 comments)
Also related and interesting:
https://news.ycombinator.com/threads?id=kevinbuzzard
Mathematicians welcome computer-assisted proof in ‘grand unification’ theory - https://news.ycombinator.com/item?id=27559917 - June 2021 (136 comments)
Formalising Mathematics: An Introduction - https://news.ycombinator.com/item?id=26214593 - Feb 2021 (116 comments)
A mathematical formalisation challenge by Peter Scholze - https://news.ycombinator.com/item?id=25322551 - Dec 2020 (24 comments)
At the International Mathematical Olympiad, computers prepare to go for the gold - https://news.ycombinator.com/item?id=24544607 - Sept 2020 (64 comments)
Division by zero in type theory: a FAQ - https://news.ycombinator.com/item?id=23745532 - July 2020 (82 comments)
Where is the fashionable mathematics? - https://news.ycombinator.com/item?id=22390486 - Feb 2020 (64 comments)
Otherwise I guess you would call it a "conjecture prover".
But automated theorem provers (e.g. for first-order logic, SAT, or SMT), they can and have been used to solve open problems in mathematics: the famous four-color theorem, but many others.
The Liquid Tensor Experiment [1] formalised a proof that the author himself found sufficiently complicated to have doubts about. And at a very different level, I myself began to formalise a proof [2] while it still had at least one hole in it. I was fortunate it turned out to be true!
[1] https://leanprover-community.github.io/blog/posts/lte-final/ [2] https://github.com/agjftucker/exists-unique
I knew somebody whose PhD project was a proof that all objects X are in Y. After rather some time he found instead that there are no objects X. That proof was not considered PhD material, although it seems like it should have been.
There are several new and non-trivial things going on in this language! Look at the papers about hygienic macros, or functional-but-in-place, or any of the others.