A Mechanized Proof of the Bar-Hillel–Gaifman–Shamir Theorem in Lean 4: Weak Equivalence of AB Categorial Grammars and Context-Free Grammars
The theorem of Bar-Hillel, Gaifman, and Shamir (1960) establishes the foundational equivalence between Chomsky's phrase-structure Context-Free Grammars (CFGs) and Ajdukiewicz–Bar-Hillel Basic Categorial Grammars (ABGs). We present both a complete, self-contained mathematical exposition and its machine-checked formalization in Lean 4 (v4.36.0), spanning 2,147 lines across 9 modules with zero external libraries (no Mathlib), zero sorrys, and zero custom axioms. Both formalisms are specified via their textbook string-rewriting and directional slash-cancellation semantics and bridged to structural derivation trees. For ABG → CFG, the classical subcategory argument gives a finite translation whose proof uses neither decidable equality nor the axiom of choice. For CFG → ABG, we develop a finite-universe monotone fixpoint engine supporting a binarize-first Chomsky Normal Form pipeline followed by a left-corner construction to 2-standard Greibach Normal Form, yielding the main equivalence together with its unidirectional refinement: every ε-free context-free language is generated by a right-slash-only AB grammar of slash-nesting depth at most 2. Source code repository: https://github.com/bocchitherock888-ux/lean-grammar-equivalences (archived at DOI: 10.5281/zenodo.24622877). Keywords: Lean 4, formal linguistics, categorial grammar, context-free grammar, Chomsky normal form, Greibach normal form, interactive theorem proving
Authors
- bocchitherock888-ux
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-28
- DOI
- https://doi.org/10.5281/zenodo.24623323
- Primary Topic
- semigroups and automata theory
- Type
- preprint