# CS 3520 Homework 1   - Due August 27

This homework is due August 27, 11:59 PM. Place all of the requested functions in a single file, hw1.txt, and submit it with submit for hw1, e.g.:
`   submit 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:
• (2 + (7 - 10))
• f(x) = (x - x)   (4 + f(5))
• h(z) = (g(z) - z)  g(y) = (y + 1)   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>.
• 4
• (1 + 2)
• 1 + 2
• f(x) = x   g = f   f(x)
• f(x) = x   g(z) = y   (1 - 1)
• f(x) = 1   f(1)   g(x) = 2   g(2 + 2)
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: Tuesday, August 27th, 2002mflatt@cs.utah.edu