Formalization of algorithms in Lean 4

A library of machine-checked definitions, theorems, and algorithms, covering the standard undergraduate-through-graduate curriculum. It spans graph theory — walks, trees, and colorings through spectral methods, matchings, and planarity — alongside the classical algorithms and data structures built on them, each shipped with proofs of correctness and runtime.

×

Vision

AlgoLib aims to formalize algorithms and the theory they rest on, with proofs of both correctness and runtime, in a way that stays close to the informal definitions used across the standard literature. The intent is to minimize the overhead for practitioners coming from textbook mathematics, so that statements, objects, and arguments in Lean read as directly as possible like their pen-and-paper counterparts.

Where definitions and results prove generally useful, the long-term goal is to upstream contributions back to Mathlib and cslib, so that the broader Lean ecosystem benefits.

Roadmap

For v1, we aim to formalize the following fundamental concepts before moving on to more advanced material. The three groups below mirror the top-level structure of the library: Theory/, Algorithms/, and DataStructures/.

Theory

Algorithms

Data structures