Imperative Readability, Pure Proof Power (`do` + `Except` / `StateM`)
Real systems code uses early-return error handling and mutable-looking state updates. Lean 4's do notation compiles let mut, for, and early throw over Except Err and StateM S directly into pure functional transformers—giving you imperative ergonomics in code and pure mathematical equations in proofs (the Functional Core, Imperative Shell architecture).
`termination_by` + `fun_induction`
Once you prove a recursive parser or binary search terminates (termination_by hi - lo), Lean automatically synthesizes a custom induction principle matched to that recursion (fun_induction), eliminating manual strong-induction boilerplate.