Lecture 9: The Substitution Lemma

October 6

The Substitution Lemma

If Γ, x: τ1 |- x : τ2 and e' : τ1, then Γ |- [e'/x]e : τ2

Proof by induction on the derivation of Γ, x: τ1 |- x : τ2, and the crucial case is the one for λ.

In this case, we have
Γ, x: τ1, y: τ |- e1 : τ'
-----------------------------
Γ, x: τ1 |- λy:τ.e1 : τ -> τ'

(we have e = λy:τ.e1 and τ2 = τ -> τ' in this case, so we need to show Γ |- [e'/x]λy:τ.e1 : τ -> τ')

Due to the magic of alpha-variance, we can assume, "without loss of generality," that x != y and y !ε FV(e'), so that by the rules of substitution from before, [e'/x]λy:τ.e1 = λy:τ.[e'/x]e1. That means that we need to show that Γ |- λy:τ.[e'/x]e1 : τ -> τ' in order to complete the case.

Because we said we would treat the context Γ like a set, we can rewrite Γ, x: τ1, y: τ as Γ, y: τ, x: τ1. We have Γ, y: τ, x: τ1 |- e1 : τ' and e' : τ'1, so by the induction hypothesis we have Γ, y: τ |- [e'/x]e1 : τ'.

Now, by rule, we have Γ |- λy:τ.[e'/x]e1 : τ -> τ'. We're done!


$LastChangedDate: 2008-11-10 11:52:21 -0500 (Mon, 10 Nov 2008) $
$Author: rjsimmon $
$Rev: 1029 $