Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Well-Kindedness of Signature Encoding (Theorem 7), Pattern/Spine Elaboration (Theorems 8 & 9), and Rigid Variable Polarity Classification (Lemmas 3–5)

Disproved
NishtAbel2024.theorems_7_8_9_and_lemmas_3_4_5

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

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

Theorems 7, 8, 9 and Lemmas 3, 4, 5 (Sections 6.1–6.2, pp. 42–47): (1) well-kindedness of polarized signature encoding EncodeType; (2) negative-μ / positive-ν polarity separation of fresh size variables generated by EncodeType at π* = −, π = +; (3–4) well-typedness of InferPat and InferSpine in System F_ω^{cop, SCT}; and (5–6) four-way polarity classification of rigid size variables in patterns (PatRigidVarClass) and copattern spines (SpineRigidVarClass).

Superseded. This is the first formalization of Theorems 7–9 and Lemmas 3–5 (pp. 43–47) of the thesis. It is refuted through its Lemma 5 conjunct by the accepted disproof cc630262-14b8-44ff-8ad5-2a36e3725105. Take Ψ1=[i<∞]\Psi_1 = [i < \infty]Ψ1​=[i<∞], M=μi⟨⟩M = \mu^i\langle\rangleM=μi⟨⟩ and A0=M→(M→1)A_0 = M \to (M \to 1)A0​=M→(M→1), and match the first argument with a variable pattern xxx. The index iii then occurs positively in the type of xxx and negatively in the remaining type M→1M \to 1M→1, so none of the four mutually exclusive classes of Lemma 5 applies. A separate checked result shows that the thesis's signature encoding never produces a type in which one inductive index occurs in two argument positions like this, so the counterexample exploits an input more general than the thesis considers. The Theorem 7, Lemma 3 and Theorems 8–9 conjuncts are not refuted. Corrected statement: NishtAbel2024V2.theorems_7_8_9_and_lemmas_3_4_5. It restates Lemmas 4–5 as polarity bounds on kinding-aware occurrences (CheckUse) instead of the four-way classification.

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

/-- Theorem 7 (p. 43), Lemma 3 (p. 43), Theorem 8 (p. 45), Theorem 9 (p. 45),
Lemma 4 (pp. 45–46), and Lemma 5 (pp. 46–47):
1. (**Theorem 7**) If `π; Δ ⊢_{SCT}^{π*} A ⇒ Ψ; A'` for `Δ ⊢_{F_ω} A ⇐ *`, then `Δ ⊢ ∀Ψ. A' ⇐ *`.
2. (**Lemma 3**) If `+; Δ ⊢_{SCT}^− A ⇒ Ψ; A'`, then every `i ∈ Ψ` either occurs negatively as a
   `μ`-size variable in `A'` or positively as a `ν`-size variable in `A'` (exclusively).
3. (**Theorem 8**) If `Δ₀ ⊢_{SCT} p : A ⇒ Γ; Δ; Ψ; p'`, then `Δ; Γ ⊢_{Δ₀} p' ⇐ A`.
4. (**Theorem 9**) If `Δ₀ ⊢_{SCT} q⃗ : A ⇒ C; Γ; Δ; Ψ; q⃗'`, then `Δ; Γ | A ⊢_{Δ₀} q⃗' ⇒ C`.
5. (**Lemma 4**) Under `PositiveFixpointHygiene Δ₀ A₀`, if `Δ₀ ⊢_{SCT} p : A₀ ⇒ Γ; Δ; Ψ; p'`,
   then every `i ∈ Ψ` satisfies `PatRigidVarClass`.
6. (**Lemma 5**) Under `SignatureFixpointHygiene`, if
   `Δ₀, Ψ₁ ⊢_{SCT} q⃗ : A₀ ⇒ A''; Γ; Δ; Ψ₂; q⃗'`, then every `i ∈ Ψ₁ ++ Ψ₂` satisfies
   `SpineRigidVarClass`. -/
theorem theorems_7_8_9_and_lemmas_3_4_5 :
    (∀ (πstar π : Polarity) (Δ : KindingCtx) (A A' : TypeExpr) (Ψ : SizeCtx),
      SizeCtxWf Δ.sizes →
      FwKindCheck Δ A .star →
      EncodeType πstar π Δ A Ψ A' →
      KindCheck Δ (TypeExpr.forallSizes Ψ A') .star) ∧
    (∀ (Δ : KindingCtx) (A A' : TypeExpr) (Ψ : SizeCtx),
      EncodeType .neg .pos Δ A Ψ A' →
      ∀ i ∈ Ψ.dom,
        (SizeOccursFixPol (Δ.extSizes Ψ) .mu i .neg A' ∧
          ¬ SizeOccursFixPol (Δ.extSizes Ψ) .nu i .pos A') ∨
        (SizeOccursFixPol (Δ.extSizes Ψ) .nu i .pos A' ∧
          ¬ SizeOccursFixPol (Δ.extSizes Ψ) .mu i .neg A')) ∧
    (∀ (Δ₀ : KindingCtx) (p p' : Pat) (A : TypeExpr)
       (Γ : TermCtx) (Δ : List TyDecl) (Ψ : SizeCtx),
      InferPat Δ₀ p A Γ Δ Ψ p' →
      PatTyping Δ₀ Δ Γ p' A) ∧
    (∀ (Δ₀ : KindingCtx) (qs qs' : PatSpine) (A C : TypeExpr)
       (Γ : TermCtx) (Δ : List TyDecl) (Ψ : SizeCtx),
      InferSpine Δ₀ qs A C Γ Δ Ψ qs' →
      SpineTyping Δ₀ Δ Γ A qs' C) ∧
    (∀ (Δ₀ : KindingCtx) (p p' : Pat) (A₀ : TypeExpr)
       (Γ : TermCtx) (Δ : List TyDecl) (Ψ : SizeCtx),
      PositiveFixpointHygiene Δ₀ A₀ →
      InferPat Δ₀ p A₀ Γ Δ Ψ p' →
      ∀ i ∈ Ψ.dom, PatRigidVarClass (Δ₀.append ⟨Ψ, Δ⟩) Γ i) ∧
    (∀ (Δ₀ : KindingCtx) (Ψ₁ Ψ₂ : SizeCtx) (qs qs' : PatSpine)
       (A₀ A'' : TypeExpr) (Γ : TermCtx) (Δ : List TyDecl),
      SignatureFixpointHygiene (Δ₀.extSizes Ψ₁) A₀ →
      InferSpine (Δ₀.extSizes Ψ₁) qs A₀ A'' Γ Δ Ψ₂ qs' →
      ∀ i ∈ (Ψ₁ ++ Ψ₂).dom,
        SpineRigidVarClass ((Δ₀.extSizes Ψ₁).append ⟨Ψ₂, Δ⟩) Γ A'' i) := 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 6.1–6.2, Theorem 7 (p. 43), Lemma 3 (p. 43), Theorem 8 (p. 45), Theorem 9 (p. 45), Lemma 4 (pp. 45–46), and Lemma 5 (pp. 46–47).
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_7_8_9_and_lemmas_3_4_5.lean

The declaration theorems_7_8_9_and_lemmas_3_4_5 asserts the conjunction of six universally quantified implications concerning polarity-aware size encoding, pattern and copattern-spine elaboration, and rigid size-variable polarity classification over a custom syntax of sized System FωF_\omegaFω​ types with inductive (μ\muμ) and coinductive (ν\nuν) fixpoint types.

Underlying data and judgments unfolded across the six conjuncts:

  • Polarities (Polarity): A four-element lattice π∈{∘,+,−,⊤}\pi \in \{\circ, +, -, \top\}π∈{∘,+,−,⊤} (mixed, pos, neg, top) ordered by ∘⊑π⊑⊤\circ \sqsubseteq \pi \sqsubseteq \top∘⊑π⊑⊤, +⊑++\sqsubseteq ++⊑+, and −⊑−-\sqsubseteq -−⊑−. Polarity composition π1π2\pi_1 \pi_2π1​π2​ (Polarity.comp) returns ⊤\top⊤ if either argument is ⊤\top⊤, else ∘\circ∘ if either argument is ∘\circ∘, else treats +++ as the identity and sets (−)(−)=+(-)(-) = +(−)(−)=+. Left-inverse composition π1−1π2\pi_1^{-1}\pi_2π1−1​π2​ (Polarity.invComp) is defined by ⊤−1π′=∘\top^{-1}\pi' = \circ⊤−1π′=∘, ∘−1∘=∘\circ^{-1}\circ = \circ∘−1∘=∘, ∘−1π′=⊤\circ^{-1}\pi' = \top∘−1π′=⊤ for π′≠∘\pi' \neq \circπ′=∘, +−1π′=π′+^{-1}\pi' = \pi'+−1π′=π′, and −−1π′=(−)π′-^{-1}\pi' = (-)\pi'−−1π′=(−)π′.
  • Size expressions (SizeExp) and size contexts (SizeCtx): Size variables iii and type variables XXX are both natural numbers (N\mathbb{N}N). A shifted size variable is a pair (i,n)∈N×N(i, n) \in \mathbb{N} \times \mathbb{N}(i,n)∈N×N (representing i+ni + ni+n). A size expression aaa is either a shifted infinity ∞+n\infty + n∞+n (inf n, with ∞:=∞+0\infty := \infty + 0∞:=∞+0) or a formal minimum meet(m)\text{meet}(m)meet(m) of a non-empty list mmm of shifted size variables; var(i,n)\text{var}(i, n)var(i,n) is the singleton minimum ⟨(i,n),[]⟩\langle (i, n), [] \rangle⟨(i,n),[]⟩. Bound normalization a.boundNorma.\text{boundNorm}a.boundNorm maps ∞+n↦∞+1\infty + n \mapsto \infty + 1∞+n↦∞+1 for every n∈Nn \in \mathbb{N}n∈N and leaves meet(m)\text{meet}(m)meet(m) unchanged. A size context Ψ\PsiΨ is a list of declarations (i,π,a)(i, \pi, a)(i,π,a) (var, pol, bound), with domain dom(Ψ)=Ψ.map(⋅.var)\text{dom}(\Psi) = \Psi.\text{map}(\cdot.\text{var})dom(Ψ)=Ψ.map(⋅.var). A size expression aaa is well-formed in Ψ\PsiΨ (SizeWf Ψ a) if a=∞+na = \infty + na=∞+n, or if a=meet(m)a = \text{meet}(m)a=meet(m) and every shifted variable (j,n)(j, n)(j,n) in mmm has some declaration (j,π,b)∈Ψ(j, \pi, b) \in \Psi(j,π,b)∈Ψ with π∈{∘,+}\pi \in \{\circ, +\}π∈{∘,+}. A size context Ψ\PsiΨ is well-formed (SizeCtxWf Ψ) if it is built from [][][] by successively appending (i,π,a)(i, \pi, a)(i,π,a) where iii is not in the preceding domain and SizeWf (Ψ.invScalePol .mixed) a holds (since ∘−1π′⊑+\circ^{-1}\pi' \sqsubseteq +∘−1π′⊑+ holds iff π′=∘\pi' = \circπ′=∘, every size variable referenced in aaa must be declared in the preceding prefix with polarity ∘\circ∘).
  • Kinds and kinding contexts (SKind, Kind, KindingCtx): Simple kinds ι\iotaι are ∗*∗, prop\text{prop}prop, or ι1→πι2\iota_1 \xrightarrow{\pi} \iota_2ι1​π​ι2​. Target kinds κ\kappaκ are ∗*∗, bounded size kinds <a< a<a, or κ1→πκ2\kappa_1 \xrightarrow{\pi} \kappa_2κ1​π​κ2​. The embedding Kind.ofSKind maps both ∗*∗ and prop\text{prop}prop to ∗*∗ and preserves arrows. Both functorKind and fwFunctorSKind are ∗→∘∗* \xrightarrow{\circ} *∗∘​∗. A kinding context Δ=(Δsizes,Δtypes)\Delta = (\Delta_{\text{sizes}}, \Delta_{\text{types}})Δ=(Δsizes​,Δtypes​) pairs a SizeCtx and a list of type declarations (X,π,κ)(X, \pi, \kappa)(X,π,κ). Extending Δ\DeltaΔ by a type binding Δ.extType(X,π,κ)\Delta.\text{extType}(X, \pi, \kappa)Δ.extType(X,π,κ) appends (X,π,κ)(X, \pi, \kappa)(X,π,κ) to Δtypes\Delta_{\text{types}}Δtypes​ and, if κ=(<a)\kappa = (< a)κ=(<a), also appends (X,π,a)(X, \pi, a)(X,π,a) to Δsizes\Delta_{\text{sizes}}Δsizes​. Extending by sizes Δ.extSizes(Ψ)\Delta.\text{extSizes}(\Psi)Δ.extSizes(Ψ) appends Ψ\PsiΨ to Δsizes\Delta_{\text{sizes}}Δsizes​ and appends Ψ.map(λ(i,π,a)⇒(i,π,<a))\Psi.\text{map}(\lambda(i,\pi,a) \Rightarrow (i, \pi, < a))Ψ.map(λ(i,π,a)⇒(i,π,<a)) to Δtypes\Delta_{\text{types}}Δtypes​. Context concatenation Δ1.append(Δ2)\Delta_1.\text{append}(\Delta_2)Δ1​.append(Δ2​) concatenates the two .sizes lists and the two .types lists.
  • Type expressions (TypeExpr): Built from atoms (size a, var X, unit 111, prod ×\times×, arr →\to→, all κ ∀κ\forall_\kappa∀κ​, ex κ ∃κ\exists_\kappa∃κ​), type abstraction λX:ι. F\lambda X : \iota.\, FλX:ι.F, application F GF\, GFG, inductive fixpoints μaS\mu^a SμaS (where SSS is a list of constructor-name/functor pairs (c,Fc)(c, F_c)(c,Fc​)), and coinductive fixpoints νaR\nu^a RνaR (where RRR is a list of projection-name/functor pairs (d,Fd)(d, F_d)(d,Fd​)). Beta-normalizing application F.normApp(G)F.\text{normApp}(G)F.normApp(G) substitutes GGG for XXX in F0F_0F0​ if F=λX:ι. F0F = \lambda X : \iota.\, F_0F=λX:ι.F0​ (via substTyVar, which stops at shadowed λX\lambda XλX without capture-avoiding renaming and does not substitute inside size expressions) and forms F GF\, GFG otherwise. Iterated universal size quantification forallSizes(Ψ,A′)\text{forallSizes}(\Psi, A')forallSizes(Ψ,A′) right-folds Ψ\PsiΨ to wrap A′A'A′ in ∀<d.bound(λd.var:∗. ⋯ )\forall_{< d.\text{bound}} (\lambda d.\text{var} : *.\, \cdots)∀<d.bound​(λd.var:∗.⋯) (ignoring d.pold.\text{pol}d.pol).
  • Fixpoint polarity cleanliness and hygiene (PosFixpointPolClean, NegFixpointPolClean, PositiveFixpointHygiene, SignatureFixpointHygiene):
    • SizeOccursFixPol Δ fk i π F holds iff iii appears as the top-level bound var(i,n)\text{var}(i, n)var(i,n) of a μ\muμ-type (fk=μ\text{fk} = \mufk=μ) or ν\nuν-type (fk=ν\text{fk} = \nufk=ν) at accumulated polarity π\piπ along a path of μ\muμ-branches, ν\nuν-fields, λ\lambdaλ-bodies (extending Δ\DeltaΔ with (X,∘,ofSKind(ι))(X, \circ, \text{ofSKind}(\iota))(X,∘,ofSKind(ι))), and well-kinded applications (requiring KindInfer on the function part of every application traversed).
    • PosFixpointPolClean Δ A holds iff for every i∈allSizeVars(A)i \in \text{allSizeVars}(A)i∈allSizeVars(A) (SizeOccursIn i A), exclusively either (SizeOccursFixPol(Δ,μ,i,+,A)∧¬SizeOccursFixPol(Δ,ν,i,−,A))(\text{SizeOccursFixPol}(\Delta, \mu, i, +, A) \land \neg \text{SizeOccursFixPol}(\Delta, \nu, i, -, A))(SizeOccursFixPol(Δ,μ,i,+,A)∧¬SizeOccursFixPol(Δ,ν,i,−,A)) or (SizeOccursFixPol(Δ,ν,i,−,A)∧¬SizeOccursFixPol(Δ,μ,i,+,A))(\text{SizeOccursFixPol}(\Delta, \nu, i, -, A) \land \neg \text{SizeOccursFixPol}(\Delta, \mu, i, +, A))(SizeOccursFixPol(Δ,ν,i,−,A)∧¬SizeOccursFixPol(Δ,μ,i,+,A)).
    • NegFixpointPolClean Δ A holds iff for every i∈allSizeVars(A)i \in \text{allSizeVars}(A)i∈allSizeVars(A), exclusively either (SizeOccursFixPol(Δ,μ,i,−,A)∧¬SizeOccursFixPol(Δ,ν,i,+,A))(\text{SizeOccursFixPol}(\Delta, \mu, i, -, A) \land \neg \text{SizeOccursFixPol}(\Delta, \nu, i, +, A))(SizeOccursFixPol(Δ,μ,i,−,A)∧¬SizeOccursFixPol(Δ,ν,i,+,A)) or (SizeOccursFixPol(Δ,ν,i,+,A)∧¬SizeOccursFixPol(Δ,μ,i,−,A))(\text{SizeOccursFixPol}(\Delta, \nu, i, +, A) \land \neg \text{SizeOccursFixPol}(\Delta, \mu, i, -, A))(SizeOccursFixPol(Δ,ν,i,+,A)∧¬SizeOccursFixPol(Δ,μ,i,−,A)).
    • PositiveFixpointHygiene Δ₀ A₀ holds iff PosFixpointPolClean Δ₀ A₀ holds and for every μ\muμ-branch list S∈A0.allMuBranchListsS \in A_0.\text{allMuBranchLists}S∈A0​.allMuBranchLists (collected recursively from all μ\muμ-subexpressions of A0A_0A0​), every constructor ccc, functor ScS_cSc​ with lookupCons(S,c)=some Sc\text{lookupCons}(S, c) = \text{some } S_clookupCons(S,c)=some Sc​, and fresh size variable j∉dom(Δ0,sizes)∪allSizeVarsBranches(S)j \notin \text{dom}(\Delta_{0,\text{sizes}}) \cup \text{allSizeVarsBranches}(S)j∈/dom(Δ0,sizes​)∪allSizeVarsBranches(S), setting Δj:=Δ0.extType(j,+,<∞)\Delta_j := \Delta_0.\text{extType}(j, +, < \infty)Δj​:=Δ0​.extType(j,+,<∞) and B:=Sc.normApp(μvar(j,0)S)B := S_c.\text{normApp}(\mu^{\text{var}(j,0)} S)B:=Sc​.normApp(μvar(j,0)S), we have PosFixpointPolClean Δj B and (j∈allSizeVars(B)→SizeOccursFixPol(Δj,μ,j,+,B)∧¬SizeOccursFixPol(Δj,ν,j,−,B))(j \in \text{allSizeVars}(B) \to \text{SizeOccursFixPol}(\Delta_j, \mu, j, +, B) \land \neg \text{SizeOccursFixPol}(\Delta_j, \nu, j, -, B))(j∈allSizeVars(B)→SizeOccursFixPol(Δj​,μ,j,+,B)∧¬SizeOccursFixPol(Δj​,ν,j,−,B)).
    • SignatureFixpointHygiene Δ₀ A₀ holds iff (1) NegFixpointPolClean Δ₀ A₀ holds, (2) the above μ\muμ-branch unfolding condition holds for every S∈A0.allMuBranchListsS \in A_0.\text{allMuBranchLists}S∈A0​.allMuBranchLists, and (3) for every ν\nuν-field list R∈A0.allNuFieldListsR \in A_0.\text{allNuFieldLists}R∈A0​.allNuFieldLists, every projection ddd, functor RdR_dRd​ with lookupProj(R,d)=some Rd\text{lookupProj}(R, d) = \text{some } R_dlookupProj(R,d)=some Rd​, and fresh j∉dom(Δ0,sizes)∪allSizeVarsBranches(R)j \notin \text{dom}(\Delta_{0,\text{sizes}}) \cup \text{allSizeVarsBranches}(R)j∈/dom(Δ0,sizes​)∪allSizeVarsBranches(R), setting Δj:=Δ0.extType(j,+,<∞)\Delta_j := \Delta_0.\text{extType}(j, +, < \infty)Δj​:=Δ0​.extType(j,+,<∞) and B:=Rd.normApp(νvar(j,0)R)B := R_d.\text{normApp}(\nu^{\text{var}(j,0)} R)B:=Rd​.normApp(νvar(j,0)R), we have NegFixpointPolClean Δj B and (j∈allSizeVars(B)→SizeOccursFixPol(Δj,ν,j,+,B)∧¬SizeOccursFixPol(Δj,μ,j,−,B))(j \in \text{allSizeVars}(B) \to \text{SizeOccursFixPol}(\Delta_j, \nu, j, +, B) \land \neg \text{SizeOccursFixPol}(\Delta_j, \mu, j, -, B))(j∈allSizeVars(B)→SizeOccursFixPol(Δj​,ν,j,+,B)∧¬SizeOccursFixPol(Δj​,μ,j,−,B)).

The six conjuncts literally state:

  1. Kinding preservation of EncodeType (Conjunct 1): For all polarities π∗,π\pi^*, \piπ∗,π, kinding contexts Δ\DeltaΔ, type expressions A,A′A, A'A,A′, and size contexts Ψ\PsiΨ, if:

    • Δsizes\Delta_{\text{sizes}}Δsizes​ is well-formed (SizeCtxWf Δ.sizes),
    • AAA checks at simple kind ∗*∗ in Δ\DeltaΔ under the unannotated System FωF_\omegaFω​ kinding relation (FwKindCheck Δ A .star, which forbids size atoms, requires ∀/∃\forall/\exists∀/∃ kinds to be in the image of Kind.ofSKind, and requires all μ/ν\mu/\nuμ/ν size bounds in AAA to be ∞\infty∞ with branches checking at ∗→∘∗* \xrightarrow{\circ} *∗∘​∗), and
    • EncodeType πstar π Δ A Ψ A' holds (which traverses AAA tracking polarity π\piπ, replaces μ∞S\mu^\infty Sμ∞S by μvar(i,0)S′\mu^{\text{var}(i,0)} S'μvar(i,0)S′ with a fresh declaration (i,∘,∞)(i, \circ, \infty)(i,∘,∞) prepended to Ψ\PsiΨ iff π=π∗\pi = \pi^*π=π∗ and keeps μ∞S′\mu^\infty S'μ∞S′ otherwise, replaces ν∞R\nu^\infty Rν∞R by νvar(i,0)R′\nu^{\text{var}(i,0)} R'νvar(i,0)R′ with a fresh (i,∘,∞)(i, \circ, \infty)(i,∘,∞) prepended to Ψ\PsiΨ iff π=(−)π∗\pi = (-)\pi^*π=(−)π∗ and keeps ν∞R′\nu^\infty R'ν∞R′ otherwise, and at each application node F GF\, GFG requires FwKindInfer on FFF, KindInfer on F′F'F′ in Δ.extSizes(Ψ1)\Delta.\text{extSizes}(\Psi_1)Δ.extSizes(Ψ1​), KindCheck on G′G'G′ in (Δ.extSizes(Ψ2)).invScalePol(π′)(\Delta.\text{extSizes}(\Psi_2)).\text{invScalePol}(\pi')(Δ.extSizes(Ψ2​)).invScalePol(π′), and pairwise disjointness of dom(Ψ1)\text{dom}(\Psi_1)dom(Ψ1​) and dom(Ψ2)\text{dom}(\Psi_2)dom(Ψ2​) from each other and from the opposite subterm's size variables), then KindCheck Δ (TypeExpr.forallSizes Ψ A') .star holds in the target kinding system.
  2. Fixpoint polarity separation of EncodeType at (π∗,π)=(−,+)(\pi^*, \pi) = (-, +)(π∗,π)=(−,+) (Conjunct 2): For all Δ,A,A′,Ψ\Delta, A, A', \PsiΔ,A,A′,Ψ, if EncodeType .neg .pos Δ A Ψ A' holds, then for every size variable i∈dom(Ψ)i \in \text{dom}(\Psi)i∈dom(Ψ), under the extended kinding context Δ′=Δ.extSizes(Ψ)\Delta' = \Delta.\text{extSizes}(\Psi)Δ′=Δ.extSizes(Ψ), exclusively either:

SizeOccursFixPol(Δ′,μ,i,−,A′)∧¬SizeOccursFixPol(Δ′,ν,i,+,A′)\text{SizeOccursFixPol}(\Delta', \mu, i, -, A') \land \neg \text{SizeOccursFixPol}(\Delta', \nu, i, +, A')SizeOccursFixPol(Δ′,μ,i,−,A′)∧¬SizeOccursFixPol(Δ′,ν,i,+,A′)

or

SizeOccursFixPol(Δ′,ν,i,+,A′)∧¬SizeOccursFixPol(Δ′,μ,i,−,A′).\text{SizeOccursFixPol}(\Delta', \nu, i, +, A') \land \neg \text{SizeOccursFixPol}(\Delta', \mu, i, -, A').SizeOccursFixPol(Δ′,ν,i,+,A′)∧¬SizeOccursFixPol(Δ′,μ,i,−,A′).
  1. Soundness of pattern elaboration (Conjunct 3): For all kinding contexts Δ0\Delta_0Δ0​, patterns p,p′p, p'p,p′, type expressions AAA, term contexts Γ\GammaΓ, type declaration lists Δ\DeltaΔ, and size contexts Ψ\PsiΨ, if InferPat Δ₀ p A Γ Δ Ψ p' holds (which elaborates pattern ppp against AAA, inserting a fresh size variable jjj with declaration (j,+,<a.boundNorm)(j, +, < a.\text{boundNorm})(j,+,<a.boundNorm) in Δ\DeltaΔ, (j,+,a.boundNorm)(j, +, a.\text{boundNorm})(j,+,a.boundNorm) in Ψ\PsiΨ, and wrapping the subpattern in tyPack j\text{tyPack } jtyPack j at each constructor pattern cons c p0\text{cons } c\, p_0cons cp0​ against μaS\mu^a SμaS), then PatTyping Δ₀ Δ Γ p' A holds.

  2. Soundness of copattern-spine elaboration (Conjunct 4): For all Δ0\Delta_0Δ0​, copattern spines qs,qs′qs, qs'qs,qs′, types A,CA, CA,C, term contexts Γ\GammaΓ, type declaration lists Δ\DeltaΔ, and size contexts Ψ\PsiΨ, if InferSpine Δ₀ qs A C Γ Δ Ψ qs' holds (which elaborates spine qsqsqs from AAA to CCC, inserting a fresh size variable jjj with (j,+,<a.boundNorm)(j, +, < a.\text{boundNorm})(j,+,<a.boundNorm) in Δ\DeltaΔ, (j,+,a.boundNorm)(j, +, a.\text{boundNorm})(j,+,a.boundNorm) in Ψ\PsiΨ, and inserting tyVar j\text{tyVar } jtyVar j after proj d\text{proj } dproj d at each projection against νaR\nu^a RνaR), then SpineTyping Δ₀ Δ Γ A qs' C holds.

  3. Pattern rigid variable classification under PositiveFixpointHygiene (Conjunct 5): For all Δ0,p,p′,A0,Γ,Δ,Ψ\Delta_0, p, p', A_0, \Gamma, \Delta, \PsiΔ0​,p,p′,A0​,Γ,Δ,Ψ, if PositiveFixpointHygiene Δ₀ A₀ and InferPat Δ₀ p A₀ Γ Δ Ψ p' hold, then for every i∈dom(Ψ)i \in \text{dom}(\Psi)i∈dom(Ψ), PatRigidVarClass (Δ₀.append ⟨Ψ, Δ⟩) Γ i holds, meaning that in Δ∗=Δ0.append⟨Ψ,Δ⟩\Delta^* = \Delta_0.\text{append}\langle\Psi, \Delta\rangleΔ∗=Δ0​.append⟨Ψ,Δ⟩, the bindings (x,B)∈Γ(x, B) \in \Gamma(x,B)∈Γ satisfy one of three mutually exclusive cases: (a) iii occurs in some BBB as a (μ,+)(\mu, +)(μ,+) fixpoint bound, in no BBB as a (ν,−)(\nu, -)(ν,−) fixpoint bound, and i∈allSizeVars(B)i \in \text{allSizeVars}(B)i∈allSizeVars(B) for some BBB; (b) iii occurs in no BBB as (μ,+)(\mu, +)(μ,+), in some BBB as (ν,−)(\nu, -)(ν,−), and i∈allSizeVars(B)i \in \text{allSizeVars}(B)i∈allSizeVars(B) for some BBB; or (c) iii occurs in no BBB as (μ,+)(\mu, +)(μ,+), in no BBB as (ν,−)(\nu, -)(ν,−), and i∉allSizeVars(B)i \notin \text{allSizeVars}(B)i∈/allSizeVars(B) for all BBB.

  4. Spine rigid variable classification under SignatureFixpointHygiene (Conjunct 6): For all Δ0,Ψ1,Ψ2,qs,qs′,A0,A′′,Γ,Δ\Delta_0, \Psi_1, \Psi_2, qs, qs', A_0, A'', \Gamma, \DeltaΔ0​,Ψ1​,Ψ2​,qs,qs′,A0​,A′′,Γ,Δ, if SignatureFixpointHygiene (Δ₀.extSizes Ψ₁) A₀ and InferSpine (Δ₀.extSizes Ψ₁) qs A₀ A'' Γ Δ Ψ₂ qs' hold, then for every i∈dom(Ψ1++Ψ2)i \in \text{dom}(\Psi_1 \mathbin{++} \Psi_2)i∈dom(Ψ1​++Ψ2​), SpineRigidVarClass ((Δ₀.extSizes Ψ₁).append ⟨Ψ₂, Δ⟩) Γ A'' i holds, meaning that in Δ∗=(Δ0.extSizes(Ψ1)).append⟨Ψ2,Δ⟩\Delta^* = (\Delta_0.\text{extSizes}(\Psi_1)).\text{append}\langle\Psi_2, \Delta\rangleΔ∗=(Δ0​.extSizes(Ψ1​)).append⟨Ψ2​,Δ⟩, exactly one of the following four propositions holds:

    • c1c_1c1​: ∃(x,B)∈Γ,  SizeOccursFixPol(Δ∗,μ,i,+,B)\exists (x, B) \in \Gamma,\; \text{SizeOccursFixPol}(\Delta^*, \mu, i, +, B)∃(x,B)∈Γ,SizeOccursFixPol(Δ∗,μ,i,+,B),
    • c2c_2c2​: SizeOccursFixPol(Δ∗,μ,i,−,A′′)\text{SizeOccursFixPol}(\Delta^*, \mu, i, -, A'')SizeOccursFixPol(Δ∗,μ,i,−,A′′),
    • c3c_3c3​: (∃(x,B)∈Γ,  SizeOccursFixPol(Δ∗,ν,i,−,B))∨SizeOccursFixPol(Δ∗,ν,i,+,A′′)(\exists (x, B) \in \Gamma,\; \text{SizeOccursFixPol}(\Delta^*, \nu, i, -, B)) \lor \text{SizeOccursFixPol}(\Delta^*, \nu, i, +, A'')(∃(x,B)∈Γ,SizeOccursFixPol(Δ∗,ν,i,−,B))∨SizeOccursFixPol(Δ∗,ν,i,+,A′′),
    • c4c_4c4​: i∉allSizeVars(A′′)∧∀(x,B)∈Γ,  i∉allSizeVars(B)i \notin \text{allSizeVars}(A'') \land \forall (x, B) \in \Gamma,\; i \notin \text{allSizeVars}(B)i∈/allSizeVars(A′′)∧∀(x,B)∈Γ,i∈/allSizeVars(B).

Degenerate cases, vacuous hypotheses, and anomalies:

  • Outer context Δ0\Delta_0Δ0​ in allMuBranchLists / allNuFieldLists: In PositiveFixpointHygiene Δ₀ A₀ and SignatureFixpointHygiene Δ₀ A₀, branch lists S∈A0.allMuBranchListsS \in A_0.\text{allMuBranchLists}S∈A0​.allMuBranchLists and field lists R∈A0.allNuFieldListsR \in A_0.\text{allNuFieldLists}R∈A0​.allNuFieldLists are extracted syntactically from A0A_0A0​ at any depth, including under ∀/∃\forall/\exists∀/∃ quantifiers ∀κ(λX. ⋯ )\forall_\kappa (\lambda X.\, \cdots)∀κ​(λX.⋯) or ∃κ(λX. ⋯ )\exists_\kappa (\lambda X.\, \cdots)∃κ​(λX.⋯), and their unfoldings BBB are checked for PosFixpointPolClean / NegFixpointPolClean in Δj=Δ0.extType(j,+,<∞)\Delta_j = \Delta_0.\text{extType}(j, +, < \infty)Δj​=Δ0​.extType(j,+,<∞) without extending Δ0\Delta_0Δ0​ by enclosing bound type variables XXX. Because SizeOccursFixPol requires KindInfer on the function part of applications, any fixpoint occurrence of a size variable inside an application headed by an enclosing ∀/∃\forall/\exists∀/∃-bound type variable X∉dom(Δ0,types)X \notin \text{dom}(\Delta_{0,\text{types}})X∈/dom(Δ0,types​) cannot be derived in Δj\Delta_jΔj​.
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