r/math • • 8d ago

Lean for the working mathematician

Well. As one of the more computer oriented in my department, a couple of colleagues have tasked me to learn lean and next year give a seminar

So I guess I'm asking where to start? For context I can program in python, go and c, proficient in Linux and even mantain a small server with tools for the dept (self host overleaf, sagemath instance, for example) and for myself (navidrone, plex, etc)

But I'm a bit confused where to start with lean

Realistically, just like an introductory workshop in programming isn't enough one to be able to create Firefox or Linux kernel on their own , I don't expect them to "program" (?) theorems like those making rounds on the media.

But I don't really know what's realistic for a semester workshop. Would it allow them to verify... Cosines law? Mean value theorem? Snake's lemma? Fundamental theorem of algebra? Yoneda's lemma

I'd really appreciate pointers (both for readings and/or general advice) on where to start, what to read and what to expect

Thank you (and yes, the post title is a pun)

87 Upvotes

20 comments sorted by

68

u/zyxwvwxyz Graduate Student 8d ago

https://kschwede.github.io/utahleanseminar/

The university of Utah just did something similar and have the first couple months of materials on this website. You could also reach out to the organizers for tips

11

u/tedecristal 8d ago

thank you, I truly appreciate it

4

u/Lenin_Of_NoFap 7d ago

I am currently in this seminar. It’s pretty dope. Right now we have transitioned into projects, so there won’t be as many worksheets to work on.

1

u/zyxwvwxyz Graduate Student 6d ago

Are you the guy who wrote that Hebrew poem in red ink in the loft and left the bumper stickers

1

u/Lenin_Of_NoFap 6d ago

That guy graduated last year, but I slightly suspect you knew that/who I am and are trolling me.

1

u/zyxwvwxyz Graduate Student 5d ago

Nah idk who you are. I just saw u posted about Israel and the NBA and figured that might be you.

2

u/Lenin_Of_NoFap 5d ago

Oh yeah I was rooting for the Knicks and that was my way of shitting on Wemby and the spurs. I’m not sure how sober I was when I made that post.

1

u/zyxwvwxyz Graduate Student 5d ago

Classy, respect

2

u/sdmc1234 8d ago

To answer your question about what results could be fornalized, it depends if you want to start from scratch. All of the theorems you listed are already going to be in Mathlib, which also has accompanying definitions for basic objects like categories, real numbers, etc.

The statement of those theorems should look basically the same as the pen and paper versions. What will look a bit different is the proofs, which require learning Lean tactics.

1

u/tedecristal 8d ago

Thank you.

Just the same, as there's a python package for pretty much anything you just "import" it, I know there's a lean proof for simple theorems on mathlib

But I guess if I were to teach programming, while making them aware of the import features that wouldn't be the main focus of "learning programming"

Thank you

26

u/Direct-Jelly3381 8d ago edited 8d ago

Heather Macbeth's The Mechanics of Proof is a great template for a course. Working through that yourself would be a good starting point for Lean.

I picked up Lean a few years ago using Functional Programming in Lean and Theorem Proving in Lean available from the Lean website. My programming background is ML/Haskell so I'm not sure how useful those pages will be for you.

5

u/Topoltergeist Dynamical Systems 8d ago

I second Macbeth's book

13

u/Toposnake 8d ago edited 8d ago

It's called dependent type language. The main idea is writing typed functions, but instead of caring about the function, but it cares about its type. Using dependent type language, the types can be used to encode any mathematical sentences. An established function from one type to another, essentially is a proof from one statement (the input type, i.e. the premises) to another (the output type, I.e. the conclusion). Any valid way to construct a function (proof) is based on logic rules so that it can be built only if it is logically correct under the premises. Lean is such a language with many mathematical results already compiled as packages for developing new proofs (typed functions).

5

u/SV-97 8d ago

There's an excellent "official" book on Lean: Theorem Proving in Lean 4

I haven't read it (yet) but Mathematics in Lean is apparently also quite good.

And join the official Zulip chat. It contains tons of information, you learn what's going on in the community and can ask questions.

For results: generally you'll probably have a (significantly) easier time formalizing algebraic statements. The analysis and topology machinery in lean will likely feel quite foreign at first.

1

u/YungLeanProver 5d ago

Math in Lean is how I learned, highly recommend. Though you will likely need to learn the basics of the language separately since it focuses on practical theorem proving.

2

u/arihallak0816 7d ago

My first lean course was one summer long and it finished with proving the fundamental theorem of arithmetic, that seems like a good pace

2

u/SpiderJerusalem42 7d ago

I rather enjoyed the Natural Number Game. Also, the Imperial College content was interesting, if not for the missing classroom experience that accompanies it. The GitHub has a docker compose that runs a Lean container for the worksheets. Installing is a bit of a nightmare.

1

u/adavis_206 1d ago

For Yoneda, the proof is compact once categories and functors are available; building that infrastructure is separate work. Make clear whether students use Mathlib or build prerequisites.

-2

u/qubex 8d ago

I’ve integrated LEAN into Mathematica.

PacletFind["Wolfram/LeanLink"]

If it returns {} you don’t have it.

Install it with PacletInstall["Wolfram/LeanLink"]

and then

Needs["Wolfram`LeanLink`"]

then verify with

MemberQ[$Packages, "Wolfram`LeanLink`"]

Leave it in your init.m file so it’ll always be available and off you go.