1 / 28

CSE-321 Programming Languages Fixed Point Combinator

CSE-321 Programming Languages Fixed Point Combinator. 박성우. POSTECH March 29, 2006. :  -reduction. redex = reducible expression. Values and Reductions. Substitution Completed. avoid variable captures. Outline. Abstract syntax of the  -calculus V

thane-nash
Download Presentation

CSE-321 Programming Languages Fixed Point Combinator

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 LanguagesFixed Point Combinator 박성우 POSTECH March 29, 2006

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

  3. Substitution Completed avoid variable captures

  4. Outline • Abstract syntax of the -calculus V • Operational semantics of the l-calculus V • Substitutions V • Programming in the -calculus V • Fixed point combinator • non-termination in the -calculus • recursive functions in the -calculus

  5. Non-termination in -calculus

  6. Recursive Functions in -calculus • Plan of attack • Assume a recursive function constructfun f x. e • Rewrite it as an expression in the -calculusi.e., show that it is syntactic sugar.

  7. Example: Factorial • Plan of attack • Assume a recursive function construct • Rewrite it as an expression in the -calculusi.e., show that it is syntactic sugar.

  8. fac to FAC

  9. FAC produces a new function from f

  10. new! KEY Observation on FAC

  11. FAC improves the input function f :computes fac(0), fac(1), ..., fac(k) :computes fac(0), fac(1), ..., fac(k), fac(k + 1)

  12. Special Case no matter what

  13. Invariant:

  14. FAC fac

  15. Key Equation

  16. What is f ?

  17. (Earlier Slide)

  18. Now we only need to solve:

  19. Fixed Point • Fixed point of function f V such that V = f (V) • Ex. f (x) = 2 - x fixed point of f = 11 = f (1)

  20. Now we only need to solve: Now we only need to find a fixed point of:

  21. Magic Revealed • Fixed point combinator / Y combinator (call-by-value) • fix F returns a fixed point of F.

  22. Magic Explained

  23. Now we only need to solve: Now we only need to find a fixed point of: Now we only need to compute:

  24. Answer

  25. If you are a masochist, • See the course notes to learn how to derive the fixed point combinator! • There is a really crazy idea!

More Related