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
4Lake Build System
5BasicsBasics.lean
6Data StructuresDataStructures.lean, MagicTheGathering.lean
7Control Flow and StructuresControlFlow.lean, FizzBuzz.lean, Collatz.lean, DndCharacter.lean
8Polymorphism and Type ClassesPolymorphism.lean, SpellEffects.lean, Units.lean
9EffectsEffects.lean, Transporter.lean
10IO and ConcurrencyIO.lean, WordFreq.lean
11ProofsProving.lean
12Type TheoryTypeTheory.lean
13Dependent TypesTypeTheory.lean, DependentTypes.lean, VendingMachine.lean, NQueens.lean
14Proof StrategyProofStrategy.lean
15Tactics ReferenceTactics.lean
16Congruence and SubtypingSubtyping.lean
17Classic ProofsProofs/
18Algebraic StructuresAlgebraicStructures.lean
19MathlibMathlib.lean
20Software VerificationVerification.lean, Compiler.lean, GameOfLife.lean, StackMachine.lean, ParserCombinators.lean
21Artificial IntelligenceAuction.lean, Vickrey.lean, CombinatorialAuction.lean
22References

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.