summaryrefslogtreecommitdiff
path: root/Homework/cs5000/hw07
diff options
context:
space:
mode:
Diffstat (limited to 'Homework/cs5000/hw07')
-rw-r--r--Homework/cs5000/hw07/hw07.org58
-rw-r--r--Homework/cs5000/hw07/hw07.pdfbin0 -> 88254 bytes
-rw-r--r--Homework/cs5000/hw07/hw07.tex88
3 files changed, 146 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$.
diff --git a/Homework/cs5000/hw07/hw07.pdf b/Homework/cs5000/hw07/hw07.pdf
new file mode 100644
index 0000000..6d555a1
--- /dev/null
+++ b/Homework/cs5000/hw07/hw07.pdf
Binary files differ
diff --git a/Homework/cs5000/hw07/hw07.tex b/Homework/cs5000/hw07/hw07.tex
new file mode 100644
index 0000000..53c92bd
--- /dev/null
+++ b/Homework/cs5000/hw07/hw07.tex
@@ -0,0 +1,88 @@
+% Created 2023-11-04 Sat 18:02
+% Intended LaTeX compiler: pdflatex
+\documentclass[11pt]{article}
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage{graphicx}
+\usepackage{longtable}
+\usepackage{wrapfig}
+\usepackage{rotating}
+\usepackage[normalem]{ulem}
+\usepackage{amsmath}
+\usepackage{amssymb}
+\usepackage{capt-of}
+\usepackage{hyperref}
+\notindent \notag \usepackage{amsmath} \usepackage[a4paper,margin=1in,portrait]{geometry}
+\author{Elizabeth Hunt (A02364151)}
+\date{\today}
+\title{HW 07}
+\hypersetup{
+ pdfauthor={Elizabeth Hunt (A02364151)},
+ pdftitle={HW 07},
+ pdfkeywords={},
+ pdfsubject={},
+ pdfcreator={Emacs 28.2 (Org mode 9.7-pre)},
+ pdflang={English}}
+\begin{document}
+
+\maketitle
+\setlength\parindent{20pt}
+
+\section{Problem One}
+\label{sec:orgd2348b9}
+
+\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}
+
+\section{Problem Two}
+\label{sec:org07c7432}
+\begin{enumerate}
+\item \((1, \sigma) | \sigma = \{X_1 = 2, Y = 0, Z_1 = 0\}\)
+\item \((4, \sigma) | \sigma = \{X_1 = 2, Y = 0, Z_1 = 0\}\)
+\item \((5, \sigma) | \sigma = \{X_1 = 1, Y = 0, Z_1 = 0\}\)
+\item \((6, \sigma) | \sigma = \{X_1 = 1, Y = 1, Z_1 = 0\}\)
+\item \((7, \sigma) | \sigma = \{X_1 = 1, Y = 1, Z_1 = 1\}\)
+\item \((1, \sigma) | \sigma = \{X_1 = 1, Y = 1, Z_1 = 1\}\)
+\item \((4, \sigma) | \sigma = \{X_1 = 1, Y = 1, Z_1 = 1\}\)
+\item \((5, \sigma) | \sigma = \{X_1 = 0, Y = 1, Z_1 = 1\}\)
+\item \((6, \sigma) | \sigma = \{X_1 = 0, Y = 2, Z_1 = 1\}\)
+\item \((7, \sigma) | \sigma = \{X_1 = 0, Y = 2, Z_1 = 2\}\)
+\item \((1, \sigma) | \sigma = \{X_1 = 0, Y = 2, Z_1 = 2\}\)
+\item \((2, \sigma) | \sigma = \{X_1 = 0, Y = 2, Z_1 = 2\}\)
+\item \((3, \sigma) | \sigma = \{X_1 = 0, Y = 2, Z_1 = 3\}\)
+\item \((8, \sigma) | \sigma = \{X_1 = 0, Y = 2, Z_1 = 3\}\)
+\end{enumerate}
+
+\section{Problem Three}
+\label{sec:orgf9c18d1}
+\begin{verbatim}
+1. [A1] Y <- Y
+2. Y <- Y
+3. Y <- Y
+4. Y <- Y
+5. Y <- Y
+6. GOTO E
+\end{verbatim}
+
+\section{Problem Four}
+\label{sec:org49ea029}
+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\).
+\end{document} \ No newline at end of file