Lean lecture
NMMB568, Formal Mathematics and Proof Assistants, 2+1
Schedule
There are two parallel lectures, choose one that suits you.
- Malá Strana SW1: Tuesday 9:00 – 10:30 (lecture), 10:40 – 11:20 (exercise / consultation)
- or Karlín K4: Wednesday 17:20 – 18:50 (lecture), 19:00 – 19:40 (exercise / consultation)
Links
Lectures
I am following my write-up notes here in the directory LeanTeaching. The actual files shown in the lectures are stored in the directory Live.
- Lean as a basic functional language: Numbers, top-bottom type inference, functions, recursion, structures, object-oriented syntax, inductive types
- Dependent types, Pi & Sigma types, Vector implementations, Curry-Howard correspondence (Propositions as Types), inductive type vs. proposition (examples Or & Exists).
- Forward & backward proof, basic tactics (refine, exact, intro, apply), practical example (tactics induction, rw, rw??), library search
- Equality levels: Syntactic / definitional / provable. Why rw fails with rewriting under a binder, or with rewriting an index of a list.
- Tactic Zoo, part 1: Many goal oriented / assumptions oriented tactics, rewriting, scripting.
- Tactic Zoo, part 2: Massaging, closing (bashing) & organizing tactics.
- Typeclasses: Bundled / unbundled data structures. Defining a custom type class: type class as a structure, instance as def. Specific type classes: Add, Decidable, coercions (CoeT, Coe)
- Quotients: Setoid, mk'', lift. Containers: List, Multiset, Finset, Set, set comprehension, coercion to type, finiteness (Fintype, Finite), cardinality, maximum, sum. Analysis: filters (filtered quantifiers), predicates vs. dummy values.
- Universes: Lean's logical strength, inaccessible cardinals, ZFCSet, universe-polymorphic constants.
Homework
Enroll in the owl submission system via this link. You need 60 points from homeworks to get the credit.
- Extending numerical Expr data type. [Lean file]
- Implementing dependent zeros function, and writing explicit proof terms. [Lean file]
- Proving identity about LCM & proving correntness of Expr.deriv [Lean file]
- Making floor defeq & low-level proofs: [Lean file]
- Reverting clear_value & using rcases syntax & scripting exercise [Lean file]
- Typeclass operator overloading for Expr & finding the right library typeclasses for orthogonal lines. [Lean file]
- Formalize certain math definitions: IMO problem (filtered forall) & putnam problem (geometry) & sets modulo finite difference. [Lean file]
- Define large type constructions using the ZFC operations & include correct universe-polymorphic definitions. [Lean file]
Project / Exam
To get an exam, you must do a Lean project, which we will discuss at the exam. Formalizing your favorite math problem(s), theorem, topic, algorithm... We can discuss proposals individually. It is possible that I will put some suggestions here as well (but do not count on it).
Other info
Go back to the promo page.