From 3b7cc51ec06919738387f58e3c0121d749f9474d Mon Sep 17 00:00:00 2001 From: Jim Date: Sat, 31 Jan 2015 21:48:35 -0500 Subject: [PATCH] update week1 notes --- week1.mdwn | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/week1.mdwn b/week1.mdwn index 7a6050ef..c75da692 100644 --- a/week1.mdwn +++ b/week1.mdwn @@ -107,7 +107,7 @@ As one of you was quick to notice in class, though, when I shift to the `let`-vo let x be 5 in x + 1 -which evaluates to `6`. Okay, fair enough, so I am moving beyond the ∀ `x==5.` φ 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. +which evaluates to `6`. Okay, fair enough, so I am moving beyond the ∀ `x==5.` φ idea when I do this. But the rules 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: @@ -128,4 +128,18 @@ It's okay to also write it all inline, like so: `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. +Now we can allow ourselves to introduce λ-expressions in the following way. If a λ-expression is applied to an argument, as in: `(`λ `x.` φ`) M`, for any (simple or complex) expressions φ and `M`, this means the same as: `let x be M in` φ. That is, the argument to the λ-expression provides (when evaluated) a value for the variable `x` to be bound to, and then the result of the whole thing is whatever φ evaluates to, under that binding to `x`. + +If we restricted ourselves to only that usage of λ-expressions, that is when they were applied to all the arguments they're expecting, then we wouldn't have moved very far from the decidable fragment of arithmetic we began with. + +However, it's tempting to help ourselves to the notion (at least partly) *unapplied* λ-expressions, too. If I can make sense of what: + + (λ x. x + 1) 5 + +means, then I can make sense of what: + + (λ x. x + 1) + +means, too. It's just *the function* that waits for an argument and then returns the result of `x + 1` with `x` bound to that argument. + *More to come.* -- 2.11.0