1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#+TITLE: HW 07
#+AUTHOR: Elizabeth Hunt (A02364151)
#+STARTUP: entitiespretty fold inlineimages
#+LATEX_HEADER: \notindent \notag \usepackage{amsmath} \usepackage[a4paper,margin=1in,portrait]{geometry}
#+LATEX: \setlength\parindent{20pt}
#+OPTIONS: toc:nil
* Problem One
\begin{verbatim}
1. [A1] Y <- Y - 1
2. IF Y != 0 GOTO A
3. [B1] IF X1 != 0 GOTO C
4. GOTO E
5. [C1] X1 <- X1 - 1
6. Y <- Y + 1
7. Y <- Y + 1
8. Y <- Y + 1
9. GOTO B1
\end{verbatim}
* Problem Two
1. $(1, \sigma) | \sigma = \{X_1 = 2, Y = 0, Z_1 = 0\}$
2. $(4, \sigma) | \sigma = \{X_1 = 2, Y = 0, Z_1 = 0\}$
3. $(5, \sigma) | \sigma = \{X_1 = 1, Y = 0, Z_1 = 0\}$
4. $(6, \sigma) | \sigma = \{X_1 = 1, Y = 1, Z_1 = 0\}$
5. $(7, \sigma) | \sigma = \{X_1 = 1, Y = 1, Z_1 = 1\}$
6. $(1, \sigma) | \sigma = \{X_1 = 1, Y = 1, Z_1 = 1\}$
7. $(4, \sigma) | \sigma = \{X_1 = 1, Y = 1, Z_1 = 1\}$
8. $(5, \sigma) | \sigma = \{X_1 = 0, Y = 1, Z_1 = 1\}$
9. $(6, \sigma) | \sigma = \{X_1 = 0, Y = 2, Z_1 = 1\}$
10. $(7, \sigma) | \sigma = \{X_1 = 0, Y = 2, Z_1 = 2\}$
11. $(1, \sigma) | \sigma = \{X_1 = 0, Y = 2, Z_1 = 2\}$
12. $(2, \sigma) | \sigma = \{X_1 = 0, Y = 2, Z_1 = 2\}$
13. $(3, \sigma) | \sigma = \{X_1 = 0, Y = 2, Z_1 = 3\}$
14. $(8, \sigma) | \sigma = \{X_1 = 0, Y = 2, Z_1 = 3\}$
* Problem Three
\begin{verbatim}
1. [A1] Y <- Y
2. Y <- Y
3. Y <- Y
4. Y <- Y
5. Y <- Y
6. GOTO E
\end{verbatim}
* Problem Four
Let $P$ be a program in $L$ that computes $g(x_1, x_2, \cdots, x_n)$; a list of instructions $[I_1, I_2, \cdots, I_k]$,
where $I_1$ is the first instruction and $I_k$ the last.
Then, define $P^i | i \in N$ to be a new program such that each instruction $I_n$ replaces $I_{n+i}$ (when $n=0$
we perform no operation), appending
to the end of the instruction list if necessary. We then replace the sublist $[I_1, \cdots, I_i]$ with
$[Y \leftarrow Y]^i$ in the program $P$. As $Y \leftarrow Y$ produces no side effects then $P^i$ still computes $g$.
Finally, for all $i \in N$ the length of $P^i$ is greater than $k$ and thus there are countably infinitely
many $L$ -programs to compute $g$.
|