week1: remove test2.mdwn
[lambda.git] / week1.mdwn
index 5ae3e65..1bc2309 100644 (file)
@@ -39,6 +39,24 @@ 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.)
 
+Here is its syntax:
+
+<blockquote>
+<strong>Variables</strong>: <code>x</code>, <code>y</code>, <code>z</code>...
+</blockquote>
+
+Each variable is an expression. For any expressions M and N and variable a, the following are also expressions:
+
+<blockquote>
+<strong>Abstract</strong>: <code>(&lambda;a M)</code>
+</blockquote>
+
+We'll tend to write <code>(&lambda;a M)</code> as just `(\a M)`, so we don't have to write out the markup code for the <code>&lambda;</code>. You can yourself write <code>(&lambda;a M)</code> or `(\a M)` or `(lambda a M)`.
+
+<blockquote>
+<strong>Application</strong>: <code>(M N)</code>
+</blockquote>
+
 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.
 
 Examples of expressions:
@@ -267,18 +285,16 @@ 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   = 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.)
 
@@ -585,7 +601,6 @@ Here's how it looks to say the same thing in various of these languages.
 
        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
 
        OCaml permits you to abbreviate:
@@ -656,9 +671,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.