الرجوع
تسجيل الدخول
أنت تتصفح نسخة مؤرشفة من الموقع اضغط للانتقال إلى الموقع الجديد بكامل المزايا

Here are 5 hands-on questions that require pen and paper, along with their answers:

 

1. **Question**:  

   Given the following definition of addition in lambda calculus:

 

   ```

   ADD X 0 = X  

   ADD X (SUCC Y) = ADD (SUCC X) Y

   ```

 

   Compute the result of `ADD 2 3` using this recursive definition.

 

   **Answer**:

   ```

   ADD 2 3  

   = ADD (SUCC 2) 2  

   = ADD (SUCC (SUCC 2)) 1  

   = ADD (SUCC (SUCC (SUCC 2))) 0  

   = SUCC (SUCC (SUCC 2))  

   = 5

   ```

 

2. **Question**:  

   Write out the steps to evaluate the expression `SUCC(SUCC(PRED(3)))` using the following definitions:

 

   ```

   PRED 0 = 0  

   PRED (SUCC X) = X  

   SUCC N = N + 1

   ```

 

   **Answer**:

   ```

   SUCC(SUCC(PRED(3)))  

   = SUCC(SUCC(2))  

   = SUCC(3)  

   = 4

   ```

 

3. **Question**:  

   Using the following case definition for boolean negation:

 

   ```

   NOT TRUE = FALSE  

   NOT FALSE = TRUE

   ```

 

   Evaluate the following boolean expression: `NOT(NOT(TRUE AND FALSE))`

 

   **Answer**:

   ```

   TRUE AND FALSE = FALSE  

   NOT(FALSE) = TRUE  

   NOT(TRUE) = FALSE

   ```

 

4. **Question**:  

   Given the recursive definition for multiplication:

 

   ```

   MULT X 0 = 0  

   MULT X (SUCC Y) = ADD X (MULT X Y)

   ```

 

   Evaluate `MULT 2 3` using this definition.

 

   **Answer**:

   ```

   MULT 2 3  

   = ADD 2 (MULT 2 2)  

   = ADD 2 (ADD 2 (MULT 2 1))  

   = ADD 2 (ADD 2 (ADD 2 (MULT 2 0)))  

   = ADD 2 (ADD 2 (ADD 2 0))  

   = ADD 2 (ADD 2 2)  

   = ADD 2 4  

   = 6

   ```

 

5. **Question**:  

   Write the steps to compute the following expression using the given character mapping:

 

   ```

   ORD('A') + ORD('C') = ?

   ```

 

   where `'A' = 65` and `'C' = 67`.

 

   **Answer**:

   ```

   ORD('A') = 65  

   ORD('C') = 67  

   65 + 67 = 132

   ```

 

These hands-on questions encourage students to work through lambda calculus and type theory concepts step by step, requiring careful manual computation.