arXiv Science⌕ Search

arXiv · 2611.36474

A Verified Implementation of the L*-Algorithm in Lean

Abstract

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.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Dominik Mascherbauer, Bernhard K. Aichernig. 2026-11-26. A Verified Implementation of the L*-Algorithm in Lean. https://arxiv.science/abs/2611.36474

Citations retain the original authors and DOI and include this site’s record URL. If this discovery service contributed to your research, you can also cite arXiv Science by Indiciae: BibTeX · RIS.

KEEP EXPLORING

Related papers

More on Maximally Permissive Similarity Control of Discrete Event Systems

Takai proposed a method for constructing a maximally permissive supervisor for the similarity control problem (IEEE Transactions on Automatic Control, 66(7):3197-3204, 2021). This paper points out that this construction does not(necessarily) work when the specification is not image-finite. Inspired by Takai's construction, the notion of a (saturated) (G, R)-automaton is introduced and metatheorems concerning (maximally permissive) supervisors for the similarity control problem are provided in terms of this notion. As an application of these metatheorems, the flaws in Takai's work are corrected.

cs.FL↗

Machine-Checked Grammar-Constrained Decoding

Grammar-constrained decoding (GCD) restricts a language model's next-token choices so that its output remains extendable to a string accepted by a user-provided grammar. GreatGramma is a compositional GCD algorithm built from automata-theoretic components. We formalize its executable checker in Lean 4 and prove it sound and complete under explicit assumptions on the vocabulary, lexer, parser, and whitespace. To our knowledge, this is the first machine-checked end-to-end correctness proof for a grammar-constrained decoding algorithm for LLMs. The formalization finds an end-of-stream bug in the published lexer construction and makes explicit a universal-assumption needed for the algorithm. The development also includes reusable verified components for finite-state automata and transducers, pushdown automata, parser overapproximations, and graph search.

cs.FL↗

Average-Case Parsing of Unambiguous Context-Free Grammars

We show that every fixed unambiguous context-free grammar admits a deterministic parser with expected running time $O(n^{1.5})$ on a uniformly random word of length $n$. The parser utilizes a certain form of sparsity estimate supplied by the unambiguity itself.

cs.FL↗