Well-Kindedness of Signature Encoding (Theorem 7), Pattern/Spine Elaboration (Theorems 8 & 9), and Rigid Variable Polarity Classification (Lemmas 3–5)
DisprovedNishtAbel2024.theorems_7_8_9_and_lemmas_3_4_5Theorems 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
, and ,
and match the first argument with a variable pattern . The index then
occurs positively in the type of and negatively in the remaining type
, 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.
import Definitions.Def_NishtAbel2024_Syntax import Definitions.Def_NishtAbel2024_Inference
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 NishtAbel2024Read-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 types with inductive () and coinductive () fixpoint types.
Underlying data and judgments unfolded across the six conjuncts:
- Polarities (
Polarity): A four-element lattice (mixed,pos,neg,top) ordered by , , and . Polarity composition (Polarity.comp) returns if either argument is , else if either argument is , else treats as the identity and sets . Left-inverse composition (Polarity.invComp) is defined by , , for , , and . - Size expressions (
SizeExp) and size contexts (SizeCtx): Size variables and type variables are both natural numbers (). A shifted size variable is a pair (representing ). A size expression is either a shifted infinity (inf n, with ) or a formal minimum of a non-empty list of shifted size variables; is the singleton minimum . Bound normalization maps for every and leaves unchanged. A size context is a list of declarations (var,pol,bound), with domain . A size expression is well-formed in (SizeWf Ψ a) if , or if and every shifted variable in has some declaration with . A size context is well-formed (SizeCtxWf Ψ) if it is built from by successively appending where is not in the preceding domain andSizeWf (Ψ.invScalePol .mixed) aholds (since holds iff , every size variable referenced in must be declared in the preceding prefix with polarity ). - Kinds and kinding contexts (
SKind,Kind,KindingCtx): Simple kinds are , , or . Target kinds are , bounded size kinds , or . The embeddingKind.ofSKindmaps both and to and preserves arrows. BothfunctorKindandfwFunctorSKindare . A kinding context pairs aSizeCtxand a list of type declarations . Extending by a type binding appends to and, if , also appends to . Extending by sizes appends to and appends to . Context concatenation concatenates the two.sizeslists and the two.typeslists. - Type expressions (
TypeExpr): Built from atoms (size a,var X,unit,prod,arr,all κ,ex κ), type abstraction , application , inductive fixpoints (where is a list of constructor-name/functor pairs ), and coinductive fixpoints (where is a list of projection-name/functor pairs ). Beta-normalizing application substitutes for in if (viasubstTyVar, which stops at shadowed without capture-avoiding renaming and does not substitute insidesizeexpressions) and forms otherwise. Iterated universal size quantification right-folds to wrap in (ignoring ). - Fixpoint polarity cleanliness and hygiene (
PosFixpointPolClean,NegFixpointPolClean,PositiveFixpointHygiene,SignatureFixpointHygiene):SizeOccursFixPol Δ fk i π Fholds iff appears as the top-level bound of a -type () or -type () at accumulated polarity along a path of -branches, -fields, -bodies (extending with ), and well-kinded applications (requiringKindInferon the function part of every application traversed).PosFixpointPolClean Δ Aholds iff for every (SizeOccursIn i A), exclusively either or .NegFixpointPolClean Δ Aholds iff for every , exclusively either or .PositiveFixpointHygiene Δ₀ A₀holds iffPosFixpointPolClean Δ₀ A₀holds and for every -branch list (collected recursively from all -subexpressions of ), every constructor , functor with , and fresh size variable , setting and , we havePosFixpointPolClean Δj Band .SignatureFixpointHygiene Δ₀ A₀holds iff (1)NegFixpointPolClean Δ₀ A₀holds, (2) the above -branch unfolding condition holds for every , and (3) for every -field list , every projection , functor with , and fresh , setting and , we haveNegFixpointPolClean Δj Band .
The six conjuncts literally state:
-
Kinding preservation of
EncodeType(Conjunct 1): For all polarities , kinding contexts , type expressions , and size contexts , if:- is well-formed (
SizeCtxWf Δ.sizes), - checks at simple kind in under the unannotated System kinding relation (
FwKindCheck Δ A .star, which forbids size atoms, requires kinds to be in the image ofKind.ofSKind, and requires all size bounds in to be with branches checking at ), and EncodeType πstar π Δ A Ψ A'holds (which traverses tracking polarity , replaces by with a fresh declaration prepended to iff and keeps otherwise, replaces by with a fresh prepended to iff and keeps otherwise, and at each application node requiresFwKindInferon ,KindInferon in ,KindCheckon in , and pairwise disjointness of and from each other and from the opposite subterm's size variables), thenKindCheck Δ (TypeExpr.forallSizes Ψ A') .starholds in the target kinding system.
- is well-formed (
-
Fixpoint polarity separation of
EncodeTypeat (Conjunct 2): For all , ifEncodeType .neg .pos Δ A Ψ A'holds, then for every size variable , under the extended kinding context , exclusively either:
or
-
Soundness of pattern elaboration (Conjunct 3): For all kinding contexts , patterns , type expressions , term contexts , type declaration lists , and size contexts , if
InferPat Δ₀ p A Γ Δ Ψ p'holds (which elaborates pattern against , inserting a fresh size variable with declaration in , in , and wrapping the subpattern in at each constructor pattern against ), thenPatTyping Δ₀ Δ Γ p' Aholds. -
Soundness of copattern-spine elaboration (Conjunct 4): For all , copattern spines , types , term contexts , type declaration lists , and size contexts , if
InferSpine Δ₀ qs A C Γ Δ Ψ qs'holds (which elaborates spine from to , inserting a fresh size variable with in , in , and inserting after at each projection against ), thenSpineTyping Δ₀ Δ Γ A qs' Cholds. -
Pattern rigid variable classification under
PositiveFixpointHygiene(Conjunct 5): For all , ifPositiveFixpointHygiene Δ₀ A₀andInferPat Δ₀ p A₀ Γ Δ Ψ p'hold, then for every ,PatRigidVarClass (Δ₀.append ⟨Ψ, Δ⟩) Γ iholds, meaning that in , the bindings satisfy one of three mutually exclusive cases: (a) occurs in some as a fixpoint bound, in no as a fixpoint bound, and for some ; (b) occurs in no as , in some as , and for some ; or (c) occurs in no as , in no as , and for all . -
Spine rigid variable classification under
SignatureFixpointHygiene(Conjunct 6): For all , ifSignatureFixpointHygiene (Δ₀.extSizes Ψ₁) A₀andInferSpine (Δ₀.extSizes Ψ₁) qs A₀ A'' Γ Δ Ψ₂ qs'hold, then for every ,SpineRigidVarClass ((Δ₀.extSizes Ψ₁).append ⟨Ψ₂, Δ⟩) Γ A'' iholds, meaning that in , exactly one of the following four propositions holds:- : ,
- : ,
- : ,
- : .
Degenerate cases, vacuous hypotheses, and anomalies:
- Outer context in
allMuBranchLists/allNuFieldLists: InPositiveFixpointHygiene Δ₀ A₀andSignatureFixpointHygiene Δ₀ A₀, branch lists and field lists are extracted syntactically from at any depth, including under quantifiers or , and their unfoldings are checked forPosFixpointPolClean/NegFixpointPolCleanin without extending by enclosing bound type variables . BecauseSizeOccursFixPolrequiresKindInferon the function part of applications, any fixpoint occurrence of a size variable inside an application headed by an enclosing -bound type variable cannot be derived in .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.