Strong Normalization of Mutual Blocks & Programs (Theorems 4 & 5), and Embedding of System F_ω^{cop} (Theorem 6)
DisprovedNishtAbel2024.theorems_4_5_and_6by 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 NishtAbel2024Source
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∧Q4 of four propositions concerning the semantic validity of mutually recursive function blocks (Q1), sequences of mutual blocks (Q2), complete programs (Q3), and the translation of copattern mutual blocks with lexicographic measure indices into SCT-typed mutual blocks (Q4).
Underlying Definitions.
- Function declarations, mutual blocks, and signatures: A function declaration decl=(f,Ψf,Af,Dsf)∈FunDecl consists of a function name f∈N, a size parameter context Ψf∈SizeCtx, a type expression Af∈TypeExpr, and a list of clauses Dsf∈ListClause. Both MutualBlock and GlobalSig are aliases for ListFunDecl.
- Syntactic declaration and block typing:
- Given sig,Ξ∈ListFunDecl, an invocation graph family G∈InvGraphFamily, and decl=(f,Ψf,Af,Dsf)∈FunDecl, let Δ0=(Ψf,Ψf.map(λd⇒(d.var,d.pol,<d.bound))) and Ω=(sig,Ξ,G,f,Ψf). Then DeclTyping(sig,Ξ,G,decl) holds iff:
- SizeCtxWf(Ψf),
- KindCheck(Δ0,Af,⋆), and
- for every clause D∈Dsf, ClauseCheck(Ω,Δ0,[],D,Af).
- MutualBlockTypingWith(sig,Ξ,G) holds iff:
- SCTValid(G),
- for every decl∈Ξ, G.arity(decl.name)=∣decl.sizeParams∣, and
- for every decl∈Ξ, DeclTyping(sig,Ξ,G,decl).
- MutualBlockTyping(sig,Ξ) holds iff there exists G∈InvGraphFamily such that MutualBlockTypingWith(sig,Ξ,G) holds.
- SigBlocksTyping(blocks) for blocks∈ListMutualBlock holds inductively for [], and for blocks++[Ξ] when SigBlocksTyping(blocks) and MutualBlockTyping(blocks.flatten,Ξ) hold.
- A program P=(blocks,tmain)∈Program consists of a list of mutual blocks blocks∈ListMutualBlock and a main term tmain∈Term. ProgramTyping(P) holds iff SigBlocksTyping(blocks) holds and there exists A∈TypeExpr such that
ExprInfer((blocks.flatten,[],(λ_⇒0,λ__⇒[]),0,[]),([],[]),[],tmain,A)
holds.
- Semantic validity of blocks and programs:
- SemMutualBlockValid(sig,Ξ) holds iff for every decl=(f,Ψf,Af,Dsf)∈Ξ:
- SN(sig++Ξ,[],lamClauses(Dsf)) holds, and
- for all as∈ListSizeExp and ρ:N→SizeOrd, if ValidSizeTuple(Ψf,as.map([[−]]ρ)) holds, then funRef(f,as)∈[[Af]]SizeVal.ofList(Ψf.dom.zip(as.map([[−]]ρ)))sig++Ξ,[].
- SemProgramValid(P) holds iff SN(P.sig.flatten,[],P.main) holds (i.e., P.main is strongly normalizing under one-step reduction
RedStep with global signature P.sig.flatten and empty mutual block []).
- Lexicographic measure declarations:
- A measured function declaration cdecl=(decl,measureIndices)∈CopFunDecl pairs a FunDecl with a list of natural numbers measureIndices∈ListN. For Ξcop∈ListCopFunDecl, eraseMeasures(Ξcop)=Ξcop.map(⋅.decl).
- Given measureIndices∈ListN, p∈N (
paramArity), and s∈N (stepIdx), the invocation graph lexInvGraph(measureIndices,p,s) has left and right arity p and canonical edges determined by: for 0≤l,r<p, there is no edge if l=r; if l=r and the first occurrence of l in measureIndices (measureIndices.idxOf? l) is at index pos, the edge (l,l) has label le if pos<s, label lt if pos=s, and no edge if pos>s or l∈/measureIndices.
- Given dom∈ListN, p∈N, and measureIndices∈ListN, lexInvGraphFamily(dom,p,measureIndices) is the
InvGraphFamily assigning arity p to every function name f∈N and assigning to (f,g)∈N×N the list [lexInvGraph(measureIndices,p,s)∣s∈[0,1,…,∣measureIndices∣−1]] if f∈dom∧g∈dom, and [] otherwise.
- Letting dom=eraseMeasures(Ξcop).map(⋅.name), CopMutualBlockTyping(sig,Ξcop) holds iff there exist p∈N and measureIndices∈ListN such that:
- measureIndices=[],
- measureIndices.Nodup (all indices in measureIndices are pairwise distinct),
- for every idx∈measureIndices, idx<p,
- for every cdecl∈Ξcop, cdecl.measureIndices=measureIndices and ∣cdecl.decl.sizeParams∣=p, and
- for every cdecl∈Ξcop, DeclTyping(sig,eraseMeasures(Ξcop),lexInvGraphFamily(dom,p,measureIndices),cdecl.decl) holds.
Statement of the Four Conjuncts.
- First Conjunct (Q1): For every global signature sig∈GlobalSig and mutual block Ξ∈MutualBlock, if SemSigValid(sig) and MutualBlockTyping(sig,Ξ) hold, then SemMutualBlockValid(sig,Ξ) holds.
- Second Conjunct (Q2): For every list of mutual blocks blocks∈ListMutualBlock, if SigBlocksTyping(blocks) holds, then SemSigValid(blocks.flatten) holds.
- Third Conjunct (Q3): For every program P∈Program, if ProgramTyping(P) holds, then SemProgramValid(P) holds.
- Fourth Conjunct (Q4): For every global signature sig∈GlobalSig and list of measured function declarations Ξcop∈ListCopFunDecl, if CopMutualBlockTyping(sig,Ξcop) holds, then 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 or Ξ to have distinct name fields, whereas WhdStep.funClause nondeterministically unfolds funRef(f,as) using any decl∈sig++Ξ with decl.name=f.
- Empty mutual blocks: When Ξ=[] (or Ξcop=[]),
MutualBlockTyping and SemMutualBlockValid hold trivially (witnessed by the empty graph family with dom=[]).
View graph
Confirmed by the moderator at approval.