Theorems 10, 11 & 12 (V5): Constraint Orientation in Subtype Comparison and Call-Site Inference
ProvedNishtAbel2024V5.theorems_10_11_and_12Characterizes the structure and variable provenance of all size constraints emitted during algorithmic subtype comparison and bidirectional call-site checking (Chapter 6, Section 6.3, pp. 52–56 of Nisht and Abel 2024):\n\n1. Theorem 10 — Constraints in Higher-Kinded Type Comparison: Every constraint emitted by (Compare Ψ Δ A B κ C) is a non-strict, upper-bound-normalized inequality (, ) in context whose free size variables are either all -indices of or , or all -indices of or :\n
\n2. Theorems 11 & 12 — Constraints in Expression Inference, Checking, and Clause Checking: Every constraint emitted by InferTm, CheckTm, or CheckClause belongs to one of three classes:\n - a strict constructor or projection step constraint where is a flexible variable recorded in with polarity ;\n - a strict recursive call-bound constraint where is a flexible variable; or\n - a non-strict comparison constraint arising from Compare whose variables are pure -indices or pure -indices of the compared types.
import Definitions.Def_NishtAbel2024V5_Syntax import Definitions.Def_NishtAbel2024V5_Semantics import Definitions.Def_NishtAbel2024V5_Inference
namespace NishtAbel2024V5
theorem theorems_10_11_and_12 :
(∀ {Ψ : SizeCtx} {Δ : KCtx} {A B : Ty} {κ : Kind} {C : List SConstr},
Compare Ψ Δ A B κ C →
∀ c ∈ C,
c.ctx = Ψ ∧ c.strict = false ∧ c.up = true ∧
((∀ i ∈ c.lhs.fvars ++ c.rhs.fvars, A.indexes .mu i = true ∨ B.indexes .mu i = true) ∨
(∀ i ∈ c.lhs.fvars ++ c.rhs.fvars, A.indexes .nu i = true ∨ B.indexes .nu i = true))) ∧
(∀ {Ω : InfEnv},
(∀ {Ψ Θ Γ r A Φ C T K},
InferTm Ω Ψ Θ Γ r A Φ C T K →
∀ c ∈ C,
(∃ j π, FlexName j ∧ ⟨j, π, c.ctx⟩ ∈ Φ ∧ (π = .pos ∨ π = .neg) ∧
c.lhs = .var j 0 ∧ c.strict = true ∧ c.up = true) ∨
(∃ k, FlexName k ∧ c.lhs = .var k 0 ∧ c.strict = true ∧ c.up = false) ∨
(∃ A₁ B₁ : Ty, c.strict = false ∧ c.up = true ∧
((∀ i ∈ c.lhs.fvars ++ c.rhs.fvars,
A₁.indexes .mu i = true ∨ B₁.indexes .mu i = true) ∨
(∀ i ∈ c.lhs.fvars ++ c.rhs.fvars,
A₁.indexes .nu i = true ∨ B₁.indexes .nu i = true)))) ∧
(∀ {Ψ Θ Γ A t Φ C T K},
CheckTm Ω Ψ Θ Γ A t Φ C T K →
∀ c ∈ C,
(∃ j π, FlexName j ∧ ⟨j, π, c.ctx⟩ ∈ Φ ∧ (π = .pos ∨ π = .neg) ∧
c.lhs = .var j 0 ∧ c.strict = true ∧ c.up = true) ∨
(∃ k, FlexName k ∧ c.lhs = .var k 0 ∧ c.strict = true ∧ c.up = false) ∨
(∃ A₁ B₁ : Ty, c.strict = false ∧ c.up = true ∧
((∀ i ∈ c.lhs.fvars ++ c.rhs.fvars,
A₁.indexes .mu i = true ∨ B₁.indexes .mu i = true) ∨
(∀ i ∈ c.lhs.fvars ++ c.rhs.fvars,
A₁.indexes .nu i = true ∨ B₁.indexes .nu i = true)))) ∧
(∀ {Ψ Θ Γ A cl Φ C T K},
CheckClause Ω Ψ Θ Γ A cl Φ C T K →
∀ c ∈ C,
(∃ j π, FlexName j ∧ ⟨j, π, c.ctx⟩ ∈ Φ ∧ (π = .pos ∨ π = .neg) ∧
c.lhs = .var j 0 ∧ c.strict = true ∧ c.up = true) ∨
(∃ k, FlexName k ∧ c.lhs = .var k 0 ∧ c.strict = true ∧ c.up = false) ∨
(∃ A₁ B₁ : Ty, c.strict = false ∧ c.up = true ∧
((∀ i ∈ c.lhs.fvars ++ c.rhs.fvars,
A₁.indexes .mu i = true ∨ B₁.indexes .mu i = true) ∨
(∀ i ∈ c.lhs.fvars ++ c.rhs.fvars,
A₁.indexes .nu i = true ∨ B₁.indexes .nu i = true))))) := by sorry
end NishtAbel2024V5