Interactive Theorem Proving using Lean, Summer 2025
These are the notes for a course on formal proving with the interactive theorem prover Lean4 (in the following we just write Lean) in the summer semester of 2025 at the University of Freiburg. To be able to work through the course in a meaningful way, the following technical preparations are to be made:
-
Installation of vscode.
-
Local installation of Lean and the associated tools: Please follow these instructions.
-
Installing the course repository: Navigate to a location where you would like to put the course materials and use
git clone https://github.com/pfaffelh/leancourse` cd leancourse lake exe cache get
When you type code .
within the leancourse
folder, navigate to Leancourse/Exercises/01-Logic/01-a.lean
, accept to haveELAN
installed, as well as the corresponding Lean
version. When all is finished. Everything is fine once orange and/or red bars disapprear, and navigating in the left hand side of the windom leads to changes in the right hand side (the infoview). You should see some code which looks a bit like mathematics.
-
The directory
Leancourse/Exercises
contains the material for the course. We recommend that you first copy this directory, for example tomyExercises
. Otherwise, an update of the repository may overwrite the local files. -
To update the course materials, enter
git pull
from within theleancourse
directory.
(In case you cannot install the course material locally, do the following: Right click here and open link in new tab to access the repository using Gitpod. You will probably need a github account in order to do this.)
- 1. Introduction
- 2. Lean
-
3. Tactics
- 3.1. Tactics Cheatsheet
-
3.2.
apply
-
3.3.
apply?
-
3.4.
assumption
-
3.5.
by_cases
-
3.6.
by_contra
-
3.7.
calc
-
3.8.
cases'
-
3.9.
change
-
3.10.
clear
-
3.11.
congr
-
3.12.
constructor
-
3.13.
exact
-
3.14.
exfalso
-
3.15.
have
-
3.16.
induction
-
3.17.
intro
-
3.18.
left
-
3.19.
linarith
-
3.20.
norm_num
-
3.21.
nth_rewrite
-
3.22.
obtain
-
3.23.
push_neg
-
3.24.
rcases
-
3.25.
refine
-
3.26.
revert
-
3.27.
rfl
-
3.28.
right
-
3.29.
ring
-
3.30.
rintro
-
3.31.
rw
-
3.32.
simp
-
3.33.
specialize
-
3.34.
tauto
-
3.35.
triv
-
3.36.
use