samth/test-bugs — Issue #76: Variable capture in stepper's substitution
Author: racket-bug-submit
Created: 2012-03-07 18:55:50+00:00
State: open

Originally submitted on: Wed Oct 31 14:20:02 -0400 2007

When substituting a lambda term M into the body of another lambda term N, the stepper doesn't alpha-rename to avoid capturing free variables in M.
Steps to reproduce:

Stepping the program

(define x 42)

(define f
(lambda (g)
(lambda (x)
(g x))))

((f (lambda (y) x)) 0)

reaches the term

(((lambda (g)
(lambda (x) (g x)))
(lambda (y) x))
0)

which the stepper reduces to

((lambda (x)
((lambda (y) x) x))
0)

capturing the free occurence of x.
This bug was converted from Gnats bug [9030](http://bugs.racket-lang.org/query/?cmd=view&pr=9030).