\documentclass[11pt]{article}

\usepackage{exscale}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{latexsym}
\usepackage{times,mathptm}
\usepackage{epsfig}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{automata, positioning, arrows, decorations}

\textwidth 6.5truein          
\textheight 9.0truein
\oddsidemargin 0.0in
\topmargin -0.8in

\parindent 0pt          
\parskip 0pt
%\def\baselinestretch{1.1}

\tikzset{
->, % makes the edges directed
%>=medium, % makes the arrow heads bold
node distance=3cm, % specifies the minimum distance between two nodes. Change if necessary.
every state/.style={thick, fill=gray!10}, % sets the properties for each ’state’ node
initial text=$ $, % sets the text that appears on the start arrow
}

\begin{document}

\begin{large}
\centerline {\bf Computer Science 423}
\centerline {\bf Fall 2024}
\centerline {\bf Homework 9}
\centerline{\bf My name and section}
%\end{large}
\vskip .5cm

%\begin{Large}
\bf Due: beginning of class, Thursday, 11/14/2024 \hfill Points: 60
\end{large}
\vskip 0.3cm
Answer the following questions and submit typeset solutions by the due date.  As stated on the syllabus, any collaborators or 
outside sources must be listed under the corresponding problem.  Further, your final submission must be completely your own work.
\begin{enumerate}

\item {[2 points each]}  For each language complement below, state whether it is (i) TD, (ii) TR but not TD, or (iii) non-TR.  No explanation necessary.
\begin{enumerate}
\item ${\overline A_{REX}}$
\item ${\overline A_{CFG}}$
\item ${\overline {HALT}_{TM}}$

\end{enumerate}

Collaborators:\\

\item {[2 points each]} Let $A =\{0,1,2,...\}$ and let $B=\{-1\le x \le 1\}$, both with a universal domain of $\mathbb{R}$.  State whether each of the
following is Finite, Infinitely Countable, or Uncountable (select only one). 

\begin{enumerate}
\item $A$
\item $B$
\item $A - B$
\item $B - A$
\item $A \cap B$

\end{enumerate}

Collaborators:\\

\item {[6 points]} List the properties (one-to-one, onto, correspondence) for (a) $f(n)$ and (b) $g(n)$. Assume a
domain of $\{0,1,2,3,4\}$ and a codomain of $\{5,6,7,8,9\}$.

\begin{tabular}{c|c}
$n$ & $f(n)$ \\ 
\hline 
0 & 6 \\ 
1 & 5 \\
2 & 8 \\  
3 & 6 \\  
4 & 9 \\ 
\end{tabular}
\quad
{\centering {
\begin{tabular}{c|c}
$n$ & $g(n)$ \\ 
\hline 
0 & 5 \\ 
1 & 7 \\
2 & 9 \\  
3 & 8 \\  
4 & 6 \\
\end{tabular} } }
 
 \vskip .3cm
 
Collaborators:\\

\newpage

\item {[5 points]} Let $L(M_1)$ and $L(M_2)$ be regular languages.  Prove that the following is decidable:\\
$$U_{TM} = \{<M_1,M_2,w>\ |\ w {\rm\ is\ accepted\ by\ either}\ M_1 {\rm\ or}\ M_2, {\rm\ but\ not\ both}\}$$
(Hint: Use $A_{DFA}$ as needed.)\\

Collaborators:\\


\item {[6 points]} Prove that the following is undecidable:\\
$$SUB_{TM} = \{<M_1,M_2>\ |\ L(M_1) \subseteq L(M_2)\}$$
(Hint: Reduce $EQ_{TM}$ to two instances of $SUB_{TM}$.)\\

Collaborators:\\


\item {[27 points]} Consider the following language and the Turing machine that recognizes it:

\begin{eqnarray*}
 L_1&=\{a^nb^n\ |\ n \ge 1\}
\end{eqnarray*}

\begin{center}
\begin{tikzpicture}
\node[state, initial] (q0) {$q_0$};
\node[state, right of=q0] (q1) {$q_1$};
\node[state, right of=q1] (q2) {$q_2$};
\node[state, right of=q2] (qa) {$q_{accept}$};

\draw [thick]
         (q0) edge[above] node{$a\rightarrow X$,R} (q1)
         (q1) edge[loop,above] node[align=center]{$a\rightarrow$ R\\ $Y\rightarrow$ R} (q1)
         (q1) edge[above] node{$b\rightarrow\ Y$,R} (q2)
         (q2) edge[loop,above] node[align=center]{$a\rightarrow$ L\\ $b\rightarrow$ L\\ $Y\rightarrow$ L} (q2)
         (q2) edge[bend left,below] node{$X \rightarrow$ R} (q0)
         (q2) edge[above] node{$\sqcup \rightarrow$ L} (qa);
\end{tikzpicture}
\end{center}


Answer the following for using this Turing machine for the Post Correspondence Problem (PCP):
\begin{enumerate}
\item {[4 points]} List all the $\delta$ functions for the Turing machine.
\item {[4 points]} Create the tiles associated with the $\delta$ functions from (a), as in Parts 2 and 3 of the PCP simulation.
\item {[3 points]} Create additional tiles, as in Parts 4, 5, and 6 of the PCP simulation.
\item {[16 points]} Run the simulation on $aabb$ until a match is achieved.  Diagonal lines aligning the top substrings with the bottom replacements
need not be drawn; however, place vertical bars around the main substring to be replaced in each configuration in the top line, along with vertical bars around
the corresponding replacement string in each of the configurations in the bottom line.  Since the strings will be quite long, write only four configurations per line.
\end{enumerate}

Collaborators:

\end{enumerate}

\end{document}
