🤖 AI Summary
This work addresses the closure properties of the class of type-0 languages (i.e., Turing-recognizable languages) under union, reversal, concatenation, and Kleene star—fundamental operations in formal language theory. We present the first fully grammar-based, machine-free formal verification in Lean 3. Our methodology relies exclusively on constructive grammatical transformations and rigorous inductive reasoning, eschewing Turing machine encodings. Specifically: (1) we formally define type-0 grammars and their generated languages, proving their Turing equivalence; (2) we provide standard yet formally verified grammatical constructions and correctness proofs for union, reversal, and concatenation; and (3) we propose an original, syntactically precise grammar construction for Kleene star and formally verify its correctness. All proofs are mechanized using inductive definitions, formal operational semantics, and deductive reasoning within Lean’s interactive theorem-proving framework, ensuring end-to-end verifiability. This work fills a critical gap in the formalization of closure properties for formal languages in mainstream proof assistants.
📝 Abstract
We formalized general (i.e., type-0) grammars using the Lean 3 proof assistant. We defined basic notions of rewrite rules and of words derived by a grammar, and used grammars to show closure of the class of type-0 languages under four operations: union, reversal, concatenation, and the Kleene star. The literature mostly focuses on Turing machine arguments, which are possibly more difficult to formalize. For the Kleene star, we could not follow the literature and came up with our own grammar-based construction.