Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit 29aae5b3 authored by Sean Gillespie's avatar Sean Gillespie Committed by GitHub
Browse files

Add an introduction on name conflicts

parent 4301c557
No related branches found
No related tags found
No related merge requests found
......@@ -104,6 +104,19 @@ We simply "copy" the body of the abstraction, and replace occurrences of the bou
This is the expression `(succ 0)`, as we defined it earlier. We apply Β-reduction twice, first on the outermost abstraction, then on the inner abstraction.
### Name Conflicts
If a free variable `x` has the same name as a bound variable, Β reduction breaks down. Consider an example:
(λ f x. f x) (λ f. x) → λ x. (λ f. x) x
→ λ x. x
`x` is a free variable the expression above. The abstraction `(λ f x. f x)` binds a variable with the same name. When we apply the abstraction, it pushes a free variable into an inner abstraction and is now bound. To show the desired effect, we can rename some variables:
(λ f x. f x) (λ g. y) → λ x. (λ g. y) x
→ λ x. y
We will use alpha conversion to avoid this problem.
# References
1. [Lambda Calculus](https://en.wikipedia.org/wiki/Lambda_calculus). Wikipedia: The Free Encyclopedia
2. Types and Programming Languages. Benjamin C. Pierce
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment