Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Strong Normalization of Mutual Blocks & Programs (Theorems 4 & 5), and Embedding of System F_ω^{cop} (Theorem 6)

Disproved
NishtAbel2024.theorems_4_5_and_6

by kmehltretter82 · Oct 31, 2026 · Mathlib 0df444a (Lean v4.33.1)

agdacopatternssize-change-terminationsized-typesstrong-normalizationtermination-checkingtype-theory

Theorems 4, 5, and 6 (Sections 5.4.4–5.5, pp. 37–40): (1) every well-typed mutual block MutualBlockTyping sig Ξ over a semantically valid signature sig is semantically valid and strongly normalizing (SemMutualBlockValid sig Ξ); (2) every well-typed signature sequence SigBlocksTyping is semantically valid; (3) every well-typed program ProgramTyping P is strongly normalizing (SemProgramValid P); and (4) every System F_ω^{cop} mutual block with a lexicographic size measure embeds into System F_ω^{cop, SCT} (MutualBlockTyping).

Superseded. This is the first formalization of Theorem 4, Lemma 2, Theorem 5 and Theorem 6 (pp. 37–39) of the thesis. It is refuted through its Theorem 4 conjunct by the accepted disproof 469b61a8-c1ac-4d55-bb1e-a402e10e2934: an existing global function calls a function that is only declared later; a new block declares that function with a call back to the existing one. The new block is well-typed with an empty invocation-graph family that satisfies the size-change criterion, but in the combined signature the two functions reduce to each other forever. As with Theorem 15, the formal statement omits the thesis's scope discipline, which rules out such forward references. The Lemma 2, Theorem 5 and Theorem 6 conjuncts are not refuted individually. Corrected statement: NishtAbel2024V2.theorems_4_5_and_6. It adds the scope hypotheses (scopeBlockExtension, scopeOrderedBlocks, ScopedProgramTyping) and requires a non-empty lexicographic measure in Theorem 6.

Preamble
import Definitions.Def_NishtAbel2024_Syntax
import Definitions.Def_NishtAbel2024_Semantics
Formal statement
namespace NishtAbel2024

/-- Theorem 4 (Soundness of mutual blocks, p. 37), Lemma 2 (Soundness of global environment, p. 38),
Theorem 5 (Soundness of programs in System `F_ω^{cop, SCT}`, p. 38), and
Theorem 6 (Relation of System `F_ω^{cop, SCT}` and System `F_ω^{cop}`, p. 39):
1. (**Theorem 4**) If `⊨ Σ` and `Σ ⊢ Ξ`, then `Σ ⊨ Ξ`.
2. (**Lemma 2**) If `⊢ Σ`, then `⊨ Σ`.
3. (**Theorem 5**) If `⊢ P`, then `⊨ P` (`P.main ∈ SN`).
4. (**Theorem 6**) If `Σ ⊢ Ξ` in System `F_ω^{cop}`, then `Σ ⊢ |Ξ|` in System `F_ω^{cop, SCT}`. -/
theorem theorems_4_5_and_6 :
    (∀ (sig : GlobalSig) (Ξ : MutualBlock),
      SemSigValid sig →
      MutualBlockTyping sig Ξ →
      SemMutualBlockValid sig Ξ) ∧
    (∀ blocks : List MutualBlock,
      SigBlocksTyping blocks →
      SemSigValid blocks.flatten) ∧
    (∀ P : Program,
      ProgramTyping P →
      SemProgramValid P) ∧
    (∀ (sig : GlobalSig) (Ξcop : List CopFunDecl),
      CopMutualBlockTyping sig Ξcop →
      MutualBlockTyping sig (eraseMeasures Ξcop)) := by
  sorry

end NishtAbel2024
Source
Kanstantsin Nisht, 'Type-Based Termination Checking in Agda', Master's Thesis in Computer Science and Engineering, Chalmers University of Technology and University of Gothenburg (supervised by Andreas Abel), 2024; extended abstract by Kanstantsin Nisht and Andreas Abel, 30th International Conference on Types for Proofs and Programs (TYPES 2024). Sections 5.4.4–5.5, Theorem 4 (p. 37), Theorem 5 (p. 38), and Theorem 6 (p. 39).
Read-back

What the Lean code literally says, in plain math · Gemini 3.1 Pro (Independent Blind Auditor)

Independent Mathematical Read-Back: Thm_NishtAbel2024_theorems_4_5_and_6.lean

The declaration NishtAbel2024.theorems_4_5_and_6 asserts the conjunction Q1∧Q2∧Q3∧Q4Q_1 \land Q_2 \land Q_3 \land Q_4Q1​∧Q2​∧Q3​∧Q4​ of four propositions concerning the semantic validity of mutually recursive function blocks (Q1Q_1Q1​), sequences of mutual blocks (Q2Q_2Q2​), complete programs (Q3Q_3Q3​), and the translation of copattern mutual blocks with lexicographic measure indices into SCT-typed mutual blocks (Q4Q_4Q4​).

Underlying Definitions.

  • Function declarations, mutual blocks, and signatures: A function declaration decl=(f,Ψf,Af,Dsf)∈FunDecl\mathrm{decl} = (f, \Psi_f, A_f, Ds_f) \in \mathrm{FunDecl}decl=(f,Ψf​,Af​,Dsf​)∈FunDecl consists of a function name f∈Nf \in \mathbb{N}f∈N, a size parameter context Ψf∈SizeCtx\Psi_f \in \mathrm{SizeCtx}Ψf​∈SizeCtx, a type expression Af∈TypeExprA_f \in \mathrm{TypeExpr}Af​∈TypeExpr, and a list of clauses Dsf∈List ClauseDs_f \in \mathrm{List}\,\mathrm{Clause}Dsf​∈ListClause. Both MutualBlock\mathrm{MutualBlock}MutualBlock and GlobalSig\mathrm{GlobalSig}GlobalSig are aliases for List FunDecl\mathrm{List}\,\mathrm{FunDecl}ListFunDecl.
  • Syntactic declaration and block typing:
    • Given sig,Ξ∈List FunDecl\mathrm{sig}, \Xi \in \mathrm{List}\,\mathrm{FunDecl}sig,Ξ∈ListFunDecl, an invocation graph family G∈InvGraphFamily\mathcal{G} \in \mathrm{InvGraphFamily}G∈InvGraphFamily, and decl=(f,Ψf,Af,Dsf)∈FunDecl\mathrm{decl} = (f, \Psi_f, A_f, Ds_f) \in \mathrm{FunDecl}decl=(f,Ψf​,Af​,Dsf​)∈FunDecl, let Δ0=(Ψf,Ψf.map(λd⇒(d.var,d.pol,< d.bound)))\Delta_0 = (\Psi_f, \Psi_f.\mathrm{map}(\lambda d \Rightarrow (d.\mathrm{var}, d.\mathrm{pol}, {<}\,d.\mathrm{bound})))Δ0​=(Ψf​,Ψf​.map(λd⇒(d.var,d.pol,<d.bound))) and Ω=(sig,Ξ,G,f,Ψf)\Omega = (\mathrm{sig}, \Xi, \mathcal{G}, f, \Psi_f)Ω=(sig,Ξ,G,f,Ψf​). Then DeclTyping(sig,Ξ,G,decl)\mathrm{DeclTyping}(\mathrm{sig}, \Xi, \mathcal{G}, \mathrm{decl})DeclTyping(sig,Ξ,G,decl) holds iff:
      1. SizeCtxWf(Ψf)\mathrm{SizeCtxWf}(\Psi_f)SizeCtxWf(Ψf​),
      2. KindCheck(Δ0,Af,⋆)\mathrm{KindCheck}(\Delta_0, A_f, \star)KindCheck(Δ0​,Af​,⋆), and
      3. for every clause D∈DsfD \in Ds_fD∈Dsf​, ClauseCheck(Ω,Δ0,[],D,Af)\mathrm{ClauseCheck}(\Omega, \Delta_0, [], D, A_f)ClauseCheck(Ω,Δ0​,[],D,Af​).
    • MutualBlockTypingWith(sig,Ξ,G)\mathrm{MutualBlockTypingWith}(\mathrm{sig}, \Xi, \mathcal{G})MutualBlockTypingWith(sig,Ξ,G) holds iff:
      1. SCTValid(G)\mathrm{SCTValid}(\mathcal{G})SCTValid(G),
      2. for every decl∈Ξ\mathrm{decl} \in \Xidecl∈Ξ, G.arity(decl.name)=∣decl.sizeParams∣\mathcal{G}.\mathrm{arity}(\mathrm{decl}.\mathrm{name}) = |\mathrm{decl}.\mathrm{sizeParams}|G.arity(decl.name)=∣decl.sizeParams∣, and
      3. for every decl∈Ξ\mathrm{decl} \in \Xidecl∈Ξ, DeclTyping(sig,Ξ,G,decl)\mathrm{DeclTyping}(\mathrm{sig}, \Xi, \mathcal{G}, \mathrm{decl})DeclTyping(sig,Ξ,G,decl).
    • MutualBlockTyping(sig,Ξ)\mathrm{MutualBlockTyping}(\mathrm{sig}, \Xi)MutualBlockTyping(sig,Ξ) holds iff there exists G∈InvGraphFamily\mathcal{G} \in \mathrm{InvGraphFamily}G∈InvGraphFamily such that MutualBlockTypingWith(sig,Ξ,G)\mathrm{MutualBlockTypingWith}(\mathrm{sig}, \Xi, \mathcal{G})MutualBlockTypingWith(sig,Ξ,G) holds.
    • SigBlocksTyping(blocks)\mathrm{SigBlocksTyping}(\mathrm{blocks})SigBlocksTyping(blocks) for blocks∈List MutualBlock\mathrm{blocks} \in \mathrm{List}\,\mathrm{MutualBlock}blocks∈ListMutualBlock holds inductively for [][][], and for blocks+ ⁣+[Ξ]\mathrm{blocks} \mathbin{+\!+} [\Xi]blocks++[Ξ] when SigBlocksTyping(blocks)\mathrm{SigBlocksTyping}(\mathrm{blocks})SigBlocksTyping(blocks) and MutualBlockTyping(blocks.flatten,Ξ)\mathrm{MutualBlockTyping}(\mathrm{blocks}.\mathrm{flatten}, \Xi)MutualBlockTyping(blocks.flatten,Ξ) hold.
    • A program P=(blocks,tmain)∈ProgramP = (\mathrm{blocks}, t_{\mathrm{main}}) \in \mathrm{Program}P=(blocks,tmain​)∈Program consists of a list of mutual blocks blocks∈List MutualBlock\mathrm{blocks} \in \mathrm{List}\,\mathrm{MutualBlock}blocks∈ListMutualBlock and a main term tmain∈Termt_{\mathrm{main}} \in \mathrm{Term}tmain​∈Term. ProgramTyping(P)\mathrm{ProgramTyping}(P)ProgramTyping(P) holds iff SigBlocksTyping(blocks)\mathrm{SigBlocksTyping}(\mathrm{blocks})SigBlocksTyping(blocks) holds and there exists A∈TypeExprA \in \mathrm{TypeExpr}A∈TypeExpr such that
ExprInfer((blocks.flatten,[],(λ_⇒0,λ__⇒[]),0,[]),([],[]),[],tmain,A)\mathrm{ExprInfer}((\mathrm{blocks}.\mathrm{flatten}, [], (\lambda \_ \Rightarrow 0, \lambda \_ \_ \Rightarrow []), 0, []), ([], []), [], t_{\mathrm{main}}, A)ExprInfer((blocks.flatten,[],(λ_⇒0,λ__⇒[]),0,[]),([],[]),[],tmain​,A)
holds.
  • Semantic validity of blocks and programs:
    • SemMutualBlockValid(sig,Ξ)\mathrm{SemMutualBlockValid}(\mathrm{sig}, \Xi)SemMutualBlockValid(sig,Ξ) holds iff for every decl=(f,Ψf,Af,Dsf)∈Ξ\mathrm{decl} = (f, \Psi_f, A_f, Ds_f) \in \Xidecl=(f,Ψf​,Af​,Dsf​)∈Ξ:
      1. SN(sig+ ⁣+Ξ,[],lamClauses(Dsf))\mathrm{SN}(\mathrm{sig} \mathbin{+\!+} \Xi, [], \mathsf{lamClauses}(Ds_f))SN(sig++Ξ,[],lamClauses(Dsf​)) holds, and
      2. for all as∈List SizeExpas \in \mathrm{List}\,\mathrm{SizeExp}as∈ListSizeExp and ρ:N→SizeOrd\rho : \mathbb{N} \to \mathrm{SizeOrd}ρ:N→SizeOrd, if ValidSizeTuple(Ψf,as.map(⟦−⟧ρ))\mathrm{ValidSizeTuple}(\Psi_f, as.\mathrm{map}(\llbracket - \rrbracket_\rho))ValidSizeTuple(Ψf​,as.map([[−]]ρ​)) holds, then funRef(f,as)∈⟦Af⟧SizeVal.ofList(Ψf.dom.zip(as.map(⟦−⟧ρ)))sig+ ⁣+Ξ,[]\mathsf{funRef}(f, as) \in \llbracket A_f \rrbracket^{\mathrm{sig} \mathbin{+\!+} \Xi, []}_{\mathrm{SizeVal.ofList}(\Psi_f.\mathrm{dom}.\mathrm{zip}(as.\mathrm{map}(\llbracket - \rrbracket_\rho)))}funRef(f,as)∈[[Af​]]SizeVal.ofList(Ψf​.dom.zip(as.map([[−]]ρ​)))sig++Ξ,[]​.
    • SemProgramValid(P)\mathrm{SemProgramValid}(P)SemProgramValid(P) holds iff SN(P.sig.flatten,[],P.main)\mathrm{SN}(P.\mathrm{sig}.\mathrm{flatten}, [], P.\mathrm{main})SN(P.sig.flatten,[],P.main) holds (i.e., P.mainP.\mathrm{main}P.main is strongly normalizing under one-step reduction RedStep with global signature P.sig.flattenP.\mathrm{sig}.\mathrm{flatten}P.sig.flatten and empty mutual block [][][]).
  • Lexicographic measure declarations:
    • A measured function declaration cdecl=(decl,measureIndices)∈CopFunDecl\mathrm{cdecl} = (\mathrm{decl}, \mathrm{measureIndices}) \in \mathrm{CopFunDecl}cdecl=(decl,measureIndices)∈CopFunDecl pairs a FunDecl\mathrm{FunDecl}FunDecl with a list of natural numbers measureIndices∈List N\mathrm{measureIndices} \in \mathrm{List}\,\mathbb{N}measureIndices∈ListN. For Ξcop∈List CopFunDecl\Xi_{\mathrm{cop}} \in \mathrm{List}\,\mathrm{CopFunDecl}Ξcop​∈ListCopFunDecl, eraseMeasures(Ξcop)=Ξcop.map(⋅.decl)\mathrm{eraseMeasures}(\Xi_{\mathrm{cop}}) = \Xi_{\mathrm{cop}}.\mathrm{map}(\cdot.\mathrm{decl})eraseMeasures(Ξcop​)=Ξcop​.map(⋅.decl).
    • Given measureIndices∈List N\mathrm{measureIndices} \in \mathrm{List}\,\mathbb{N}measureIndices∈ListN, p∈Np \in \mathbb{N}p∈N (paramArity), and s∈Ns \in \mathbb{N}s∈N (stepIdx), the invocation graph lexInvGraph(measureIndices,p,s)\mathrm{lexInvGraph}(\mathrm{measureIndices}, p, s)lexInvGraph(measureIndices,p,s) has left and right arity ppp and canonical edges determined by: for 0≤l,r<p0 \le l, r < p0≤l,r<p, there is no edge if l≠rl \ne rl=r; if l=rl = rl=r and the first occurrence of lll in measureIndices\mathrm{measureIndices}measureIndices (measureIndices.idxOf? l) is at index pos\mathrm{pos}pos, the edge (l,l)(l, l)(l,l) has label le\mathsf{le}le if pos<s\mathrm{pos} < spos<s, label lt\mathsf{lt}lt if pos=s\mathrm{pos} = spos=s, and no edge if pos>s\mathrm{pos} > spos>s or l∉measureIndicesl \notin \mathrm{measureIndices}l∈/measureIndices.
    • Given dom∈List N\mathrm{dom} \in \mathrm{List}\,\mathbb{N}dom∈ListN, p∈Np \in \mathbb{N}p∈N, and measureIndices∈List N\mathrm{measureIndices} \in \mathrm{List}\,\mathbb{N}measureIndices∈ListN, lexInvGraphFamily(dom,p,measureIndices)\mathrm{lexInvGraphFamily}(\mathrm{dom}, p, \mathrm{measureIndices})lexInvGraphFamily(dom,p,measureIndices) is the InvGraphFamily assigning arity ppp to every function name f∈Nf \in \mathbb{N}f∈N and assigning to (f,g)∈N×N(f, g) \in \mathbb{N} \times \mathbb{N}(f,g)∈N×N the list [lexInvGraph(measureIndices,p,s)∣s∈[0,1,…,∣measureIndices∣−1]][\mathrm{lexInvGraph}(\mathrm{measureIndices}, p, s) \mid s \in [0, 1, \dots, |\mathrm{measureIndices}| - 1]][lexInvGraph(measureIndices,p,s)∣s∈[0,1,…,∣measureIndices∣−1]] if f∈dom∧g∈domf \in \mathrm{dom} \land g \in \mathrm{dom}f∈dom∧g∈dom, and [][][] otherwise.
    • Letting dom=eraseMeasures(Ξcop).map(⋅.name)\mathrm{dom} = \mathrm{eraseMeasures}(\Xi_{\mathrm{cop}}).\mathrm{map}(\cdot.\mathrm{name})dom=eraseMeasures(Ξcop​).map(⋅.name), CopMutualBlockTyping(sig,Ξcop)\mathrm{CopMutualBlockTyping}(\mathrm{sig}, \Xi_{\mathrm{cop}})CopMutualBlockTyping(sig,Ξcop​) holds iff there exist p∈Np \in \mathbb{N}p∈N and measureIndices∈List N\mathrm{measureIndices} \in \mathrm{List}\,\mathbb{N}measureIndices∈ListN such that:
      1. measureIndices≠[]\mathrm{measureIndices} \ne []measureIndices=[],
      2. measureIndices.Nodup\mathrm{measureIndices}.\mathrm{Nodup}measureIndices.Nodup (all indices in measureIndices\mathrm{measureIndices}measureIndices are pairwise distinct),
      3. for every idx∈measureIndices\mathrm{idx} \in \mathrm{measureIndices}idx∈measureIndices, idx<p\mathrm{idx} < pidx<p,
      4. for every cdecl∈Ξcop\mathrm{cdecl} \in \Xi_{\mathrm{cop}}cdecl∈Ξcop​, cdecl.measureIndices=measureIndices\mathrm{cdecl}.\mathrm{measureIndices} = \mathrm{measureIndices}cdecl.measureIndices=measureIndices and ∣cdecl.decl.sizeParams∣=p|\mathrm{cdecl}.\mathrm{decl}.\mathrm{sizeParams}| = p∣cdecl.decl.sizeParams∣=p, and
      5. for every cdecl∈Ξcop\mathrm{cdecl} \in \Xi_{\mathrm{cop}}cdecl∈Ξcop​, DeclTyping(sig,eraseMeasures(Ξcop),lexInvGraphFamily(dom,p,measureIndices),cdecl.decl)\mathrm{DeclTyping}(\mathrm{sig}, \mathrm{eraseMeasures}(\Xi_{\mathrm{cop}}), \mathrm{lexInvGraphFamily}(\mathrm{dom}, p, \mathrm{measureIndices}), \mathrm{cdecl}.\mathrm{decl})DeclTyping(sig,eraseMeasures(Ξcop​),lexInvGraphFamily(dom,p,measureIndices),cdecl.decl) holds.

Statement of the Four Conjuncts.

  1. First Conjunct (Q1Q_1Q1​): For every global signature sig∈GlobalSig\mathrm{sig} \in \mathrm{GlobalSig}sig∈GlobalSig and mutual block Ξ∈MutualBlock\Xi \in \mathrm{MutualBlock}Ξ∈MutualBlock, if SemSigValid(sig)\mathrm{SemSigValid}(\mathrm{sig})SemSigValid(sig) and MutualBlockTyping(sig,Ξ)\mathrm{MutualBlockTyping}(\mathrm{sig}, \Xi)MutualBlockTyping(sig,Ξ) hold, then SemMutualBlockValid(sig,Ξ)\mathrm{SemMutualBlockValid}(\mathrm{sig}, \Xi)SemMutualBlockValid(sig,Ξ) holds.
  2. Second Conjunct (Q2Q_2Q2​): For every list of mutual blocks blocks∈List MutualBlock\mathrm{blocks} \in \mathrm{List}\,\mathrm{MutualBlock}blocks∈ListMutualBlock, if SigBlocksTyping(blocks)\mathrm{SigBlocksTyping}(\mathrm{blocks})SigBlocksTyping(blocks) holds, then SemSigValid(blocks.flatten)\mathrm{SemSigValid}(\mathrm{blocks}.\mathrm{flatten})SemSigValid(blocks.flatten) holds.
  3. Third Conjunct (Q3Q_3Q3​): For every program P∈ProgramP \in \mathrm{Program}P∈Program, if ProgramTyping(P)\mathrm{ProgramTyping}(P)ProgramTyping(P) holds, then SemProgramValid(P)\mathrm{SemProgramValid}(P)SemProgramValid(P) holds.
  4. Fourth Conjunct (Q4Q_4Q4​): For every global signature sig∈GlobalSig\mathrm{sig} \in \mathrm{GlobalSig}sig∈GlobalSig and list of measured function declarations Ξcop∈List CopFunDecl\Xi_{\mathrm{cop}} \in \mathrm{List}\,\mathrm{CopFunDecl}Ξcop​∈ListCopFunDecl, if CopMutualBlockTyping(sig,Ξcop)\mathrm{CopMutualBlockTyping}(\mathrm{sig}, \Xi_{\mathrm{cop}})CopMutualBlockTyping(sig,Ξcop​) holds, then MutualBlockTyping(sig,eraseMeasures(Ξcop))\mathrm{MutualBlockTyping}(\mathrm{sig}, \mathrm{eraseMeasures}(\Xi_{\mathrm{cop}}))MutualBlockTyping(sig,eraseMeasures(Ξcop​)) holds.

Edge Cases and Notes.

  • No distinctness requirement on function names in signatures or blocks: Neither MutualBlockTyping nor SigBlocksTyping requires function declarations in sig\mathrm{sig}sig or Ξ\XiΞ to have distinct name fields, whereas WhdStep.funClause nondeterministically unfolds funRef(f,as)\mathsf{funRef}(f, as)funRef(f,as) using any decl∈sig+ ⁣+Ξ\mathrm{decl} \in \mathrm{sig} \mathbin{+\!+} \Xidecl∈sig++Ξ with decl.name=f\mathrm{decl}.\mathrm{name} = fdecl.name=f.
  • Empty mutual blocks: When Ξ=[]\Xi = []Ξ=[] (or Ξcop=[]\Xi_{\mathrm{cop}} = []Ξcop​=[]), MutualBlockTyping and SemMutualBlockValid hold trivially (witnessed by the empty graph family with dom=[]\mathrm{dom} = []dom=[]).
Human review
  • Endorsed by Shuze Chen · Nov 1, 2026

    Confirmed by the moderator at approval.

  • Endorsed by kmehltretter82 · Nov 1, 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 paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me