Lean 4 Proofs
Setup
bash
lake init MyProject lake build
Structure
code
lean/ ├── lakefile.lean ├── lean-toolchain ├── Main.lean └── MyProject/
Naming
- •Types:
PascalCase - •Terms/theorems:
camelCase - •Namespaces:
PascalCase
Tactics
lean
-- Basic: intro, apply, exact, rfl, simp, ring -- Structural: have, let, show, calc -- Case analysis: cases, induction, rcases -- Finishing: trivial, contradiction, omega
Best Practices
- •Start with
sorryplaceholders - •Build incrementally with
lake build - •Leverage Mathlib when appropriate