From: Jim
Date: Mon, 9 Feb 2015 01:57:10 +0000 (-0500)
Subject: expand assignment3
X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=commitdiff_plain;h=077b3c9d4eb81dc63a3b5cf75d4185812728e1f3
expand assignment3
---
diff --git a/exercises/assignment3.mdwn b/exercises/assignment3.mdwn
index 36154531..d1cec2a9 100644
--- a/exercises/assignment3.mdwn
+++ b/exercises/assignment3.mdwn
@@ -24,7 +24,21 @@
8. Recall our proposed encoding for the numbers, called "Church's encoding". As we explained last week, it's similar to our proposed encoding of lists in terms of their folds. In last week's homework, you defined `succ` for numbers so encoded. Can you now define `pred` in the Lambca Calculus? Let `pred 0` result in whatever `err` is bound to. This is challenging. For some time theorists weren't sure it could be done. (Here is [some interesting commentary](http://okmij.org/ftp/Computation/lambda-calc.html#predecessor).) However, in this week's notes we examined one strategy for defining `tail` for our chosen encodings of lists, and given the similarities we explained between lists and numbers, perhaps that will give you some guidance in defining `pred` for numbers.
-9. Define `leq` for numbers (that is, ≤) in the Lambda Calculus.
+9. Define `leq` for numbers (that is, ≤) in the Lambda Calculus. Here is the expected behavior,
+where `one` abbreviates `succ zero`, and `two` abbreviates `succ (succ zero)`.
+
+ leq zero zero ~~> true
+ leq zero one ~~> true
+ leq zero two ~~> true
+ leq one zero ~~> false
+ leq one one ~~> true
+ leq one two ~~> true
+ leq two zero ~~> false
+ leq two one ~~> false
+ leq two two ~~> true
+ ...
+
+ You'll need to make use of the predecessor function, but it's not essential to understanding this problem that you have successfully implemented it yet. You can treat it as a black box.
## Combinatorial Logic
@@ -53,3 +67,21 @@ Using the mapping specified in this week's notes, translate the following lambda
23. For each of the above translations, how many `I`s are there? Give a rule for describing what each `I` corresponds to in the original lambda term.
+
+More Lambda Practice
+--------------------
+
+Reduce to beta-normal forms:
+
+
+- `(\x. x (\y. y x)) (v w)`
+
- `(\x. x (\x. y x)) (v w)`
+
- `(\x. x (\y. y x)) (v x)`
+
- `(\x. x (\y. y x)) (v y)`
+
+
- `(\x y. x y y) u v`
+
- `(\x y. y x) (u v) z w`
+
- `(\x y. x) (\u u)`
+
- `(\x y z. x z (y z)) (\u v. u)`
+

+