A Verified Implementation of the L*-Algorithm in Lean
Angluin's L*-algorithm learns the minimal deterministic finite automaton (DFA) of an unknown regular language from membership and equivalence queries to a teacher. It underpins active automata learning, yet its correctness guarantees have so far rested on pen-and-paper proofs, separate from the implementations in use. We close this gap for L* using Lean 4, which is both a functional programming language and an interactive theorem prover: we implement L* in the Minimally Adequate Teacher framework and prove its properties directly about the executable code. We establish two results: (1) Termination: for every teacher that answers consistently with a regular language and returns only genuine counterexamples, learning terminates. (2) Minimality and correctness: the learned DFA is never larger than the minimal DFA of that language, and if the teacher answers equivalence queries truthfully, it is isomorphic to that minimal DFA. The result is a single artifact that is both a mechanically checked proof and an executable learner. To the best of our knowledge, this is the first mechanized correctness proof of the classical L*-algorithm.