2.7 KiB
Algebra in Lean
A hands-on introduction to formalizing algebra with the proof assistant Lean and its mathematical library Mathlib. The course accompanies the lecture notes Algebra und Zahlentheorie (Stefan Kebekus, Universität Freiburg) and is aimed at students who are learning algebra and have little prior experience with Lean.
Selected proofs from the lecture notes are translated into Lean sentence by sentence: the German original of each sentence is quoted as a comment directly above the Lean code implementing it, so you can see how the standard phrases of a lecture-style proof translate into Lean/Mathlib.
Getting started
-
Install Lean (
elan, VS Code and the Lean 4 extension). -
Clone this repository and fetch the precompiled Mathlib cache:
git clone <repository url> cd AlgebraInLean lake exe cache get -
Open the folder in VS Code and start with
AlgebraInLean/LittleFermat.lean.
Contents
| File | Lecture notes | Topic |
|---|---|---|
AlgebraInLean/Basics.lean |
Kapitel 2 | First steps: tactics, groups in Mathlib |
AlgebraInLean/Quotients.lean |
Kapitel 2, 17 | Kernels, normal subgroups, quotient groups |
AlgebraInLean/Ideals.lean |
Kapitel 9 | Ideals; ℤ is a principal ideal ring |
AlgebraInLean/Polynomials.lean |
Kapitel 7 | Polynomials; Eisenstein's criterion applied |
AlgebraInLean/Degrees.lean |
Kapitel 3 | Field extensions; the tower law |
AlgebraInLean/LittleFermat.lean |
Kapitel 17 | Fermat's little theorem via Lagrange |
AlgebraInLean/Cauchy.lean |
Kapitel 18 | The key lemma on fixed points and Cauchy's theorem |
AlgebraInLean/Frobenius.lean |
Kapitel 14 | Finite fields; the Frobenius endomorphism |
AlgebraInLean/Galois.lean |
Kapitel 15, 16 | Galois theory; fixed fields |
AlgebraInLean/Reciprocity.lean |
Kapitel 24 | Quadratic reciprocity; computing Legendre symbols |
The rendered course notes
The folder Book/ contains the same material as a
Verso book (the technical setup
follows Peter Pfaffelhuber's
leancourse). To render it:
lake build
lake exe algebrainlean --output _out
python3 -m http.server 8000 -d _out/html-multi # then open http://localhost:8000
All Lean code in the book is elaborated during the build, so the
rendered proofs are guaranteed to compile. ./deploy.sh builds the
site and copies it to public/, which is synced to the CPLX web
server as for the lecture notes.
License
CC-BY 4.0, like the lecture notes.