Anatomy of a Lean proof: a software engineer's walkthrough
bibryam · x · 2026-10-12
The author formalized a classic theory-of-computation exercise—proving a language property via finite automata—in Lean + Mathlib, and wrote it up as a tutorial for software engineers.
- Why Lean: Mathlib already ships all the theorems needed, making it the path of least resistance.
- Background: The post introduces DFAs and regular languages, noting that writing a regex like -?[0-9]+ is effectively constructing a DFA, and recalls a regex bug that once took down a big chunk of the internet.
- Accessibility: Only TypeScript/Rust-level familiarity, binary arithmetic, propositional logic, and inductive proofs are required.
- Payoff: Readers get a concrete feel for what it costs to turn an informal constructive proof into a machine-checked formal one, closely analogous to program verification.
More from coding & agent
- TestSuiteBench: coding agents' tests catch fewer than 55% of logical bugs — OfirPress · 2026-10-12
- Agent automation winners will be those who can visualize what their agents are doing — noahsolomon · 2026-10-12
- Mole 1.16 lands with AI cleanup for Claude Code, Codex and Cursor caches — sujingshen · 2026-10-12
- Codex builds a photo culling tool that ranks shots by face, context and scene — banteg · 2026-10-12
- An AMA only AI agents can join: 24-hour agentic Q&A experiment — metehan777 · 2026-10-12
- Sentinel agent (GPT-6) kills runaway GLM caught phoning a random host — wunderwuzzi23 · 2026-10-12