# Zulip Chat Archive

## Stream: new members

### Topic: Joel McCracken

#### Joel McCracken (Feb 18 2023 at 19:35):

Hi, My name is Joel. I'm a professional Haskell developer, and have been growing my interest in Lean and mathematics in general.

#### Joel McCracken (Feb 18 2023 at 19:52):

as I study deeper topics in CS and PLT especially, I run into problems where my lack of training in proving things is limiting my ability to understand the material. So, I've been working on that. I'm slowly working through Velleman's *How to Prove It,* but I naturally wish I had a way to check my proofs, as I have no idea if my proof is correct (or not).

What I'd like to do is use Lean for this, but I've been having some trouble getting started with it and understanding how bits and pieces fit together. So, as a way to resolve that, I started looking at the learning resources for lean, with the goal of starting with some simpler proofs and building from there. So, I started reading https://leanprover.github.io/logic_and_proof/index.html

does not currently work (this is the second example here https://leanprover.github.io/logic_and_proof/introduction.html#interactive-theorem-proving), I really don't understand the error message from the lean-web-editor. Was mathlib updated with backwards incompatible changes on the web editor or something? Can I change that? If not, can I find out which versions I need and set them up locally?

So, I guess I'm looking for some general guidance. Where do I start on this Journey?

Additionally, from what I read, while its clear that lean 4 is not backwards compatible with lean 3, based upon what I read here https://leanprover.github.io/lean4/doc/lean3changes.html, it seems that it should be relatively straightforward to translate anything written about lean 3 to lean 4?

#### Kyle Miller (Feb 18 2023 at 20:04):

Just to answer your question about the errors in the proof, here's something I got working with some renamings:

```
import data.nat.prime
open nat
theorem sqrt_two_irrational {a b : ℕ} (co : gcd a b = 1) :
a^2 ≠ 2 * b^2 :=
assume h : a^2 = 2 * b^2,
have 2 ∣ a^2,
by simp [h],
have 2 ∣ a,
from nat.prime.dvd_of_dvd_pow prime_two this,
exists.elim this $
assume (c : nat) (aeq : a = 2 * c),
have 2 * (2 * c^2) = 2 * b^2,
by simp [eq.symm h, aeq];
simp [pow_succ', mul_comm, mul_assoc, mul_left_comm],
have 2 * c^2 = b^2,
from mul_left_cancel₀ dec_trivial this,
have 2 ∣ b^2,
by simp [eq.symm this],
have 2 ∣ b,
from nat.prime.dvd_of_dvd_pow prime_two this,
have 2 ∣ gcd a b,
from dvd_gcd ‹2 ∣ a› ‹2 ∣ b›,
have 2 ∣ (1 : ℕ),
by simp * at *,
show false, from absurd ‹2 ∣ 1› dec_trivial
```

#### Kyle Miller (Feb 18 2023 at 20:05):

One problem is that there's now both `prime`

and `nat.prime`

, so I needed to fully qualify `nat.prime.dvd_of_dvd_pow`

. The second is that `mul_left_cancel'`

seems to have been renamed to `mul_left_cancel₀`

.

#### Kyle Miller (Feb 18 2023 at 20:07):

I'm not sure which version of Lean & mathlib the textbook Logic and Proof is expecting, but in principle you can set up a project locally on your computer with exactly the right versions to follow along with the textbook.

#### Kyle Miller (Feb 18 2023 at 20:08):

Here's one resource to keep with with all of mathlib's backwards incompatible changes, for example https://mathlib-changelog.org/theorem/mul_left_cancel'

#### Kyle Miller (Feb 18 2023 at 20:09):

If you haven't done it already, as a very first step you could do #nng

#### Joel McCracken (Feb 18 2023 at 20:15):

Ah, thank you!

#### Kevin Buzzard (Feb 18 2023 at 20:26):

@Dan Velleman is on this server and they've been thinking about their book and Lean!

#### Joel McCracken (Feb 18 2023 at 20:55):

Oh cool, well @Dan Velleman if you did that I would certainly enjoy it =) I've been considering putting my proofs up on github when I get them.

#### Dan Velleman (Feb 18 2023 at 21:14):

Joel, you could be a guinea pig for a project I'm working on. You can find it here.

#### Joel McCracken (Feb 18 2023 at 21:39):

Oh sweet, yeah I'll totally do it. Are you open to any contributions? I was hoping to also verify some of the earlier proofs, for example these were long enough that I started to feel uncertain that I had done them correctly: Screen-Shot-2023-02-18-at-4.36.54-PM.png (from section 1.4 page 43)

#### Joel McCracken (Feb 18 2023 at 21:43):

Ah, ok, so it seems that your recommendation is to do it by hand until section 3.2. OK, I can do that

#### Dan Velleman (Feb 18 2023 at 21:50):

Eventually you will be able to do proofs like that, but they're probably not the best ones to start with.

#### Dan Velleman (Feb 18 2023 at 22:20):

A couple of warnings:

- This is a work in progress. There may be glitches, and things may change.
- My focus is on teaching math, not teaching Lean. So there's lots of stuff about Lean that isn't covered, and the Lean proofs look pretty different from the proofs that most Lean users write.

I'd really appreciate any feedback you can give me.

#### Joel McCracken (Feb 18 2023 at 22:34):

ok, will do! I really like your book, it has helped me get past some points I've been struggling with for a long time. I'll definitely be working though this lean adaptation of your book. Thanks!

Last updated: Dec 20 2023 at 11:08 UTC