Merge branch 'working'
authorJim <jim.pryor@nyu.edu>
Thu, 12 Feb 2015 16:49:37 +0000 (11:49 -0500)
committerJim <jim.pryor@nyu.edu>
Thu, 12 Feb 2015 16:49:37 +0000 (11:49 -0500)
* working:
  tweak combinatory

content.mdwn
index.mdwn
topics/_week4_fixed_point_combinator.mdwn
topics/week3_what_is_computation.mdwn [moved from topics/_week3_what_is_computation.mdwn with 72% similarity]

index aaab7a5..99686d4 100644 (file)
@@ -5,6 +5,8 @@ week in which they were introduced.
 
 ## Topics by content ##
 
+*   [[What is computation?|topics/week3_what_is_computation]]
+
 *   Functional Programming
 
     *   [[Introduction|topics/week1 kapulet intro]]
@@ -53,8 +55,9 @@ Week 2:
 *   [[Encoding Booleans, Tuples, Lists, and Numbers|topics/week2 encodings]]
 *   [[Homework for week 2|exercises/assignment2]]
 
-Week 3:
+Week 3:But even deci
 
+*   [[What is computation?|topics/week3_what_is_computation]]
 *   More on Lists
 Introduces list comprehensions, discusses how to get the `tail` of lists in the Lambda Calculus
 *   [[Combinatory Logic|topics/week3 combinatory logic]]
index 9fd9d69..af593b6 100644 (file)
@@ -14,6 +14,8 @@ One student session to discuss homeworks will be held every Wednesday from 5-6,
 
 ## Announcements ##
 
+*   [[Untyped lambda calculus evaluator|code/lambda_evaluator]] on this site
+
 *   This wiki will be undergoing lots of changes throughout the semester, and particularly in these first few days as we get it set up, migrate over some of the content from the previous time
 we taught this course, and iron out various technical wrinkles. Please be patient. When you sit down to read the wiki, it's a good idea to always hit "Refresh" in your browser to make sure you're reading the latest additions and refinements of the website. (Sometimes these will be tweaks, other times very substantial. Updates will happen at miscellaneous hours, sometimes many times in a given day.)
 
index 253fd97..bc714f3 100644 (file)
@@ -1,5 +1,14 @@
 [[!toc]]
 
+#Recursion: fixed points in the lambda calculus##
+
+Sometimes when you type in a web search, Google will suggest
+alternatives.  For instance, if you type in "Lingusitics", it will ask
+you "Did you mean Linguistics?".  But the engineers at Google have
+added some playfulness to the system.  For instance, if you search for
+"anagram", Google asks you "Did you mean: nag a ram?"  And if you
+search for "recursion", Google asks: "Did you mean: recursion?"
+
 ##What is the "rec" part of "letrec" doing?##
 
 How could we compute the length of a list? Without worrying yet about what lambda-calculus implementation we're using for the list, the basic idea would be to define this recursively:
similarity index 72%
rename from topics/_week3_what_is_computation.mdwn
rename to topics/week3_what_is_computation.mdwn
index 47748a1..79fd399 100644 (file)
@@ -6,13 +6,26 @@ expression and replacing it with an equivalent simpler expression.
     3 + 4 == 7
 
 This equation can be interpreted as expressing the thought that the
-complex expression `3 + 4` evaluates to `7`.  The evaluation of the
-expression computing a sum.  There is a clear sense in which the
-expression `7` is simpler than the expression `3 + 4`: `7` is
-syntactically simple, and `3 + 4` is syntactically complex.
-
-Now let's take this folk notion of computation, and put some pressure
-on it.
+complex expression `3 + 4` evaluates to `7`.  In this case, the
+evaluation of the expression involves computing a sum.  There is a
+clear sense in which the expression `7` is simpler than the expression
+`3 + 4`: `7` is syntactically simple, and `3 + 4` is syntactically
+complex.
+
+It's worth pausing a moment and wondering why we feel that replacing a
+complex expression like `3 + 4` with a simplex expression like `7`
+feels like we've accomplished something.  If they really are
+equivalent, why shouldn't we consider them to be equally valuable, or
+even to prefer the longer expression?  For instance, should we prefer
+2^9, or 512?  Likewise, in the realm of logic, why shold we ever
+prefer `B` to the conjunction of `A` with `A --> B`?
+
+The question to ask here is whether our intuitions about what counts
+as more evaluated always tracks simplicity of expression, or whether
+it tracks what is more useful to us in a given larger situation.
+
+But even deciding which expression ought to count as simpler is not
+always so clear.
 
 ##Church arithmetic##
 
@@ -64,14 +77,14 @@ But now consider multiplication:
 Is the final result simpler?  This time, the answer is not so straightfoward.
 Compare the starting expression with the final expression:
 
-        *           3             4
+        *           3             4 
         (\lrf.l(rf))(\fz.f(f(fz)))(\fz.f(f(f(fz))))
     ~~> 12
         (\fz.f(f(f(f(f(f(f(f(f(f(f(fz))))))))))))
 
 And if we choose different numbers, the result is even less clear:
 
-        *           3             6
+        *           3             6 
         (\lrf.l(rf))(\fz.f(f(fz)))(\fz.f(f(f(f(f(fz))))))
     ~~> 18
         (\fz.f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(fz))))))))))))))))))
@@ -84,7 +97,7 @@ encoding of `18` is just a uniform sequence of nested `f`'s.
 This example shows that computation can't be just simplicity as
 measured by the number of symbols in the representation.  There is
 still some sense in which the evaluated expression is simpler, but the
-right way to characterize simpler is elusive.
+right way to characterize "simpler" is elusive.
 
 One possibility is to define simpler in terms of irreversability.  The
 reduction rules of the lambda calculus define an asymmetric relation
@@ -97,16 +110,16 @@ that reduce to that term.
     (y((\xx)y)) ~~> yy
     etc.
 
-In the arithmetic example, there is only one number that corresponds
-to the sum of 3 and 4 (namely, 7).  But there are many sums that add
-up to 7: 3+4, 4+3, 5+2, 2+5, 6+1, 1+6, etc.
+Likewise, in the arithmetic example, there is only one number that
+corresponds to the sum of 3 and 4 (namely, 7).  But there are many
+sums that add up to 7: 3+4, 4+3, 5+2, 2+5, 6+1, 1+6, etc.
 
 So the unevaluated expression contains information that is missing
 from the evaluated value: information about *how* that value was
 arrived at.  So this suggests the following way of thinking about what
 counts as evaluated:
 
-    Given two expressions such that one reduced to the other,
+    Given two expressions such that one reduces to the other,
     the more evaluated one is the one that contains less information.
 
 This definition is problematic, though, if we try to define the amount
@@ -124,12 +137,14 @@ pathological examples where the results do not align so well:
 In this example, reduction returns the exact same lambda term.  There
 is no simplification at all.
 
-    (\x.xxx)(\x.xxx) ~~> ((\x.xxxx)(\x.xxxx)(\x.xxxx))
+    (\x.xxx)(\x.xxx) ~~> ((\x.xxxx)(\x.xxxx)(\x.xxxx)) 
 
 Even worse, in this case, the "reduced" form is longer and more
 complex by any measure.
 
+We may have to settle for the idea that a well-chosen reduction system
+will characterize our intuitive notion of evaluation in most cases, or
+in some useful class of non-pathological cases.  
+
 These are some of the deeper issues to keep in mind as we discuss the
 ins and outs of reduction strategies.
-
-