summaryrefslogtreecommitdiff
path: root/Homework/cs5000/hw07/hw07.org
diff options
context:
space:
mode:
authorElizabeth Alexander Hunt <me@liz.coffee>2026-07-02 11:55:17 -0700
committerElizabeth Alexander Hunt <me@liz.coffee>2026-07-02 11:55:17 -0700
commit6bf4b90c90f15f4ab60833bddf5b5756d1a6b1f6 (patch)
treeed97e39ec77c5231ffd2c394493e68d00ddac5a4 /Homework/cs5000/hw07/hw07.org
downloadmisc-undergrad-main.tar.gz
misc-undergrad-main.zip
Diffstat (limited to 'Homework/cs5000/hw07/hw07.org')
-rw-r--r--Homework/cs5000/hw07/hw07.org58
1 files changed, 58 insertions, 0 deletions
diff --git a/Homework/cs5000/hw07/hw07.org b/Homework/cs5000/hw07/hw07.org
new file mode 100644
index 0000000..b88e959
--- /dev/null
+++ b/Homework/cs5000/hw07/hw07.org
@@ -0,0 +1,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$.