# CS 3520 Homework 1   - Due August 28

This homework is due August 28, 11:59 PM. Place all of the requested functions in a single file, hw1.txt, and submit it with handin for hw1, e.g.:
`   handin cs3520 hw1 hw1.txt`

The questions below refer to the language of algebra defined in class.

### Exercise 1.1, Evaluations

Show a complete sequence of evaluation steps for the following programs:
• (1 + (2 - 3))
• f(x) = (x + x)   f((4 + 5))
• g(y) = (y - 1)   h(z) = (z + g(z))   h(17)
A "complete sequence of evaluation steps" is a sequence of <prog> elements separated by ->, where the final element has a number expression after the definitions. You do not have to identify the rule used in each step, since it's obvious enough for now.

### Exercise 1.2, Membership Proofs

Which of the following are programs? For each program, provide a proof tree showing that it is an element of <prog>.
• +
• (1 + 2)
• 1 + 2
• f(x) = f(x)   f(x)
• f(x) = 1   (1 + 1)   g(x) = 2   (2 + 2)
• f(x) = 1   g(x) = 1   (1 - 1)
Here's an example showing how to type a proof tree in a text file:
```                        n in <id>
-----------
p in <id>  n in <id>   n in <expr>
----------------------------------
p(n) = n  in  <defn>```
but your trees will alayws have something in <prog> at the bottom. Your answer doesn't have to be pretty, but it must be readable.

 Last update: Thursday, August 23rd, 2001mflatt@cs.utah.edu