moved applications to separate page
[lambda.git] / week1.mdwn
index 801ae69..ec57775 100644 (file)
@@ -1,41 +1,20 @@
 Here's what we did in seminar on Monday 9/13,
 
-Sometimes these notes will expand on things mentioned only briefly in class, or discuss useful tangents that didn't even make it into class. These notes expand on *a lot*, and some of this material will be reviewed next week.
+Sometimes these notes will expand on things mentioned only briefly in class, or discuss useful tangents that didn't even make it into class. This present page expands on *a lot*, and some of this material will be reviewed next week.
 
-Applications
-============
+[Linguistic and Philosophical Applications of the Tools We'll be Studying](/applications)
+==========================================================================
 
-We mentioned a number of linguistic and philosophical applications of the tools that we'd be helping you learn in the seminar. (We really do mean "helping you learn," not "teaching you." You'll need to aggressively browse and experiment with the material yourself, or nothing we do in a few two-hour sessions will succeed in inducing mastery of it.)
-
-From linguistics
-----------------
-
-*      generalized quantifiers are a special case of operating on continuations
-
-*      (Chris: fill in other applications...)
-
-*      expressives -- at the end of the seminar we gave a demonstration of modeling [[damn]] using continuations...see the [summary](/damn) for more explanation and elaboration
-
-From philosophy
----------------
-
-*      the natural semantics for positive free logic is thought by some to have objectionable ontological commitments; Jim says that thought turns on not understanding the notion of a "union type", and conflating the folk notion of "naming" with the technical notion of semantic value. We'll discuss this in due course.
-
-*      those issues may bear on Russell's Gray's Elegy argument in "On Denoting"
-
-*      and on discussion of the difference between the meaning of "is beautiful" and "beauty," and the difference between the meaning of "that snow is white" and "the proposition that snow is white."
-
-*      the apparatus of monads, and techniques for statically representing the semantics of an imperatival language quite generally, are explicitly or implicitly invoked in dynamic semantics
-
-*      the semantics for mutation will enable us to make sense of a difference between numerical and qualitative identity---for purely mathematical objects!
-
-*      issues in that same neighborhood will help us better understand proposals like Kit Fine's that semantics is essentially coordinated, and that `R a a` and `R a b` can differ in interpretation even when `a` and `b` don't
+[Explanation of the "Damn" example shown in class](/damn)
 
+Basics of Lambda Calculus
+=========================
 
+See also:
 
+*      [Chris Barker's Lambda Tutorial](http://homepages.nyu.edu/~cb125/Lambda)
+*      [Lambda Animator](http://thyer.name/lambda-animator/)
 
-Basics of Lambda Calculus
-=========================
 
 The lambda calculus we'll be focusing on for the first part of the course has no types. (Some prefer to say it instead has a single type---but if you say that, you have to say that functions from this type to this type also belong to this type. Which is weird.)
 
@@ -59,7 +38,6 @@ We'll tend to write <code>(&lambda;a M)</code> as just `(\a M)`, so we don't hav
 
 Some authors reserve the term "term" for just variables and abstracts. We'll probably just say "term" and "expression" indiscriminately for expressions of any of these three forms.
 
-<div>
 Examples of expressions:
 
        x
@@ -70,13 +48,12 @@ Examples of expressions:
        (\x (\y x))
        (x (\x x))
        ((\x (x x)) (\x (x x)))
-</div>
 
 The lambda calculus has an associated proof theory. For now, we can regard the
 proof theory as having just one rule, called the rule of **beta-reduction** or
 "beta-contraction". Suppose you have some expression of the form:
 
-       ((\ a M) N)
+       ((\a M) N)
 
 that is, an application of an abstract to some other expression. This compound form is called a **redex**, meaning it's a "beta-reducible expression." `(\a M)` is called the **head** of the redex; `N` is called the **argument**, and `M` is called the **body**.
 
@@ -156,47 +133,53 @@ Shorthand
 The grammar we gave for the lambda calculus leads to some verbosity. There are several informal conventions in widespread use, which enable the language to be written more compactly. (If you like, you could instead articulate a formal grammar which incorporates these additional conventions. Instead of showing it to you, we'll leave it as an exercise for those so inclined.)
 
 
-**Dot notation** Dot means "put a left paren here, and put the right
-paren as far the right as possible without creating unbalanced
-parentheses". So:
+**Parentheses** Outermost parentheses around applications can be dropped. Moreover, applications will associate to the left, so `M N P` will be understood as `((M N) P)`. Finally, you can drop parentheses around abstracts, but not when they're part of an application. So you can abbreviate:
 
-       (\x (\y (x y)))
+       (\x (x y))
 
-can be abbreviated as:
+as:
+
+       \x (x y)
+
+but you should include the parentheses in:
 
-       (\x (\y. x y))
+       (\x (x y)) z
 
 and:
 
-       (\x (\y. (z y) z))
+       z (\x (x y))
+
 
-would abbreviate:
+**Dot notation** Dot means "put a left paren here, and put the right
+paren as far the right as possible without creating unbalanced
+parentheses". So:
 
-       (\x (\y ((z y) z)))
+       \x (\y (x y))
 
-This on the other hand:
+can be abbreviated as:
 
-       (\x (\y. z y) z)
+       \x (\y. x y)
 
-would abbreviate:
+and that as:
 
-       (\x (\y (z y)) z)
+       \x. \y. x y
 
-**Parentheses** Outermost parentheses around applications can be dropped. Moreover, applications will associate to the left, so `M N P` will be understood as `((M N) P)`. Finally, you can drop parentheses around abstracts, but not when they're part of an application. So you can abbreviate:
+This:
 
-       (\x. x y)
+       \x. \y. (x y) x
 
-as:
+abbreviates:
 
-       \x. x y
+       \x (\y ((x y) x))
 
-but you should include the parentheses in:
+This on the other hand:
 
-       (\x. x y) z
+       (\x. \y. (x y)) x
 
-and:
+abbreviates:
+
+       ((\x (\y (x y))) x)
 
-       z (\x. x y)
 
 **Merging lambdas** An expression of the form `(\x (\y M))`, or equivalently, `(\x. \y. M)`, can be abbreviated as:
 
@@ -262,7 +245,7 @@ computer](/how_to_get_the_programming_languages_running_on_your_computer), and
 proposed answers to the assignment.
 
 
-
+There's also a (slow, bare-bones, but perfectly adequate) version of Scheme available for online use at <http://tryscheme.sourceforge.net/>.
 
 
 
@@ -287,18 +270,15 @@ It's possible to enhance the lambda calculus so that functions do get identified
 
 It's often said that dynamic systems are distinguished because they are the ones in which **order matters**. However, there are many ways in which order can matter. If we have a trivalent boolean system, for example---easily had in a purely functional calculus---we might choose to give a truth-table like this for "and":
 
-<pre><code>
-true and true   = true
-true and true   = true
-true and *      = *
-true and false  = false
-* and true      = *
-* and *         = *
-* and false     = *
-false and true  = false
-false and *     = false
-false and false = false
-</code></pre>
+       true and true   = true
+       true and *      = *
+       true and false  = false
+       * and true      = *
+       * and *         = *
+       * and false     = *
+       false and true  = false
+       false and *     = false
+       false and false = false
 
 And then we'd notice that `* and false` has a different intepretation than `false and *`. (The same phenomenon is already present with the material conditional in bivalent logics; but seeing that a non-symmetric semantics for `and` is available even for functional languages is instructive.)
 
@@ -366,6 +346,11 @@ Rosetta Stone
 
 Here's how it looks to say the same thing in various of these languages.
 
+The following site may be useful; it lets you run a Scheme interpreter inside your web browser:
+
+*      [Try Scheme in your web browser](http://tryscheme.sourceforge.net/)
+
+
 1.     Binding suitable values to the variables `three` and `two`, and adding them.
 
        In Scheme:
@@ -543,7 +528,7 @@ Here's how it looks to say the same thing in various of these languages.
 
                (let* [(bar (lambda (x) B))] M)
 
-       then wherever `bar` occurs in `M` (and isn't rebound by a more local "let" or "lambda"), it will be interpreted as the function `(lambda (x) B)`.
+       then wherever `bar` occurs in `M` (and isn't rebound by a more local `let` or `lambda`), it will be interpreted as the function `(lambda (x) B)`.
 
        Similarly, in OCaml:
 
@@ -603,8 +588,7 @@ Here's how it looks to say the same thing in various of these languages.
                let x = A;;
                ... rest of the file or interactive session ...
 
-       It's easy to be lulled into thinking this is a kind of imperative construction. *But it's not!* It's really just a shorthand for the compound "let"-expressions we've already been looking at, taking the maximum syntactically permissible scope. (Compare the "dot" convention in the lambda calculus, discussed above.)
-
+       It's easy to be lulled into thinking this is a kind of imperative construction. *But it's not!* It's really just a shorthand for the compound `let`-expressions we've already been looking at, taking the maximum syntactically permissible scope. (Compare the "dot" convention in the lambda calculus, discussed above.)
 
 9.     Some shorthand
 
@@ -676,9 +660,8 @@ Here's how it looks to say the same thing in various of these languages.
 
        and there's no more mutation going on there than there is in:
 
-       <pre>
-       <code>&forall;x. (F x or &forall;x (not (F x)))</code>
-       </pre>
+       <pre><code>&forall;x. (F x or &forall;x (not (F x)))
+       </code></pre>
 
        When a previously-bound variable is rebound in the way we see here, that's called **shadowing**: the outer binding is shadowed during the scope of the inner binding.
 
@@ -755,7 +738,7 @@ Or even:
        (define foo B)
        (foo 2)
 
-don't involve any changes or sequencing in the sense we're trying to identify. As we said, these programs are just syntactic variants of (single) compound syntactic structures involving "let"s and "lambda"s.
+don't involve any changes or sequencing in the sense we're trying to identify. As we said, these programs are just syntactic variants of (single) compound syntactic structures involving `let`s and `lambda`s.
 
 Since Scheme and OCaml also do permit imperatival constructions, they do have syntax for genuine sequencing. In Scheme it looks like this:
 
@@ -796,18 +779,3 @@ We'll discuss this more as the seminar proceeds.
 
 
 
-1.     Declarative vs imperatival models of computation.
-2.     Variety of ways in which "order can matter."
-3.     Variety of meanings for "dynamic."
-4.     Schoenfinkel, Curry, Church: a brief history
-5.     Functions as "first-class values"
-6.     "Curried" functions
-
-1.     Beta reduction
-1.     Encoding pairs (and triples and ...)
-1.     Encoding booleans
-
-
-
-
-