Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Lemma 4.9: every singleton of a term is regular

Proved
MSKleene.singleton_term_regular

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

formal-languagesmany-sorted-algebratree-automatauniversal-algebra

Every singleton of a term is regular (Lemma 4.9).

Let s∈Ss\in Ss∈S and P∈TΣ(X)sP\in\mathrm{T}_{\Sigma}(X)_{s}P∈TΣ​(X)s​. Then P∈TReg(S,Σ,X)(X)sP\in\mathrm{T}_{\mathrm{Reg}(S,\Sigma,X)}(X)_{s}P∈TReg(S,Σ,X)​(X)s​ and {P}sX♯={P}\{P\}^{X\sharp}_{s}=\{P\}{P}sX♯​={P}. Consequently {P}∈Regs(TΣ(X))\{P\}\in\mathrm{Reg}_{s}(\mathbf{T}_{\Sigma}(X)){P}∈Regs​(TΣ​(X)).

Preamble
import Definitions.Def_MSKleene_Regular
Formal statement
namespace MSKleene

/-- **Every singleton of a term is regular** (Lemma 4.9).

For finite `S`, `Σ`, and `X`, every `P ∈ T_Σ(X)_s`, viewed as a regular
expression over `(S,Σ,X)`, denotes exactly `{P}`. Consequently, `{P}` is an
`s`-regular language. -/
theorem singleton_term_regular {S : Type} [Finite S]
    (sig : Signature S) (X : SSet S) (hsig : SigFinite sig) (hX : SFinite X)
    {s : S} (P : Term sig X s) :
    interpExpr sig X s (Term.toReg P) = {P}
  ∧ {P} ∈ RegS sig X s := 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 · gpt-5

For every type of sorts SSS equipped with the assumption that SSS is finite; every many-sorted signature sig\mathit{sig}sig, meaning a family of types sig(w,s)\mathit{sig}(w,s)sig(w,s) of operation symbols indexed by a finite list www of input sorts and an output sort sss; every sorted family of variable types X=(Xt)t∈SX=(X_t)_{t\in S}X=(Xt​)t∈S​; assumptions that the dependent sum of all operation-symbol types ∑w:List⁡(S)∑t:Ssig(w,t)\sum_{w:\operatorname{List}(S)}\sum_{t:S}\mathit{sig}(w,t)∑w:List(S)​∑t:S​sig(w,t) is finite and that the dependent sum ∑t:SXt\sum_{t:S}X_t∑t:S​Xt​ is finite; every sort s∈Ss\in Ss∈S; and every finite sig\mathit{sig}sig-term PPP of sort sss built recursively either from a variable in XXX of the appropriate sort or by applying an operation symbol to a matching tuple of subterms, the following conjunction holds. First, if PPP is converted to a regular expression by leaving every variable node unchanged and replacing every original operation-symbol node by the corresponding base-symbol node, then interpreting that expression as a language of sig\mathit{sig}sig-terms—variables denote their singleton variable terms and a base operation applied to languages denotes all operation applications obtained by choosing one argument term from each component language—gives exactly the singleton language {P}\{P\}{P}. Second, {P}\{P\}{P} is regular in the following literal sense: there exist a sorted family of auxiliary variable types E=(Et)t∈SE=(E_t)_{t\in S}E=(Et​)t∈S​ for which ∑t:S(Xt⊔Et)\sum_{t:S}(X_t\mathbin{\sqcup}E_t)∑t:S​(Xt​⊔Et​) is finite, and a regular expression RRR of sort sss over the enlarged variables Xt⊔EtX_t\mathbin{\sqcup}E_tXt​⊔Et​, such that the language denoted by RRR is exactly the image of {P}\{P\}{P} under recursive relabelling along the injections Xt↪Xt⊔EtX_t\hookrightarrow X_t\mathbin{\sqcup}E_tXt​↪Xt​⊔Et​. Here such a regular expression is a term whose operation symbols are either base symbols from sig\mathit{sig}sig or the added empty-language, binary-union, variable-indexed iteration, and variable-indexed substitution symbols, interpreted respectively as the empty set, union, finite-stage iteration, and completely additive term substitution. The existentially asserted EEE and RRR in the second conjunct are not stated to be any particular choices, and in particular the statement does not identify RRR with the converted expression from the first conjunct. No nonemptiness assumption is imposed on SSS, XXX, or the signature; when there is no possible choice of the explicitly quantified sss and PPP, the corresponding universal assertion has no instances.

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