1 / 19

Introduction to β-reduction and Capture-Avoiding Substitution in Programming Languages

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.

wstella
Download Presentation

Introduction to β-reduction and Capture-Avoiding Substitution in Programming Languages

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSE-321 Programming Languages-Calculus 임현승 POSTECH March 26, 2009

  2. : -reduction redex = reducible expression Values and Reductions

  3. Call-by-name Call-by-value

  4. Call-by-name Call-by-value

  5. [e' / x] e • Informally"substitute e' for every occurrence of x in e." • Examples

  6. Easy Cases First

  7. Two Remaining Cases

  8. First (stupid) attempt • Second attempt • But wait:

  9. Bound Variables • Names of bound variables do not matter. • Hence • for a fresh variable y,

  10. One Remaining Case

  11. A Naive Attempt • An anomaly: something for y

  12. Free Variables • Variables that are bound nowhere FV(e) = set of free variables in e

  13. ? 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

  14. Capture-Avoiding Substitution • What happens if • the free variable y is captured and becomes a bound variable. • To an outside observer, it suddenly disappears!

  15. Substitution Completed

  16. Capture-Avoiding Substitution in Action • We have to rename bound variables as necessary.

  17. -Conversion • Renaming bound variables when necessary • Okay because the names of bound variables do not matter. • Examples

  18. Formalization of -Conversion • See the course notes! • It's more interesting than you might think.

  19. Announcement • Assignment #4 is out tonight. • Implementing the call-by-value -calculus • Due in 2 weeks.

More Related