
Doing a math assignment with the Lean theorem prover - ahelwer
https://ahelwer.ca/post/2020-04-05-lean-assignment/
======
xvilka
The same can be done also with Coq[1], it is easy to learn[2], actively
developed[3], and better documented[4]. You can also visit their discussion
board[5]. Regarding the usual Lean vs Coq "war" and so-called "setoid hell"
you can read a lengthy discussion on their GitHub[6].

[1] [http://coq.inria.fr/](http://coq.inria.fr/)

[2]
[https://learnxinyminutes.com/docs/coq/](https://learnxinyminutes.com/docs/coq/)

[3] [https://github.com/coq/coq](https://github.com/coq/coq)

[4]
[https://softwarefoundations.cis.upenn.edu/](https://softwarefoundations.cis.upenn.edu/)

[5] [https://coq.discourse.group/](https://coq.discourse.group/)

[6]
[https://github.com/coq/coq/issues/10871](https://github.com/coq/coq/issues/10871)

~~~
ivanbakel
That final link is very insightful. Not to pick sides, but if Lean really
doesn't have subject reduction when you use quotient types, that's a crazy
property to drop (or lose accidentally).

~~~
zozbot234
Setoids are also very relevant in constructive math, for similar reasons.
Quotient types/sets basically conflate cases where one can easily normalize
the elements of some equivalent class vs. cases where this cannot be done
effectively, and that's not a good approach at all.

~~~
kevinbuzzard
Lean's maths library development is essentially completely focussed on
classical mathematics, which is why it has been so successful in drawing
"working mathematicians" in. Such people do not care at all about the issues
involving quotients, indeed quotients in Lean work just fine for them, and
they don't care about constructibility either, because this is the prevailing
culture in maths departments (although it is not, I am well aware, the
prevailing culture in computer science departments). If you are interested in
constructivism I would not recommend Lean. Many of the developments in mathlib
are classical. That's why it's moving so quickly -- classical mathematics is
much easier.

------
logicchains
For people interested in using Lean, note that there's a community fork
([https://github.com/leanprover-community/lean](https://github.com/leanprover-
community/lean)) of the last official Lean 3 release 3.4.2
([https://github.com/leanprover/lean](https://github.com/leanprover/lean)).
The fork is still under active maintenance, so might be a better place to
start (the main development team have moved onto developing Lean 4.0
([https://github.com/leanprover/lean4](https://github.com/leanprover/lean4)),
and it's not clear when that will be ready).

------
abjKT26nO8
It's a bit ironic, but the author repeated the same error every time they
wrote the formula involving sigma. What they wanted to write was $\sum_{0}^{n}
k$. What they actually wrote ($\sum_{0}^{n} n$) is equal to $n \cdot (n+1)$
(without the division by 2).

~~~
mkl
Yes, though it's better to define k: $\sum_{k=0}^n k$.

~~~
ahelwer
lol oops, fixed thanks!

------
outlace
I just started learning Lean today - what a coincidence. I have found learning
lean difficult but gratifying. The post serves as further motivation.

------
dhosek
It's a pity that the author's high school didn't use geometry as the means of
introducing the concept of mathematical proof. The classical high school two-
column proof is in many ways quite similar to the methods of Lean, albeit with
a different structure.

~~~
Smaug123
I greatly recommend Lockhart's Lament
([https://www.maa.org/external_archive/devlin/LockhartsLament....](https://www.maa.org/external_archive/devlin/LockhartsLament.pdf))
which says exactly the opposite.

I didn't personally undergo "two-column proof" education, and learned what the
phrase means from Lockhart's Lament itself, but it sounds miserable; I say
this as an MMath who specialised in set theory and logic, and who has been
side-project formalising maths in Agda for the last two years.

~~~
JadeNB
> I didn't personally undergo "two-column proof" education, and learned what
> the phrase means from Lockhart's Lament itself, but it sounds miserable; I
> say this as an MMath who specialised in set theory and logic, and who has
> been side-project formalising maths in Agda for the last two years.

As a professional mathematician who _did_ go through two-column proof, you're
not the only one who finds them miserable. Personally, abstract algebra was
what won me over to the beauty of proof (probably that old standby, the
irrationality of sqrt(2), was the first); but everyone will find a different
experience.

~~~
dhosek
Aesthetically, two-column proofs are miserable, but they have the advantage
that the logic is very clearly laid out. There's no chance to hand-wave when
every step of the proof needs to be explicitly justified.

------
wwarner
This is really futuristic. Feels like it could be applied to model based
design.

------
masteranza
The example the author provided is too trivial to convince me to use lean.

~~~
kevinbuzzard
[Here]([https://arxiv.org/abs/1907.01449](https://arxiv.org/abs/1907.01449))
is a Lean formalisation of a 2017 Annals of Mathematics paper.

