190 likes | 206 Views
This article explores β-reduction and capture-avoiding substitution in programming languages, specifically focusing on the concepts of values and reductions. It discusses different strategies such as call-by-name and call-by-value and presents examples to illustrate the concepts. The article also explains the importance of free and bound variables in substitution and introduces α-conversion. The formalization of α-conversion is briefly mentioned, and an announcement regarding Assignment #4 is made.
E N D
CSE-321 Programming Languages-Calculus 임현승 POSTECH March 26, 2009
: -reduction redex = reducible expression Values and Reductions
[e' / x] e • Informally"substitute e' for every occurrence of x in e." • Examples
First (stupid) attempt • Second attempt • But wait:
Bound Variables • Names of bound variables do not matter. • Hence • for a fresh variable y,
A Naive Attempt • An anomaly: something for y
Free Variables • Variables that are bound nowhere FV(e) = set of free variables in e
? Free Variables Remain Free • From the point of view of an outside observer,a free variable remains free until it is explicitly replaced. variable capture outside observer
Capture-Avoiding Substitution • What happens if • the free variable y is captured and becomes a bound variable. • To an outside observer, it suddenly disappears!
Capture-Avoiding Substitution in Action • We have to rename bound variables as necessary.
-Conversion • Renaming bound variables when necessary • Okay because the names of bound variables do not matter. • Examples
Formalization of -Conversion • See the course notes! • It's more interesting than you might think.
Announcement • Assignment #4 is out tonight. • Implementing the call-by-value -calculus • Due in 2 weeks.