Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Proposition 3.6: the subterm order is Artinian

Proved
MSKleene.subterm_wf

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

formal-languagesmany-sorted-algebratree-automatauniversal-algebra

The subterm order is artinian (Proposition 3.6).

The order ≤TΣ(X)\le_{\mathbf{T}_{\Sigma}(X)}≤TΣ​(X)​ has no strictly descending ω0\omega_{0}ω0​-chains, i.e. it is Artinian. Moreover Min(∐TΣ(X),≤TΣ(X))\mathrm{Min}(\coprod\mathrm{T}_{\Sigma}(X),\le_{\mathbf{T}_{\Sigma}(X)})Min(∐TΣ​(X),≤TΣ​(X)​) is exactly {(x,s)∣s∈S, x∈Xs}∪{(σTΣ(X),s)∣s∈S, σ∈Σλ,s}\{(x,s)\mid s\in S,\ x\in X_{s}\}\cup\{(\sigma^{\mathbf{T}_{\Sigma}(X)},s)\mid s\in S,\ \sigma\in\Sigma_{\lambda,s}\}{(x,s)∣s∈S, x∈Xs​}∪{(σTΣ​(X),s)∣s∈S, σ∈Σλ,s​}: the variables and the constant symbols.

Preamble
import Definitions.Def_MSKleene_Subterm
Formal statement
namespace MSKleene

/-- **The subterm order is Artinian** (Proposition 3.6).

On the free algebra `T_Σ(X)` the strict proper-subterm order `SubtermLT` is
well-founded, and a sorted term is minimal for it iff it is a variable or a
constant symbol. -/
theorem subterm_wf {S : Type} (sig : Signature S) (X : SSet S) :
    WellFounded (SubtermLT (sig := sig) (X := X))
  ∧ ∀ b : STerm sig X, Min b ↔
      ((∃ x : X b.1, b.2 = Term.var x)
       ∨ (∃ σ : sig [] b.1, b.2 = Term.app σ TermVec.nil)) := 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: MSKleene.subterm_wf

Fix an arbitrary type SSS (its inhabitants are called sorts), an arbitrary family Σ\SigmaΣ assigning to every pair consisting of a finite list www of sorts and a single sort sss a type Σ(w,s)\Sigma(w,s)Σ(w,s) (the operation symbols of argument profile www and result sort sss; formally sig:List S→S→Type\mathrm{sig} : \mathrm{List}\,S \to S \to \mathrm{Type}sig:ListS→S→Type), and an arbitrary family XXX assigning to every sort sss a type XsX_sXs​ (the variables of sort sss; formally X:S→TypeX : S \to \mathrm{Type}X:S→Type). Here SSS is an implicit parameter while Σ\SigmaΣ and XXX are explicit; the theorem asserts the statement below for every such SSS, Σ\SigmaΣ, XXX. Over this data one has the mutually inductively defined families Term(s)\mathrm{Term}(s)Term(s) (terms of sort sss) and TermVec(w)\mathrm{TermVec}(w)TermVec(w) (term-vectors of profile www), whose constructors are: var(x)∈Term(s)\mathrm{var}(x) \in \mathrm{Term}(s)var(x)∈Term(s) for each x∈Xsx \in X_sx∈Xs​; app(σ,t⃗ )∈Term(s)\mathrm{app}(\sigma,\vec t\,) \in \mathrm{Term}(s)app(σ,t)∈Term(s) for each list www, each σ∈Σ(w,s)\sigma \in \Sigma(w,s)σ∈Σ(w,s) and each t⃗∈TermVec(w)\vec t \in \mathrm{TermVec}(w)t∈TermVec(w); nil∈TermVec([ ])\mathrm{nil} \in \mathrm{TermVec}([\,])nil∈TermVec([]); and cons(t,r⃗ )∈TermVec(s::w)\mathrm{cons}(t,\vec r\,) \in \mathrm{TermVec}(s :: w)cons(t,r)∈TermVec(s::w) for each t∈Term(s)t \in \mathrm{Term}(s)t∈Term(s) and r⃗∈TermVec(w)\vec r \in \mathrm{TermVec}(w)r∈TermVec(w). Let

STerm  =  ∑s:STerm(s)\mathrm{STerm} \;=\; \sum_{s : S} \mathrm{Term}(s)STerm=s:S∑​Term(s)

be the type of dependent pairs b=(b1,b2)b = (b_1, b_2)b=(b1​,b2​) with b1∈Sb_1 \in Sb1​∈S a sort and b2∈Term(b1)b_2 \in \mathrm{Term}(b_1)b2​∈Term(b1​) a term of that sort (a sorted term). Write p∈ts⃗p \in \vec{ts}p∈ts for the inductively defined membership predicate on term-vectors: p∈cons(p,ps⃗)p \in \mathrm{cons}(p,\vec{ps})p∈cons(p,ps​) always holds (this base case requires ppp to be literally the head entry and of the same sort as the head), and p∈cons(q,ps⃗)p \in \mathrm{cons}(q,\vec{ps})p∈cons(q,ps​) holds whenever p∈ps⃗p \in \vec{ps}p∈ps​ (regardless of the head qqq). Define the immediate-subterm relation ImmSub(a,b)\mathrm{ImmSub}(a,b)ImmSub(a,b) on STerm\mathrm{STerm}STerm to hold iff

∃ w∈List S,    ∃ σ∈Σ(w,b1),    ∃ ts⃗∈TermVec(w)  :b2=app(σ,ts⃗ )  and  a2∈ts⃗,\exists\, w \in \mathrm{List}\,S,\;\; \exists\, \sigma \in \Sigma(w, b_1),\;\; \exists\, \vec{ts} \in \mathrm{TermVec}(w) \;:\quad b_2 = \mathrm{app}(\sigma, \vec{ts}\,) \ \text{ and } \ a_2 \in \vec{ts},∃w∈ListS,∃σ∈Σ(w,b1​),∃ts∈TermVec(w):b2​=app(σ,ts)  and  a2​∈ts,

the first equation being an equation in the (dependent) type Term(b1)\mathrm{Term}(b_1)Term(b1​); note the sort a1a_1a1​ of aaa is not constrained beyond being whatever sort makes a2a_2a2​ occur in ts⃗\vec{ts}ts. Define SubtermLT(a,b)\mathrm{SubtermLT}(a,b)SubtermLT(a,b) to be the transitive closure of ImmSub\mathrm{ImmSub}ImmSub, i.e. there is a finite chain a=c0, c1, …, cn=ba = c_0,\, c_1,\, \dots,\, c_n = ba=c0​,c1​,…,cn​=b with n≥1n \ge 1n≥1 and ImmSub(ci−1,ci)\mathrm{ImmSub}(c_{i-1}, c_i)ImmSub(ci−1​,ci​) for every i∈{1,…,n}i \in \{1,\dots,n\}i∈{1,…,n} (at least one step; reflexivity is not included). Define Min(b)\mathrm{Min}(b)Min(b) to hold iff  ∀ a∈STerm, ¬ ImmSub(a,b)\ \forall\, a \in \mathrm{STerm},\ \neg\, \mathrm{ImmSub}(a,b) ∀a∈STerm, ¬ImmSub(a,b), i.e. no sorted term is an immediate subterm of bbb.

The theorem asserts the conjunction of the following two statements.

(1) The relation SubtermLT\mathrm{SubtermLT}SubtermLT on STerm\mathrm{STerm}STerm is well-founded: every element of STerm\mathrm{STerm}STerm is accessible for SubtermLT\mathrm{SubtermLT}SubtermLT; equivalently, there is no infinite sequence (ak)k∈N(a_k)_{k \in \mathbb{N}}(ak​)k∈N​ of sorted terms with SubtermLT(ak+1,ak)\mathrm{SubtermLT}(a_{k+1}, a_k)SubtermLT(ak+1​,ak​) for all kkk (no infinitely descending chain of proper subterms), and equivalently every non-empty predicate on STerm\mathrm{STerm}STerm has a SubtermLT\mathrm{SubtermLT}SubtermLT-minimal element.

(2) For every sorted term b∈STermb \in \mathrm{STerm}b∈STerm,

Min(b)⟺(∃ x∈Xb1: b2=var(x))  ∨  (∃ σ∈Σ([ ], b1): b2=app(σ, nil)),\mathrm{Min}(b) \quad\Longleftrightarrow\quad \Big(\exists\, x \in X_{b_1} : \ b_2 = \mathrm{var}(x)\Big) \ \ \lor\ \ \Big(\exists\, \sigma \in \Sigma([\,],\, b_1) : \ b_2 = \mathrm{app}(\sigma,\, \mathrm{nil})\Big),Min(b)⟺(∃x∈Xb1​​: b2​=var(x))  ∨  (∃σ∈Σ([],b1​): b2​=app(σ,nil)),

both equalities being equalities in Term(b1)\mathrm{Term}(b_1)Term(b1​); that is, bbb has no immediate subterm exactly when its term component is either a variable of sort b1b_1b1​, or an operation symbol whose argument profile is the empty list and whose result sort is b1b_1b1​, applied to the empty term-vector (a nullary/constant application). This is a genuine biconditional in both directions.

Degenerate cases the quantifiers silently include: if SSS is empty then STerm\mathrm{STerm}STerm is empty, so SubtermLT\mathrm{SubtermLT}SubtermLT is well-founded vacuously and the universally quantified biconditional in (2) holds vacuously; more generally, for any bbb for which neither disjunct on the right of (2) is satisfiable (for instance when Xb1X_{b_1}Xb1​​ and Σ([ ],b1)\Sigma([\,],b_1)Σ([],b1​) are both empty, or when b2b_2b2​ has the form app(σ,ts⃗)\mathrm{app}(\sigma,\vec{ts})app(σ,ts) that matches neither shape), statement (2) forces ¬ Min(b)\neg\,\mathrm{Min}(b)¬Min(b). The types XsX_sXs​ and Σ(w,s)\Sigma(w,s)Σ(w,s) are permitted to be empty or infinite; no finiteness, decidability, or non-emptiness hypotheses are imposed on SSS, Σ\SigmaΣ, or XXX.

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