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
8Standard Library and BatteriesStdLibrary.lean
9Polymorphism and Type ClassesPolymorphism.lean, SpellEffects.lean, Units.lean
10EffectsEffects.lean, ATM.lean
11IO and ConcurrencyIO.lean, WordFreq.lean
12ProofsProving.lean
13Type TheoryTypeTheory.lean
14Dependent TypesTypeTheory.lean, DependentTypes.lean, VendingMachine.lean, NQueens.lean
15Proof StrategyProofStrategy.lean
16Congruence and SubtypingSubtyping.lean
17Classic ProofsProofs/
18Algebraic StructuresAlgebraicStructures.lean
19MathlibMathlib.lean
20Verified ProgramsVerification.lean, Compiler.lean, GameOfLife.lean, StackMachine.lean, CircuitBreaker.lean, ParserCombinators.lean
21Model CheckingModelChecking.lean
22Artificial IntelligenceAuction.lean, Vickrey.lean, CombinatorialAuction.lean
23References

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.