Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Global substitution operator

Definition
MSKleene_SubstGlobal

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

formal-languagesmany-sorted-algebratree-automatauniversal-algebra

The global substitution operator (((x/Lx)x∈Xt)t∈S)♯p(((x/L_x)_{x\in X_t})_{t\in S})^{\sharp\mathsf{p}}(((x/Lx​)x∈Xt​​)t∈S​)♯p of Definition 3.20, used in Proposition 3.30.

An SSS-sorted map ρ:X→TΣ(X)℘\rho : X \to \mathbf{T}_\Sigma(X)^{\wp}ρ:X→TΣ​(X)℘ is exactly a family of languages (Lx)x(L_x)_x(Lx​)x​, one per variable. substGlobalHom ρ is the induced homomorphism TΣ(X)→TΣ(X)℘\mathbf{T}_\Sigma(X) \to \mathbf{T}_\Sigma(X)^{\wp}TΣ​(X)→TΣ​(X)℘, and substGlobalP ρ s K = ⋃_{P ∈ K} (substGlobalHom ρ)_s(P) its completely additive extension.

Definition code
/-
The global substitution operator `(((x/L_x)_{x∈X_t})_{t∈S})^{♯ᵖ}` of
Definition 3.20, used in Proposition 3.30 (`PRecSubs`).

An `S`-sorted map `ρ : X → T_Σ(X)^℘` is exactly a family of languages
`(L_x)_{x}` , one per variable. `substGlobalHom ρ` is the induced homomorphism
`T_Σ(X) → T_Σ(X)^℘`, and `substGlobalP ρ s` its completely additive extension.
-/
import Definitions.Def_MSKleene_Term
import Definitions.Def_MSKleene_Power
import Mathlib.Data.Set.Lattice

namespace MSKleene

universe u

variable {S : Type u} {sig : Signature S} {X : SSet S}

/-- The homomorphism `(((x/L_x))_{x})^{♯} : T_Σ(X) → T_Σ(X)^℘` induced by a
family of languages `ρ` indexed by the variables (Definition 3.20). -/
noncomputable def substGlobalHom
    (ρ : SMap X (powerAlgebra (freeAlgebra sig X)).carrier) :
    Hom (freeAlgebra sig X) (powerAlgebra (freeAlgebra sig X)) :=
  evalHom (powerAlgebra (freeAlgebra sig X)) ρ

/-- Its completely additive extension
`(((x/L_x))_{x})^{♯ᵖ}_s (K) = ⋃_{P ∈ K} (((x/L_x))_{x})^{♯}_s (P)`. -/
noncomputable def substGlobalP
    (ρ : SMap X (powerAlgebra (freeAlgebra sig X)).carrier) (s : S)
    (K : Set (Term sig X s)) : Set (Term sig X s) :=
  ⋃ P ∈ K, (substGlobalHom ρ).toFun s P

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

substGlobalHom

Fix a universe level, a type SSS whose elements are called sorts, a signature sigsigsig over SSS (implicitly), and an SSS-indexed family of variable types XXX (implicitly); here sigsigsig assigns to each list of sorts www and each sort sss a type sig  w  ssig\;w\;ssigws of operation symbols with input profile www and output sort sss, and XsX_sXs​ is the type of variables of sort sss. Recall that Term(sig,X)s\mathrm{Term}(sig,X)_sTerm(sig,X)s​ is the type of well-sorted terms of sort sss: every variable x∈Xsx \in X_sx∈Xs​ gives a term var(x)\mathrm{var}(x)var(x), and every symbol σ∈sig  w  s\sigma \in sig\;w\;sσ∈sigws together with a sort-indexed tuple of subterms whose sorts spell out www gives a term app(σ,… )\mathrm{app}(\sigma,\dots)app(σ,…). Let F=freeAlgebra(sig,X)F = \mathrm{freeAlgebra}(sig,X)F=freeAlgebra(sig,X) be the term algebra, whose carrier at sort sss is Term(sig,X)s\mathrm{Term}(sig,X)_sTerm(sig,X)s​ and whose interpretation of a symbol σ\sigmaσ on an argument tuple is the term app(σ,that tuple)\mathrm{app}(\sigma,\text{that tuple})app(σ,that tuple). Let P(F)=powerAlgebra(F)\mathcal{P}(F) = \mathrm{powerAlgebra}(F)P(F)=powerAlgebra(F) be its power algebra, whose carrier at sort sss is the set of all subsets L⊆Term(sig,X)sL \subseteq \mathrm{Term}(sig,X)_sL⊆Term(sig,X)s​ and whose interpretation of a symbol σ∈sig  w  s\sigma \in sig\;w\;sσ∈sigws on a tuple of sets (L1,…,Lk)(L_1,\dots,L_k)(L1​,…,Lk​) (indexed by w=[s1,…,sk]w = [s_1,\dots,s_k]w=[s1​,…,sk​]) is

powerOpF(σ)(L1,…,Lk)  =  { app(σ,(t1,…,tk))∣ti∈Li for every i },\mathrm{powerOp}_F(\sigma)(L_1,\dots,L_k) \;=\; \{\, \mathrm{app}(\sigma,(t_1,\dots,t_k)) \mid t_i \in L_i \text{ for every } i \,\},powerOpF​(σ)(L1​,…,Lk​)={app(σ,(t1​,…,tk​))∣ti​∈Li​ for every i},

which for empty www reduces to the singleton {app(σ,())}\{\mathrm{app}(\sigma,())\}{app(σ,())} (the membership condition being vacuous). The definition takes one explicit argument ρ\rhoρ that, for every sort sss and every variable x∈Xsx \in X_sx∈Xs​, selects a set of terms ρs(x)⊆Term(sig,X)s\rho_s(x) \subseteq \mathrm{Term}(sig,X)_sρs​(x)⊆Term(sig,X)s​. It returns the algebra homomorphism F→P(F)F \to \mathcal{P}(F)F→P(F) given by the evaluation homomorphism into P(F)\mathcal{P}(F)P(F) determined by ρ\rhoρ; write it Φρ\Phi_\rhoΦρ​. Its underlying sort-indexed map sends a term ttt of sort sss to a subset Φρ,s(t)⊆Term(sig,X)s\Phi_{\rho,s}(t) \subseteq \mathrm{Term}(sig,X)_sΦρ,s​(t)⊆Term(sig,X)s​ defined by structural recursion: Φρ,s(var(x))=ρs(x)\Phi_{\rho,s}(\mathrm{var}(x)) = \rho_s(x)Φρ,s​(var(x))=ρs​(x), and Φρ,s(app(σ,(t1,…,tk)))=powerOpF(σ)(Φρ,s1(t1),…,Φρ,sk(tk))\Phi_{\rho,s}(\mathrm{app}(\sigma,(t_1,\dots,t_k))) = \mathrm{powerOp}_F(\sigma)\big(\Phi_{\rho,s_1}(t_1),\dots,\Phi_{\rho,s_k}(t_k)\big)Φρ,s​(app(σ,(t1​,…,tk​)))=powerOpF​(σ)(Φρ,s1​​(t1​),…,Φρ,sk​​(tk​)), i.e. the set of all terms app(σ,(u1,…,uk))\mathrm{app}(\sigma,(u_1,\dots,u_k))app(σ,(u1​,…,uk​)) with each uiu_iui​ ranging over the recursively computed set Φρ,si(ti)\Phi_{\rho,s_i}(t_i)Φρ,si​​(ti​). As a homomorphism, Φρ\Phi_\rhoΦρ​ also carries the proof that for every symbol σ∈sig  w  s\sigma \in sig\;w\;sσ∈sigws and every tuple of term arguments tˉ\bar ttˉ, Φρ,s(app(σ,tˉ))\Phi_{\rho,s}(\mathrm{app}(\sigma,\bar t))Φρ,s​(app(σ,tˉ)) equals powerOpF(σ)\mathrm{powerOp}_F(\sigma)powerOpF​(σ) applied to the tuple obtained by applying Φρ\Phi_\rhoΦρ​ componentwise to tˉ\bar ttˉ. The definition is marked noncomputable and has no further hypotheses.

substGlobalP

With the same implicitly fixed data (universe level, sort type SSS, signature sigsigsig, variable family XXX), this definition takes three explicit arguments: an assignment ρ\rhoρ that for every sort sss and every variable x∈Xsx \in X_sx∈Xs​ gives a set of terms ρs(x)⊆Term(sig,X)s\rho_s(x) \subseteq \mathrm{Term}(sig,X)_sρs​(x)⊆Term(sig,X)s​ (the same argument as for substGlobalHom\mathrm{substGlobalHom}substGlobalHom), a sort s∈Ss \in Ss∈S, and a set K⊆Term(sig,X)sK \subseteq \mathrm{Term}(sig,X)_sK⊆Term(sig,X)s​ of terms of sort sss. It returns the set of terms of sort sss

substGlobalP(ρ,s,K)  =  ⋃P∈KΦρ,s(P),\mathrm{substGlobalP}(\rho,s,K) \;=\; \bigcup_{P \in K} \Phi_{\rho,s}(P),substGlobalP(ρ,s,K)=P∈K⋃​Φρ,s​(P),

where Φρ=substGlobalHom(ρ)\Phi_\rho = \mathrm{substGlobalHom}(\rho)Φρ​=substGlobalHom(ρ) is the homomorphism described above and Φρ,s\Phi_{\rho,s}Φρ,s​ is its component function at sort sss. Equivalently, a term yyy of sort sss belongs to substGlobalP(ρ,s,K)\mathrm{substGlobalP}(\rho,s,K)substGlobalP(ρ,s,K) if and only if there exists a term PPP with P∈KP \in KP∈K and y∈Φρ,s(P)y \in \Phi_{\rho,s}(P)y∈Φρ,s​(P), where Φρ,s(P)\Phi_{\rho,s}(P)Φρ,s​(P) is the value that substGlobalHom(ρ)\mathrm{substGlobalHom}(\rho)substGlobalHom(ρ) assigns to PPP, namely the evaluation of PPP in the power algebra P(F)\mathcal{P}(F)P(F) under ρ\rhoρ. In particular, when KKK is empty the result is the empty set. The definition is marked noncomputable and carries no additional hypotheses.

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