Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Lemma 3.28: iteration absorption

Proved
MSKleene.iter_absorb

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

formal-languagesmany-sorted-algebratree-automatauniversal-algebra

Iteration absorption (Lemma 3.28).

Let s∈Ss\in Ss∈S, z∈Xsz\in X_{s}z∈Xs​, L⊆TΣ(X)sL\subseteq\mathrm{T}_{\Sigma}(X)_{s}L⊆TΣ​(X)s​. Then ( ⁣zL⋆z ⁣)s♯p(L)⊆L⋆z\left(\!\begin{smallmatrix}z\\L^{\star z}\end{smallmatrix}\!\right)^{\sharp\mathsf{p}}_{s}(L)\subseteq L^{\star z}(zL⋆z​)s♯p​(L)⊆L⋆z.

Preamble
import Definitions.Def_MSKleene_Iteration
Formal statement
namespace MSKleene

/-- **Iteration absorption** (Lemma 3.28).

For `z ∈ X_s` and a language `L ⊆ T_Σ(X)_s`,
`⟨z/L^{⋆z}⟩^♯ᵖ_s(L) ⊆ L^{⋆z}`. -/
theorem iter_absorb {S : Type} (sig : Signature S) (X : SSet S) {s : S}
    (z : X s) (L : Set (Term sig X s)) :
    substP z (iterate z L) s L ⊆ iterate z L := 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

Read-back of MSKleene.iter_absorb

Fix a type SSS (a set of sorts), an SSS-sorted signature sig\mathrm{sig}sig — a family assigning to each finite word w∈List(S)w\in\mathrm{List}(S)w∈List(S) and each sort s∈Ss\in Ss∈S a type sig(w,s)\mathrm{sig}(w,s)sig(w,s) of operation symbols of arity www and result sort sss — and an SSS-indexed family of variable types X=(Xs)s∈SX=(X_s)_{s\in S}X=(Xs​)s∈S​. Let Termsig,X(r)\mathrm{Term}_{\mathrm{sig},X}(r)Termsig,X​(r) denote the terms of sort rrr built from these variables and symbols: each x∈Xrx\in X_rx∈Xr​ yields a term var(x)\mathrm{var}(x)var(x), and each σ∈sig(w,r)\sigma\in\mathrm{sig}(w,r)σ∈sig(w,r) applied to a length-matching tuple of subterms yields a term σ(t1,…,tn)\sigma(t_1,\dots,t_n)σ(t1​,…,tn​). The theorem further fixes a sort s∈Ss\in Ss∈S, a distinguished variable z∈Xsz\in X_sz∈Xs​, and an arbitrary set L⊆Termsig,X(s)L\subseteq\mathrm{Term}_{\mathrm{sig},X}(s)L⊆Termsig,X​(s) of terms of sort sss. Here sig\mathrm{sig}sig and XXX are explicit parameters, sss is implicit, and z,Lz,Lz,L are explicit; there are no typeclass assumptions or other hypotheses.

For any set M⊆Termsig,X(s)M\subseteq\mathrm{Term}_{\mathrm{sig},X}(s)M⊆Termsig,X​(s), define a set-valued substitution operator θz,M\theta_{z,M}θz,M​, acting on a term PPP of sort rrr and returning a subset θz,M(P)⊆Termsig,X(r)\theta_{z,M}(P)\subseteq\mathrm{Term}_{\mathrm{sig},X}(r)θz,M​(P)⊆Termsig,X​(r), as the structural (homomorphic) extension of the variable assignment "z↦Mz\mapsto Mz↦M, and every other variable yyy of any sort ↦{var(y)}\mapsto\{\mathrm{var}(y)\}↦{var(y)}", i.e. recursively

θz,M(var(y))={Mif r=s and y=z,{var(y)}otherwise,θz,M(σ(t1,…,tn))={ σ(u1,…,un) ∣ uj∈θz,M(tj) for each j }.\theta_{z,M}(\mathrm{var}(y))= \begin{cases} M & \text{if } r=s \text{ and } y=z,\\[2pt] \{\mathrm{var}(y)\} & \text{otherwise,} \end{cases} \qquad \theta_{z,M}\big(\sigma(t_1,\dots,t_n)\big)=\big\{\,\sigma(u_1,\dots,u_n)\ \big|\ u_j\in\theta_{z,M}(t_j)\ \text{for each } j\,\big\}.θz,M​(var(y))={M{var(y)}​if r=s and y=z,otherwise,​θz,M​(σ(t1​,…,tn​))={σ(u1​,…,un​) ​ uj​∈θz,M​(tj​) for each j}.

Thus θz,M(P)\theta_{z,M}(P)θz,M​(P) is the set of all terms obtained from PPP by replacing every occurrence of the variable zzz — independently at each occurrence — by some element of MMM, leaving all other variables untouched. For a set K⊆Termsig,X(s)K\subseteq\mathrm{Term}_{\mathrm{sig},X}(s)K⊆Termsig,X​(s) put

substP(z,M,K) = ⋃P∈Kθz,M(P) ⊆ Termsig,X(s).\mathrm{substP}(z,M,K)\ =\ \bigcup_{P\in K}\theta_{z,M}(P)\ \subseteq\ \mathrm{Term}_{\mathrm{sig},X}(s).substP(z,M,K) = P∈K⋃​θz,M​(P) ⊆ Termsig,X​(s).

Define sets Ii⊆Termsig,X(s)I_i\subseteq\mathrm{Term}_{\mathrm{sig},X}(s)Ii​⊆Termsig,X​(s) for i∈Ni\in\mathbb{N}i∈N by

I0={var(z)},Ii+1=Ii ∪ substP(z, Ii, L),I_0=\{\mathrm{var}(z)\},\qquad I_{i+1}=I_i\ \cup\ \mathrm{substP}(z,\ I_i,\ L),I0​={var(z)},Ii+1​=Ii​ ∪ substP(z, Ii​, L),

so that Ii+1I_{i+1}Ii+1​ adjoins to IiI_iIi​ every term obtained from a term of LLL by replacing each occurrence of zzz by some element of IiI_iIi​; and set

iterate(z,L) = ⋃i∈NIi.\mathrm{iterate}(z,L)\ =\ \bigcup_{i\in\mathbb{N}} I_i .iterate(z,L) = i∈N⋃​Ii​.

The theorem asserts exactly the one set inclusion

substP(z, iterate(z,L), L) ⊆ iterate(z,L),\mathrm{substP}\big(z,\ \mathrm{iterate}(z,L),\ L\big)\ \subseteq\ \mathrm{iterate}(z,L),substP(z, iterate(z,L), L) ⊆ iterate(z,L),

equivalently: for every term P∈LP\in LP∈L and every term u∈θz, iterate(z,L)(P)u\in\theta_{z,\,\mathrm{iterate}(z,L)}(P)u∈θz,iterate(z,L)​(P) — i.e. every uuu gotten from PPP by substituting, independently at each occurrence of zzz, some element of iterate(z,L)\mathrm{iterate}(z,L)iterate(z,L) — one has u∈Iiu\in I_iu∈Ii​ for some i∈Ni\in\mathbb{N}i∈N.

Edge cases folded into the quantifiers: if L=∅L=\varnothingL=∅ the left-hand side is the empty union ∅\varnothing∅ and the inclusion holds vacuously (and then iterate(z,L)={var(z)}\mathrm{iterate}(z,L)=\{\mathrm{var}(z)\}iterate(z,L)={var(z)}); the union defining iterate\mathrm{iterate}iterate includes the index i=0i=0i=0, so var(z)∈iterate(z,L)\mathrm{var}(z)\in\mathrm{iterate}(z,L)var(z)∈iterate(z,L) always; a term P∈LP\in LP∈L in which zzz does not occur satisfies θz,M(P)={P}\theta_{z,M}(P)=\{P\}θz,M​(P)={P} and hence contributes PPP itself to the left-hand side; and SSS is necessarily inhabited because s∈Ss\in Ss∈S is supplied.

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