Little Bits of Lean 4
Fourteen small programs: classic AI, symbolic math, LLMs, and the web. Each one is a single file.
by Mark Watson
Tested with Lean 4.35.0 on macOS, November 2026.
Sources: source_code/ holds the fourteen programs, and source_code/standalone/ holds the stand-alone tool from chapter 19; manuscript/ holds the chapters. Repository: https://github.com/mark-watson/lean4.
For readers new to Lean; some functional programming experience helps. You need Lean 4.35.0, macOS for chapter 12, the lightpanda binary for chapter 13, a local Ollama server for chapter 14, and API keys for chapters 15 and 17. Chapter 16 needs internet access.