Motivation
Kleene's theorem (Kleene 1956; McNaughton–Yamada 1960) is a cornerstone of formal language theory: over a free monoid, the languages recognized by finite automata are exactly the regular ones — those built from finite languages by union, concatenation, and the Kleene star. Mezei and Wright (1967) lifted recognizability off strings, calling a subset of an arbitrary algebra recognizable when it is the preimage of a subset of a finite algebra under a homomorphism. Replacing strings by terms — finite trees labelled by operation symbols — gives the theory of recognizable tree languages and finite tree automata of Gécseg and Steinby (1984), where the Kleene correspondence reappears with a tree concatenation and an iteration operation in the role of the star.
Many computational structures are inherently many-sorted: typed lambda calculi, structured programming languages, process calculi, XML schemas — data and operations organized into distinct sorts. In the many-sorted setting a signature assigns to each operation symbol the sorts of its arguments and of its value, variables carry sorts, and a language is a sort-indexed family of term sets. The predecessor of this mission, Climent Vidal–Cosme Llópez 2020 (CVCL20), established that recognizability over free many-sorted algebras is preserved — and, where applicable, reflected — by substitution, iteration, quotient, inverse tree-homomorphic image, and direct linear image, via finite-index congruences. What CVCL20 left open is the regular side: whether a natural class of many-sorted regular expressions captures exactly the recognizable languages. This mission closes that gap.
Setting
Fix a finite set of sorts S. An S-sorted set A=(As)s∈S is a family of sets; it is finite when ∐s∈SAs is finite. An S-sorted signature Σ assigns to each pair (s,s)∈S⋆×S a set Σs,s of operation symbols of arity s and coarity s. A Σ-algebra A is an S-sorted set A together with, for each σ∈Σs,s, an operation σA:As→As, where As=∏jAsj. A homomorphism commutes with all operations sortwise.
The free Σ-algebra TΣ(X) on an S-sorted set X of variables has as its sort-s carrier TΣ(X)s the set of (X,s)-terms; every S-sorted map X→A extends uniquely to a homomorphism TΣ(X)→A. Following automata-theoretic tradition, subsets of TΣ(X) are called languages. For a sort s, a language L⊆TΣ(X)s is s-recognizable when there are a finite Σ-algebra N, a homomorphism f:TΣ(X)→N, and a subset M⊆Ns with L=fs−1[M]. Write Recs(TΣ(X)) for the set of all such L.
Two operations on languages, both performed sortwise, generate the regular expressions. Given a variable z∈Xu and a language L⊆TΣ(X)u, z-substitution (zL)s♯p replaces, in every term of an input language of sort s, each occurrence of z independently by a term of L. The z-iteration is L⋆z=⋃i∈NLiz, where L0z={z} and Li+1z=Liz∪(zLiz)s♯p(L). For a finite S-sorted set Z, the regular signature Reg(S,Σ,Z) expands Σ by an empty constant ∅s, a binary sum +s, a unary z-iteration (⋅)⋆z for each z∈Zs, and a z-substitution operation for each z∈Zt. Its terms are the regular expressions over (S,Σ,Z); the power algebra TΣ(Z)℘ carries a canonical Reg(S,Σ,Z)-algebra structure, and interpreting a regular expression there yields a language {R}sZ♯. A language L⊆TΣ(X)s is s-regular when L={R}sZ♯ for some finite Z⊇X and some regular expression R of type s; write Regs(TΣ(X)).
Formalization targets
Goal — the many-sorted Kleene theorem
∀s∈S,Recs(TΣ(X))=Regs(TΣ(X)).
The statement fixes no automaton model and no normal form for regular expressions: it asserts only that the two classes of languages coincide, at every sort, for every finite S, every finite S-sorted signature Σ, and every finite S-sorted set X. It splits into Regs⊆Recs (Corollary 4.8) and Recs⊆Regs (Proposition 4.10).
Significance
The result completes the Kleene–Myhill–Nerode correspondence on the side of universal algebra, uniformly over an arbitrary finite many-sorted signature: it names the exact operations — those of Σ, plus empty language, union, sortwise substitution, and sortwise iteration — that generate precisely the finite-state behaviours. Over non-free structures the correspondence is known to fail (recognizable but non-rational subsets of a monoid, Eilenberg 1974), which is what makes the free many-sorted algebra the natural home for an exact statement. The forward direction organizes the regular languages into a Reg-algebra and instantiates the closure properties of CVCL20; the converse gives a constructive, syntactic procedure — from a recognizing homomorphism it builds a regular expression denoting the language — generalizing Lemma 2.5.7 of Gécseg–Steinby, itself descended from McNaughton–Yamada.
The paper is new (June 2026) and has no machine-checked proof. This mission produces the first formalization: a reusable Lean development of finite many-sorted universal algebra — signatures, algebras, free term algebras and their universal property, the Artinian subterm order, power algebras, recognizability, and the substitution/iteration calculus — together with the two inclusions and the state-elimination argument. Everything below the §4 headline results is infrastructure of independent value for many-sorted formal language theory.
Difficulty
The converse inclusion is the substance. The single-sorted proof eliminates automaton states one at a time along a single axis; the naive port to the many-sorted case — fix a linear order on all states and eliminate — loses track of the sort at which each elimination happens and does not terminate cleanly. The argument instead carries a sortwise budget: an S-sorted family K≤N recording, for each sort t, the set Kt of state values still admissible at internal subterms. The induction is on ∥∥K∥∥=∑s∈Sks, and each step removes the top state of one chosen sort, so the recursion branches over the sorts whose budget is nonzero and the key identity (Equation (E)) is a union over those sorts. The inductive invariant — the family of auxiliary languages Lu(C,K,l) with its budget bookkeeping — is what separates the many-sorted argument from its ancestor; it is also the part Gécseg–Steinby declare "obvious from the construction" and this proof spells out in full (Claims C1–C6).
Formalization scope
Proposed Lean representation: S a type with [Fintype S]; an S-sorted set as S → Type; a signature as a family List S → S → Type with finiteness where the theorems need it; the free algebra as an inductive term type; the power algebra with sort-s carrier Set (T_Σ Z s); s-recognizability as the existence of a finite Σ-algebra, a homomorphism, and a subset whose sortwise preimage is the language. Committed conventions: S finite throughout; Σ finite and X finite for the §4 results (so that only finitely many basic terms exist and the budget induction is well-founded); the regular operations are exactly {∅,+,(⋅)⋆z,z-subst} together with the operations of Σ — not an unrestricted Boolean or closure algebra, which would trivialize the statement.
A complete development needs: the many-sorted UA core (sorted sets and maps, signature, algebra, homomorphism, subalgebra, congruence); the free algebra with unique readability (Proposition 3.4) and universal property (Proposition 3.5); the Artinian subterm order (Proposition 3.6); the power algebra; recognizability and s-recognizability with the CVCL20 closure results (Propositions 3.29, 3.30, 3.33); the substitution and iteration calculus (Lemmas 3.23, 3.25, 3.28, Corollary 3.17, Lemma 3.18); and the §4 regular-expression layer (Definition 4.1, Proposition 4.3, Corollary 4.4, Definition 4.6). The UA core and the substitution calculus are reusable beyond this mission. Contributions are welcome at every level — the definitions, the closure results, the auxiliary claims C1–C6, and either inclusion.
Selected references
- L. Gong, R. Ruiz Mora, N. Sanmartín Vich, E. Cosme Llópez, A Kleene theorem for free many-sorted algebras, 2026.
- J. Climent Vidal, E. Cosme Llópez, Congruence-based proofs of the recognizability theorems for free many-sorted algebras, Journal of Logic and Computation 30(2) (2020), 561–633. https://arxiv.org/abs/1808.08217
- F. Gécseg, M. Steinby, Tree Automata, Akadémiai Kiadó, Budapest, 1984.
- R. McNaughton, H. Yamada, Regular expressions and state graphs for automata, IRE Transactions on Electronic Computers EC-9 (1960), 39–47.
- S. C. Kleene, Representation of events in nerve nets and finite automata, in Automata Studies, Princeton University Press, 1956, 3–42.
- J. Mezei, J. Wright, Algebraic automata and context-free sets, Information and Control 11 (1967), 3–29.
- S. Eilenberg, Automata, Languages, and Machines, Vol. A, Academic Press, New York, 1974.