CSE-321%20Programming%20Languages%20Fixed%20Point%20Combinator - PowerPoint PPT Presentation

About This Presentation
Title:

CSE-321%20Programming%20Languages%20Fixed%20Point%20Combinator

Description:

Abstract syntax of the -calculus V. Operational semantics of the ... Rewrite it as an expression in the -calculus. i.e., show that it is syntactic sugar. ... – PowerPoint PPT presentation

Number of Views:66
Avg rating:3.0/5.0
Slides: 29
Provided by: sungwo8
Category:

less

Transcript and Presenter's Notes

Title: CSE-321%20Programming%20Languages%20Fixed%20Point%20Combinator


1
CSE-321 Programming LanguagesFixed Point
Combinator
???
  • POSTECH
  • March 29, 2006

2
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 construct fun 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
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
(No Transcript)
18
(Earlier Slide)
19
(No Transcript)
20
(No Transcript)
21
Now we only need to solve
22
Fixed Point
  • Fixed point of function f
  • V such that V f (V)
  • Ex.
  • f (x) 2 - x
  • fixed point of f 1 1 f (1)

23
Now we only need to solve
Now we only need to find a fixed point of
24
Magic Revealed
  • Fixed point combinator / Y combinator
    (call-by-value)
  • fix F returns a fixed point of F.

25
Magic Explained
26
Now we only need to solve
Now we only need to find a fixed point of
Now we only need to compute
27
Answer
28
If you are a masochist,
  • See the course notes to learn how to derive the
    fixed point combinator!
  • There is a really crazy idea!
Write a Comment
User Comments (0)
About PowerShow.com