X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=topics%2Fweek4_fixed_point_combinators.mdwn;h=ca9ab649f6a131f43585358bca880423dabfa486;hp=b20212d6148776fc9d191d55b835e55d82676ead;hb=a95160473037089ea4deb34eceff948391b0cee4;hpb=145310e497b03752f7895ab007bf1b4fdd958ad9 diff --git a/topics/week4_fixed_point_combinators.mdwn b/topics/week4_fixed_point_combinators.mdwn index b20212d6..ca9ab649 100644 --- a/topics/week4_fixed_point_combinators.mdwn +++ b/topics/week4_fixed_point_combinators.mdwn @@ -281,7 +281,7 @@ saying that we are looking for a fixed point for `h`: h LENGTH <~~> LENGTH -Replacing `h` with its definition, we have +Replacing `h` with its definition, we have: (\xs. (empty? xs) 0 (succ (LENGTH (tail xs)))) <~~> LENGTH @@ -289,10 +289,21 @@ If we can find a value for `LENGTH` that satisfies this constraint, we'll have a function we can use to compute the length of an arbitrary list. All we have to do is find a fixed point for `h`. -The strategy we will present will turn out to be a general way of +Let's reinforce this. The left-hand side has the form: + + (\body. Φ[...body...]) LENGTH + +which beta-reduces to: + + Φ[...LENGTH...] + +where that whole formula is convertible with the term LENGTH itself. In other words, the term `Φ[...LENGTH...]` contains (a term that convertible with) itself --- despite being only finitely long. (If it had to contain a term *syntactically identical to* itself, this could not be achieved.) + +The key to achieving all this is finding a fixed point for `h`. The strategy we will present will turn out to be a general way of finding a fixed point for any lambda term. + ## Deriving Y, a fixed point combinator ## How shall we begin? Well, we need to find an argument to supply to @@ -533,7 +544,7 @@ to *the tail* of the list we were evaluating its application to at the previous ## Fixed-point Combinators Are a Bit Intoxicating ## -[[tatto|/images/y-combinator-fixed.jpg]] +[[tatto|/images/y-combinator-fixed.png]] There's a tendency for people to say "Y-combinator" to refer to fixed-point combinators generally. We'll probably fall into that usage ourselves. Speaking correctly, though, the Y-combinator is only one of many fixed-point combinators.