Zero to QED

From Zero to QED

CI

An informal introduction to formality in Lean 4.

Read

  • HTML - Read online
  • PDF - Download for offline reading

Try Online

No local setup required. Launch a complete Lean 4 environment in your browser:

The environment comes pre-configured with Lean 4, the VS Code extension, and all dependencies.

Try Locally

Install Lean 4 with VS Code and the Lean 4 extension, then:

git clone https://github.com/sdiehl/zero-to-qed
cd zero-to-qed
lake exe cache get   # Download prebuilt Mathlib
lake build

Alternatively, if you have Docker and VS Code installed, clone the repo and open it in VS Code. You'll be prompted to "Reopen in Container" which builds the same environment on your machine.

Contents

#ProseCode
1Introduction
2Why?
3Theorem Provers
4BasicsBasics.lean
5Lake Build System
6Data StructuresDataStructures.lean, MagicTheGathering.lean
7Control Flow and StructuresControlFlow.lean, FizzBuzz.lean, Collatz.lean, DndCharacter.lean
8Termination and Well-Founded RecursionTermination.lean
9Standard Library and BatteriesStdLibrary.lean
10Polymorphism and Type ClassesPolymorphism.lean, SpellEffects.lean, Units.lean
11EffectsEffects.lean, ATM.lean
12IO and ConcurrencyIO.lean, WordFreq.lean
13ProofsProving.lean
14Type TheoryTypeTheory.lean
15Dependent TypesTypeTheory.lean, DependentTypes.lean, VendingMachine.lean, NQueens.lean
16Proof StrategyProofStrategy.lean
17Congruence and SubtypingSubtyping.lean
18Classic ProofsProofs/
19Algebraic StructuresAlgebraicStructures.lean
20MathlibMathlib.lean
21Verified ProgramsVerification.lean, Compiler.lean, GameOfLife.lean, StackMachine.lean, CircuitBreaker.lean, ParserCombinators.lean
22Model CheckingModelChecking.lean
23Artificial IntelligenceAuction.lean, Vickrey.lean, CombinatorialAuction.lean
24References

Contributing

See BUILD.md for details on the HTML and PDF build pipeline. Add yourself to CONTRIBUTORS.md and submit a PR.

License

Software (Lean code in src/): MIT License. See LICENSE.

Prose (text in docs/): Public domain. Share it, adapt it, translate it. I just ask that you not sell it. It is meant to be free.