Lemma 3.4: Linear Substitution Decreases Weight `μ`
OpenAehligSchwichtenberg2002.lemma_3_4For any term r and linear variable x occurring at most once in r outside !-subterms, μ(r[s/x]) < μ((λx. r)s).
import Definitions.Def_AehligSchwichtenberg2002_Syntax
namespace AehligSchwichtenberg2002
theorem lemma_3_4 {Γ₁ Γ₁' Γ₂ Γ : Context} {x : Var} {t s : Term} {τ : Ty}
(hu₁ : IsCtxUnion Γ₁ [x] Γ₁')
(ht : HasType Γ₁' t τ)
(hs : HasType Γ₂ s x.ty)
(hdj : IsDisjointCtxUnion Γ₁ Γ₂ Γ) :
HasType Γ (substTerm t x s) τ := by sorry
end AehligSchwichtenberg2002Read-back
What the Lean code literally says, in plain math · Gemini 3.1 Pro (Independent Blind Auditor)
Read-back: Thm_AehligSchwichtenberg2002_lemma_3_4.lean
Theorem lemma_3_4
Let be contexts (finite lists of typed variables ), let be a typed variable, let and be raw terms, and let be a type in the finite linear type system . Assume the following four hypotheses:
- Context union for (
hu₁): is a set-extensional union of and the singleton context (IsCtxUnion Γ₁ [x] Γ₁'), meaning that for every variable , . Note that this hypothesis does not require ; may or may not belong to . - Typing of (
ht): (HasType Γ₁' t τ) in the affine linear typing system. - Typing of (
hs): (HasType Γ₂ s x.ty). - Disjoint union of remaining contexts (
hdj): is a set-extensional disjoint union of and (IsDisjointCtxUnion Γ₁ Γ₂ Γ), meaning that no variable belongs to both and , and for every variable , .
Then the capture-avoiding substitution (substTerm t x s, which replaces every free occurrence of in by while renaming bound variables of that occur free in to fresh variable identifiers) is well-typed in context with type :
In the edge case where (permitted by hu₁), disjointness hdj ensures , and remains present in the resulting context even though all free occurrences of in have been replaced by .