Lecture 7: Capture-avoiding substitution
September 29
e ::= x | n
| e e | λx:A.e | ...
[e/x] e' - e is the substitutand.
The Partial Solution
- [e/x]n = n
- [e/x] x = e
- [e/x] y = y (x != y)
- [e/x] e1 e2 = ([e/x] e1) ([e/x] e2)
The Wrong Solution
- [e/x] λx:A.e' = λx:A.e'
- [e/x] λy:A.e' = λy:A.([e/x]e') where x != y
But what if e contains a free y? That free variable
would get captured!
The Complicated Solution Maybe
- [e/x] λx:A.e' = λx:A.e'
- [e/x] λy:A.e' = λy:A.([e/x]e') where x != y and y not in FV(e)
- [e/x] λy:A.e' = λy':A.([e/x][y'/y]e') where x != y and y in FV(e) and y' not in FV(e) AND y' not in FV(e')
This is kind of poorly speficied. How do we find y'?
The Solution
- [e/x] λy:A.e' = λy:A.([e/x]e') where x != y and y not in FV(e)
The other cases just aren't there - part of the deal with y is that we can always vary it to fit the two criteria we specified.
$LastChangedDate: 2008-11-10 11:52:21 -0500 (Mon, 10 Nov 2008) $
$Author: rjsimmon $
$Rev: 1029 $