update week1 notes
authorJim <jim.pryor@nyu.edu>
Sun, 1 Feb 2015 02:36:02 +0000 (21:36 -0500)
committerJim <jim.pryor@nyu.edu>
Sun, 1 Feb 2015 02:36:02 +0000 (21:36 -0500)
week1.mdwn

index 7a8b00a..dffe060 100644 (file)
@@ -97,6 +97,35 @@ Functions are another class of values we'll have in our language. They aren't "l
 
 (By the way, I really am serious about thinking of *the numbers themselves* as being expressions in this language; rather than some "numerals" that aren't themselves numbers. We can talk about this down the road. For now, don't worry about it too much.)
 
 
 (By the way, I really am serious about thinking of *the numbers themselves* as being expressions in this language; rather than some "numerals" that aren't themselves numbers. We can talk about this down the road. For now, don't worry about it too much.)
 
-I said we wanted to be starting with a fragment of arithmetic, so we'll keep the function values off-stage for the moment, and also all the symbolic atoms except for `'true` and `'false`. So we've got numbers, truth-values, and some functions and relations (that is, boolean functions) defined on them. We also help ourselves to a notion of bounded quantification, as in &forall;`x < M.` &phi;, where `M` and &phi; are (simple or complex) expressions that evaluate to a number and a boolean, respectively.
+I said we wanted to be starting with a fragment of arithmetic, so we'll keep the function values off-stage for the moment, and also all the symbolic atoms except for `'true` and `'false`. So we've got numbers, truth-values, and some functions and relations (that is, boolean functions) defined on them. We also help ourselves to a notion of bounded quantification, as in &forall;`x < M.` &phi;, where `M` and &phi; are (simple or complex) expressions that evaluate to a number and a boolean, respectively. We limit ourselves to *bounded* quantification so that the fragment we're dealing with can be "effectively" or mechanically decided. (As we extend the language, we will lose that property, but it will be a topic for later discussion exactly when that happens.)
 
 
-*More to come*
+As I mentioned in class, I will sometimes write &forall; x : &psi; . &phi; in my informal metalanguage, where the &psi; clause represents the quantifier's *restrictor*. Other people write this like `[`&forall; x : &psi; `]` &phi;, or in various other ways. My notation is meant to parallel the notation some linguists (for example, Heim &amp; Kratzer) use in writing &lambda; x : &psi; . &phi;, where &psi;  clause restricts the range of arguments over which the function designated by the &lambda; expression is defined. Later we will see the colon used in a somewhat similar (but also somewhat different) way in our programming languages. But that's just foreshadowing.
+
+So we have bounded quantification as in &forall; `x < 10.` &phi;. Obviously we could also make sense of &forall; `x == 5.` &phi; in just the same way. This would evaluate &phi; but with the variable `x` now bound to the value `5`, ignoring whatever it may be bound to in broader contexts. I will express this idea in a more perspicuous vocabulary, like this: `let x be 5 in` &phi;.
+
+As one of you was quick to notice in class, though, when I shift to the `let`-vocabulary, I no longer restricted myself to just the case where &phi; evaluates to a boolean. I also permitted myself expressions like this:
+
+    let x be 5 in x + 1
+
+which evaluates to `6`. Okay, fair enough, so I am moving beyond the &forall; `x==5.` &phi; idea when I do this. But the rule for how to interpret this are just a straightforward generalization of our existing understanding for how to interpret bound variables. So there's nothing fundamentally novel here.
+
+We can have multiple `let`-expressions embedded, as in:
+
+    let y be (let x be 5 in x + 1) in 2 * y
+
+    let x be 5 in let y be x + 1 in 2 * y
+
+both of which evaluate to `12`. When we have a stack of `let`-expressions as in the second example, I will write it like this:
+
+    let
+      x be 5;
+      y be x + 1
+    in 2 * y
+
+It's okay to also write it all inline, like so: `let x be 5; y be x + 1 in 2 * y`. The `;` represents that we have a couple of `let`-bindings coming in sequence. The earlier bindings in the sequence are considered to be in effect for the later right-hand expressions in the sequence. Thus in:
+
+    let x be 0 in (let x be 5; y be x + 1 in 2 * y)
+
+The `x + 1` that is evaluated to give the value that `y` gets bound to uses the (more local) binding of `x` to `5`, not the (previous, less local) binding of `x` to `0`. By the way, the parentheses in that displayed expression were just to focus your attention. It would have parsed and meant the same without them.
+
+*More to come.*