Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Proposition 3.29: basic terms are recognizable

Proved
MSKleene.rec_basic

by Cosme · Sep 8, 2026 · Mathlib 0df444a (Lean v4.33.1)

formal-languagesmany-sorted-algebratree-automatauniversal-algebra

Basic terms are recognizable (Proposition 3.29).

Assume SSS finite. For every s∈Ss\in Ss∈S: (1) for every x∈Xsx\in X_{s}x∈Xs​, {x}\{x\}{x} is sss-recognizable; (2) for every σ∈Σλ,s\sigma\in\Sigma_{\lambda,s}σ∈Σλ,s​, {σTΣ(X)}\{\sigma^{\mathbf{T}_{\Sigma}(X)}\}{σTΣ​(X)} is sss-recognizable; (3) for every s∈S⋆−{λ}\mathbf{s}\in S^{\star}-\{\lambda\}s∈S⋆−{λ}, σ∈Σs,s\sigma\in\Sigma_{\mathbf{s},s}σ∈Σs,s​, and (xj)j∈Xs(x_{j})_{j}\in X_{\mathbf{s}}(xj​)j​∈Xs​, {σTΣ(X)((xj)j)}\{\sigma^{\mathbf{T}_{\Sigma}(X)}((x_{j})_{j})\}{σTΣ​(X)((xj​)j​)} is sss-recognizable. (From CVCL20, Prop. 3.1–3.3.)

Preamble
import Definitions.Def_MSKleene_Term
import Definitions.Def_MSKleene_Recognizable
import Definitions.Def_MSKleene_Power
Formal statement
namespace MSKleene

/-- **Basic terms are recognizable** (Proposition 3.29; from CVCL20).

With `S` finite: for every sort `s`, every singleton `{x}` of a variable, and
every singleton `{σ(x₁,…,x_k)}` of an operation symbol applied to variables
(the constant case `k = 0` included), is `s`-recognizable. -/
theorem rec_basic {S : Type} [Finite S] (sig : Signature S) (X : SSet S) (s : S) :
    (∀ x : X s, sRecognizable (freeAlgebra sig X) s {Term.var x})
  ∧ (∀ (w : List S) (σ : sig w s) (xs : Args X w),
        sRecognizable (freeAlgebra sig X) s
          {Term.app σ (TermVec.ofArgs (Args.map (fun _ x => Term.var x) xs))}) := by
  sorry

end MSKleene
Source
Gong, Ruiz Mora, Sanmartín Vich, Cosme Llópez, "A Kleene theorem for free many-sorted algebras", 2026
Read-back

What the Lean code literally says, in plain math · claude-sonnet-5

Fix a type SSS carrying a Finite instance (so SSS has only finitely many elements), a signature Σ\SigmaΣ over SSS — that is, an assignment of a type Σ(w,s)\Sigma(w,s)Σ(w,s) of operation symbols to each pair consisting of a word w∈List⁡(S)w\in\operatorname{List}(S)w∈List(S) (the input profile) and a sort s∈Ss\in Ss∈S (the output sort) — an SSS‑sorted family of variable types X=(Xs′)s′∈SX=(X_{s'})_{s'\in S}X=(Xs′​)s′∈S​, and a distinguished sort s∈Ss\in Ss∈S. Let TΣ,X=(TΣ,X,s′)s′∈ST_{\Sigma,X}=(T_{\Sigma,X,s'})_{s'\in S}TΣ,X​=(TΣ,X,s′​)s′∈S​ be the SSS‑sorted set of terms: TΣ,X,s′T_{\Sigma,X,s'}TΣ,X,s′​ is inductively generated by term‑variables var⁡(x)\operatorname{var}(x)var(x) for x∈Xs′x\in X_{s'}x∈Xs′​ and by applications app⁡(σ,t⃗)\operatorname{app}(\sigma,\vec t)app(σ,t) where, for some word w=[w1,…,wn]w=[w_1,\dots,w_n]w=[w1​,…,wn​], σ∈Σ(w,s′)\sigma\in\Sigma(w,s')σ∈Σ(w,s′) and t⃗\vec tt is a vector holding one term of sort wiw_iwi​ in position iii. Let FFF be the term (free) algebra on Σ\SigmaΣ and XXX: its carrier at sort s′s's′ is TΣ,X,s′T_{\Sigma,X,s'}TΣ,X,s′​, and its interpretation of a symbol σ∈Σ(w,s′)\sigma\in\Sigma(w,s')σ∈Σ(w,s′) maps an argument vector t⃗\vec tt to the term app⁡(σ,t⃗)\operatorname{app}(\sigma,\vec t)app(σ,t). For a Σ\SigmaΣ‑algebra AAA, a sort s′s's′, and a set L⊆As′L\subseteq A_{s'}L⊆As′​, call LLL s′s's′‑recognizable in AAA when there exist (i) a Σ\SigmaΣ‑algebra BBB whose total carrier ∑s′′∈SBs′′\sum_{s''\in S} B_{s''}∑s′′∈S​Bs′′​ is a finite type, (ii) a Σ\SigmaΣ‑homomorphism f ⁣:A→Bf\colon A\to Bf:A→B, i.e. a family of maps fs′′ ⁣:As′′→Bs′′f_{s''}\colon A_{s''}\to B_{s''}fs′′​:As′′​→Bs′′​ such that for every www, every s′′s''s′′, every σ∈Σ(w,s′′)\sigma\in\Sigma(w,s'')σ∈Σ(w,s′′) and every argument vector a⃗\vec aa one has fs′′ ⁣(σA(a⃗))=σB ⁣(f applied componentwise to a⃗)f_{s''}\!\big(\sigma^{A}(\vec a)\big)=\sigma^{B}\!\big(f\text{ applied componentwise to }\vec a\big)fs′′​(σA(a))=σB(f applied componentwise to a), and (iii) a set M⊆Bs′M\subseteq B_{s'}M⊆Bs′​, such that fs′−1(M)=Lf_{s'}^{-1}(M)=Lfs′−1​(M)=L exactly (equality of sets, not mere inclusion). The theorem asserts the conjunction of the following two statements, in which the algebra BBB, the homomorphism fff and the set MMM witnessing recognizability may be chosen independently for each instance:

(1)∀ x∈Xs,{ var⁡(x) }⊆TΣ,X,s  is s-recognizable in F,\textbf{(1)}\qquad \forall\, x\in X_{s},\quad \{\,\operatorname{var}(x)\,\}\subseteq T_{\Sigma,X,s}\ \text{ is } s\text{-recognizable in } F,(1)∀x∈Xs​,{var(x)}⊆TΣ,X,s​  is s-recognizable in F, (2)∀ w∈List⁡(S), ∀ σ∈Σ(w,s), ∀ (x1,…,xn) with xi∈Xwi,{ app⁡ ⁣(σ,(var⁡(x1),…,var⁡(xn))) }⊆TΣ,X,s  is s-recognizable in F,\textbf{(2)}\qquad \forall\, w\in\operatorname{List}(S),\ \forall\, \sigma\in\Sigma(w,s),\ \forall\, (x_1,\dots,x_n)\ \text{with } x_i\in X_{w_i},\quad \big\{\,\operatorname{app}\!\big(\sigma,(\operatorname{var}(x_1),\dots,\operatorname{var}(x_n))\big)\,\big\}\subseteq T_{\Sigma,X,s}\ \text{ is } s\text{-recognizable in } F,(2)∀w∈List(S), ∀σ∈Σ(w,s), ∀(x1​,…,xn​) with xi​∈Xwi​​,{app(σ,(var(x1​),…,var(xn​)))}⊆TΣ,X,s​  is s-recognizable in F,

where in (2) the single term named is the application of σ\sigmaσ directly to the variable terms var⁡(xi)\operatorname{var}(x_i)var(xi​) as its immediate subterms. Edge cases folded into the quantifiers: in (1), if XsX_sXs​ is empty the claim is vacuous; in (2), the quantifier over (x1,…,xn)(x_1,\dots,x_n)(x1​,…,xn​) ranges over the sorted tuple type Xw1×⋯×XwnX_{w_1}\times\cdots\times X_{w_n}Xw1​​×⋯×Xwn​​, which is empty (making that instance vacuous) whenever www is nonempty and some XwiX_{w_i}Xwi​​ is empty, and the quantifier over σ\sigmaσ contributes nothing when Σ(w,s)\Sigma(w,s)Σ(w,s) is empty; when w=[ ]w=[\,]w=[] the symbol σ∈Σ([ ],s)\sigma\in\Sigma([\,],s)σ∈Σ([],s) is a constant, the tuple (x1,…,xn)(x_1,\dots,x_n)(x1​,…,xn​) is the unique element of a one‑point type, and (2) asserts that the singleton {app⁡(σ,( ))}\{\operatorname{app}(\sigma,(\,))\}{app(σ,())} containing the constant term is sss‑recognizable in FFF. No finiteness is assumed of the signature Σ\SigmaΣ or of the variable family XXX; the only finiteness hypotheses are that SSS is finite and that each recognizing algebra BBB has finite total carrier.

Human review
  • Endorsed by Shuze Chen · Sep 9, 2026

  • Endorsed by Cosme · Sep 9, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me